From 32f341f4481ebfb975d7b58d60d09833c0564cae Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 6 Oct 2016 08:44:19 +0300 Subject: [PATCH] Fix for payment refund --- app/Services/PaymentService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index b40e81600cfe..c1a7c36f04bb 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -149,10 +149,11 @@ class PaymentService extends BaseService foreach ($payments as $payment) { if (Auth::user()->can('edit', $payment)) { $amount = !empty($params['amount']) ? floatval($params['amount']) : null; - $accountGateway = $payment->account_gateway; - $paymentDriver = $accountGateway->paymentDriver(); - if ($paymentDriver->refundPayment($payment, $amount)) { - $successful++; + if ($accountGateway = $payment->account_gateway) { + $paymentDriver = $accountGateway->paymentDriver(); + if ($paymentDriver->refundPayment($payment, $amount)) { + $successful++; + } } } }