Skip to content

Add the PINT AE rules and UBL format - #8

Open
miguelalvarezd wants to merge 74 commits into
mainfrom
pint-ae-support
Open

miguelalvarezd wants to merge 74 commits into
mainfrom
pint-ae-support

Conversation

@miguelalvarezd

@miguelalvarezd miguelalvarezd commented Nov 10, 2026 •

Copy link
Copy Markdown

Adds Peppol PINT AE 1.0.5 support (UAE e-invoicing): the AE rules in the peppol-pint-v1 addon, and a new ubl+peppol+pint+ae format, FormatAE. Every AE fixture validates against the official PINT AE 1.0.5 Schematron in phorm (VESID 2026.11), billing and self-billing. It also applies several shared PINT rules to every PINT regime, and moves FormatPINT and FormatAUNZ to PINT 1.1.3.

How to review

  • addon/pint: the rules, grouped by the object they check: bill.go (invoices, discounts and charges), bill_line.go, org_*.go, tax_combo.go and pay.go. PINT AE rules sit behind an AE regime guard; the rest apply to every PINT regime. Normalizers live next to the rules of the same object, the extensions in extensions.go and the transaction type in transaction_type.go.
  • ubl/ae.go: FormatAE, with one export and one import function per field or adjustment, called in order from exportAE and importAE. The formats are registered in ubl/ubl.go.
  • Fixtures, most of the diff: ubl/testdata/convert/pint/ae has our GOBL invoices and the UBL they produce, and ubl/testdata/parse/pint/ae the official PINT AE 1.0.5 examples (plus a margin scheme credit note made from one) and how they import. The out/ files are generated.

A good order: the README's PINT AE section, then the rules, then ubl/ae.go, then one convert fixture with its output.

Depends on

go.mod pins gobl to the tip of gobl#1033 (based on gobl#1040) and gobl.ubl to the tip of gobl.ubl#189, so the branch builds on its own.

PR What this PR needs from it
invopop/gobl#1040 EN 16931 rules: taxes on document-level charges (BR-37, PINT's aligned-ibrp-037), the customer name (BR-7) and line taxes (BR-CO-04), and BR-CO-25 removed, so PINT documents no longer need to ignore it
invopop/gobl#1033 The AE regime identity types (TIN, TL, EID, CD), the TRN and TIN formats and check digits, the exported TINPattern, TRNPattern and TINScheme, and the margin-scheme tag. Based on gobl#1040
invopop/gobl.ubl#189 The UBL 2.1 elements FormatAE writes (see that PR's table)

The other gobl.ubl changes this work needed are merged: the line cost as cbc:AccountingCost (#192), issue times with a time zone (#190), keeping the tags an import sets (#191) and the gross price with more decimals in the discount (#197).

What this PR does and doesn't do

Implemented:

  • PINT AE rules, on UAE documents: document types, VAT categories and rates, exemption reasons (cef-vatex with the UAE codes), parties, identities and addresses, the transaction types, credit notes, the exchange rate to AED, lines and items, and payment.
  • Shared PINT rules, on every PINT regime: no email electronic addresses, one customer identifier and tax registration, the payee, one note per document and line, and currency decimals. FormatPINT and FormatAUNZ validate against PINT 1.1.3.
  • FormatAE, export and import, with self-billing. Every AE fixture and every official example validates against the PINT AE 1.0.5 Schematron in phorm.

Not implemented, or limited:

  • Due dates: only the payment due date (IBT-009) is written, so more than one due date, or one for part of the amount, is rejected. PINT instalments (IBG-33) aren't mapped.
  • Credit transfers: only the first is written, as gobl.ubl does for every UBL format.
  • Optional fields with no rule aren't mapped: billing frequency, customs reference, batch number, scheme versions, line purchase order and despatch advice, remittance and IBAN schemes.
  • IBR-114-AE, IBR-115-AE, IBR-133-AE, IBR-154-AE, IBR-176-AE and IBR-178-AE have no GOBL rule, as our output can't fail them: only lines get the margin scheme category N, the supplier always has a TIN, the transaction type is always built from the tags, and the seller's TIN is always written next to its TRN.
  • The bank branch address is only written by FormatAE, though generic PINT has it too.
Details: rules, fields and format

Addon (addon/pint)

PINT AE rules

They run under the AE regime only, apart from one that keeps the addon's tags to UAE documents (GOBL can't limit an addon's tags to a regime).

  • Tax combos: AE categories S, Z, E, O, AE and N; standard rate 5% and zero rate 0%. Exempt lines, discounts and charges need an exemption reason in cef-vatex (IBR-167/168/169-AE), as one tax combo rule. A second rule only takes the UAE codes DL8.46.1 to DL8.46.4: the Schematron doesn't check the list, but Article 46 of the UAE VAT Decree-Law allows no other exempt supplies.
  • Out of scope documents: the outside-tax-scope tag gives the type codes 480 (invoice) and 81 (credit note). Their lines, discounts and charges can only be E or O (IBR-122-AE), and their supplier needs a TRN or TIN (IBR-177-AE).
  • Document types: PINT AE only has 380 and 480 for invoices, 381 and 81 for credit notes, and 389 and 261 for self-billing (ibr-cl-01). Pro forma, corrective and debit note types and the partial, prepayment and factoring tags are rejected.
  • Currency decimals: the totals may have as many decimals as PINT 1.1.4, which PINT AE 1.0.5 builds on, allows for the currency (3 for BHD, KWD, OMR and others, 2 for most).
  • Parties and identities:
    • A supplier with a UAE TRN gets, when missing, the TIN the TRN starts with as a tax identity of type TIN (IBT-032), and, when it has no endpoint or inbox at all, the UAE Peppol endpoint 0235:<TIN> the UAE PASR gives every end user. A TRN whose TIN fails the check digit gives nothing, so the regime reports it once.
    • The seller TIN is the supplier's tax identity of type TIN (IBR-148-AE); the regime checks its format and check digit.
    • Legal identities of a party with a UAE Peppol endpoint (other than the predefined 9900000098 and 9900000099) must be a trade licence, Emirates ID, passport or Cabinet Decision (IBR-173/181/180/183-AE). Every one of these Schematron tests only applies with a 0235 cbc:EndpointID, so only UAE Peppol participants are checked.
    • A trade licence needs its issuing authority (IBR-172/101-AE) and a passport its issuing country (IBR-010/012-AE).
    • Every UAE address needs an emirate code (IBR-128-AE). gobl.ubl writes a party's tax ID country over its address country, so a party with a UAE TRN needs an address with an emirate wherever it is.
    • Deemed supplies must be addressed to the predefined endpoint 0235:9900000097, as the PINT AE BIS (section 1.5.3 and IBT-049) requires. No Schematron rule checks it, but a deemed supply sent to the buyer's own endpoint would be delivered instead of only reported. 9900000099 (exports to a receiver not on Peppol) and 9900000098 (buyer not subject to UAE e-invoicing) are left to the user, as GOBL can't tell those cases.
  • Other AE rules: the exchange rate to AED, credit notes and their reasons, the conditions of each transaction type (free trade zone, summary with its ordering period, disclosed agent, e-commerce, exports, reverse charge), lines and items (goods type, GTIN, HS and SAC codes), and the payment account. GOBL's tax.point is rejected, as PINT AE uses its element (cac:InvoicePeriod/cbc:DescriptionCode) for the billing frequency.

Shared PINT rules

These are PINT rules, so they apply to every regime with the addon, and FormatPINT and FormatAUNZ documents fail them too. Documents that fail them already fail at the access point; GOBL now rejects them first.

  • The supplier's and customer's electronic address can't be an email address (mailto: endpoint or inbox email), which gobl.ubl writes with the scheme EM, not in PINT's list (IBR-081, IBR-080, ibr-cl-25). This assumes no party has both a Peppol endpoint and an email address.
  • At most one customer identifier written as cac:PartyIdentification (ibr-sr-16) and one customer tax registration (ibr-104).
  • The payee needs a name and must differ from the supplier (ibr-017).
  • At most one note on the document and one on each line (ibr-sr-51, ibr-sr-34). More are rejected, not joined, so the user decides how to combine their texts and subject codes.
  • At most one due date, for the whole amount due. Not PINT rules but our own limitation, said so in the code: PINT can carry instalments (IBG-33), but only the payment due date (IBT-009) is written, and it has no amount, so more due dates or a partial one are rejected rather than lost.
  • The totals of non-UAE documents may have 2 decimals at most (PINT 1.1.3).
  • EN 16931's exemption note rule (GOBL-EU-EN16931-BILL-INVOICE-08, BR-E/O/AE-10) is ignored, as PINT has no such rule.

FormatPINT, FormatAUNZ and A-NZ self-billing validate against PINT 1.1.3.

PINT AE fields

Five extensions remain, each required by a rule in some case. Everything else uses a GOBL field.

Field In GOBL
BTAE-02 transaction type peppol-pint-ae-transaction-type, built from invoice tags (free-trade-zone, deemed-supply, margin-scheme, summary, continuous-supply, disclosed-agent, e-commerce, export)
BTAE-01, BTAE-14 beneficiary and principal IDs peppol-pint-ae-beneficiary-id, peppol-pint-ae-principal-id (a TRN, IBR-132-AE)
BTAE-03 credit note reason peppol-pint-ae-credit-note-reason
BTAE-09 goods type, and GTIN peppol-pint-ae-goods-type on the item; GTIN as an item identity with scheme 0160
VAT exemption reason (IBT-186, IBT-196, IBT-198) GOBL's cef-vatex on exempt combos, with the UAE codes
BTAE-13 item type, HS and SAC codes The item key (goods, services, PINT goods-services); HS and SAC as item identities with those labels
Margin scheme (category N) The AE regime's margin-scheme tag with exempt lines; the regime's statement note becomes the N breakdown's exemption reason
BTAE-22 Incoterms GOBL's icc-incoterms-2020 (or -2010) extension on the delivery, written with schemeID="Incoterms"
BTAE-23 deliver to party ID The delivery receiver's UAE tax ID (TRN), or its TIN identity without one
BTAE-05 contract value The contract reference's description
IBT-185 line exemption reason text The invoice's tax note for the line's VAT category

Format (ubl/ae.go)

FormatAE writes and reads back everything above, plus: the invoice UUID; price base quantity and gross price; the bare UAE TRN; the 5% rate on reverse charge and margin scheme lines, and on reverse charge allowances and charges (aligned-ibrp-ae-06/07); one VAT breakdown per category and rate; line amounts with VAT (BTAE-08/10) in AED; for invoices not in AED, the exchange rate and the total in AED (BTAE-20); a TIN identification with its ISO 6523 scheme 0235 (ibr-cl-10). On import it reads the seller and buyer electronic addresses as endpoints with the shared importEndpoints, any non-VAT seller tax registration as the TIN (the official examples use the schemes TIN and TAX; both are written back as TIN), and 0235 identifications as TINs. It also has a self-billing specification.

It also writes the PINT fields gobl.ubl leaves out: the issue time, each contract's description, the payee account's branch address, cbc:TaxIncludedIndicator as false, the line exemption reason code and text.

Tests

TestRoundTripAE exports each AE fixture, imports it, exports it again and checks both XML documents are the same.

go test ./..., and go test ./ubl/ ./cii/ -args -validate=true against phorm 2.2.15 (PINT AE 1.0.5 and PINT 1.1.3). The convert fixtures cover each AE case, including self-billing, the out-of-scope credit note, the margin scheme credit note and the deemed supply with its predefined endpoint, and invoice-ae-shared-fields for the EN 16931 and PINT fields that AE rules check or the AE export changes.

Before merging

  • invopop/gobl#1040 and invopop/gobl#1033 merged and released.
  • invopop/gobl.ubl#189 merged and released (the other gobl.ubl changes are in v0.103.0).
  • gobl and gobl.ubl pins in go.mod moved to those releases, and CI green.
  • Parse goldens regenerated if the new releases change any import.
  • Marked ready for review.

Closes MAP-11

🤖 Generated with Claude Code

Add the AE regime guards to the PINT addon and validate AE tax combos:

- Category code must be S, Z, E, O or AE (IBR-139-AE).
- Standard rate must be greater than zero (ALIGNED-IBRP-S-05/06/07).
- Standard rate must be exactly 5% (IBR-190-AE).
- Zero rate must be 0% (ALIGNED-IBRP-Z-05/06/07, IBR-120-AE).

The rate rules apply to AE only for now. The margin scheme category
(N) comes with the BTAE extensions.
Validate AE payment instructions and exchange rates:

- Credit transfers (means 30) must include an IBAN or account
  number (IBR-192-AE).
- Payment instructions are required, except on credit notes
  (IBR-191-AE).
- Invoices not in AED must have an exchange rate to AED
  (IBR-159-AE).
- Exchange rates must have at most 6 decimals (IBR-002-AE).

The deemed supply exception of IBR-191-AE comes with the BTAE
extensions.
Add an outside-scope tag to the PINT addon. On UAE documents it sets
the UNTDID 1001 document type to 480 on invoices and 81 on credit
notes, replacing EN 16931's 380 and 381. 480 is defined in PINT, as
the EN 16931 code list doesn't include it.
Validate UAE documents against the PINT AE invoice, party and line
rules:

- Lines must have a VAT combo (IBR-145-AE) and an item description
  (IBR-125-AE).
- The seller TRN is required, except on 480 and 81 (IBR-134-AE).
- Reverse charge needs a buyer tax registration (IBR-103-AE).
- 480 and 81 need a buyer legal identity (IBR-136-AE) and only allow
  the E, Z and O categories on lines, discounts and charges
  (IBR-122-AE).
- 380 and 381 need at least one line that is not E or O
  (IBR-151-AE).
- The VAT point date is not allowed on 381 and 81 (IBR-124-AE) and
  must be before the issue date (IBR-141-AE).
- A due date is required when an amount is due, except on 381, 81
  and 261 (IBR-127-AE). 261 follows the Schematron test, not the
  rule text.
- UAE TRNs must be 15 digits, start with 1 and end with 03
  (IBR-132-AE).
- Supplier and customer addresses need a street, city and region
  (IBR-143-AE, IBR-144-AE), and UAE addresses an emirate code
  (IBR-128-AE).
Add FormatAE (ubl+peppol+pint+ae-v1) for UAE e-invoicing, with PINT AE
Billing and Self-Billing identifiers and the PINT AE 1.0.4 VESIDs, and
adjust the exported XML to the PINT AE rules:

- Write the invoice UUID (IBR-193-AE).
- Add the price base quantity and gross price (IBR-126-AE).
- Write UAE TRNs without the country prefix (IBR-132-AE).
- Write no rate on exempt lines and breakdowns, and 5 on reverse
  charge ones (aligned-ibrp-e-05, IBR-121-AE, aligned-ibrp-ae-05-ae,
  IBR-119-AE).
- Merge the VAT breakdowns of the same category and rate
  (aligned-ibrp-e-01, e-08).

On import, read the out-of-scope type codes 480 and 81 back as the
outside-scope tag.

Add AE convert and parse fixtures, modelled on the official examples.
With -validate, the AE convert fixtures still fail the rules that the
AED line amounts (IBR-104, 162, 194), the legal identity types
(IBR-173, 180, 181) and the BTAE extensions (IBR-055, 154, 158, 166,
167, 168, 174) will cover.
- Write each line's amount with VAT and VAT amount in
  cac:ItemPriceExtension (BTAE-10, BTAE-08; IBR-104-AE, IBR-194-AE):
  no VAT amount on exempt lines (IBR-163-AE), zero on zero rated and
  reverse charge ones (IBR-165-AE, IBR-162-AE).
- For invoices not in AED, write the exchange rate to AED
  (IBR-153-AE, IBR-159-AE) and the total with VAT in AED (BTAE-20,
  IBR-175-AE).

Needs a gobl.ubl with cac:ItemPriceExtension (gobl.ubl#189); the
go.mod pin is bumped in a later commit.
- Require a typed legal identity with a UAE (0235) endpoint
  (IBR-150-AE, IBR-173-AE, IBR-181-AE, IBR-180-AE, IBR-183-AE), the
  issuing country on passports (IBR-010-AE, IBR-012-AE) and the
  authority on trade licences (IBR-101-AE, IBR-172-AE).
- Check the seller TIN (IBR-148-AE, IBR-178-AE) and the buyer tax
  registrations (IBR-149-AE, IBR-179-AE, IBR-133-AE).
- Write the identity type, authority or passport country as
  @schemeAgencyID and @schemeAgencyName, and the seller TIN under the
  TIN tax scheme; read them back on import, with CL as a trade licence.

Needs the AE identity keys and scopes from gobl#1033 and
cac:ItemPriceExtension from gobl.ubl#189; the go.mod pins are bumped in
a later commit.
- Build the transaction type (BTAE-02) from new invoice tags, one per
  flag, into the peppol-pint-ae-transaction-type extension, and require
  it (IBR-154-AE).
- Add the beneficiary (BTAE-01) and principal (BTAE-14) ID extensions,
  and the flag rules: IBR-007-AE, IBR-137-AE, IBR-138-AE, IBR-142-AE,
  IBR-152-AE, IBR-157-AE, IBR-176-AE, IBR-177-AE and IBR-135-AE.
- Exempt deemed supplies from payment instructions and due dates
  (IBR-191-AE, IBR-127-AE).
- Write the transaction type as cbc:ProfileExecutionID and the IDs as
  the buyer and seller parties, and read them back on import.
- Add the credit note reason extension (BTAE-03) with the Reasons for
  credit note code list (IBR-001-AE).
- Require it on 381 and 81 credit notes (IBR-158-AE, IBR-055-AE), and
  require a preceding invoice except for volume discounts, which must
  have none (IBR-055-AE).
- Write it as cac:DiscrepancyResponse on credit notes and read it back.

Needs cac:DiscrepancyResponse from gobl.ubl#189.
- Add the billing frequency extension (BTAE-06) with the frequency of
  billing code list (IBR-005-AE), and require a note with Others
  (IBR-160-AE).
- Reject a tax point on UAE invoices: its code goes in the element
  that holds the billing frequency, which only accepts frequencies
  (IBR-005-AE).
- Write it as cac:InvoicePeriod/cbc:DescriptionCode and read it back.
- Add the UAE VAT exemption reason extension, and require it on
  exempt lines (IBR-167-AE).
- Require a reason code on exempt discounts and charges, as the
  IBR-168-AE and IBR-169-AE tests check.
- Write it as the line's tax exemption reason code and read it back.
- Explain why the billing frequency is written as the period's
  description code.

Needs the line exemption reason code from gobl.ubl#189.
- Add the type of goods or services extension, with the PINT AE
  code list (IBR-006-AE), and require it on reverse charge items
  (IBR-166-AE).
- Require a GTIN identity on reverse charge items (IBR-174-AE).
- Write the goods type as the item's nature code and the GTIN as
  its standard identifier, and read the goods type back.
- Link the PINT AE code list pages from the extensions' sources.

Needs the commodity classification nature code from gobl.ubl#189.
- Write the item type from the item key: goods, services, or the
  new PINT goods-services key for both, and read it back.
- Require an HS classification on goods (IBR-184-AE), a service
  accounting code on services (IBR-185-AE), and both on goods and
  services (IBR-186-AE), and only HS classifications (IBR-188-AE).
- Write the identities labelled SAC as service accounting codes
  (IBR-189-AE), and read them back.

Needs the commodity code and additional item identifiers from
gobl.ubl#189.
- Map the AE regime's margin-scheme VAT key to the N category, and
  check categories against the PINT list instead of EN 16931's.
- Forbid the margin scheme on discounts and charges (IBR-115-AE,
  IBR-114-AE), and require it everywhere on margin scheme invoices
  (IBR-116-AE).
- Write N at 5% with no VAT amount, and read it back as the
  margin-scheme key.

Needs the margin-scheme VAT key in the gobl AE regime.
Write the delivery identity labelled Incoterms as the delivery
terms (BTAE-22), keeping it out of the delivery location ID, and read
it back.

Needs the delivery terms on deliveries from gobl.ubl#189.
miguelalvarezd and others added 6 commits November 12, 2026 10:59
gobl.ubl now reads cbc:CompanyLegalForm as the party registration.
GOBL now has icc-incoterms-2020 and -2010 extensions on delivery
details, and gobl.ubl no longer maps delivery terms to delivery
identities. Write the delivery terms from those extensions, and read
them back as the 2020 edition, instead of using a delivery identity
labelled Incoterms.
- Say where each PINT AE extension applies: the PINT addon, the AE
  regime, and the object it goes on.
- Remove the unused A-NZ and AE regime guard.
- Drop a redundant field from the tax point date check.
- Check only the first credit transfer for IBR-192-AE, as it is the
  only one written.
- Build the transaction type from the tags only, so removing a tag
  clears its flag.
- Set the scope of UAE identities here instead of in the AE regime,
  and only when no other identity of the party has that scope.
- Drop the IBR-178-AE rule, which EN 16931 already covers.
- Follow the tests of IBR-002-AE, IBR-127-AE, IBR-138-AE and
  IBR-188-AE, which check less than their texts say.
- Check IBR-128-AE on the issuer and the line sellers too.
- Ignore the EN 16931 VATEX rule on UAE documents: PINT AE only asks
  for the UAE exemption reason on exempt lines.
- Keep the margin scheme category and the addon's tags to UAE
  documents.
- Merge the standard rate above zero rule into the 5% one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Write the zero price discount with the decimals of the price, as
  gobl.ubl does for a list price, so a re-export gives the same XML.
- Import the seller and buyer electronic addresses as endpoints, which
  the PINT rules need, instead of the inbox gobl.ubl reads them as.
- Remove the EU VATEX codes from the fixtures: PINT AE has no reason
  on the VAT breakdowns.
- Add fixtures for a self-billed invoice and credit note, and for an
  out of scope credit note (81).
- Check that the official examples import as valid GOBL documents,
  listing the ones that don't and why.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
gobl.ubl now keeps every cac:DeliveryTerms of a delivery, as UBL 2.1
allows. PINT AE has a single Incoterms code (BTAE-22), so write one
term and read the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miguelalvarezd and others added 2 commits November 12, 2026 17:02
- Leave importPINT out of FormatAE. It made a tax registration that
  isn't VAT the tax ID, which in PINT AE is the seller's TIN, so a
  seller with only a TIN got it as its TRN. gobl.ubl already reads
  the VAT one as the tax ID.
- Read the invoice UUID (BTAE-07) on import.
- Set identity scopes on the supplier and customer only, and the tax
  scope only on the supplier's TIN: PINT AE has no TIN registration
  for the customer.
- Check IBR-128-AE against the country gobl.ubl writes, the tax ID's
  when there is one, and fail a UAE party without an address, which
  is written with only its country.
- Count only the identities written as classifications for the HS and
  SAC rules (IBR-184-AE to IBR-186-AE).
- Read an Incoterms code only the 2010 edition has as that edition.
- Check the exact faults of the official examples that don't import
  as valid documents.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The AE regime now checks the check digit of the TIN, also in the first
10 digits of a TRN. Give the fixtures, the example and the tests TRNs
and TINs that pass it.

The official PINT AE examples use made-up numbers, so none of them
imports as a valid GOBL document any more. The import test now checks
the exact faults each one gives, so any other fault is still caught.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@migueltorresvalls migueltorresvalls left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good, I'd try to use GOBL's core validators and try to drill down rule.Field instead of using the complete document for validation.

Also point to GOBL's branch so tests do not fail.

Comment thread addon/pint/bill.go Outdated
is.Func("credit note", invoiceIsCreditNote),
is.Func("deemed supply", invoiceIsDeemedSupply),
)),
rules.Assert("07", "payment instructions required, except on credit notes and deemed supplies (IBR-191-AE)",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd try to drill down to the exact object using rules.Field and try to avoid helpers

Until invopop/gobl#1033 and invopop/gobl.ubl#189 are released, build
against their head commits so the tests can run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
miguelalvarezd and others added 3 commits November 19, 2026 11:15
Fourteen extensions down to five: transaction type, beneficiary ID,
principal ID, credit note reason and goods type, each required by a rule.

- The VAT exemption reason goes in cef-vatex instead of its own extension.
  GOBL doesn't check its values, and gobl.ubl already writes it on the
  discounts, charges and VAT breakdowns. A new rule (tax combo 07) only
  takes the four UAE codes, DL8.46.1 to DL8.46.4: Article 46 of the UAE
  VAT Decree-Law allows no other exempt supplies, though the Schematron
  doesn't check the list.
- The contract value is the contract's description, written for FormatAE
  only. gobl.ubl already reads it back as the description.
- Dropped as optional with no rule, and not on the Ministry of Finance's
  list of mandatory fields: the customs reference (BTAE-21), batch number
  (BTAE-24), line purchase order (IBT-183), line despatch advice
  (IBT-184), remittance scheme (IBT-083-1), billing frequency (IBT-008;
  a note can carry it) and scheme version (IBT-158-2, BTAE-17-2). Summary
  invoices now need the ordering period (IBR-138-AE), in two rules.
- The item type (GOBL's item key) and the Incoterms (GOBL's ICC
  extensions) stay mapped, as they are GOBL data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- TestRoundTripAE now also compares the imported invoice with the one
  exported, with the differences UBL can't avoid listed in one place:
  series joined to the code, currency rounding, the country gobl.ubl gives
  tax registrations, the gross price PINT AE needs, line charge and
  discount bases, note keys, and the order of tags and identities.
- PINT allows one note on the document and one on each line (ibr-sr-51,
  ibr-sr-34). Invoices with more are now rejected in every PINT format
  (invoice rules 13 and 14), instead of FormatAE joining them.
- Only the payment due date (IBT-009) is written: FormatAE no longer writes
  the first due date as a PINT instalment (IBG-33), which the import never
  read back and the official examples gained on every round trip. Two
  shared rules, our own limitation rather than PINT rules, reject more than
  one due date (rule 15) or one for part of the amount due (rule 16).
- The later invoice rules are renumbered, 01 to 70 with no gaps.
- The convert fixtures drop the Peppol inboxes the EN 16931 addon already
  copies into endpoints, and the payment terms key nothing needs.
- TODOs on the TIN country gobl.ubl adds on import, and on the branch
  address generic PINT also has (IBG-34).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two critical issues remain: AE validation permits an unpaired N tax category, and document-level exempt allowances or charges lose their required exemption reason codes during export.

2 open issues
3 resolved since last review

Review effort: Lite

Comment thread addon/pint/tax_combo.go Resolved
Comment thread ubl/ae.go Resolved
miguelalvarezd and others added 2 commits November 19, 2026 15:05
- Comments: no comments on individual rules except one line for a real
  quirk, rule set comments say where the rules apply, helpers get one or
  two lines, self-explanatory constants lose their per-item comments
  (short end-of-line notes where a value needs one), and no comment cites
  bare rule numbers or removed behaviour. Notes on why a rule isn't
  implemented move out of the code.
- Tests: tests of removed behaviour, of gobl or EN 16931 rather than this
  addon, or repeating what the fixtures prove are gone, as is the
  GOBL-equality half of the round-trip test. ubl/ae_internal_test.go keeps
  the edge cases and the guards that hold coverage (unchanged: addon
  90.6%, ubl 89.8%).
- The PINT tax combo rule 01 is back as on main, and the AE rules ignore
  it, as they check their own category list with N (IBR-139-AE).
- The rate on reverse charge and margin scheme taxes comes from the AE
  regime's standard VAT rate instead of a constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two unresolved defects remain: the free-trade-zone beneficiary ID lacks required UAE TRN validation, and exporting multiple credit transfers silently drops all but the first account.

2 open issues
2 resolved since last review

Review effort: Lite

Comment thread ubl/ae.go Resolved
Comment thread addon/pint/bill.go Resolved
Brings in the Peppol BIS formats and the endpoint import (#10). FormatAE
now imports endpoints with the shared importEndpoints, so it keeps the
inbox gobl.ubl adds next to the endpoint, as PINT and A-NZ do, and drops
its own importAEPartyEndpoint. The BIS, PINT and A-NZ fixtures are main's,
so this PR only changes the AE ones. gobl.ubl is pinned to #189 rebased on
its main, which has #193.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified, and the change is supported by extensive AE-specific validation, conversion, parsing, round-trip, fixture, and CI coverage.

No open issues 🎉

2 resolved since last review

Review effort: Lite

miguelalvarezd and others added 3 commits November 19, 2026 16:40
The scheme (IBT-084-1) is optional and no PINT AE rule checks it, and
gobl.ubl keeps the account ID a plain string again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 16:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The broad tax-compliance and UBL/Schematron changes rely on unreleased gobl and gobl.ubl heads plus external phorm validation that cannot be independently verified here, so dependency pins and CI results need human confirmation.

No open issues 🎉

Review effort: Lite

miguelalvarezd and others added 2 commits November 19, 2026 16:51
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gobl.ubl v0.103.0 reads issue times with a time zone (#190), so the
official PINT AE 1.0.5 examples that have one can be imported. They are
added as parse fixtures, with their goldens, and give only the faults of
their made-up data: TRNs that fail the check digit and placeholder email
addresses. None of the PINT addon's rules fails on any of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 16:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The broad regulatory-format change depends on external phorm 2.2.15 Schematron and pinned gobl/gobl.ubl contracts that were not independently runtime-validated in this review.

No open issues 🎉

Review effort: Lite

- Drop the transaction type rule (IBR-154-AE): the normalizer always
  builds it from the tags.
- Drop the IBR-133-AE rule and its helpers: with the other supplier
  rules and the normalizer, the supplier always has a TIN.
- Drop the discount and charge rule sets (IBR-114/115-AE): only lines
  get N.
- Check the margin scheme on the lines' categories, and reject
  discounts and charges on margin scheme invoices, without helpers.
- Check the principal ID's 03 ending with the extension's pattern.
- Remove the VAT guards on UAE tax combos (the AE regime only has VAT)
  and check the exemption reason on the extensions directly.
- Test the tax point rule (IBR-005-AE).
- Renumber the invoice rules in file order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 19, 2026 18:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The exporter still checks only the percentage when both percentage and amount are present, allowing partial amounts to pass validation and be silently dropped.

1 open issue

Review effort: Lite

Comment thread addon/pint/bill.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants