Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] requiresConfirmation status helper method #1068

Merged
merged 5 commits into from
Mar 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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