Fixes for incorrect fee calculation edge case
This commit is contained in:
parent
0c89f998eb
commit
a66fa1c678
1 changed files with 7 additions and 3 deletions
|
|
@ -70,7 +70,7 @@ class AutoBillInvoice extends AbstractService
|
|||
/* Determine $amount */
|
||||
if ($this->invoice->partial > 0) {
|
||||
$is_partial = true;
|
||||
$invoice_total = $this->invoice->amount;
|
||||
$invoice_total = $this->invoice->balance;
|
||||
$amount = $this->invoice->partial;
|
||||
} elseif ($this->invoice->balance > 0) {
|
||||
$amount = $this->invoice->balance;
|
||||
|
|
@ -94,10 +94,14 @@ class AutoBillInvoice extends AbstractService
|
|||
/* $gateway fee */
|
||||
$this->invoice = $this->invoice->service()->addGatewayFee($gateway_token->gateway, $gateway_token->gateway_type_id, $amount)->save();
|
||||
|
||||
//change from $this->invoice->amount to $this->invoice->balance
|
||||
if($is_partial)
|
||||
$fee = $this->invoice->amount - $invoice_total;
|
||||
$fee = $this->invoice->balance - $invoice_total;
|
||||
else
|
||||
$fee = $this->invoice->amount - $amount;
|
||||
$fee = $this->invoice->balance - $amount;
|
||||
|
||||
if($fee > $amount)
|
||||
$fee = 0;
|
||||
|
||||
/* Build payment hash */
|
||||
$payment_hash = PaymentHash::create([
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue