1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Cleanup for storecove

This commit is contained in:
David Bomba 2024-11-04 20:44:31 +11:00
parent 59ec545c1c
commit 0222b85a36
2 changed files with 20 additions and 1 deletions

View File

@ -50,4 +50,10 @@ class AccountingCustomerParty
$this->public_identifiers = $public_identifiers;
return $this;
}
public function addPublicIdentifiers($public_identifier): self
{
$this->public_identifiers[] = $public_identifier;
return $this;
}
}

View File

@ -208,7 +208,20 @@ nlog($peppolInvoice);
$this->storecove_invoice->setAllowanceCharges($allowances);
$this->storecove_invoice->setTaxSystem('tax_line_percentages');
//set additional identifier if required (ie de => FR with FR vat)
//resolve and set the public identifier for the customer
$accounting_customer_party = $this->storecove_invoice->getAccountingCustomerParty();
if(strlen($this->ninja_invoice->client->vat_number) > 2)
{
$id = $this->ninja_invoice->client->vat_number;
$scheme = $this->storecove->router->resolveTaxScheme($this->ninja_invoice->client->country->iso_3166_2, $this->ninja_invoice->client->classification ?? 'individual');
$pi = new \App\Services\EDocument\Gateway\Storecove\Models\PublicIdentifiers($scheme, $id);
$accounting_customer_party->addPublicIdentifiers($pi);
$this->storecove_invoice->setAccountingCustomerParty($accounting_customer_party);
}
return $this;
}