mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add stale gateway fee checks
This commit is contained in:
parent
1d07d48165
commit
1feff63c1b
@ -59,15 +59,12 @@ class CleanStaleInvoiceOrder implements ShouldQueue
|
||||
Invoice::query()
|
||||
->withTrashed()
|
||||
->where('status_id', Invoice::STATUS_SENT)
|
||||
->whereBetween('created_at', [now()->subHours(1), now()->subMinutes(30)])
|
||||
->where('created_at', '<', now()->subMinutes(30))
|
||||
->where('balance', '>', 0)
|
||||
->whereJsonContains('line_items', ['type_id' => '3'])
|
||||
->cursor()
|
||||
->each(function ($invoice) {
|
||||
|
||||
if (collect($invoice->line_items)->contains('type_id', 3)) {
|
||||
$invoice->service()->removeUnpaidGatewayFees();
|
||||
}
|
||||
|
||||
$invoice->service()->removeUnpaidGatewayFees();
|
||||
});
|
||||
|
||||
return;
|
||||
@ -86,6 +83,18 @@ class CleanStaleInvoiceOrder implements ShouldQueue
|
||||
$invoice->is_proforma = false;
|
||||
$repo->delete($invoice);
|
||||
});
|
||||
|
||||
Invoice::query()
|
||||
->withTrashed()
|
||||
->where('status_id', Invoice::STATUS_SENT)
|
||||
->where('created_at', '<', now()->subMinutes(30))
|
||||
->where('balance', '>', 0)
|
||||
->whereJsonContains('line_items', ['type_id' => '3'])
|
||||
->cursor()
|
||||
->each(function ($invoice) {
|
||||
$invoice->service()->removeUnpaidGatewayFees();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,12 +453,6 @@ class InvoiceService
|
||||
if ((int) $pre_count != (int) $post_count) {
|
||||
$adjustment = $balance - $new_balance;
|
||||
|
||||
// $this->invoice
|
||||
// ->client
|
||||
// ->service()
|
||||
// ->updateBalance($adjustment * -1)
|
||||
// ->save();
|
||||
|
||||
$this->invoice
|
||||
->ledger()
|
||||
->updateInvoiceBalance($adjustment * -1, 'Adjustment for removing gateway fee');
|
||||
|
Loading…
x
Reference in New Issue
Block a user