Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding TIN algorithms #400

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
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
9 changes: 9 additions & 0 deletions data/regimes/at.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
]
}
],
"identity_keys": [
{
"key": "at-tax-number",
"name": {
"de": "Steuernummer",
"en": "Tax Number"
}
}
],
"scenarios": [
{
"schema": "bill/invoice",
Expand Down
9 changes: 9 additions & 0 deletions data/regimes/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@
]
}
],
"identity_types": [
{
"value": "SPI",
"name": {
"en": "Index Steering System",
"fr": "Système de Pilotage des Indices"
}
}
],
"scenarios": [
{
"schema": "bill/invoice",
Expand Down
14 changes: 14 additions & 0 deletions data/regimes/gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@
]
}
],
"identity_types": [
{
"value": "UTR",
"name": {
"en": "Unique Taxpayer Reference"
}
},
{
"value": "NINO",
"name": {
"en": "National Insurance Number"
}
}
],
"scenarios": [
{
"schema": "bill/invoice",
Expand Down
172 changes: 172 additions & 0 deletions data/regimes/ie.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"$schema": "https://gobl.org/draft-0/tax/regime-def",
"name": {
"en": "Ireland"
},
"time_zone": "Europe/Dublin",
"country": "IE",
"currency": "EUR",
"tags": [
{
"schema": "bill/invoice",
"list": [
{
"key": "simplified",
"name": {
"de": "Vereinfachte Rechnung",
"en": "Simplified Invoice",
"es": "Factura Simplificada",
"it": "Fattura Semplificata"
},
"desc": {
"de": "Wird für B2C-Transaktionen verwendet, wenn die Kundendaten nicht verfügbar sind. Bitte wenden Sie sich an die örtlichen Behörden, um die Grenzwerte zu ermitteln.",
"en": "Used for B2C transactions when the client details are not available, check with local authorities for limits.",
"es": "Usado para transacciones B2C cuando los detalles del cliente no están disponibles, consulte con las autoridades locales para los límites.",
"it": "Utilizzato per le transazioni B2C quando i dettagli del cliente non sono disponibili, controllare con le autorità locali per i limiti."
}
},
{
"key": "reverse-charge",
"name": {
"de": "Umkehr der Steuerschuld",
"en": "Reverse Charge",
"es": "Inversión del Sujeto Pasivo",
"it": "Inversione del soggetto passivo"
}
},
{
"key": "self-billed",
"name": {
"de": "Rechnung durch den Leistungsempfänger",
"en": "Self-billed",
"es": "Facturación por el destinatario",
"it": "Autofattura"
}
},
{
"key": "customer-rates",
"name": {
"de": "Kundensätze",
"en": "Customer rates",
"es": "Tarifas aplicables al destinatario",
"it": "Aliquote applicabili al destinatario"
}
},
{
"key": "partial",
"name": {
"de": "Teilweise",
"en": "Partial",
"es": "Parcial",
"it": "Parziale"
}
}
]
}
],
"scenarios": [
{
"schema": "bill/invoice",
"list": [
{
"tags": [
"reverse-charge"
],
"note": {
"key": "legal",
"src": "reverse-charge",
"text": "Reverse charge: Customer to account for VAT to the relevant tax authority."
}
}
]
}
],
"corrections": [
{
"schema": "bill/invoice",
"types": [
"credit-note"
]
}
],
"categories": [
{
"code": "VAT",
"name": {
"en": "VAT"
},
"title": {
"en": "Value Added Tax"
},
"rates": [
{
"key": "zero",
"name": {
"en": "Zero Rate"
},
"values": [
{
"percent": "0.0%"
}
]
},
{
"key": "standard",
"name": {
"en": "Standard Rate"
},
"values": [
{
"since": "2021-02-28",
"percent": "23%"
},
{
"since": "2020-09-01",
"percent": "21%"
},
{
"since": "2012-01-01",
"percent": "23%"
}
]
},
{
"key": "reduced",
"name": {
"en": "Reduced Rate"
},
"values": [
{
"since": "2003-01-01",
"percent": "13.5%"
}
]
},
{
"key": "super-reduced",
"name": {
"en": "Reduced Rate"
},
"values": [
{
"since": "2011-07-01",
"percent": "9%"
}
]
},
{
"key": "special",
"name": {
"en": "Reduced Rate"
},
"values": [
{
"since": "2005-01-01",
"percent": "4.8%"
}
]
}
]
}
]
}
9 changes: 9 additions & 0 deletions data/regimes/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@
]
}
],
"identity_types": [
{
"value": "PESEL",
"name": {
"en": "Tax Number",
"pl": "Numer podatkowy"
}
}
],
"payment_means_keys": [
{
"key": "cash",
Expand Down
4 changes: 4 additions & 0 deletions data/schemas/bill/invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@
"const": "GB",
"title": "United Kingdom"
},
{
"const": "IE",
"title": "Ireland"
},
{
"const": "IT",
"title": "Italy"
Expand Down
13 changes: 6 additions & 7 deletions data/schemas/tax/regime-def.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,20 @@
"title": "Extensions",
"description": "Extensions defines the keys that can be used for extended or extra data inside the regime that\nis specific to the regime and cannot be easily determined from other GOBL structures.\nTypically these are used to define local codes for suppliers, customers, products, or tax rates."
},
"tax_identity_type_keys": {
"identity_keys": {
"items": {
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
},
"type": "array",
"title": "Tax Identity Type Keys",
"description": "Tax Identity types specific for the regime and may be validated\nagainst."
"title": "Identity Keys",
"description": "Identity keys used in addition to regular tax identities and specific for the\nregime that may be validated against."
},
"identity_keys": {
"identity_types": {
"items": {
"$ref": "https://gobl.org/draft-0/cbc/key-definition"
"$ref": "https://gobl.org/draft-0/cbc/value-definition"
},
"type": "array",
"title": "Identity Keys",
"description": "Identity keys used in addition to regular tax identities and specific for the\nregime that may be validated against."
"description": "Identity Types are used as an alternative to Identity Keys when there is a clear local\ndefinition of a specific code."
},
"charge_keys": {
"items": {
Expand Down
9 changes: 8 additions & 1 deletion regimes/at/at.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/invopop/gobl/cbc"
"github.com/invopop/gobl/currency"
"github.com/invopop/gobl/i18n"
"github.com/invopop/gobl/org"
"github.com/invopop/gobl/regimes/common"
"github.com/invopop/gobl/tax"
)
Expand All @@ -31,7 +32,8 @@ func New() *tax.RegimeDef {
Tags: []*tax.TagSet{
common.InvoiceTags(),
},
Categories: taxCategories,
Categories: taxCategories,
IdentityKeys: identityKeyDefinitions, // identities.go
Corrections: []*tax.CorrectionDefinition{
{
Schema: bill.ShortSchemaInvoice,
Expand All @@ -50,7 +52,10 @@ func Validate(doc any) error {
return validateInvoice(obj)
case *tax.Identity:
return validateTaxIdentity(obj)
case *org.Identity:
return validateTaxNumber(obj)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be:

Suggested change
return validateTaxNumber(obj)
return validateIdentity(obj)

}

return nil
}

Expand All @@ -59,5 +64,7 @@ func Normalize(doc any) {
switch obj := doc.(type) {
case *tax.Identity:
tax.NormalizeIdentity(obj)
case *org.Identity:
normalizeTaxNumber(obj)
}
}
Loading
Loading