mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Merge pull request #4976 from chimp1984/remove-ngn-from-transferwise
[1.5.2] Remove NGN (Nigerian Naira) as their central bank blocked Transferwise
This commit is contained in:
commit
245e736bc4
2 changed files with 15 additions and 3 deletions
|
@ -301,7 +301,6 @@ public class CurrencyUtil {
|
|||
new FiatCurrency("MAD"),
|
||||
new FiatCurrency("NPR"),
|
||||
new FiatCurrency("NZD"),
|
||||
new FiatCurrency("NGN"),
|
||||
new FiatCurrency("NOK"),
|
||||
new FiatCurrency("PKR"),
|
||||
new FiatCurrency("PEN"),
|
||||
|
|
|
@ -97,12 +97,25 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
}
|
||||
|
||||
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())
|
||||
|
|
Loading…
Add table
Reference in a new issue