Skip to content
Open
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
25 changes: 24 additions & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/invopop/gobl/addons/de/xrechnung"
"github.com/invopop/gobl/addons/eu/en16931"
"github.com/invopop/gobl/addons/fr/facturx"
peppolpint "github.com/invopop/gobl/addons/peppol/pint"
"github.com/invopop/gobl/bill"
"github.com/invopop/gobl/cbc"
)
Expand Down Expand Up @@ -224,6 +225,28 @@ var ContextZATCA = Context{
},
}

// ContextPeppolPINT defines the default Peppol PINT context.
var ContextPeppolPINT = Context{
CustomizationID: "urn:peppol:pint:billing-1@aunz-1",
ProfileID: "urn:peppol:bis:billing",
Addons: []cbc.Key{peppolpint.V1},
VESIDs: VESIDMapping{
Invoice: "org.peppol.pint.aunz:invoice:1.1.2",
CreditNote: "org.peppol.pint.aunz:creditnote:1.1.2",
},
}

// ContextPeppolPINTSelfBilled defines the Peppol PINT self-billed context.
var ContextPeppolPINTSelfBilled = Context{
CustomizationID: "urn:peppol:pint:selfbilling-1@aunz-1",
ProfileID: "urn:peppol:bis:selfbilling",
Addons: []cbc.Key{peppolpint.V1},
VESIDs: VESIDMapping{
Invoice: "org.peppol.pint.aunz:invoice-self-billing:1.1.2",
CreditNote: "org.peppol.pint.aunz:creditnote-self-billing:1.1.2",
},
}

// contexts is used internally for reverse lookups during parsing.
// When adding new contexts, remember to add them here AND as exported variables above.
var contexts = []Context{ContextEN16931, ContextPeppol, ContextPeppolSelfBilled, ContextXRechnung, ContextPeppolFranceCIUS, ContextPeppolFranceExtended, ContextZATCA}
var contexts = []Context{ContextEN16931, ContextPeppol, ContextPeppolSelfBilled, ContextXRechnung, ContextPeppolFranceCIUS, ContextPeppolFranceExtended, ContextZATCA, ContextPeppolPINT, ContextPeppolPINTSelfBilled}
1 change: 1 addition & 0 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestConvertToInvoice(t *testing.T) {
{"FranceCIUS", ubl.ContextPeppolFranceCIUS, "france-cius"},
{"FranceExtended", ubl.ContextPeppolFranceExtended, "france-extended"},
{"ZATCA", ubl.ContextZATCA, "zatca"},
{"PeppolPINT", ubl.ContextPeppolPINT, "peppol-pint"},
}

for _, ctx := range contexts {
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/invopop/gobl.ubl

go 1.24.4
go 1.25.0

require (
github.com/invopop/gobl v0.500.0
github.com/invopop/gobl v0.501.1-0.20260718154801-1358939b249e
github.com/joho/godotenv v1.5.1
github.com/spf13/cobra v1.9.1
github.com/stretchr/testify v1.11.1
Expand Down Expand Up @@ -42,10 +42,10 @@ require (
github.com/russellhaering/goxmldsig v1.6.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect
golang.org/x/crypto v0.47.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.34.0 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/text v0.38.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ 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/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/gobl v0.500.0 h1:Ob3uO8wCywDkzJFpKI8zsUY/pL0sYsFobZlfRAZjd44=
github.com/invopop/gobl v0.500.0/go.mod h1:EGDHHuPbF8JxRfct0q/s9t7ei2gjkOwjH3SytjB3aS0=
github.com/invopop/gobl v0.501.1-0.20260718154801-1358939b249e h1:qURZvnhB6x5KGsE0PJ/61+e4ypUAirsNRQUAxqaQDqU=
github.com/invopop/gobl v0.501.1-0.20260718154801-1358939b249e/go.mod h1:HmiEdQreTSQYyNbhs81VKTmI7BAJKYC/6enh9RDwnE0=
github.com/invopop/gobl.fr.ctc v0.0.4 h1:x4eJ3hp9Y9lTCzWFhNqZYm9kCXyuC34EytOuaU03faE=
github.com/invopop/gobl.fr.ctc v0.0.4/go.mod h1:YXJ0G7lCWxUehI4C2xBPL1y6rTNC29t/kOul7wY+3Xs=
github.com/invopop/gobl.sa.zatca v0.0.2 h1:qU2Y0LP+4mjvZkuG1TOUp/Zs0XxRAzkzQFHy3WOVFEU=
Expand Down Expand Up @@ -106,14 +106,14 @@ go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
go.yaml.in/yaml/v4 v4.0.0-rc.2 h1:/FrI8D64VSr4HtGIlUtlFMGsm7H7pWTbj6vOLVZcA6s=
go.yaml.in/yaml/v4 v4.0.0-rc.2/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto=
golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE=
golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww=
Expand Down
6 changes: 3 additions & 3 deletions party_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestParseParty(t *testing.T) {
supplier := inv.Supplier
require.NotNil(t, supplier)
assert.Equal(t, "Tax handling company AS", supplier.Name)
assert.Equal(t, cbc.Code("967611265"), supplier.TaxID.Code)
assert.Equal(t, cbc.Code("967611265MVA"), supplier.TaxID.Code)
assert.Equal(t, l10n.TaxCountryCode("NO"), supplier.TaxID.Country)
assert.Equal(t, "Regent street", supplier.Addresses[0].Street)
assert.Equal(t, "Newtown", supplier.Addresses[0].Locality)
Expand All @@ -34,7 +34,7 @@ func TestParseParty(t *testing.T) {
seller := inv.Ordering.Seller
require.NotNil(t, seller)
assert.Equal(t, "Salescompany ltd.", seller.Name)
assert.Equal(t, cbc.Code("123456789"), seller.TaxID.Code)
assert.Equal(t, cbc.Code("123456789MVA"), seller.TaxID.Code)
assert.Equal(t, l10n.TaxCountryCode("NO"), seller.TaxID.Country)
require.Len(t, seller.Identities, 2)
assert.Equal(t, cbc.Code("123456789"), seller.Identities[0].Code)
Expand All @@ -58,7 +58,7 @@ func TestParseParty(t *testing.T) {
customer := inv.Customer
require.NotNil(t, customer)
assert.Equal(t, "The Buyercompany", customer.Name)
assert.Equal(t, cbc.Code("987654321"), customer.TaxID.Code)
assert.Equal(t, cbc.Code("987654321MVA"), customer.TaxID.Code)
assert.Equal(t, l10n.TaxCountryCode("NO"), customer.TaxID.Country)
assert.Equal(t, "Anystreet 8", customer.Addresses[0].Street)
assert.Equal(t, "Back door", customer.Addresses[0].StreetExtra)
Expand Down
181 changes: 181 additions & 0 deletions test/data/convert/peppol-pint/credit-note-au.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"$schema": "https://gobl.org/draft-0/envelope",
"head": {
"uuid": "0195ce71-dc9c-72c8-bf2c-9890a4a9f0a2",
"dig": {
"alg": "sha256",
"val": "a3b94d4cedfac8c9a6e773e6423fd505f475e36f554a9c296007a192899d3173"
},
"from": "iso6523-actorid-upis::0151:51824753556",
"to": "iso6523-actorid-upis::0151:53004085616"
},
"doc": {
"$schema": "https://gobl.org/draft-0/bill/invoice",
"$regime": "AU",
"$addons": [
"eu-en16931-v2017"
],
"uuid": "0195ce71-dc9c-72c8-bf2c-9890a4a9f0a2",
"type": "credit-note",
"series": "SAMPLE",
"code": "CN-001",
"issue_date": "2024-05-15",
"currency": "AUD",
"tax": {
"ext": {
"untdid-document-type": "381"
}
},
"supplier": {
"name": "Provide One Pty Ltd",
"tax_id": {
"country": "AU",
"code": "51824753556"
},
"identities": [
{
"scope": "legal",
"code": "51824753556",
"ext": {
"iso-scheme-id": "0151"
}
}
],
"endpoints": [
{
"uri": "iso6523-actorid-upis::0151:51824753556"
}
],
"inboxes": [
{
"key": "peppol",
"scheme": "0151",
"code": "51824753556"
}
],
"addresses": [
{
"num": "100",
"street": "Queen Street",
"locality": "Melbourne",
"region": "VIC",
"code": "3000",
"country": "AU"
}
]
},
"customer": {
"name": "Sample Customer Pty Ltd",
"tax_id": {
"country": "AU",
"code": "53004085616"
},
"identities": [
{
"scope": "legal",
"code": "53004085616",
"ext": {
"iso-scheme-id": "0151"
}
}
],
"endpoints": [
{
"uri": "iso6523-actorid-upis::0151:53004085616"
}
],
"inboxes": [
{
"key": "peppol",
"scheme": "0151",
"code": "53004085616"
}
],
"addresses": [
{
"num": "1",
"street": "Martin Place",
"locality": "Sydney",
"region": "NSW",
"code": "2000",
"country": "AU"
}
]
},
"lines": [
{
"i": 1,
"quantity": "10",
"item": {
"name": "Consulting services",
"price": "100.00",
"unit": "h"
},
"sum": "1000.00",
"taxes": [
{
"cat": "GST",
"key": "standard",
"rate": "general",
"percent": "10.0%",
"ext": {
"untdid-tax-category": "O"
}
}
],
"total": "1000.00"
}
],
"payment": {
"terms": {
"key": "due-date",
"due_dates": [
{
"date": "2024-06-15",
"amount": "1100.00",
"percent": "100%"
}
]
},
"instructions": {
"key": "credit-transfer",
"credit_transfer": [
{
"number": "123456789",
"name": "Provide One Pty Ltd"
}
],
"ext": {
"untdid-payment-means": "30"
}
}
},
"totals": {
"sum": "1000.00",
"total": "1000.00",
"taxes": {
"categories": [
{
"code": "GST",
"rates": [
{
"key": "standard",
"ext": {
"untdid-tax-category": "O"
},
"base": "1000.00",
"percent": "10.0%",
"amount": "100.00"
}
],
"amount": "100.00"
}
],
"sum": "100.00"
},
"tax": "100.00",
"total_with_tax": "1100.00",
"payable": "1100.00"
}
}
}
Loading
Loading