From 60fd7280d0767b7d4b35c347b605062c7529392b Mon Sep 17 00:00:00 2001 From: Marius Cornescu Date: Tue, 23 Jul 2024 12:05:19 +0200 Subject: [PATCH] #145 - Add support for MA (Morocco) and reorder (countries starting with M* subsection) list in alphabetical order. (#146) * #145 - Add support for MA and reorder list in alphabetical order. #145 - Add support for MA and reorder list in alphabetical order. * Add test data --- .../java/org/iban4j/bban/BbanStructure.java | 63 ++++++++++--------- src/test/java/org/iban4j/TestDataHelper.java | 9 +++ 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/iban4j/bban/BbanStructure.java b/src/main/java/org/iban4j/bban/BbanStructure.java index ca3d91f..d074ef2 100644 --- a/src/main/java/org/iban4j/bban/BbanStructure.java +++ b/src/main/java/org/iban4j/bban/BbanStructure.java @@ -333,6 +333,33 @@ public class BbanStructure { new BbanStructure( BbanStructureEntry.bankCode(3, 'n'), BbanStructureEntry.accountNumber(13, 'c'))); + structures.put( + CountryCode.MA, + new BbanStructure( + BbanStructureEntry.bankCode(3, 'n'), + BbanStructureEntry.branchCode(5, 'n'), + BbanStructureEntry.accountNumber(16, 'n'))); + + structures.put( + CountryCode.MC, + new BbanStructure( + BbanStructureEntry.bankCode(5, 'n'), + BbanStructureEntry.branchCode(5, 'n'), + BbanStructureEntry.accountNumber(11, 'c'), + BbanStructureEntry.nationalCheckDigit(2, 'n'))); + + structures.put( + CountryCode.MD, + new BbanStructure( + BbanStructureEntry.bankCode(2, 'c'), BbanStructureEntry.accountNumber(18, 'c'))); + + structures.put( + CountryCode.ME, + new BbanStructure( + BbanStructureEntry.bankCode(3, 'n'), + BbanStructureEntry.accountNumber(13, 'n'), + BbanStructureEntry.nationalCheckDigit(2, 'n'))); + structures.put( CountryCode.MK, new BbanStructure( @@ -340,6 +367,14 @@ public class BbanStructure { BbanStructureEntry.accountNumber(10, 'c'), BbanStructureEntry.nationalCheckDigit(2, 'n'))); + structures.put( + CountryCode.MR, + new BbanStructure( + BbanStructureEntry.bankCode(5, 'n'), + BbanStructureEntry.branchCode(5, 'n'), + BbanStructureEntry.accountNumber(11, 'n'), + BbanStructureEntry.nationalCheckDigit(2, 'n'))); + structures.put( CountryCode.MT, new BbanStructure( @@ -347,14 +382,6 @@ public class BbanStructure { BbanStructureEntry.branchCode(5, 'n'), BbanStructureEntry.accountNumber(18, 'c'))); - structures.put( - CountryCode.MR, - new BbanStructure( - BbanStructureEntry.bankCode(5, 'n'), - BbanStructureEntry.branchCode(5, 'n'), - BbanStructureEntry.accountNumber(11, 'n'), - BbanStructureEntry.nationalCheckDigit(2, 'n'))); - structures.put( CountryCode.MU, new BbanStructure( @@ -362,26 +389,6 @@ public class BbanStructure { BbanStructureEntry.branchCode(2, 'n'), BbanStructureEntry.accountNumber(18, 'c'))); - structures.put( - CountryCode.MD, - new BbanStructure( - BbanStructureEntry.bankCode(2, 'c'), BbanStructureEntry.accountNumber(18, 'c'))); - - structures.put( - CountryCode.MC, - new BbanStructure( - BbanStructureEntry.bankCode(5, 'n'), - BbanStructureEntry.branchCode(5, 'n'), - BbanStructureEntry.accountNumber(11, 'c'), - BbanStructureEntry.nationalCheckDigit(2, 'n'))); - - structures.put( - CountryCode.ME, - new BbanStructure( - BbanStructureEntry.bankCode(3, 'n'), - BbanStructureEntry.accountNumber(13, 'n'), - BbanStructureEntry.nationalCheckDigit(2, 'n'))); - structures.put( CountryCode.NL, new BbanStructure( diff --git a/src/test/java/org/iban4j/TestDataHelper.java b/src/test/java/org/iban4j/TestDataHelper.java index 6892e5c..2703407 100644 --- a/src/test/java/org/iban4j/TestDataHelper.java +++ b/src/test/java/org/iban4j/TestDataHelper.java @@ -417,6 +417,15 @@ public static Collection getIbanData() { .build(), "LU280019400644750000" }, + { + new Iban.Builder() + .countryCode(CountryCode.MA) + .bankCode("011") + .branchCode("51900") + .accountNumber("0001205000534921") + .build(), + "MA64011519000001205000534921" + }, { new Iban.Builder() .countryCode(CountryCode.MF)