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

[1.5.2] Remove NGN (Nigerian Naira) as their central bank blocked Transferwise #4976

Merged
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
1 change: 0 additions & 1 deletion core/src/main/java/bisq/core/locale/CurrencyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ public static List<TradeCurrency> getAllTransferwiseCurrencies() {
new FiatCurrency("MAD"),
new FiatCurrency("NPR"),
new FiatCurrency("NZD"),
new FiatCurrency("NGN"),
new FiatCurrency("NOK"),
new FiatCurrency("PKR"),
new FiatCurrency("PEN"),
Expand Down
17 changes: 15 additions & 2 deletions core/src/main/java/bisq/core/payment/PaymentAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,25 @@ public protobuf.PaymentAccount toProtoMessage() {
}

public static PaymentAccount fromProto(protobuf.PaymentAccount proto, CoreProtoResolver coreProtoResolver) {
PaymentAccount account = PaymentAccountFactory.getPaymentAccount(PaymentMethod.getPaymentMethodById(proto.getPaymentMethod().getId()));
String paymentMethodId = proto.getPaymentMethod().getId();
List<TradeCurrency> tradeCurrencies = proto.getTradeCurrenciesList().stream()
.map(TradeCurrency::fromProto)
.collect(Collectors.toList());

// We need to remove NGN for Transferwise
Optional<TradeCurrency> ngnTwOptional = tradeCurrencies.stream()
.filter(e -> paymentMethodId.equals(PaymentMethod.TRANSFERWISE_ID))
.filter(e -> e.getCode().equals("NGN"))
.findAny();
// We cannot remove it in the stream as it would cause a concurrentModificationException
ngnTwOptional.ifPresent(tradeCurrencies::remove);

PaymentAccount account = PaymentAccountFactory.getPaymentAccount(PaymentMethod.getPaymentMethodById(paymentMethodId));
account.getTradeCurrencies().clear();
account.setId(proto.getId());
account.setCreationDate(proto.getCreationDate());
account.setAccountName(proto.getAccountName());
account.getTradeCurrencies().addAll(proto.getTradeCurrenciesList().stream().map(TradeCurrency::fromProto).collect(Collectors.toList()));
account.getTradeCurrencies().addAll(tradeCurrencies);
account.setPaymentAccountPayload(coreProtoResolver.fromProto(proto.getPaymentAccountPayload()));

if (proto.hasSelectedTradeCurrency())
Expand Down