Handle UBL errors

This commit is contained in:
Hillel Coren 2018-04-08 10:43:35 +03:00
parent 889ffb431a
commit f98a4deeff

View File

@ -2,6 +2,8 @@
namespace App\Jobs; namespace App\Jobs;
use Utils;
use Exception;
use App\Jobs\Job; use App\Jobs\Job;
use CleverIt\UBL\Invoice\Generator; use CleverIt\UBL\Invoice\Generator;
use CleverIt\UBL\Invoice\Invoice; use CleverIt\UBL\Invoice\Invoice;
@ -73,7 +75,13 @@ class ConvertInvoiceToUbl extends Job
->setTaxExclusiveAmount($taxable) ->setTaxExclusiveAmount($taxable)
->setPayableAmount($invoice->balance)); ->setPayableAmount($invoice->balance));
return Generator::invoice($ublInvoice, $invoice->client->getCurrencyCode()); try {
return Generator::invoice($ublInvoice, $invoice->client->getCurrencyCode());
} catch (Exception $exception) {
Utils::logError($exception);
return false;
}
} }
private function createParty($company, $user) private function createParty($company, $user)