From fbd7e885c3f0c5748336762f6f20c98db2d5ef6d Mon Sep 17 00:00:00 2001 From: Filip Ocelka Date: Fri, 23 Feb 2024 16:04:15 +0100 Subject: [PATCH] BATM-5894 and BATM-5900 bug fixes (#900) 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 --- gradle.properties | 2 +- .../exchanges/bitfinex/BitfinexExchange.java | 3 +++ .../extra/watchlists/ca/ParsedSanctions.java | 18 ++++++++++++++++-- .../watchlists/ca/ParsedSanctionsTest.java | 9 +++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index b733dc035..5052d5b00 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/bitfinex/BitfinexExchange.java b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/bitfinex/BitfinexExchange.java index d3575b658..1e2eac54b 100644 --- a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/bitfinex/BitfinexExchange.java +++ b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/bitfinex/BitfinexExchange.java @@ -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()); } diff --git a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctions.java b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctions.java index 45990d53d..5de73fc84 100644 --- a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctions.java +++ b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctions.java @@ -36,7 +36,7 @@ public Set 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)); } } @@ -56,7 +56,7 @@ public Set search(String firstName, String lastName) { } continue; } - if (containsSubstring(lastName, item.getAliases())) { + if (aliasContainsLastName(lastName, item.getAliases())) { candidateRecords.add(item); } } @@ -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; + } } diff --git a/server_extensions_extra/src/test/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctionsTest.java b/server_extensions_extra/src/test/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctionsTest.java index f61dcad5a..27648e3a7 100644 --- a/server_extensions_extra/src/test/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctionsTest.java +++ b/server_extensions_extra/src/test/java/com/generalbytes/batm/server/extensions/extra/watchlists/ca/ParsedSanctionsTest.java @@ -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 result = parsedSanctions.search("Unknown", "Vlad"); + assertTrue(result.isEmpty()); + } + private void assertMatch(Set result, int i) { assertEquals(1, result.size()); final Match foundMatch = result.iterator().next();