Skip to content

Commit

Permalink
add invoice types
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafal Lyzwa committed Nov 29, 2023
1 parent db335cc commit 96a7ab6
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 10 deletions.
14 changes: 7 additions & 7 deletions regimes/pl/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Gotówka",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "1",
KeyFA_VATPaymentType: "1",
},
},
{
Expand All @@ -34,7 +34,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Karta",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "2",
KeyFA_VATPaymentType: "2",
},
},
{
Expand All @@ -44,7 +44,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Bon",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "3",
KeyFA_VATPaymentType: "3",
},
},
{
Expand All @@ -54,7 +54,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Czek",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "4",
KeyFA_VATPaymentType: "4",
},
},
{
Expand All @@ -64,7 +64,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Kredyt",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "5",
KeyFA_VATPaymentType: "5",
},
},
{
Expand All @@ -74,7 +74,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Przelew",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "6",
KeyFA_VATPaymentType: "6",
},
},
{
Expand All @@ -84,7 +84,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{
i18n.PL: "Mobilna",
},
Map: cbc.CodeMap{
KeyFA_VATFormaPlatnosci: "7",
KeyFA_VATPaymentType: "7",
},
},
}
7 changes: 4 additions & 3 deletions regimes/pl/pl.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ func init() {

// Custom keys used typically in meta or codes information.
const (
KeyFA_VATFormaPlatnosci cbc.Key = "favat-forma-platnosci" // for mapping to TFormaPlatnosci's codes
KeyFA_VATPaymentType cbc.Key = "favat-forma-platnosci" // for mapping to TFormaPlatnosci's codes
KeyFA_VATInvoiceType cbc.Key = "favat-rodzaj-faktury" // for mapping to TRodzajFaktury's codes
)

// New instantiates a new Polish regime.
Expand All @@ -32,8 +33,8 @@ func New() *tax.Regime {
// ChargeKeys: chargeKeyDefinitions, // charges.go
PaymentMeansKeys: paymentMeansKeyDefinitions, // pay.go
// Extensions: extensionKeys, // extensions.go
// Tags: invoiceTags,
// Scenarios: scenarios, // scenarios.go
Tags: invoiceTags,
Scenarios: scenarios, // scenarios.go
Validator: Validate,
// Calculator: Calculate,
Categories: taxCategories, // tax_categories.go
Expand Down
110 changes: 110 additions & 0 deletions regimes/pl/scenarios.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package pl

import (
"github.com/invopop/gobl/bill"
"github.com/invopop/gobl/cbc"
"github.com/invopop/gobl/i18n"
"github.com/invopop/gobl/regimes/common"
"github.com/invopop/gobl/tax"
)

// Document tag keys
const (
TagSettlement cbc.Key = "partial"
)

var invoiceTags = []*tax.KeyDefinition{
{
Key: TagSettlement,
Name: i18n.String{
i18n.EN: "Settlement Invoice",
i18n.PL: "Faktura Rozliczeniowa",
},
},
}

var scenarios = []*tax.ScenarioSet{
invoiceScenarios,
}

var invoiceScenarios = &tax.ScenarioSet{
Schema: bill.ShortSchemaInvoice,
List: []*tax.Scenario{
// **** Invoice Type ****
{
Types: []cbc.Key{bill.InvoiceTypeStandard},
Name: i18n.String{
i18n.EN: "Regular Invoice",
i18n.PL: "Faktura Podstawowa",
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "VAT",
},
},
{
Types: []cbc.Key{bill.InvoiceTypeStandard},
Tags: []cbc.Key{common.TagPartial},

Check failure on line 46 in regimes/pl/scenarios.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: common.TagPartial (typecheck)
Name: i18n.String{
i18n.EN: "Prepayment Invoice",
i18n.PL: `Faktura Zaliczkowa`,
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "ZAL",
},
},
{
Types: []cbc.Key{bill.InvoiceTypeStandard},
Tags: []cbc.Key{TagSettlement},
Name: i18n.String{
i18n.EN: "Settlement Invoice",
i18n.PL: "Faktura Rozliczeniowa",
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "ROZ",
},
},
{
Types: []cbc.Key{bill.InvoiceTypeStandard},
Tags: []cbc.Key{common.TagSimplified},

Check failure on line 68 in regimes/pl/scenarios.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: common.TagSimplified (typecheck)
Name: i18n.String{
i18n.EN: "Simplified Invoice",
i18n.PL: "Faktura Uproszczona",
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "UPR",
},
},
{
Types: []cbc.Key{bill.InvoiceTypeCorrective},
Name: i18n.String{
i18n.EN: "Corrective Invoice",
i18n.PL: "Faktura Korygująca",
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "KOR",
},
},
{
Types: []cbc.Key{bill.InvoiceTypeCorrective},
Tags: []cbc.Key{common.TagPartial},

Check failure on line 89 in regimes/pl/scenarios.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: common.TagPartial (typecheck)
Name: i18n.String{
i18n.EN: "Corrective Prepayment Invoice",
i18n.PL: `Faktura korygująca fakturę zaliczkową`,
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "KOR_ZAL",
},
},
{
Types: []cbc.Key{bill.InvoiceTypeCorrective},
Tags: []cbc.Key{TagSettlement},
Name: i18n.String{
i18n.EN: "Corrective Settlement Invoice",
i18n.PL: "Faktura korygująca fakturę rozliczeniową",
},
Codes: cbc.CodeMap{
KeyFA_VATInvoiceType: "KOR_ROZ",
},
},
},
}

0 comments on commit 96a7ab6

Please sign in to comment.