From 1e837c23685b2deecccefde25514fdf3d3972245 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Jun 2016 10:54:20 +0300 Subject: [PATCH] Clarified/documented refund logic --- app/Services/PaymentService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 00f45a561e7d..3070671b3595 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -1005,7 +1005,11 @@ class PaymentService extends BaseService 'transactionReference' => $payment->transaction_reference, ); - if ($accountGateway->gateway_id != GATEWAY_WEPAY || $amount != ($payment->amount - $payment->refunded)) { + if ($accountGateway->gateway_id == GATEWAY_WEPAY && $amount == $payment->getCompletedAmount()) { + // WePay issues a full refund when no amount is set. If an amount is set, it will try + // to issue a partial refund without refunding any fees. However, the Stripe driver + // (but not the API) requires the amount parameter to be set no matter what. + } else { $details['amount'] = $amount; }