mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Add checks for stale gateway fees
This commit is contained in:
parent
a5fc80f408
commit
7459932536
@ -80,8 +80,6 @@ class InvoiceController extends Controller
|
||||
/**
|
||||
* Pay one or more invoices.
|
||||
*
|
||||
* @param ProcessInvoicesInBulkRequest $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function catch_bulk()
|
||||
{
|
||||
|
@ -50,6 +50,20 @@ class CleanStaleInvoiceOrder implements ShouldQueue
|
||||
$repo->delete($invoice);
|
||||
});
|
||||
|
||||
Invoice::query()
|
||||
->withTrashed()
|
||||
->where('status_id', Invoice::STATUS_SENT)
|
||||
->where('created_at', '<', now()->subHours(2))
|
||||
->where('balance', '>', 0)
|
||||
->cursor()
|
||||
->each(function ($invoice){
|
||||
|
||||
if (collect($invoice->line_items)->contains('type_id', 3)) {
|
||||
$invoice->service()->removeUnpaidGatewayFees();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ class PaymentEmailEngine extends BaseEmailEngine
|
||||
$data['$invoices.balance'] = ['value' => $this->formatInvoiceField('balance'), 'label' => ctrans('texts.invoices')];
|
||||
$data['$invoices.due_date'] = ['value' => $this->formatInvoiceField('due_date'), 'label' => ctrans('texts.invoices')];
|
||||
$data['$invoices.po_number'] = ['value' => $this->formatInvoiceField('po_number'), 'label' => ctrans('texts.invoices')];
|
||||
|
||||
$data['$invoice_numbers'] = ['value' => $this->formatInvoiceNumbersRaw(), 'label' => ctrans('texts.invoices')];
|
||||
|
||||
if ($this->payment->status_id == 4) {
|
||||
$data['$status_logo'] = ['value' => '<div class="stamp is-paid"> ' . ctrans('texts.paid') .'</div>', 'label' => ''];
|
||||
@ -347,6 +347,11 @@ class PaymentEmailEngine extends BaseEmailEngine
|
||||
|
||||
}
|
||||
|
||||
private function formatInvoiceNumbersRaw(){
|
||||
|
||||
return collect($this->payment->invoices->pluck('number')->toArray())->implode(', ');
|
||||
|
||||
}
|
||||
|
||||
private function formatInvoiceReferences()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user