Skip to content
Merged
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
10 changes: 4 additions & 6 deletions addon/bill_invoices.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package finvoice

import (
"strings"

"github.com/invopop/gobl/bill"
"github.com/invopop/gobl/cbc"
"github.com/invopop/gobl/pay"
Expand Down Expand Up @@ -76,14 +74,14 @@ func firstCreditTransferHasIBAN(val any) bool {
return cts[0] != nil && cts[0].IBAN != ""
}

// normalizePayInstructions strips the grouping spaces conventionally used
// when displaying Finnish reference numbers and RF references.
// normalizePayInstructions drops the grouping spaces conventionally used when
// displaying Finnish reference numbers and RF references.
func normalizePayInstructions(instr *pay.Instructions) {
instr.Ref = cbc.Code(strings.ReplaceAll(instr.Ref.String(), " ", ""))
instr.Ref = cbc.NormalizeAlphanumericalCode(instr.Ref)
}

// normalizePayCreditTransfer converts the IBAN to its machine form: no
// grouping spaces, upper case.
func normalizePayCreditTransfer(ct *pay.CreditTransfer) {
ct.IBAN = strings.ToUpper(strings.ReplaceAll(ct.IBAN, " ", ""))
ct.IBAN = cbc.NormalizeAlphanumericalCode(ct.IBAN)
}
2 changes: 1 addition & 1 deletion addon/bill_invoices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func TestNormalization(t *testing.T) {
inv := testInvoiceStandard(t)
inv.Payment.Instructions.CreditTransfer[0].IBAN = "fi21 1234 5600 0007 85"
require.NoError(t, inv.Calculate())
assert.Equal(t, "FI2112345600000785", inv.Payment.Instructions.CreditTransfer[0].IBAN)
assert.Equal(t, "FI2112345600000785", inv.Payment.Instructions.CreditTransfer[0].IBAN.String())
assert.NoError(t, rules.Validate(inv))
})

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/invopop/gobl.fi.finvoice
go 1.25.0

require (
github.com/invopop/gobl v0.503.1-0.20260803162610-15cd103fc60a
github.com/invopop/gobl v0.504.0
github.com/stretchr/testify v1.11.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
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/invopop/gobl v0.503.1-0.20260803162610-15cd103fc60a h1:cs0QnFnU+JTB5FFLhGJlsELFbyPRsbRnwOkA/PcuxL4=
github.com/invopop/gobl v0.503.1-0.20260803162610-15cd103fc60a/go.mod h1:HmiEdQreTSQYyNbhs81VKTmI7BAJKYC/6enh9RDwnE0=
github.com/invopop/gobl v0.504.0 h1:RLmZmeAk9RL4rkMUc7xQfC70/RGiBeekRwVgMsMthQA=
github.com/invopop/gobl v0.504.0/go.mod h1:HmiEdQreTSQYyNbhs81VKTmI7BAJKYC/6enh9RDwnE0=
github.com/invopop/jsonschema v0.14.0 h1:MHQqLhvpNUZfw+hM3AZDYK7jxO8FZoQeQM77g8iyZjg=
github.com/invopop/jsonschema v0.14.0/go.mod h1:ygm6C2EaVNMBDPpaPlnOA2pFAxBnxGjFlMZABxm9n2I=
github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso=
Expand Down
Loading