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

adding Oman country IBAN #135

Merged
merged 2 commits into from
Apr 27, 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
3 changes: 3 additions & 0 deletions src/main/java/org/iban4j/bban/BbanStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Optional;

import org.iban4j.CountryCode;

/**
Expand Down Expand Up @@ -537,6 +538,8 @@ private BbanStructure(final BbanStructureEntry... entries) {
BbanStructureEntry.bankCode(4, 'n'),
BbanStructureEntry.branchCode(4, 'n'),
BbanStructureEntry.accountNumber(13, 'c')));

structures.put(CountryCode.OM, new BbanStructure(BbanStructureEntry.bankCode(3, 'n'), BbanStructureEntry.accountNumber(16, 'c')));
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/org/iban4j/IbanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.Random;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -292,10 +294,9 @@ public void ibanConstructionRandom() {

@Test
public void ibanConstructionSeeded() {
assertAll(
() -> assertIbanUtilRandomWithSeedEquals("GL41 1918 0836 9682 13", 1),
() -> assertIbanUtilRandomWithSeedEquals("FR17 0679 7098 8804 5NYW S75F D50", 2),
() -> assertIbanUtilRandomWithSeedEquals("EG45 0882 2804 0304 6660 9507 6091 3", 3)
assertAll(() -> assertIbanUtilRandomWithSeedEquals("TN58 1908 31HJ ENIS JS33 9QZG", 1),
() -> assertIbanUtilRandomWithSeedEquals("LV92 QKBB C1OY WHST MPQA 7", 2),
() -> assertIbanUtilRandomWithSeedEquals("JO53 WQSM 2804 ERG8 WOUQ NLYT EEL7 3J", 3)
);
}

Expand All @@ -313,10 +314,9 @@ private void assertIbanUtilRandomWithSeedEquals(

@Test
public void ibanBuilderConstructionSeeded() {
assertAll(
() -> assertIbanBuilderRandomWithSeedEquals("GL41 1918 0836 9682 13", 1),
() -> assertIbanBuilderRandomWithSeedEquals("FR17 0679 7098 8804 5NYW S75F D50", 2),
() -> assertIbanBuilderRandomWithSeedEquals("EG45 0882 2804 0304 6660 9507 6091 3", 3)
assertAll(() -> assertIbanBuilderRandomWithSeedEquals("TN58 1908 31HJ ENIS JS33 9QZG", 1),
() -> assertIbanBuilderRandomWithSeedEquals("LV92 QKBB C1OY WHST MPQA 7", 2),
() -> assertIbanBuilderRandomWithSeedEquals("JO53 WQSM 2804 ERG8 WOUQ NLYT EEL7 3J", 3)
);
}

Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/iban4j/TestDataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,10 @@ public static Collection<Object[]> getIbanData() {
.countryCode(CountryCode.CV)
.bankCode("0002")
.branchCode("0000")
.accountNumber("0311180710148")
.build(), "CV64000200000311180710148"}
.accountNumber("0311180710148").build(), "CV64000200000311180710148" }, { new Iban.Builder().countryCode(CountryCode.OM)
.bankCode("028")
.accountNumber("12345678901")
.leftPadding(true).build(), "OM040280000012345678901" }
});
}

Expand Down
Loading