Fixes for stripe catching aborted payments

This commit is contained in:
David Bomba 2022-08-08 07:35:00 +10:00
parent a1dee0206f
commit 7fb139cd9b
2 changed files with 14 additions and 0 deletions

View File

@ -431,6 +431,10 @@ class BaseDriver extends AbstractPaymentDriver
public function sendFailureMail($error) public function sendFailureMail($error)
{ {
if(is_object($error)){
$error = 'Payment Aborted';
}
if (! is_null($this->payment_hash)) { if (! is_null($this->payment_hash)) {
$this->unWindGatewayFees($this->payment_hash); $this->unWindGatewayFees($this->payment_hash);
} }

View File

@ -167,6 +167,16 @@ class CreditCard
$this->stripe->client->company, $this->stripe->client->company,
); );
//if the user has come from a subscription double check here if we need to redirect
if($payment->invoices()->whereHas('subscription')->exists()){
$subscription = $payment->invoices()->first()->subscription;
if($subscription && array_key_exists('return_url', $subscription->webhook_configuration) && strlen($subscription->webhook_configuration['return_url']) >=1)
return redirect($subscription->webhook_configuration['return_url']);
}
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]); return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
} }