Skip to content

Commit

Permalink
BATM-5894 and BATM-5900 bug fixes (#900)
Browse files Browse the repository at this point in the history
BATM-5894 Added support for EUR, GBP and JPY at BitfinexExchange
BATM-5900 Fixed false positives when scanning CA sanction list and matching using aliases
  • Loading branch information
filipocelka authored Feb 23, 2024
1 parent d369cb1 commit fbd7e88
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# buildscript - project id
projectGroup=com.generalbytes.batm.public
projectVersion=1.3.8
projectVersion=1.3.9

# buildscript - common dependency versions
bitrafaelVersion=1.0.44
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public class BitfinexExchange implements IExchangeAdvanced, IRateSourceAdvanced

static {
FIAT_CURRENCIES.add(FiatCurrency.USD.getCode());
FIAT_CURRENCIES.add(FiatCurrency.EUR.getCode());
FIAT_CURRENCIES.add(FiatCurrency.GBP.getCode());
FIAT_CURRENCIES.add(FiatCurrency.JPY.getCode());
FIAT_CURRENCIES.add(CryptoCurrency.USDT.getCode());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Set<Match> search(String firstName, String lastName) {
matchedParties.add(new Match(getPartyId(item), 100));
continue;
}
if (containsSubstring(lastName, item.getAliases())) {
if (aliasContainsLastName(lastName, item.getAliases())) {
matchedParties.add(new Match(getPartyId(item), 50));
}
}
Expand All @@ -56,7 +56,7 @@ public Set<Match> search(String firstName, String lastName) {
}
continue;
}
if (containsSubstring(lastName, item.getAliases())) {
if (aliasContainsLastName(lastName, item.getAliases())) {
candidateRecords.add(item);
}
}
Expand Down Expand Up @@ -111,4 +111,18 @@ private String fixCountryName(String countryRaw) {
private boolean containsSubstring(String substring, String input) {
return input != null && input.toLowerCase().contains(substring.toLowerCase());
}

private boolean aliasContainsLastName(String lastName, String alias) {
if (alias == null) {
return false;
}
String aliasNoSeparators = alias.replaceAll(";", "");
String[] aliasWords = aliasNoSeparators.split(" ");
for (String aliasWord : aliasWords) {
if (aliasWord.equalsIgnoreCase(lastName)) {
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ public void testSearchNotFound() {
assertTrue(result.isEmpty());
}

@Test
public void testSearchAliasNoMatch() {
final Record record = createRecord("Vladimir Rudolfovich", "SOLOVYOV");
record.setAliases("Владимир Рудольфович Соловьёв; Vladimir Solovev; Soloviev");
final ParsedSanctions parsedSanctions = initializeParsedSanctions(record);
Set<Match> result = parsedSanctions.search("Unknown", "Vlad");
assertTrue(result.isEmpty());
}

private void assertMatch(Set<Match> result, int i) {
assertEquals(1, result.size());
final Match foundMatch = result.iterator().next();
Expand Down

0 comments on commit fbd7e88

Please sign in to comment.