Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MZ (Mozambique) IBAN validation #144

Merged
merged 4 commits into from
Jul 30, 2024
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
8 changes: 7 additions & 1 deletion src/main/java/org/iban4j/bban/BbanStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,13 @@ public class BbanStructure {
BbanStructureEntry.bankCode(6, 'c'),
BbanStructureEntry.branchCode(2, 'n'),
BbanStructureEntry.accountNumber(18, 'c')));

structures.put(
CountryCode.MZ,
new BbanStructure(
BbanStructureEntry.bankCode(4, 'n'),
BbanStructureEntry.branchCode(4, 'n'),
BbanStructureEntry.accountNumber(11, 'n'),
BbanStructureEntry.nationalCheckDigit(2, 'n')));
structures.put(
CountryCode.NL,
new BbanStructure(
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/iban4j/IbanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ public void ibanConstructionRandom() {
@Test
public void ibanConstructionSeeded() {
assertAll(
() -> assertIbanUtilRandomWithSeedEquals("GI33 XNNK KKDA PM6A HNQF XLK", 1),
() -> assertIbanUtilRandomWithSeedEquals("CZ17 0679 0988 8783 6940 3497", 2),
() -> assertIbanUtilRandomWithSeedEquals("NC29 0882 8280 41ER G8WO UQNL Y52", 3));
() -> assertIbanUtilRandomWithSeedEquals("BY38 LPL2 0836 1HJE NISJ S339 QZGT", 1),
() -> assertIbanUtilRandomWithSeedEquals("IE70 QKBB 0988 8722 1186 81", 2),
() -> assertIbanUtilRandomWithSeedEquals("MC38 0882 8280 41ER G8WO UQNL Y52", 3));
}

private void assertIbanUtilRandomWithSeedEquals(
Expand All @@ -321,9 +321,9 @@ private void assertIbanUtilRandomWithSeedEquals(
@Test
public void ibanBuilderConstructionSeeded() {
assertAll(
() -> assertIbanBuilderRandomWithSeedEquals("GI33 XNNK KKDA PM6A HNQF XLK", 1),
() -> assertIbanBuilderRandomWithSeedEquals("CZ17 0679 0988 8783 6940 3497", 2),
() -> assertIbanBuilderRandomWithSeedEquals("NC29 0882 8280 41ER G8WO UQNL Y52", 3));
() -> assertIbanBuilderRandomWithSeedEquals("BY38 LPL2 0836 1HJE NISJ S339 QZGT", 1),
() -> assertIbanBuilderRandomWithSeedEquals("IE70 QKBB 0988 8722 1186 81", 2),
() -> assertIbanBuilderRandomWithSeedEquals("MC38 0882 8280 41ER G8WO UQNL Y52", 3));
}

@Test
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/iban4j/TestDataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,16 @@ public static Collection<Object[]> getIbanData() {
.build(),
"NC551234512345123456789AB13"
},
{
new Iban.Builder()
.countryCode(CountryCode.MZ)
.bankCode("0003")
.branchCode("0108")
.accountNumber("00163671023")
.nationalCheckDigit("71")
.build(),
"MZ59000301080016367102371"
},
{
new Iban.Builder()
.countryCode(CountryCode.NL)
Expand Down
Loading