mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Refunds wip
This commit is contained in:
parent
28363013ee
commit
e3a6f223d0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user