Skip to content

Commit

Permalink
version 94 (#51)
Browse files Browse the repository at this point in the history
MN and NI added.

Closes #50
  • Loading branch information
jacoelho authored Apr 16, 2023
1 parent 8517a59 commit e8b1f1b
Show file tree
Hide file tree
Showing 15 changed files with 207 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ default: build
build: test
go install -v ./...

.PHONY: generate
generate:
$(GOBIN)/banking-registry:
cd registry; go install ./cmd/banking-registry

generate: $(GOBIN)/banking-registry
go generate -v ./...

.PHONY: test
Expand Down
16 changes: 16 additions & 0 deletions docs/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ countries:
account_number: 3:13
sepa: false

- code: MN
name: Mongolia
IBAN: MN2!n4!n12!n
BBAN: 4!n12!n
bank_code: 0:4
account_number: 4:16
sepa: false

- code: MR
name: Mauritania
IBAN: MR2!n5!n5!n11!n2!n
Expand Down Expand Up @@ -488,6 +496,14 @@ countries:
account_number: 8:26
sepa: false

- code: NI
name: Nicaragua
IBAN: NI2!n4!a20!n
BBAN: 4!a20!n
bank_code: 0:4
account_number: 4:24
sepa: false

- code: NL
name: The Netherlands
IBAN: NL2!n4!a10!n
Expand Down
4 changes: 4 additions & 0 deletions iban/bban_helper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions iban/bban_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,28 @@ func TestBBAN(t *testing.T) {
AccountNumber: "001000100141",
},
},
{
iban: "MN121234123456789123",
wantErr: false,
bban: iban.BBAN{
BBAN: "1234123456789123",
BankCode: "1234",
BranchCode: "",
NationalChecksum: "",
AccountNumber: "123456789123",
},
},
{
iban: "NI45BAPR00000013000003558124",
wantErr: false,
bban: iban.BBAN{
BBAN: "BAPR00000013000003558124",
BankCode: "BAPR",
BranchCode: "",
NationalChecksum: "",
AccountNumber: "00000013000003558124",
},
},
}
for _, tt := range tests {
t.Run(tt.iban,
Expand Down
1 change: 1 addition & 0 deletions iban/checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func TestChecksum(t *testing.T) {
{iban: "IQ98NBIQ850123456789012", want: "98"},
{iban: "BR9700360305000010009795493P1", want: "97"},
{iban: "DK0206715394960066", want: "02"},
{iban: "NI45BAPR00000013000003558124", want: "45"},
}
for _, tt := range tests {
tt := tt
Expand Down
4 changes: 4 additions & 0 deletions iban/country_constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions iban/country_mongolia.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions iban/country_nicaragua.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions iban/generate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions iban/iban.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package iban

import "github.com/jacoelho/banking/pool"

//go:generate banking-registry -registry-file ../docs/registry.yml -dst-directory .

// PaperFormat returns iban in paper format
// Follows EBS 204 - 5 IBAN Format 2) Paper Format
func PaperFormat(iban string) string {
Expand Down
6 changes: 6 additions & 0 deletions iban/sepa.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions iban/sepa_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build validation

package iban

import (
Expand Down Expand Up @@ -242,6 +240,16 @@ func TestIsSEPACountry(t *testing.T) {
want: false,
wantErr: false,
},
{
countryCode: "MN",
want: false,
wantErr: false,
},
{
countryCode: "NI",
want: false,
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
Expand Down
4 changes: 4 additions & 0 deletions iban/validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions iban/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,14 @@ func TestValidateIBAN(t *testing.T) {
iban: "SO211000001001000100141",
wantErr: false,
},
{
iban: "MN121234123456789123",
wantErr: false,
},
{
iban: "NI45BAPR00000013000003558124",
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
Expand Down
File renamed without changes.

0 comments on commit e8b1f1b

Please sign in to comment.