diff --git a/app/PaymentDrivers/BraintreePaymentDriver.php b/app/PaymentDrivers/BraintreePaymentDriver.php index 86b0bc8d78ba..10b3449879e4 100644 --- a/app/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/PaymentDrivers/BraintreePaymentDriver.php @@ -19,6 +19,7 @@ use App\Jobs\Util\SystemLogger; use App\Models\ClientGatewayToken; use App\Models\GatewayType; use App\Models\Invoice; +use App\Models\Payment; use App\Models\PaymentHash; use App\Models\PaymentType; use App\Models\SystemLog; @@ -115,6 +116,17 @@ class BraintreePaymentDriver extends BaseDriver } } + public function refund(Payment $payment, $amount, $return_client_response = false) + { + $this->init(); + + try { + $response = $this->gateway->transaction()->refund($payment->transaction_reference, $amount); + } catch(\Exception $e) { + // .. + } + } + public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) { $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;