Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion addons/br-nfe-v4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,23 @@ according to the RTM (applies to IBS/CBS only).
| `series` | <ul class="gobl-test"><li>Matches ^(?:0\|[1-9]{1}[0-9]{0,2})$</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-24`<br />Invoice series format is invalid; must be 0 or 1-999 |
| `tax` | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-25`<br />Invoice tax is required |
| `tax.ext` | <ul class="gobl-test"><li>Ext require [br-nfe-model, br-nfe-presence, br-nfe-purpose, br-nfe-operation-type]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-26`<br />Invoice tax requires 'br-nfe-model', 'br-nfe-presence', 'br-nfe-purpose' and 'br-nfe-operation-type' extensions |
| `tax.ext` | <ul class="gobl-test"><li>Ext 'br-nfe-model' in [55, 65]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-44`<br />'br-nfe-model' extension, when set, must be a valid code |
| `tax.ext` | <ul class="gobl-test"><li>Ext 'br-nfe-presence' in [0, 1, 2, 3, 4, 5, 9]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-45`<br />'br-nfe-presence' extension, when set, must be a valid code |
| `tax.ext` | <ul class="gobl-test"><li>Ext 'br-nfe-purpose' in [1, 2, 3, 4, 5, 6]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-46`<br />'br-nfe-purpose' extension, when set, must be a valid code |
| `tax.ext` | <ul class="gobl-test"><li>Ext 'br-nfe-operation-type' in [0, 1]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-47`<br />'br-nfe-operation-type' extension, when set, must be a valid code |
| `tax.ext` | <ul class="gobl-test"><li>NFe model</li><li>Ext 'br-nfe-presence' not in [4]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-27`<br />NF-e invoices do not support '4' for 'br-nfe-presence' |
| `tax.ext` | <ul class="gobl-test"><li>NFCe model</li><li>Ext 'br-nfe-presence' in [1, 4]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-28`<br />NFC-e invoices require in-person or delivery for 'br-nfe-presence' |
| `tax.ext` | <ul class="gobl-test"><li>Credit note purpose</li><li>Ext require [br-nfe-credit-note-type]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-40`<br />Credit note invoices require 'br-nfe-credit-note-type' extension |
| `tax.ext` | <ul class="gobl-test"><li>Credit note purpose</li><li>Ext 'br-nfe-credit-note-type' in [01, 02, 03, 04, 05]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-48`<br />'br-nfe-credit-note-type' extension, when set, must be a valid code |
| `tax.ext` | <ul class="gobl-test"><li>Debit note purpose</li><li>Ext require [br-nfe-debit-note-type]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-41`<br />Debit note invoices require 'br-nfe-debit-note-type' extension |
| `tax.ext` | <ul class="gobl-test"><li>Debit note purpose</li><li>Ext 'br-nfe-debit-note-type' in [01, 02, 03, 04, 05, 06, 07, 08]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-49`<br />'br-nfe-debit-note-type' extension, when set, must be a valid code |
| `notes[*].text` | <ul class="gobl-test"><li>Reason note</li><li>Length between 1 and 60</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-29`<br />Invoice reason note text must be between 1 and 60 characters |
| `payment` | <ul class="gobl-test"><li>Invoice not paid</li><li class="gobl-test-present">Present</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-31`<br />Invoice payment is required when invoice is unpaid |
| `payment.instructions` | <ul class="gobl-test"><li>Invoice not paid</li><li class="gobl-test-present">Present</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-32`<br />Invoice payment instructions are required when invoice is unpaid |
| `totals.due`<br /><small class="gobl-field-calculated">Calculated</small> | <ul class="gobl-test"><li>Zero or positive</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-33`<br />Invoice due amount must not be negative |
| `lines[*].ext` | <ul class="gobl-test"><li>Invoice is NFe</li><li>Ext require [br-nfe-cfop]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-35`<br />NF-e invoice lines require 'br-nfe-cfop' extension |
| `lines[*].ext` | <ul class="gobl-test"><li>Ext require [br-nfe-cfop]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-35`<br />Invoice lines require 'br-nfe-cfop' extension |
| `lines[*].taxes[*].ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext exclude [br-nfe-icms-csosn]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-42`<br />Only Simples Nacional issuers can use 'br-nfe-icms-csosn'; others must use 'br-nfe-icms-cst' |
| `lines[*].taxes[*].ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext exclude [br-nfe-icms-cst], or ext 'br-nfe-icms-cst' in [02, 15, 53, 61]</li></ul> | `GOBL-BR-NFE-BILL-INVOICE-43`<br />Simples Nacional issuers (regime 1 or 4) must use 'br-nfe-icms-csosn'; 'br-nfe-icms-cst' is only allowed for fuel codes 02, 15, 53 and 61 |
</Accordion>
<Accordion title="bill.Line">

Expand All @@ -443,19 +451,46 @@ according to the RTM (applies to IBS/CBS only).
| ----- | ---- | ------------------------- |
| `ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext require [br-nfe-icms-cst], or ext require [br-nfe-icms-csosn]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-01`<br />ICMS tax combo requires 'br-nfe-icms-cst' or 'br-nfe-icms-csosn' extension |
| `ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext require [br-nfe-icms-origin]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-02`<br />ICMS tax combo requires 'br-nfe-icms-origin' extension |
| `ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext allow one of [br-nfe-icms-cst, br-nfe-icms-csosn]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-05`<br />ICMS tax combo cannot include both 'br-nfe-icms-cst' and 'br-nfe-icms-csosn' extensions |
| `ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext 'br-nfe-icms-cst' in [00, 02, 10, 15, 20, 30, 40, 41, 50, 51, 53, 60, 61, 70, 90]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-10`<br />'br-nfe-icms-cst' extension, when set, must be a valid code |
| `ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext 'br-nfe-icms-csosn' in [101, 102, 103, 201, 202, 203, 300, 400, 500, 900]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-11`<br />'br-nfe-icms-csosn' extension, when set, must be a valid code |
| `ext` | <ul class="gobl-test"><li>ICMS category</li><li>Ext 'br-nfe-icms-origin' in [0, 1, 2, 3, 4, 5, 6, 7, 8]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-12`<br />'br-nfe-icms-origin' extension, when set, must be a valid code |
| `percent`<br /><small class="gobl-field-calculated">Calculated</small> | <ul class="gobl-test"><li>No-value CSOSN code</li><li>Equals 0%</li></ul> | `GOBL-BR-NFE-TAX-COMBO-06`<br />ICMS percent must be zero for CSOSN codes 102, 103, 202, 203, 300, 400 and 500: they carry no ICMS value |
| `percent`<br /><small class="gobl-field-calculated">Calculated</small> | <ul class="gobl-test"><li>No-value CST code</li><li>Equals 0%</li></ul> | `GOBL-BR-NFE-TAX-COMBO-07`<br />ICMS percent must be zero for CST codes 40, 41, 50 and 60: they carry no ICMS value |
| `ext` | <ul class="gobl-test"><li>PIS category</li><li>Ext require [br-nfe-pis-cst]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-03`<br />PIS tax combo requires 'br-nfe-pis-cst' extension |
| `ext` | <ul class="gobl-test"><li>PIS category</li><li>Ext 'br-nfe-pis-cst' in [01, 02, 03, 04, 05, 06, 07, 08, 09, 49, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 63, 64, 65, 66, 67, 70, 71, 72, 73, 74, 75, 98, 99]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-13`<br />'br-nfe-pis-cst' extension, when set, must be a valid code |
| `percent`<br /><small class="gobl-field-calculated">Calculated</small> | <ul class="gobl-test"><li>Non-taxed CST code</li><li>Equals 0%</li></ul> | `GOBL-BR-NFE-TAX-COMBO-08`<br />PIS percent must be zero for CST codes 04 to 09: they carry no PIS value |
| `ext` | <ul class="gobl-test"><li>COFINS category</li><li>Ext require [br-nfe-cofins-cst]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-04`<br />COFINS tax combo requires 'br-nfe-cofins-cst' extension |
| `ext` | <ul class="gobl-test"><li>COFINS category</li><li>Ext 'br-nfe-cofins-cst' in [01, 02, 03, 04, 05, 06, 07, 08, 09, 49, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 63, 64, 65, 66, 67, 70, 71, 72, 73, 74, 75, 98, 99]</li></ul> | `GOBL-BR-NFE-TAX-COMBO-14`<br />'br-nfe-cofins-cst' extension, when set, must be a valid code |
| `percent`<br /><small class="gobl-field-calculated">Calculated</small> | <ul class="gobl-test"><li>Non-taxed CST code</li><li>Equals 0%</li></ul> | `GOBL-BR-NFE-TAX-COMBO-09`<br />COFINS percent must be zero for CST codes 04 to 09: they carry no COFINS value |
</Accordion>
<Accordion title="org.Identity">

| Field | Test | Validation Code / Message |
| ----- | ---- | ------------------------- |
| `code` | <ul class="gobl-test"><li>CEST identity</li><li>Matches ^\d{7}$</li></ul> | `GOBL-BR-NFE-ORG-IDENTITY-01`<br />CEST identity code must be a 7-digit number |
| `code` | <ul class="gobl-test"><li>NCM identity</li><li>Matches ^(\d{2}\|\d{8})$</li></ul> | `GOBL-BR-NFE-ORG-IDENTITY-02`<br />NCM identity code must be an 8-digit number (or 2 digits in exceptional cases), without separators |
</Accordion>
<Accordion title="org.Party">

| Field | Test | Validation Code / Message |
| ----- | ---- | ------------------------- |
| `ext` | <ul class="gobl-test"><li>Ext 'br-nfe-regime' in [1, 2, 3, 4]</li></ul> | `GOBL-BR-NFE-ORG-PARTY-01`<br />'br-nfe-regime' extension, when set, must be a valid code |
| `ext` | <ul class="gobl-test"><li>Ext 'br-nfe-fiscal-incentive' in [1, 2]</li></ul> | `GOBL-BR-NFE-ORG-PARTY-02`<br />'br-nfe-fiscal-incentive' extension, when set, must be a valid code |
| `ext` | <ul class="gobl-test"><li>Ext 'br-nfe-special-regime' in [1, 2, 3, 4, 5, 6]</li></ul> | `GOBL-BR-NFE-ORG-PARTY-03`<br />'br-nfe-special-regime' extension, when set, must be a valid code |
</Accordion>
<Accordion title="pay.Instructions">

| Field | Test | Validation Code / Message |
| ----- | ---- | ------------------------- |
| `ext` | <ul class="gobl-test"><li>Ext require [br-nfe-payment-means]</li></ul> | `GOBL-BR-NFE-PAY-INSTRUCTIONS-01`<br />Payment instructions require 'br-nfe-payment-means' extension |
| `ext` | <ul class="gobl-test"><li>Ext 'br-nfe-payment-means' in [01, 02, 03, 04, 05, 10, 11, 12, 13, 15, 16, 17, 18, 19, 90, 99]</li></ul> | `GOBL-BR-NFE-PAY-INSTRUCTIONS-02`<br />'br-nfe-payment-means' extension, when set, must be a valid code |
</Accordion>
<Accordion title="pay.Record">

| Field | Test | Validation Code / Message |
| ----- | ---- | ------------------------- |
| `ext` | <ul class="gobl-test"><li>Ext require [br-nfe-payment-means]</li></ul> | `GOBL-BR-NFE-PAY-RECORD-01`<br />Payment advance requires 'br-nfe-payment-means' extension |
| `ext` | <ul class="gobl-test"><li>Ext 'br-nfe-payment-means' in [01, 02, 03, 04, 05, 10, 11, 12, 13, 15, 16, 17, 18, 19, 90, 99]</li></ul> | `GOBL-BR-NFE-PAY-RECORD-02`<br />'br-nfe-payment-means' extension, when set, must be a valid code |
</Accordion>
</AccordionGroup>
4 changes: 4 additions & 0 deletions addons/pt-saft-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,14 @@ Example:
| <small>Delivery</small> | <ul class="gobl-test"><li>Code format</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-03`<br />Delivery code format must be valid |
| `supplier.tax_id` | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-04`<br />Delivery supplier tax ID is required |
| `supplier.tax_id.code` | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-05`<br />Delivery supplier tax ID code is required |
| `supplier.addresses[*].code` | <ul class="gobl-test"><li>Portuguese address</li><li>Matches ^[0-9]{4}-[0-9]{3}$</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-10`<br />Delivery supplier post code must be in the 'NNNN-NNN' format |
| `despatch_date` | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-06`<br />Delivery despatch date is required |
| `preceding` | <ul class="gobl-test"><li>Length between 0 and 1</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-07`<br />Delivery preceding must have at most one entry |
| `preceding[*].series` | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-08`<br />Delivery preceding series is required |
| `preceding[*].code` | <ul class="gobl-test"><li class="gobl-test-present">Present</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-09`<br />Delivery preceding code is required |
| `customer.addresses[*].code` | <ul class="gobl-test"><li>Portuguese address</li><li>Matches ^[0-9]{4}-[0-9]{3}$</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-11`<br />Delivery customer post code must be in the 'NNNN-NNN' format |
| `despatcher.addresses[*].code` | <ul class="gobl-test"><li>Portuguese address</li><li>Matches ^[0-9]{4}-[0-9]{3}$</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-12`<br />Delivery despatcher post code must be in the 'NNNN-NNN' format |
| `receiver.addresses[*].code` | <ul class="gobl-test"><li>Portuguese address</li><li>Matches ^[0-9]{4}-[0-9]{3}$</li></ul> | `GOBL-PT-SAFT-BILL-DELIVERY-13`<br />Delivery receiver post code must be in the 'NNNN-NNN' format |
</Accordion>
<Accordion title="bill.Order">

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
github.com/invopop/gobl v0.503.0
github.com/invopop/gobl.dev v0.500.12
github.com/invopop/gobl.dev v0.500.14
github.com/wk8/go-ordered-map/v2 v2.1.8
)

Expand All @@ -17,11 +17,11 @@ require (
github.com/expr-lang/expr v1.17.8 // indirect
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/invopop/gobl.br.nfe v0.0.1 // indirect
github.com/invopop/gobl.br.nfe v0.0.3 // indirect
github.com/invopop/gobl.br.nfse v0.0.1 // indirect
github.com/invopop/gobl.fr.ctc v0.0.7 // indirect
github.com/invopop/gobl.mx.cfdi v0.63.0 // indirect
github.com/invopop/gobl.pt.saft v0.0.5 // indirect
github.com/invopop/gobl.pt.saft v0.0.6 // indirect
github.com/invopop/gobl.sa.zatca v0.0.3 // indirect
github.com/invopop/jsonschema v0.14.0 // indirect
github.com/invopop/yaml v0.3.1 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/invopop/gobl v0.503.0 h1:i15dqw6OlHdEWZzCgvM7MquMKKzBq7K8VMF8MQUJhGo=
github.com/invopop/gobl v0.503.0/go.mod h1:HmiEdQreTSQYyNbhs81VKTmI7BAJKYC/6enh9RDwnE0=
github.com/invopop/gobl.br.nfe v0.0.1 h1:ywJycz2wiyeNygbRhuRJg52gTnIECsbZ5+pGFqh3eyE=
github.com/invopop/gobl.br.nfe v0.0.1/go.mod h1:ZIJSVz5257xciD+RkBhyvqjtS46Pgw23idTca6A8ZIk=
github.com/invopop/gobl.br.nfe v0.0.3 h1:NPeJdiaI8/L3X3VtAocaWOVA3jaQBHz6Bheq9RKdWVs=
github.com/invopop/gobl.br.nfe v0.0.3/go.mod h1:qXzt4bz9S4+nJRbREb9QEAoO1W9r3Sjy6R207W7IuhY=
github.com/invopop/gobl.br.nfse v0.0.1 h1:BdwNiG7vk7bPMgE4m102P+UysOxmYWhOKIDfFI6RKEA=
github.com/invopop/gobl.br.nfse v0.0.1/go.mod h1:m22voo72ZScRiwIS49wXhzGRahzBO+IEAN0M0Kij3QI=
github.com/invopop/gobl.dev v0.500.12 h1:bva5jXrVOe986VrZhXHmLqBzPjncLwmOz+25OJ565Qs=
github.com/invopop/gobl.dev v0.500.12/go.mod h1:9LjzQPE8ZJqedAmsjY0M+W54uK+Yo622p3MkLIUMnck=
github.com/invopop/gobl.dev v0.500.14 h1:43mQ4begUXjGJ0QRc3wcv8SktanQVjtSvSZbly+lj4o=
github.com/invopop/gobl.dev v0.500.14/go.mod h1:go4xlgOSO+5Cm6D0Sf5+LO/7iV3+k3Y/DFHqVBGmB1s=
github.com/invopop/gobl.fr.ctc v0.0.7 h1:O/ihT1EcFA7o8FuYG7EbL6LMVJ/rQrWV/C1nY5ryieo=
github.com/invopop/gobl.fr.ctc v0.0.7/go.mod h1:YXJ0G7lCWxUehI4C2xBPL1y6rTNC29t/kOul7wY+3Xs=
github.com/invopop/gobl.mx.cfdi v0.63.0 h1:WkwsFCfMZfrG3N8ZHV+7NZ9VlCkYh4vRSUdqvrtEyHA=
github.com/invopop/gobl.mx.cfdi v0.63.0/go.mod h1:sXy7JIXauSKRqT0HgHsFICIV9YXuSHK3Quq9uZWZ9L0=
github.com/invopop/gobl.pt.saft v0.0.5 h1:Hc2Sbd280fDgPi9FznI/Xi95lAMzG8A4YEp6SW4H6uY=
github.com/invopop/gobl.pt.saft v0.0.5/go.mod h1:z5L+dLFBx6PmEdacnFWehYWgiYZSM2HaPzx6ld+DnQs=
github.com/invopop/gobl.pt.saft v0.0.6 h1:K0pcFMq/Q5ojPJqdmRsYJKkzWcKWeyh9pPC5BkPUE14=
github.com/invopop/gobl.pt.saft v0.0.6/go.mod h1:z5L+dLFBx6PmEdacnFWehYWgiYZSM2HaPzx6ld+DnQs=
github.com/invopop/gobl.sa.zatca v0.0.3 h1:eHG8KBndLF75iBXNKr65q91ANQ7fuqCgYoOccWDvjhw=
github.com/invopop/gobl.sa.zatca v0.0.3/go.mod h1:tmLCoaKb4X7sZ2zRU8LalA1sgxM2kQv/uqMzZslhE6A=
github.com/invopop/jsonschema v0.14.0 h1:MHQqLhvpNUZfw+hM3AZDYK7jxO8FZoQeQM77g8iyZjg=
Expand Down