Skip to content

Commit

Permalink
Add MZ (Mozambique) IBAN validation (#144)
Browse files Browse the repository at this point in the history
* feat: Add MZ Bban Structure

* test: Add MZ Bban Structure test sample

* test: change IBANs used for random with seed tests
  • Loading branch information
Jeronimo-MZ authored Jul 30, 2024
1 parent fce3f8c commit 1b9e727
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
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

0 comments on commit 1b9e727

Please sign in to comment.