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

Resolve conflict #123

Merged
merged 60 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
9af0b12
enable Java 8
Oct 13, 2020
e7bd72e
checks for national check digit be present in BBAN
Oct 13, 2020
db2ccce
enable skipTests
Oct 13, 2020
70eee95
dependency update
Oct 13, 2020
f4ef42c
Merge pull request #1 from hajk1/natioalCheckDigit
hajk1 Oct 21, 2020
991b98a
Bump junit from 4.11 to 4.13.1
dependabot[bot] Oct 13, 2020
f725794
#67: fix VG struncture
ccostin93 Nov 27, 2020
0d0ec50
java 6 replaced with java 7
Nov 6, 2020
f3c1d46
Belarus BBAN bug fixed
Nov 6, 2020
d3927b8
update oss plugin
Nov 6, 2020
4ad09c5
release 3.2.2-RELEASE
Nov 27, 2020
361b50b
Add French subterritories support
kaldebert May 3, 2021
13771f1
release 3.2.3-RELEASE
hajk1 May 21, 2021
87cb5ea
add 3.2.3-RELEASE to the README.md
hajk1 May 21, 2021
d3cca38
#67: add VA iban structure
ccostin93 Nov 28, 2020
10fccd1
upgrade jacoco maven plugin inorder to support Java versions higher t…
hajk1 Mar 25, 2022
d5eb162
update Maven config
aSemy Aug 19, 2022
6c32c50
adding Iraq IBAN support
Nov 5, 2022
edd1c07
new release updated
Nov 5, 2022
06df7ab
added Egypt IBAN structure
bogacaslan Mar 1, 2023
a744cb7
Adding Gabon BbanStructure
dvg2207x Dec 2, 2022
f139083
Release 3.2.5
hajk1 Apr 23, 2023
e30eb47
Fix typo in Guernsey
becky-sequence Apr 19, 2023
3c37aa6
adding GB and FI sub-territories support (#100)
remy-duval May 23, 2023
b5606af
Refactor tests (#108)
hajk1 Jun 21, 2023
4fd80b3
Create CODE_OF_CONDUCT.md
hajk1 Jun 22, 2023
82f370b
GitHub action (#109)
hajk1 Jun 22, 2023
1816730
GitHub action (#110)
hajk1 Jun 22, 2023
4f69ff1
GitHub action (#111)
hajk1 Jun 23, 2023
057d833
Issue 33 (#112)
hajk1 Jul 11, 2023
89c4ed8
fixed formatting
hajk1 Jul 21, 2023
5bbeca5
fixed formatting
hajk1 Jul 21, 2023
6890e73
Issue 101 (#113)
hajk1 Aug 25, 2023
9eae291
making static utility methods public (#118)
hajk1 Sep 24, 2023
027039e
Add GitHub action for verifying tests (#94)
aSemy Sep 29, 2023
b60dce4
Delete .github/workflows/build-github-actions.yml
hajk1 Sep 29, 2023
2761e7e
exception changed to iban4jException (#119)
hajk1 Sep 29, 2023
092d91d
bank code validation changed to accept alphanumeric values
hajk1 Sep 29, 2023
3f4f709
3.2.7 released
hajk1 Sep 29, 2023
50c9db3
readme
hajk1 Sep 29, 2023
8b4331f
changing the urls to make renovatebot happy (#121)
hajk1 Oct 2, 2023
bd1bd80
Adding Cap Verde structure (#102)
hoorom Oct 2, 2023
a90c8fb
Allow setting a custom Random (#93)
aSemy Oct 2, 2023
d816170
checks for national check digit be present in BBAN
Oct 13, 2020
fcf6a7f
enable skipTests
Oct 13, 2020
ca03436
Merge remote-tracking branch 'origin/master'
hajk1 Oct 2, 2023
27cc008
Adding Gabon BbanStructure
dvg2207x Dec 2, 2022
b10aa54
GitHub action (#109)
hajk1 Jun 22, 2023
7ad434a
Delete .github/workflows/build-github-actions.yml
hajk1 Sep 29, 2023
e3abe32
Merge remote-tracking branch 'origin/fetch-remote-sync' into fetch-re…
hajk1 Oct 2, 2023
f746501
Adding Gabon BbanStructure
dvg2207x Dec 2, 2022
4f36d96
GitHub action (#109)
hajk1 Jun 22, 2023
92a0366
Delete .github/workflows/build-github-actions.yml
hajk1 Sep 29, 2023
902f327
making java 8 release compatible
hajk1 Oct 2, 2023
76051d5
Merge remote-tracking branch 'origin/fetch-remote-sync' into fetch-re…
hajk1 Oct 2, 2023
0a1d2e4
Merge pull request #2 from hajk1/fetch-remote-sync
hajk1 Oct 2, 2023
ad47040
Adding Gabon BbanStructure
dvg2207x Dec 2, 2022
d96079c
GitHub action (#109)
hajk1 Jun 22, 2023
a94cb40
Delete .github/workflows/build-github-actions.yml
hajk1 Sep 29, 2023
50db843
Merge branch 'master' into resolve-conflict
hajk1 Oct 2, 2023
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
27 changes: 2 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.release>8</maven.compiler.release>
<jdk7Signature>java17</jdk7Signature>
<skipSigning>true</skipSigning>
<junit-jupiter.version>5.9.2</junit-jupiter.version>
Expand Down Expand Up @@ -125,7 +126,7 @@
<!-- Sets the VM argument line used when unit tests are run. -->
<argLine>${surefireArgLine}</argLine>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
<skipTests>${skipTests}</skipTests>
<!-- Excludes integration tests when unit tests are run. -->
<excludes>
<exclude>**/IT*.java</exclude>
Expand Down Expand Up @@ -265,30 +266,6 @@
<version>2.5.3</version>
</plugin>

<!-- Checking a project against API signatures -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.22</version>
<executions>
<execution>
<id>check-java-api</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature
</groupId>
<artifactId>${jdk7Signature}</artifactId>
<version>1.0</version>
</signature>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/org/iban4j/Iban.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public Iban build(boolean validate) throws IbanFormatException,
IllegalArgumentException, UnsupportedCountryException {

// null checks
require(countryCode, bankCode, accountNumber);
require(countryCode, bankCode, accountNumber, nationalCheckDigit);

// iban is formatted with default check digit.
final String formattedIban = formatIban();
Expand Down Expand Up @@ -486,7 +486,8 @@ private String formatIban() {

private void require(final CountryCode countryCode,
final String bankCode,
final String accountNumber)
final String accountNumber,
final String nationalCheckDigit)
throws IbanFormatException {
if(countryCode == null) {
throw new IbanFormatException(COUNTRY_CODE_NOT_NULL,
Expand All @@ -502,6 +503,12 @@ private void require(final CountryCode countryCode,
throw new IbanFormatException(ACCOUNT_NUMBER_NOT_NULL,
"accountNumber is required; it cannot be null");
}
if (BbanStructure.hasNationalCheckDigit(countryCode)) {
if (nationalCheckDigit == null) {
throw new IbanFormatException(NATIONAL_CHECK_DIGIT_NOT_NULL,
"nationalCheckDigit is required; it cannot be null");
}
}
}

private void fillMissingFieldsRandomly() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/iban4j/IbanFormatException.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ public static enum IbanFormatViolation {
BBAN_ONLY_DIGITS_OR_LETTERS,

BANK_CODE_NOT_NULL,
ACCOUNT_NUMBER_NOT_NULL
ACCOUNT_NUMBER_NOT_NULL,
NATIONAL_CHECK_DIGIT_NOT_NULL

}
}
20 changes: 20 additions & 0 deletions src/main/java/org/iban4j/bban/BbanStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ private BbanStructure(final BbanStructureEntry... entries) {
structures.put(CountryCode.PM, BbanStructure.FRENCH_STRUCTURE);
structures.put(CountryCode.WF, BbanStructure.FRENCH_STRUCTURE);

structures.put(CountryCode.GA,
new BbanStructure(
BbanStructureEntry.bankCode(5, 'n'),
BbanStructureEntry.branchCode(5, 'n'),
BbanStructureEntry.accountNumber(13, 'c')));

structures.put(CountryCode.GA,
new BbanStructure(
BbanStructureEntry.bankCode(5, 'n'),
Expand Down Expand Up @@ -534,6 +540,20 @@ public static BbanStructure forCountry(final CountryCode countryCode) {
return structures.get(countryCode);
}

/**
* Checks whether national Check digit is mandatory for specific country
*
* @param countryCode the country code
* @return true/false
*/
public static boolean hasNationalCheckDigit(final CountryCode countryCode) {
Optional<BbanStructure> bbanStructure = Optional.ofNullable(forCountry(countryCode));
return bbanStructure.map(structure -> structure.getEntries()
.stream()
.anyMatch(e -> BbanEntryType.national_check_digit.equals(e.getEntryType())))
.orElse(false);
}

public List<BbanStructureEntry> getEntries() {
return Collections.unmodifiableList(Arrays.asList(entries));
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/iban4j/BicUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.iban4j.TestDataHelper.defaultExceptionMessage;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

Expand All @@ -29,7 +30,6 @@ public class BicUtilTest {

public static class InvalidBicValidationTest {

String defaultExceptionMessage ="Expected doThing() to throw, but it didn't";

@Test
public void bicValidationWithNullShouldThrowException() {
Expand Down
17 changes: 14 additions & 3 deletions src/test/java/org/iban4j/IbanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package org.iban4j;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.Random;

import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
import static org.iban4j.TestDataHelper.defaultExceptionMessage;
import static org.junit.jupiter.api.Assertions.*;

@DisplayName("Iban general test")
Expand Down Expand Up @@ -286,7 +286,6 @@ public void ibanConstructionRandom() {
}

@Test
@Disabled
public void ibanConstructionSeeded() {
assertIbanUtilRandomWithSeedEquals("FR87 8734 4468 89P1 RIYK UO5K 809", 1);
assertIbanUtilRandomWithSeedEquals("FI79 2079 0697 8464 44", 2);
Expand All @@ -306,7 +305,6 @@ private static void assertIbanUtilRandomWithSeedEquals(
}

@Test
@Disabled
public void ibanBuilderConstructionSeeded() {
assertIbanBuilderRandomWithSeedEquals("FR87 8734 4468 89P1 RIYK UO5K 809", 1);
assertIbanBuilderRandomWithSeedEquals("FI79 2079 0697 8464 44", 2);
Expand Down Expand Up @@ -416,5 +414,18 @@ public void ibanConstructionRandomDoesNotOverwriteIdentificationNumber() {
.buildRandom();
assertThat(iban.getIdentificationNumber(), is(equalTo("1234567890")));
}

@Test
public void ibanConstructionWithLackingNationalCheckDigitShouldThrowExceptionIfValidationRequested() {
IbanFormatException thrown = assertThrows(
IbanFormatException.class,
() -> new Iban.Builder()
.countryCode(CountryCode.NO)
.bankCode("4435")
.accountNumber("0343730")
.build(true),
defaultExceptionMessage);
assertThat(thrown.getMessage(), containsString("nationalCheckDigit is required; it cannot be null"));
}
}
}
1 change: 1 addition & 0 deletions src/test/java/org/iban4j/TestDataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Collection;

final class TestDataHelper {
public static final String defaultExceptionMessage ="Expected doThing() to throw, but it didn't";

private TestDataHelper() {
}
Expand Down
Loading