From 55f72ba45089b6c48f1db989fb6f832a0d42f9de Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 23 May 2023 23:27:28 +1000 Subject: [PATCH] add pending as valid refund state for Stripe --- app/PaymentDrivers/StripePaymentDriver.php | 7 ++++++- app/Utils/Traits/CleanLineItems.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index e5cbc4b895c4..70c2f009730a 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -617,7 +617,7 @@ class StripePaymentDriver extends BaseDriver 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency()), ], $meta); - if ($response->status == $response::STATUS_SUCCEEDED) { + if (in_array($response->status, [$response::STATUS_SUCCEEDED, 'pending'])) { SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all()], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client, $this->client->company); return [ @@ -712,6 +712,11 @@ class StripePaymentDriver extends BaseDriver } if ($payment) { + + if(isset($transaction['payment_method_details']['au_becs_debit'])) { + $payment->transaction_reference = $transaction['id']; + } + $payment->status_id = Payment::STATUS_COMPLETED; $payment->save(); } diff --git a/app/Utils/Traits/CleanLineItems.php b/app/Utils/Traits/CleanLineItems.php index 19938c0dce0b..8c6a79b85478 100644 --- a/app/Utils/Traits/CleanLineItems.php +++ b/app/Utils/Traits/CleanLineItems.php @@ -76,7 +76,7 @@ trait CleanLineItems } - if (array_key_exists('id', $item)) { + if (array_key_exists('id', $item) || array_key_exists('_id', $item)) { unset($item['id']); }