From e7888624ba3e542bf6cbe22046cceb49e572cba4 Mon Sep 17 00:00:00 2001 From: hajk1 Date: Sat, 31 Aug 2024 19:59:40 +0330 Subject: [PATCH 1/4] ading some changes --- pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pom.xml b/pom.xml index 63a2554..524148b 100644 --- a/pom.xml +++ b/pom.xml @@ -281,6 +281,18 @@ + + maven-jar-plugin + + + + org.iban4j + + + + org.apache.maven.plugins + + From f9ecfbdb4aaad742a2ee72790fc55553ca5e75ef Mon Sep 17 00:00:00 2001 From: hajk1 Date: Mon, 2 Sep 2024 12:33:01 +0330 Subject: [PATCH 2/4] adding module-info.java and pom changes --- pom.xml | 103 +++++++++++++++++---------------- src/main/java/module-info.java | 4 ++ 2 files changed, 57 insertions(+), 50 deletions(-) create mode 100644 src/main/java/module-info.java diff --git a/pom.xml b/pom.xml index 524148b..6442190 100644 --- a/pom.xml +++ b/pom.xml @@ -54,55 +54,6 @@ - - UTF-8 - 1.8 - 1.8 - 8 - java17 - true - 5.9.2 - - - - - org.junit.jupiter - junit-jupiter-engine - ${junit-jupiter.version} - test - - - junit-jupiter-params - org.junit.jupiter - test - ${junit-jupiter.version} - - - com.carrotsearch - junit-benchmarks - 0.7.2 - test - - - - org.hamcrest - hamcrest - 2.2 - test - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - @@ -116,6 +67,8 @@ -parameters + ${maven.compiler.source} + ${maven.compiler.target}} @@ -282,7 +235,9 @@ + org.apache.maven.plugins maven-jar-plugin + 3.4.2 @@ -290,12 +245,60 @@ - org.apache.maven.plugins + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + test + + + junit-jupiter-params + org.junit.jupiter + test + ${junit-jupiter.version} + + + com.carrotsearch + junit-benchmarks + 0.7.2 + test + + + + org.hamcrest + hamcrest + 2.2 + test + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + UTF-8 + 11 + 11 + 11 + java17 + true + 5.9.2 + + diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..5bf33bb --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module org.iban4j { + exports org.iban4j; + opens org.iban4j; +} From 3e347fe3de1c3e1026017296e222a4b821c88c70 Mon Sep 17 00:00:00 2001 From: hajk1 Date: Mon, 2 Sep 2024 12:34:51 +0330 Subject: [PATCH 3/4] adding module-info.java and pom changes --- src/main/java/module-info.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 5bf33bb..f074267 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,5 @@ module org.iban4j { - exports org.iban4j; - opens org.iban4j; + exports org.iban4j; + + opens org.iban4j; } From f849cc2bb085b16ec878f11cda2e79d43d208612 Mon Sep 17 00:00:00 2001 From: hajk1 Date: Fri, 18 Oct 2024 23:33:37 +0330 Subject: [PATCH 4/4] Apply Seychelles IBAN changes --- src/main/java/org/iban4j/Iban.java | 20 +++++++++++++++++++ src/main/java/org/iban4j/IbanUtil.java | 13 +++++++++++- .../java/org/iban4j/bban/BbanEntryType.java | 1 + .../java/org/iban4j/bban/BbanStructure.java | 3 ++- .../org/iban4j/bban/BbanStructureEntry.java | 7 +++++++ src/test/java/org/iban4j/TestDataHelper.java | 15 +++++++------- 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/iban4j/Iban.java b/src/main/java/org/iban4j/Iban.java index 2998b21..231adcf 100644 --- a/src/main/java/org/iban4j/Iban.java +++ b/src/main/java/org/iban4j/Iban.java @@ -225,6 +225,7 @@ public final static class Builder { private CountryCode countryCode; private String bankCode; + private String bankCodeExt; private String branchCode; private String nationalCheckDigit; private String accountType; @@ -272,6 +273,17 @@ public Builder bankCode(final String bankCode) { return this; } + /** + * Sets iban's bank code extension. + * + * @param bankCodeExt String + * @return builder Builder + */ + public Builder bankCodeExt(final String bankCodeExt) { + this.bankCodeExt = bankCodeExt; + return this; + } + /** * Sets iban's branch code. * @@ -444,6 +456,9 @@ private String formatBban() { case bank_code: sb.append(getPaddedString(bankCode, entry.getLength())); break; + case bank_code_ext: + sb.append(getPaddedString(bankCodeExt, entry.getLength())); + break; case branch_code: sb.append(getPaddedString(branchCode, entry.getLength())); break; @@ -532,6 +547,11 @@ private void fillMissingFieldsRandomly(final Random random) { bankCode = entry.getRandom(random); } break; + case bank_code_ext: + if (bankCodeExt == null) { + bankCodeExt = entry.getRandom(random); + } + break; case branch_code: if (branchCode == null) { branchCode = entry.getRandom(random); diff --git a/src/main/java/org/iban4j/IbanUtil.java b/src/main/java/org/iban4j/IbanUtil.java index c812e92..5523e0b 100644 --- a/src/main/java/org/iban4j/IbanUtil.java +++ b/src/main/java/org/iban4j/IbanUtil.java @@ -15,11 +15,12 @@ */ package org.iban4j; +import static org.iban4j.IbanFormatException.IbanFormatViolation.*; + import org.iban4j.bban.BbanEntryType; import org.iban4j.bban.BbanStructure; import org.iban4j.bban.BbanStructureEntry; -import static org.iban4j.IbanFormatException.IbanFormatViolation.*; /** * Iban Utility Class */ @@ -229,6 +230,16 @@ public static String getBankCode(final String iban) { return extractBbanEntry(iban, BbanEntryType.bank_code); } + /** + * Returns iban's bank code extension. + * + * @param iban String + * @return bankCodeExt String + */ + public static String getBankCodeExt(final String iban) { + return extractBbanEntry(iban, BbanEntryType.bank_code_ext); + } + /** * Returns iban's branch code. * diff --git a/src/main/java/org/iban4j/bban/BbanEntryType.java b/src/main/java/org/iban4j/bban/BbanEntryType.java index c3d07d0..5c35715 100644 --- a/src/main/java/org/iban4j/bban/BbanEntryType.java +++ b/src/main/java/org/iban4j/bban/BbanEntryType.java @@ -20,6 +20,7 @@ */ public enum BbanEntryType { bank_code, + bank_code_ext, branch_code, account_number, national_check_digit, diff --git a/src/main/java/org/iban4j/bban/BbanStructure.java b/src/main/java/org/iban4j/bban/BbanStructure.java index 382f0ab..abe39fa 100644 --- a/src/main/java/org/iban4j/bban/BbanStructure.java +++ b/src/main/java/org/iban4j/bban/BbanStructure.java @@ -447,7 +447,8 @@ public class BbanStructure { CountryCode.SC, new BbanStructure( BbanStructureEntry.bankCode(4, 'a'), - BbanStructureEntry.branchCode(4, 'n'), + BbanStructureEntry.bankCodeExt(2, 'n'), + BbanStructureEntry.branchCode(2, 'n'), BbanStructureEntry.accountNumber(16, 'n'), BbanStructureEntry.accountType(3, 'a'))); diff --git a/src/main/java/org/iban4j/bban/BbanStructureEntry.java b/src/main/java/org/iban4j/bban/BbanStructureEntry.java index f06cd50..dc36eed 100644 --- a/src/main/java/org/iban4j/bban/BbanStructureEntry.java +++ b/src/main/java/org/iban4j/bban/BbanStructureEntry.java @@ -60,6 +60,13 @@ public static BbanStructureEntry bankCode(final int length, final char character EntryCharacterType.valueOf(String.valueOf(characterType)), length); } + public static BbanStructureEntry bankCodeExt(final int length, final char characterType) { + return new BbanStructureEntry( + BbanEntryType.bank_code_ext, + EntryCharacterType.valueOf(String.valueOf(characterType)), + length); + } + public static BbanStructureEntry branchCode(final int length, final char characterType) { return new BbanStructureEntry(BbanEntryType.branch_code, EntryCharacterType.valueOf(String.valueOf(characterType)), length); diff --git a/src/test/java/org/iban4j/TestDataHelper.java b/src/test/java/org/iban4j/TestDataHelper.java index e3de7b5..7358c2d 100644 --- a/src/test/java/org/iban4j/TestDataHelper.java +++ b/src/test/java/org/iban4j/TestDataHelper.java @@ -522,12 +522,12 @@ public static Collection getIbanData() { }, { new Iban.Builder() - .countryCode(CountryCode.MZ) - .bankCode("0003") - .branchCode("0108") - .accountNumber("00163671023") - .nationalCheckDigit("71") - .build(), + .countryCode(CountryCode.MZ) + .bankCode("0003") + .branchCode("0108") + .accountNumber("00163671023") + .nationalCheckDigit("71") + .build(), "MZ59000301080016367102371" }, { @@ -633,7 +633,8 @@ public static Collection getIbanData() { new Iban.Builder() .countryCode(CountryCode.SC) .bankCode("SSCB") - .branchCode("1101") + .bankCodeExt("11") + .branchCode("01") .accountNumber("0000000000001497") .accountType("USD") .build(),