Skip to content

Commit

Permalink
Fixing grammer error in tax extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Dec 5, 2024
1 parent 59350ca commit 5a8bd84
Show file tree
Hide file tree
Showing 24 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion addons/br/nfse/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func validateSupplier(value interface{}) error {
validation.Skip,
),
validation.Field(&obj.Ext,
tax.ExtensionsRequires(
tax.ExtensionsRequire(
ExtKeySimples,
ExtKeyMunicipality,
ExtKeyFiscalIncentive,
Expand Down
2 changes: 1 addition & 1 deletion addons/br/nfse/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func validateItem(item *org.Item) error {

return validation.ValidateStruct(item,
validation.Field(&item.Ext,
tax.ExtensionsRequires(ExtKeyService),
tax.ExtensionsRequire(ExtKeyService),
validation.Skip,
),
)
Expand Down
2 changes: 1 addition & 1 deletion addons/br/nfse/tax_combo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func validateTaxCombo(tc *tax.Combo) error {
return validation.ValidateStruct(tc,
validation.Field(&tc.Ext,
validation.When(tc.Category == br.TaxCategoryISS,
tax.ExtensionsRequires(ExtKeyISSLiability),
tax.ExtensionsRequire(ExtKeyISSLiability),
),
),
)
Expand Down
8 changes: 4 additions & 4 deletions addons/co/dian/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func validateInvoiceSupplier(value interface{}) error {
validation.When(
municipalityCodeRequired(obj.TaxID),
validation.Required,
tax.ExtensionsRequires(ExtKeyMunicipality),
tax.ExtensionsRequire(ExtKeyMunicipality),
),
validation.Skip,
),
Expand Down Expand Up @@ -120,7 +120,7 @@ func validateInvoiceCustomer(tags []cbc.Key) func(value any) error {
validation.When(
municipalityCodeRequired(obj.TaxID),
validation.Required,
tax.ExtensionsRequires(ExtKeyMunicipality),
tax.ExtensionsRequire(ExtKeyMunicipality),
),
validation.Skip,
),
Expand Down Expand Up @@ -154,11 +154,11 @@ func validateInvoicePreceding(typ cbc.Key) validation.RuleFunc {
validation.Field(&obj.Ext,
validation.When(
typ == bill.InvoiceTypeCreditNote,
tax.ExtensionsRequires(ExtKeyCreditCode),
tax.ExtensionsRequire(ExtKeyCreditCode),
),
validation.When(
typ == bill.InvoiceTypeDebitNote,
tax.ExtensionsRequires(ExtKeyDebitCode),
tax.ExtensionsRequire(ExtKeyDebitCode),
),
),
validation.Field(&obj.Reason, validation.Required),
Expand Down
4 changes: 2 additions & 2 deletions addons/es/facturae/invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func validateInvoiceTax(val any) error {
}
return validation.ValidateStruct(t,
validation.Field(&t.Ext,
tax.ExtensionsRequires(
tax.ExtensionsRequire(
ExtKeyDocType,
ExtKeyInvoiceClass,
),
Expand All @@ -89,7 +89,7 @@ func validateInvoicePreceding(val any) error {
return validation.ValidateStruct(p,
validation.Field(&p.IssueDate, validation.Required),
validation.Field(&p.Ext,
tax.ExtensionsRequires(ExtKeyCorrection),
tax.ExtensionsRequire(ExtKeyCorrection),
validation.Skip,
),
)
Expand Down
6 changes: 3 additions & 3 deletions addons/es/tbai/invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func validateInvoiceTax(val any) error {
}
return validation.ValidateStruct(obj,
validation.Field(&obj.Ext,
tax.ExtensionsRequires(ExtKeyRegion),
tax.ExtensionsRequire(ExtKeyRegion),
validation.Skip,
),
)
Expand Down Expand Up @@ -137,7 +137,7 @@ func validateInvoicePreceding(val any) error {
validation.Field(&p.IssueDate, validation.Required),
validation.Field(&p.Series, validation.Required),
validation.Field(&p.Ext,
tax.ExtensionsRequires(ExtKeyCorrection),
tax.ExtensionsRequire(ExtKeyCorrection),
validation.Skip,
),
)
Expand Down Expand Up @@ -168,7 +168,7 @@ func validateInvoiceLineTax(value any) error {
validation.Field(&obj.Ext,
validation.When(
obj.Rate == tax.RateExempt,
tax.ExtensionsRequires(ExtKeyExemption),
tax.ExtensionsRequire(ExtKeyExemption),
),
validation.Skip,
),
Expand Down
4 changes: 2 additions & 2 deletions addons/es/verifactu/bill.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func validateInvoiceTax(it cbc.Key) validation.RuleFunc {
obj := val.(*bill.Tax)
return validation.ValidateStruct(obj,
validation.Field(&obj.Ext,
tax.ExtensionsRequires(ExtKeyDocType),
tax.ExtensionsRequire(ExtKeyDocType),
validation.When(
it.In(bill.InvoiceTypeStandard),
tax.ExtensionsHasValues(
Expand All @@ -122,7 +122,7 @@ func validateInvoiceTax(it cbc.Key) validation.RuleFunc {
),
validation.When(
obj.Ext.Get(ExtKeyDocType).In(docTypesCreditDebit...),
tax.ExtensionsRequires(ExtKeyCorrectionType),
tax.ExtensionsRequire(ExtKeyCorrectionType),
),
validation.Skip,
),
Expand Down
4 changes: 2 additions & 2 deletions addons/es/verifactu/tax.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func validateTaxCombo(tc *tax.Combo) error {
validation.Field(&tc.Ext,
validation.When(
tc.Percent != nil, // Taxed
tax.ExtensionsRequires(ExtKeyOpClass),
tax.ExtensionsRequire(ExtKeyOpClass),
),
validation.When(
tc.Percent == nil && !tc.Ext.Has(ExtKeyOpClass),
tax.ExtensionsRequires(ExtKeyExempt),
tax.ExtensionsRequire(ExtKeyExempt),
),
validation.Skip,
),
Expand Down
2 changes: 1 addition & 1 deletion addons/eu/en16931/bill.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func validateBillInvoiceTax(value any) error {
}
return validation.ValidateStruct(tx,
validation.Field(&tx.Ext,
tax.ExtensionsRequires(untdid.ExtKeyDocumentType),
tax.ExtensionsRequire(untdid.ExtKeyDocumentType),
validation.Skip,
),
)
Expand Down
4 changes: 2 additions & 2 deletions addons/eu/en16931/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func normalizePayAdvance(adv *pay.Advance) {
func validatePayAdvance(adv *pay.Advance) error {
return validation.ValidateStruct(adv,
validation.Field(&adv.Ext,
tax.ExtensionsRequires(untdid.ExtKeyPaymentMeans),
tax.ExtensionsRequire(untdid.ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand All @@ -57,7 +57,7 @@ func normalizePayInstructions(instr *pay.Instructions) {
func validatePayInstructions(instr *pay.Instructions) error {
return validation.ValidateStruct(instr,
validation.Field(&instr.Ext,
tax.ExtensionsRequires(untdid.ExtKeyPaymentMeans),
tax.ExtensionsRequire(untdid.ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand Down
2 changes: 1 addition & 1 deletion addons/eu/en16931/tax_combo.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func validateTaxCombo(tc *tax.Combo) error {
}
return validation.ValidateStruct(tc,
validation.Field(&tc.Ext,
tax.ExtensionsRequires(untdid.ExtKeyTaxCategory),
tax.ExtensionsRequire(untdid.ExtKeyTaxCategory),
tax.ExtensionsHasValues(untdid.ExtKeyTaxCategory, acceptedTaxCategories...),
validation.Skip,
),
Expand Down
4 changes: 2 additions & 2 deletions addons/gr/mydata/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func validateInvoiceTax(value any) error {
}
return validation.ValidateStruct(t,
validation.Field(&t.Ext,
tax.ExtensionsRequires(ExtKeyInvoiceType),
tax.ExtensionsRequire(ExtKeyInvoiceType),
validation.Skip,
),
)
Expand Down Expand Up @@ -146,7 +146,7 @@ func validateInvoiceItem(value any) error {
validation.Field(&i.Ext,
validation.When(
i.Ext.Has(ExtKeyIncomeCat) || i.Ext.Has(ExtKeyIncomeType),
tax.ExtensionsRequires(ExtKeyIncomeCat, ExtKeyIncomeType),
tax.ExtensionsRequire(ExtKeyIncomeCat, ExtKeyIncomeType),
),
validation.Skip,
),
Expand Down
4 changes: 2 additions & 2 deletions addons/gr/mydata/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func validatePayInstructions(value any) error {
validation.Skip,
),
validation.Field(&i.Ext,
tax.ExtensionsRequires(ExtKeyPaymentMeans),
tax.ExtensionsRequire(ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand All @@ -82,7 +82,7 @@ func validatePayAdvance(value any) error {
validation.Skip,
),
validation.Field(&a.Ext,
tax.ExtensionsRequires(ExtKeyPaymentMeans),
tax.ExtensionsRequire(ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand Down
6 changes: 3 additions & 3 deletions addons/gr/mydata/tax_combo.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ func validateTaxCombo(tc *tax.Combo) error {
case tax.CategoryVAT:
return validation.ValidateStruct(tc,
validation.Field(&tc.Ext,
tax.ExtensionsRequires(ExtKeyVATRate),
tax.ExtensionsRequire(ExtKeyVATRate),
validation.When(
tc.Percent == nil,
tax.ExtensionsRequires(ExtKeyExemption),
tax.ExtensionsRequire(ExtKeyExemption),
),
validation.When(
// MyDATA uses income category and type for accounting purposes
// and for them to be grouped with taxes. We ensure they're present
// here so that the
tc.Ext.Has(ExtKeyIncomeCat) || tc.Ext.Has(ExtKeyIncomeType),
tax.ExtensionsRequires(ExtKeyIncomeCat, ExtKeyIncomeType),
tax.ExtensionsRequire(ExtKeyIncomeCat, ExtKeyIncomeType),
),
validation.Skip,
),
Expand Down
2 changes: 1 addition & 1 deletion addons/it/sdi/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func validateSupplier(value interface{}) error {
validation.Skip,
),
validation.Field(&supplier.Ext,
tax.ExtensionsRequires(ExtKeyFiscalRegime),
tax.ExtensionsRequire(ExtKeyFiscalRegime),
validation.Skip,
),
)
Expand Down
4 changes: 2 additions & 2 deletions addons/it/sdi/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func normalizePayAdvance(adv *pay.Advance) {
func validatePayAdvance(a *pay.Advance) error {
return validation.ValidateStruct(a,
validation.Field(&a.Ext,
tax.ExtensionsRequires(ExtKeyPaymentMeans),
tax.ExtensionsRequire(ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand All @@ -94,7 +94,7 @@ func validatePayAdvance(a *pay.Advance) error {
func validatePayInstructions(i *pay.Instructions) error {
return validation.ValidateStruct(i,
validation.Field(&i.Ext,
tax.ExtensionsRequires(ExtKeyPaymentMeans),
tax.ExtensionsRequire(ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand Down
4 changes: 2 additions & 2 deletions addons/it/sdi/tax.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func validateTaxCombo(val any) error {
validation.Field(&c.Ext,
validation.When(
c.Percent == nil,
tax.ExtensionsRequires(ExtKeyExempt),
tax.ExtensionsRequire(ExtKeyExempt),
),
validation.Skip,
),
Expand All @@ -26,7 +26,7 @@ func validateTaxCombo(val any) error {
case it.TaxCategoryIRPEF, it.TaxCategoryIRES, it.TaxCategoryINPS, it.TaxCategoryENPAM, it.TaxCategoryENASARCO:
return validation.ValidateStruct(c,
validation.Field(&c.Ext,
tax.ExtensionsRequires(ExtKeyRetained),
tax.ExtensionsRequire(ExtKeyRetained),
validation.Skip,
),
)
Expand Down
8 changes: 4 additions & 4 deletions addons/mx/cfdi/invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ func validateInvoiceTax(preceding []*org.DocumentRef) validation.RuleFunc {
}
return validation.ValidateStruct(obj,
validation.Field(&obj.Ext,
tax.ExtensionsRequires(
tax.ExtensionsRequire(
ExtKeyDocType,
ExtKeyIssuePlace,
),
validation.When(
len(preceding) > 0,
tax.ExtensionsRequires(
tax.ExtensionsRequire(
ExtKeyRelType,
),
),
Expand All @@ -93,7 +93,7 @@ func validateInvoiceCustomer(value any) error {
validation.Field(&obj.Ext,
validation.When(
isMexican(obj),
tax.ExtensionsRequires(
tax.ExtensionsRequire(
ExtKeyFiscalRegime,
ExtKeyUse,
),
Expand Down Expand Up @@ -135,7 +135,7 @@ func validateInvoiceSupplier(value any) error {
validation.Skip,
),
validation.Field(&obj.Ext,
tax.ExtensionsRequires(
tax.ExtensionsRequire(
ExtKeyFiscalRegime,
),
),
Expand Down
2 changes: 1 addition & 1 deletion addons/mx/cfdi/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func validateItem(value any) error {
}
return validation.ValidateStruct(item,
validation.Field(&item.Ext,
tax.ExtensionsRequires(ExtKeyProdServ),
tax.ExtensionsRequire(ExtKeyProdServ),
validation.By(validItemExtensions),
validation.Skip,
),
Expand Down
4 changes: 2 additions & 2 deletions addons/mx/cfdi/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func normalizePayAdvance(adv *pay.Advance) {
func validatePayAdvance(a *pay.Advance) error {
return validation.ValidateStruct(a,
validation.Field(&a.Ext,
tax.ExtensionsRequires(ExtKeyPaymentMeans),
tax.ExtensionsRequire(ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand All @@ -94,7 +94,7 @@ func validatePayAdvance(a *pay.Advance) error {
func validatePayInstructions(i *pay.Instructions) error {
return validation.ValidateStruct(i,
validation.Field(&i.Ext,
tax.ExtensionsRequires(ExtKeyPaymentMeans),
tax.ExtensionsRequire(ExtKeyPaymentMeans),
validation.Skip,
),
)
Expand Down
4 changes: 2 additions & 2 deletions addons/pt/saft/tax_combo.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ func validateTaxCombo(val any) error {
// country tax rate.
validation.When(
c.Country == "",
tax.ExtensionsRequires(ExtKeyTaxRate),
tax.ExtensionsRequire(ExtKeyTaxRate),
),
validation.When(
c.Percent == nil,
tax.ExtensionsRequires(ExtKeyExemption),
tax.ExtensionsRequire(ExtKeyExemption),
),
validation.Skip,
),
Expand Down
2 changes: 1 addition & 1 deletion regimes/pl/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (v *invoiceValidator) preceding(value interface{}) error {
}
return validation.ValidateStruct(obj,
validation.Field(&obj.Ext,
tax.ExtensionsRequires(ExtKeyKSeFEffectiveDate),
tax.ExtensionsRequire(ExtKeyKSeFEffectiveDate),
),
validation.Field(&obj.Reason, validation.Required),
)
Expand Down
4 changes: 2 additions & 2 deletions tax/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ func ExtensionsHas(keys ...cbc.Key) validation.Rule {
}
}

// ExtensionsRequires returns a validation rule that ensures all the
// ExtensionsRequire returns a validation rule that ensures all the
// extension map's keys match those provided in the list.
func ExtensionsRequires(keys ...cbc.Key) validation.Rule {
func ExtensionsRequire(keys ...cbc.Key) validation.Rule {
return validateExtCodeMap{
required: true,
keys: keys,
Expand Down
Loading

0 comments on commit 5a8bd84

Please sign in to comment.