Skip to content

Commit

Permalink
Lint Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
apardods committed Oct 15, 2024
1 parent 1a9b76d commit 0aa93e0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions addons/de/xrechnung/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"github.com/invopop/gobl/i18n"
)

var (
ExtKeyTaxRate cbc.Key = "de-xrechnung-tax-rate"
)
// ExtKeyTaxRate is the key for the tax rate extension in XRechnung
var ExtKeyTaxRate cbc.Key = "de-xrechnung-tax-rate"

var extensions = []*cbc.KeyDefinition{
{
Expand Down
2 changes: 2 additions & 0 deletions addons/de/xrechnung/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/invopop/validation"
)

// Payment keys for XRechnung SEPA direct debit and credit transfer
const (
KeyPaymentMeansSEPACreditTransfer cbc.Key = "sepa-credit-transfer"
KeyPaymentMeansSEPADirectDebit cbc.Key = "sepa-direct-debit"
Expand All @@ -23,6 +24,7 @@ var validPaymentKeys = []cbc.Key{
KeyPaymentMeansSEPADirectDebit,
}

// ValidatePaymentInstructions validates the payment instructions according to the XRechnung standard
func ValidatePaymentInstructions(value interface{}) error {
inv, ok := value.(*bill.Invoice)
if !ok || inv == nil || inv.Payment == nil || inv.Payment.Instructions == nil {
Expand Down
1 change: 1 addition & 0 deletions addons/de/xrechnung/invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var validTypes = []cbc.Key{
invoiceTypeFinalConstruction,
}

// ValidateInvoice validates the invoice according to the XRechnung standard
func ValidateInvoice(inv *bill.Invoice) error {
return validation.ValidateStruct(inv,
// BR-DE-17
Expand Down
4 changes: 4 additions & 0 deletions addons/de/xrechnung/tax_combo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"github.com/invopop/validation"
)

// TaxRateExtensions returns the mapping of tax rates defined in DE
// to their extension values used by XRechnung.
func TaxRateExtensions() tax.Extensions {
return taxRateMap

Check warning on line 11 in addons/de/xrechnung/tax_combo.go

View check run for this annotation

Codecov / codecov/patch

addons/de/xrechnung/tax_combo.go#L10-L11

Added lines #L10 - L11 were not covered by tests
}
Expand All @@ -15,6 +17,7 @@ var taxRateMap = tax.Extensions{
tax.RateExempt: "E",
}

// NormalizeTaxCombo adds the XRechnung tax rate code to the tax combo.
func NormalizeTaxCombo(combo *tax.Combo) {
// copy the SAF-T tax rate code to the line
switch combo.Category {
Expand All @@ -33,6 +36,7 @@ func NormalizeTaxCombo(combo *tax.Combo) {
}
}

// ValidateTaxCombo validates percentage is included as BR-DE-14 indicates
func ValidateTaxCombo(tc *tax.Combo) error {
if tc == nil {
return nil

Check warning on line 42 in addons/de/xrechnung/tax_combo.go

View check run for this annotation

Codecov / codecov/patch

addons/de/xrechnung/tax_combo.go#L42

Added line #L42 was not covered by tests
Expand Down
2 changes: 2 additions & 0 deletions addons/de/xrechnung/xrechnung.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package xrechnung provides extensions and validations for the German XRechnung standard version 3.0.2 for electronic invoicing.
package xrechnung

import (
Expand All @@ -9,6 +10,7 @@ import (
)

const (
// V3 is the key for the XRechnung version 3.x
V3 cbc.Key = "de-xrechnung-v3"
)

Expand Down

0 comments on commit 0aa93e0

Please sign in to comment.