mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for confirming gateway feesg
This commit is contained in:
parent
d153ecbe1f
commit
e5e7a17d82
@ -400,8 +400,12 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$invoice = $this->payment_hash->fee_invoice;
|
||||
|
||||
$fee_count = collect($invoice->line_items)
|
||||
->map(function ($item){
|
||||
$item->gross_line_total = round($item->gross_line_total, 2);
|
||||
return $item;
|
||||
})
|
||||
->whereIn('type_id', ['3','4'])
|
||||
->where('gross_line_total', $fee_total)
|
||||
->where('gross_line_total', round($fee_total,2))
|
||||
->count();
|
||||
|
||||
if($invoice && $fee_count == 0){
|
||||
|
@ -92,6 +92,8 @@ class AddGatewayFee extends AbstractService
|
||||
/**Refresh Invoice values*/
|
||||
$this->invoice = $this->invoice->calc()->getInvoice();
|
||||
|
||||
nlog($this->invoice->line_items);
|
||||
|
||||
$new_balance = $this->invoice->balance;
|
||||
|
||||
if (floatval($new_balance) - floatval($balance) != 0) {
|
||||
@ -141,12 +143,6 @@ class AddGatewayFee extends AbstractService
|
||||
if (floatval($new_balance) - floatval($balance) != 0) {
|
||||
$adjustment = $new_balance - $balance;
|
||||
|
||||
// $this->invoice
|
||||
// ->client
|
||||
// ->service()
|
||||
// ->updateBalance($adjustment * -1)
|
||||
// ->save();
|
||||
|
||||
$this->invoice
|
||||
->ledger()
|
||||
->updateInvoiceBalance($adjustment * -1, 'Adjustment for adding gateway DISCOUNT');
|
||||
|
@ -148,9 +148,9 @@ class AutoBillInvoice extends AbstractService
|
||||
]);
|
||||
|
||||
nlog("Payment hash created => {$payment_hash->id}");
|
||||
$this->invoice->saveQuietly();
|
||||
|
||||
$payment = false;
|
||||
|
||||
try {
|
||||
$payment = $gateway_token->gateway
|
||||
->driver($this->client)
|
||||
@ -163,6 +163,7 @@ class AutoBillInvoice extends AbstractService
|
||||
|
||||
}
|
||||
|
||||
$this->invoice = $this->invoice->fresh();
|
||||
$this->invoice->auto_bill_tries += 1;
|
||||
|
||||
if ($this->invoice->auto_bill_tries == 3) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user