josemmo / einvoicing

Library for reading and creating European-compliant electronic invoices (EN 16931)
https://josemmo.github.io/einvoicing/
MIT License
113 stars 29 forks source link

Multiple PartyTaxSchemes #12

Closed hmazter closed 2 years ago

hmazter commented 2 years ago

Hi!

According to https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-AccountingSupplierParty/cac-Party/cac-PartyTaxScheme/ allows up to 2 instances of PartyTaxScheme on the AccountingSupplierParty.

And we are in need of using both those instances to accomplish this output:

<cac:PartyTaxScheme>
  <cbc:CompanyID>SE555555-555501</cbc:CompanyID>
  <cac:TaxScheme>
    <cbc:ID>VAT</cbc:ID>
  </cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyTaxScheme>
  <cbc:CompanyID>GODKÄND FÖR F-SKATT</cbc:CompanyID>
  <cac:TaxScheme>
    <cbc:ID>TAX</cbc:ID>
  </cac:TaxScheme>
</cac:PartyTaxScheme>

What could be a good approach to add that functionality? I can open a PR, but wanted to ask for directions first.

josemmo commented 2 years ago

Hi, @hmazter!

Looks like the reason for the "0..2" cardinality in PEPPOL BIS is to accommodate for both VAT identifier (BT-31) and tax registration identifier (BT-32).

I've pushed the commit 30751aa5e9bc85cc92b8406cdb9980c0cd7d0db7 to add this functionality.

hmazter commented 2 years ago

Thanks! I will try it out