1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

padding out e-invoicing - country specifics

This commit is contained in:
David Bomba 2024-07-31 13:28:43 +10:00
parent 5e5b2e666b
commit 6fa23d8538

View File

@ -48,6 +48,7 @@ use InvoiceNinja\EInvoice\Models\Peppol\CustomerPartyType\AccountingCustomerPart
use InvoiceNinja\EInvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty; use InvoiceNinja\EInvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty;
use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount; use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount;
use InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\ID; use InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\ID;
use InvoiceNinja\EInvoice\Models\Peppol\Party as PeppolParty;
use InvoiceNinja\EInvoice\Models\Peppol\PartyIdentification; use InvoiceNinja\EInvoice\Models\Peppol\PartyIdentification;
class Peppol extends AbstractService class Peppol extends AbstractService
@ -185,6 +186,8 @@ class Peppol extends AbstractService
$this->p_invoice->TaxTotal = $this->getTotalTaxes(); $this->p_invoice->TaxTotal = $this->getTotalTaxes();
$this->p_invoice->LegalMonetaryTotal = $this->getLegalMonetaryTotal(); $this->p_invoice->LegalMonetaryTotal = $this->getLegalMonetaryTotal();
$this->countryLevelMutators();
// $this->p_invoice->PaymentMeans = $this->getPaymentMeans(); // $this->p_invoice->PaymentMeans = $this->getPaymentMeans();
// $payeeFinancialAccount = (new PayeeFinancialAccount()) // $payeeFinancialAccount = (new PayeeFinancialAccount())
@ -573,6 +576,8 @@ $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiv
$contact = new Contact(); $contact = new Contact();
$contact->ElectronicMail = $this->invoice->company->owner()->email ?? 'owner@gmail.com'; $contact->ElectronicMail = $this->invoice->company->owner()->email ?? 'owner@gmail.com';
$contact->Telephone = ;
$contact->Name = ;
$party->Contact = $contact; $party->Contact = $contact;
@ -695,6 +700,7 @@ $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiv
'PaymentTerms' => 7, 'PaymentTerms' => 7,
]; ];
//only scans for top level props
foreach($settings as $prop => $visibility){ foreach($settings as $prop => $visibility){
if($prop_value = PropertyResolver::resolve($this->invoice->client->e_invoice, $prop)) if($prop_value = PropertyResolver::resolve($this->invoice->client->e_invoice, $prop))
@ -717,9 +723,16 @@ $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiv
return $this; return $this;
} }
private function setDefaultAccountingSupplierParty(): self
{
$party = new PeppolParty
}
private function DE(): self private function DE(): self
{ {
// accountingsupplierparty.party.contact MUST be set - Name / Telephone / Electronic Mail // accountingsupplierparty.party.contact MUST be set - Name / Telephone / Electronic Mail
if(!isset($this->p_invoice->AccountingSupplierParty->Party->Contact))
$this->setDefaultAccountingSupplierParty();
// ONE payment means MUST be set // ONE payment means MUST be set
@ -901,4 +914,49 @@ $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiv
return $this; return $this;
} }
private function SG(): self
{
//delayed - stage 2
return $this;
}
//Sweden
private function SE(): self
{
// Deliver invoices to the "Svefaktura" co-operation of local Swedish service providers.
// Routing is through the SE:ORGNR together with a network specification:
// "routing": {
// "eIdentifiers": [
// {
// "scheme": "SE:ORGNR",
// "id": "0012345678"
// }
// ],
// "networks": [
// {
// "application": "svefaktura",
// "settings": {
// "enabled": true
// }
// }
// ]
// }
// Use of the "Svefaktura" co-operation can also be induced by specifying an operator id, as follows:
// "routing": {
// "eIdentifiers": [
// {
// "scheme": "SE:ORGNR",
// "id": "0012345678"
// },
// {
// "scheme": "SE:OPID",
// "id": "1234567890"
// }
// ]
// }
return $this;
}
} }