From 0b56e8d4cb4e6fbe1fbd76d5a7505997d82b13ef Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 11 Sep 2020 09:01:25 +1000 Subject: [PATCH] handle payments and gateway fee integration --- app/PaymentDrivers/Authorize/AuthorizeCreditCard.php | 3 +++ app/PaymentDrivers/CheckoutComPaymentDriver.php | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index e154c5c01250..c531d6d82852 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -136,6 +136,9 @@ class AuthorizeCreditCard $response = $data['response']; if ($response != null && $response->getMessages()->getResultCode() == 'Ok') { + + $this->authorize->confirmGatewayFee($request); + return $this->processSuccessfulResponse($data, $request); } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 0fa692d50fb6..7893318e545e 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -182,17 +182,26 @@ class CheckoutComPaymentDriver extends BaseDriver $state['payment_response'] = $response; if ($response->status === 'Authorized') { + $this->confirmGatewayFee($request); + return $this->processSuccessfulPayment($state); } if ($response->status === 'Pending') { + $this->confirmGatewayFee($request); + return $this->processPendingPayment($state); } if ($response->status === 'Declined') { + $this->unWindGatewayFees($request->payment_hash); + return $this->processUnsuccessfulPayment($state); } } catch (CheckoutHttpException $e) { + + $this->unWindGatewayFees($request->payment_hash); + return $this->processInternallyFailedPayment($e, $state); } }