Skip to content

Commit

Permalink
feat: release 98 (#60)
Browse files Browse the repository at this point in the history
* feat: release 98

- PT updated (no change)
- YE added
  • Loading branch information
jacoelho authored Jul 25, 2024
1 parent 2e57725 commit 2dabe29
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 8 deletions.
9 changes: 9 additions & 0 deletions docs/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -879,3 +879,12 @@ countries:
national_checksum: 21:23
account_number: 10:21
sepa: false

- code: YE
name: Yemen
IBAN: YE2!n4!a4!n18!c
BBAN: 4!a4!n18!c
bank_code: 0:4
branch_code: 4:8
account_number: 8:26
sepa: false
2 changes: 2 additions & 0 deletions iban/bban_helper.go

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

11 changes: 11 additions & 0 deletions iban/bban_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,17 @@ func TestBBAN(t *testing.T) {
AccountNumber: "0000001299123456",
},
},
{
iban: "YE15CBYE0001018861234567891234",
wantErr: false,
bban: iban.BBAN{
BBAN: "CBYE0001018861234567891234",
BankCode: "CBYE",
BranchCode: "0001",
NationalChecksum: "",
AccountNumber: "018861234567891234",
},
},
}
for _, tt := range tests {
t.Run(tt.iban,
Expand Down
2 changes: 2 additions & 0 deletions iban/country_constants.go

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

71 changes: 71 additions & 0 deletions iban/country_yemen.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/generate.go

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

18 changes: 10 additions & 8 deletions iban/iban.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package iban

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

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

Expand All @@ -21,17 +23,17 @@ func chunkString(s string, chunkSize int, sep rune) string {
runes := []byte(s)

for i := 0; i < len(runes); i += chunkSize {
nn := i + chunkSize
if nn > len(runes) {
nn = len(runes)
}

if i > 0 {
_, _ = sb.WriteRune(sep)
sb.WriteRune(sep)
}

_, _ = sb.Write(runes[i:nn])
end := i + chunkSize
if end > len(runes) {
end = len(runes)
}

sb.Write(runes[i:end])
}

return sb.String()
}
3 changes: 3 additions & 0 deletions iban/sepa.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/validate.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/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ func TestValidateIBAN(t *testing.T) {
iban: "OM810180000001299123456",
wantErr: false,
},
{
iban: "YE15CBYE0001018861234567891234",
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
Expand Down

0 comments on commit 2dabe29

Please sign in to comment.