Refunds wip

This commit is contained in:
Benjamin Beganović 2021-05-05 17:24:31 +02:00
parent 28363013ee
commit e3a6f223d0

View File

@ -19,6 +19,7 @@ use App\Jobs\Util\SystemLogger;
use App\Models\ClientGatewayToken; use App\Models\ClientGatewayToken;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment;
use App\Models\PaymentHash; use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; 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) public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
{ {
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total; $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;