mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:14:31 -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\Services\PaymentService;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ChargeRenewalInvoices
|
* Class ChargeRenewalInvoices
|
||||||
@ -81,11 +80,10 @@ class ChargeRenewalInvoices extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
$this->info("Charging invoice {$invoice->invoice_number}");
|
||||||
$this->info("Charging invoice {$invoice->invoice_number}");
|
if ( ! $this->paymentService->autoBillInvoice($invoice)) {
|
||||||
$this->paymentService->autoBillInvoice($invoice);
|
$this->info('Failed to auto-bill, emailing invoice');
|
||||||
} catch (Exception $exception) {
|
$this->mailer->sendInvoice($invoice);
|
||||||
$this->info('Error: ' . $exception->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Exception;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Activity;
|
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)
|
public function getDatatable($clientPublicId, $search)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user