mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 15:04:32 -04:00
Fix for gateway fees w/partial
This commit is contained in:
parent
0c3db5a8e4
commit
d105943bf3
@ -27,12 +27,12 @@ trait ChargesFees
|
||||
|
||||
if ($settings->fee_percent) {
|
||||
// prevent charging taxes twice on the surcharge
|
||||
$amount = $this->getRequestedAmount();
|
||||
$amount = $this->amount;
|
||||
$taxField = $account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1';
|
||||
if ($account->$taxField) {
|
||||
$taxAmount = 0;
|
||||
foreach ($this->getTaxes() as $key => $tax) {
|
||||
$taxAmount += $tax['amount'] - $tax['paid'];
|
||||
$taxAmount += $tax['amount'];
|
||||
}
|
||||
$amount -= $taxAmount;
|
||||
}
|
||||
|
@ -132,9 +132,11 @@ class BasePaymentDriver
|
||||
return redirect()->to('view/' . $this->invitation->invitation_key);
|
||||
}
|
||||
|
||||
// apply gateway fees
|
||||
$invoicRepo = app('App\Ninja\Repositories\InvoiceRepository');
|
||||
$invoicRepo->setGatewayFee($this->invoice(), $this->gatewayType);
|
||||
if (! $this->isGatewayType(GATEWAY_TYPE_TOKEN)) {
|
||||
// apply gateway fees
|
||||
$invoicRepo = app('App\Ninja\Repositories\InvoiceRepository');
|
||||
$invoicRepo->setGatewayFee($this->invoice(), $this->gatewayType);
|
||||
}
|
||||
|
||||
if ($this->isGatewayType(GATEWAY_TYPE_TOKEN) || $gateway->is_offsite) {
|
||||
if (Session::has('error')) {
|
||||
@ -267,6 +269,9 @@ class BasePaymentDriver
|
||||
->firstOrFail();
|
||||
}
|
||||
|
||||
$invoicRepo = app('App\Ninja\Repositories\InvoiceRepository');
|
||||
$invoicRepo->setGatewayFee($this->invoice(), $paymentMethod->payment_type->gateway_type_id);
|
||||
|
||||
if (! $this->meetsGatewayTypeLimits($paymentMethod->payment_type->gateway_type_id)) {
|
||||
// The customer must have hacked the URL
|
||||
Session::flash('error', trans('texts.limits_not_met'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user