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(); $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; return $this;
} }

View File

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

View File

@ -62,7 +62,7 @@ class AutoBillInvoice extends AbstractService
$this->invoice = $this->invoice->service()->markSent()->save(); $this->invoice = $this->invoice->service()->markSent()->save();
/* Mark the invoice as paid if there is no balance */ /* 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(); return $this->invoice->service()->markPaid()->save();
} }

View File

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