Skip to content

Commit

Permalink
[12.x] requiresConfirmation status helper method (#1068)
Browse files Browse the repository at this point in the history
* requires confirmation status helper method

* style

* requires_capture status

* processing status

* no ENUM for requires_capture
  • Loading branch information
benjamindoe authored Mar 12, 2021
1 parent 4811aa7 commit b4197fd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ public function requiresAction()
return $this->paymentIntent->status === StripePaymentIntent::STATUS_REQUIRES_ACTION;
}

/**
* Determine if the payment needs to be confirmed.
*
* @return bool
*/
public function requiresConfirmation()
{
return $this->paymentIntent->status === StripePaymentIntent::STATUS_REQUIRES_CONFIRMATION;
}

/**
* Determine if the payment needs to be captured.
*
* @return bool
*/
public function requiresCapture()
{
return $this->paymentIntent->status === 'requires_capture';
}

/**
* Determine if the payment was cancelled.
*
Expand All @@ -96,6 +116,16 @@ public function isSucceeded()
return $this->paymentIntent->status === StripePaymentIntent::STATUS_SUCCEEDED;
}

/**
* Determine if the payment is processing.
*
* @return bool
*/
public function isProcessing()
{
return $this->paymentIntent->status === StripePaymentIntent::STATUS_PROCESSING;
}

/**
* Validate if the payment intent was successful and throw an exception if not.
*
Expand Down

0 comments on commit b4197fd

Please sign in to comment.