Adjustments for balance check in auto bill

This commit is contained in:
David Bomba 2024-07-17 07:31:56 +10:00
parent c46936c9f3
commit 05019e7575
5 changed files with 38 additions and 13 deletions

View File

@ -411,7 +411,7 @@ class InvoiceItemSumInclusive
$this->rule = new $class();
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2)) {
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2 ?? false)) {
return $this;
}

View File

@ -313,4 +313,13 @@ class PaymentIntentWebhook implements ShouldQueue
$client->company,
);
}
public function failed($exception = null)
{
if ($exception) {
nlog($exception->getMessage());
}
config(['queue.failed.driver' => null]);
}
}

View File

@ -32,7 +32,7 @@ class Storecove {
"network" => "peppol",
"metaScheme" => "iso6523-actorid-upis",
"scheme" => "de:lwid",
"identifier" => "10101010-STO-10"
"identifier" => "DE:VAT"
];
private array $dbn_discovery = [
@ -102,18 +102,14 @@ class Storecove {
$payload = [
"legalEntityId"=> 290868,
"idempotencyGuid"=> "61b37456-5f9e-4d56-b63b-3b1a23fa5c73",
"idempotencyGuid"=> \Illuminate\Support\Str::uuid(),
"routing"=> [
"eIdentifiers" => [
[
"scheme"=> "DE:LWID",
"id"=> "10101010-STO-10"
"scheme" => "DE:VAT",
"id"=> "DE:VAT"
],
],
"emails"=> [
"david@invoiceninja.com"
],
"eIdentifiers"=> []
]
],
"document"=> [
'documentType' => 'invoice',

View File

@ -62,7 +62,7 @@ class AutoBillInvoice extends AbstractService
$this->invoice = $this->invoice->service()->markSent()->save();
/* Mark the invoice as paid if there is no balance */
if ((int) $this->invoice->balance == 0) {
if (floatval($this->invoice->balance) == 0) {
return $this->invoice->service()->markPaid()->save();
}

View File

@ -31,7 +31,7 @@ class StorecoveTest extends TestCase
$this->markTestSkipped("do not run in CI");
}
public function teseateLegalEntity()
public function testCreateLegalEntity()
{
$data = [
@ -47,6 +47,10 @@ class StorecoveTest extends TestCase
'tax_registered' => true,
'tenant_id' => $this->company->company_key,
'zip' => $this->company->settings->postal_code,
'peppol_identifiers' => [
'scheme' => 'DE:VAT',
'id' => 'DE:VAT'
],
];
$sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
@ -56,6 +60,22 @@ class StorecoveTest extends TestCase
}
// public function testUpdateLegalEntity()
// {
// $data = [
// 'peppol_identifiers' => [
// 'scheme' => 'DE:VAT',
// 'id' => 'DE:VAT'
// ],
// ];
// $sc = new \App\Services\EDocument\Gateway\Storecove\Storecove();
// $r = $sc->updateLegalEntity(290868, $data);
// $this->assertIsArray($r);
// nlog($r);
// }
public function testGetLegalEntity()
{
@ -66,7 +86,7 @@ class StorecoveTest extends TestCase
$this->assertIsArray($r);
// nlog($r);
nlog($r);
}