From 6ffb2d7286145ec00cc7527e77b5dc0a9733a829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 24 Jun 2020 16:29:01 +0200 Subject: [PATCH] checkout.com wip refunds --- app/PaymentDrivers/CheckoutComPaymentDriver.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 1db8508bdb66..8cd1eb48cf38 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -273,4 +273,16 @@ class CheckoutComPaymentDriver extends BasePaymentDriver $company_gateway_token->save(); } } + + public function refund(Payment $payment, $amount) + { + $payment = new \Checkout\Models\Payments\Refund($payment->transaction_reference); + $payment->amount = $amount; + + try { + $refund = $this->gateway->payments()->refund($payment); + } catch (CheckoutHttpException $e) { + // .. + } + } }