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