mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 12:44:30 -04:00
Make sure invoice is emailed if auto-billing fails
This commit is contained in:
parent
4658abfbd4
commit
67b7d6ff21
@ -6,7 +6,6 @@ use App\Ninja\Repositories\AccountRepository;
|
||||
use App\Services\PaymentService;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Account;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ChargeRenewalInvoices
|
||||
@ -81,11 +80,10 @@ class ChargeRenewalInvoices extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->info("Charging invoice {$invoice->invoice_number}");
|
||||
$this->paymentService->autoBillInvoice($invoice);
|
||||
} catch (Exception $exception) {
|
||||
$this->info('Error: ' . $exception->getMessage());
|
||||
$this->info("Charging invoice {$invoice->invoice_number}");
|
||||
if ( ! $this->paymentService->autoBillInvoice($invoice)) {
|
||||
$this->info('Failed to auto-bill, emailing invoice');
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
use App\Models\Invoice;
|
||||
use Utils;
|
||||
use Auth;
|
||||
use Exception;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\Activity;
|
||||
@ -120,7 +121,11 @@ class PaymentService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
return $paymentDriver->completeOnsitePurchase(false, $paymentMethod);
|
||||
try {
|
||||
return $paymentDriver->completeOnsitePurchase(false, $paymentMethod);
|
||||
} catch (Exception $exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDatatable($clientPublicId, $search)
|
||||
|
Loading…
x
Reference in New Issue
Block a user