mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Remove spurious PaymentAccount#canSupportMultipleCurrencies()
Method was added on the false assumption `PaymentAccount#hasMultipleCurrencies()` would not always return a correct value when a `PaymentAccount` instance is created via reflection. But `hasMultipleCurrencies()` will work as long as appropriate PaymentAccount subclasses continue setting their `tradeCurrencies` fields within their default constructors.
This commit is contained in:
parent
1adde70c7a
commit
ab929d4435
@ -1002,7 +1002,7 @@ public class CreatePaymentAccountTest extends AbstractPaymentAccountTest {
|
||||
|
||||
Throwable exception = assertThrows(StatusRuntimeException.class, () ->
|
||||
createPaymentAccount(aliceClient, jsonString));
|
||||
assertEquals("INVALID_ARGUMENT: no trade currencies defined for transferwise payment account",
|
||||
assertEquals("INVALID_ARGUMENT: no trade currency defined for transferwise payment account",
|
||||
exception.getMessage());
|
||||
}
|
||||
|
||||
|
@ -138,11 +138,7 @@ class CorePaymentAccountsService {
|
||||
}
|
||||
|
||||
private void verifyPaymentAccountHasRequiredFields(PaymentAccount paymentAccount) {
|
||||
if (paymentAccount.canSupportMultipleCurrencies() && paymentAccount.getTradeCurrencies().isEmpty())
|
||||
throw new IllegalArgumentException(format("no trade currencies defined for %s payment account",
|
||||
paymentAccount.getPaymentMethod().getDisplayString().toLowerCase()));
|
||||
|
||||
if (!paymentAccount.canSupportMultipleCurrencies() && paymentAccount.getSingleTradeCurrency() == null)
|
||||
if (!paymentAccount.hasMultipleCurrencies() && paymentAccount.getSingleTradeCurrency() == null)
|
||||
throw new IllegalArgumentException(format("no trade currency defined for %s payment account",
|
||||
paymentAccount.getPaymentMethod().getDisplayString().toLowerCase()));
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class PaymentAccountTypeAdapter extends TypeAdapter<PaymentAccount> {
|
||||
|
||||
|
||||
private void writeInnerMutableFields(JsonWriter out, PaymentAccount account) {
|
||||
if (account.canSupportMultipleCurrencies()) {
|
||||
if (account.hasMultipleCurrencies()) {
|
||||
writeTradeCurrenciesField(out, account);
|
||||
writeSelectedTradeCurrencyField(out, account);
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.core.payment.payload.PaymentMethod.*;
|
||||
import static bisq.core.payment.payload.PaymentMethod.TRANSFERWISE_ID;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethodById;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@EqualsAndHashCode
|
||||
@ -152,19 +153,6 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||
return tradeCurrencies.size() > 1;
|
||||
}
|
||||
|
||||
public boolean canSupportMultipleCurrencies() {
|
||||
return this.hasPaymentMethodWithId(ADVANCED_CASH_ID)
|
||||
|| this.hasPaymentMethodWithId(AMAZON_GIFT_CARD_ID)
|
||||
|| this.hasPaymentMethodWithId(CAPITUAL_ID)
|
||||
|| this.hasPaymentMethodWithId(MONEY_GRAM_ID)
|
||||
|| this.hasPaymentMethodWithId(PAYSERA_ID)
|
||||
|| this.hasPaymentMethodWithId(PAXUM_ID)
|
||||
|| this.hasPaymentMethodWithId(REVOLUT_ID)
|
||||
// || this.hasPaymentMethodWithId(SWIFT_ID)
|
||||
|| this.hasPaymentMethodWithId(TRANSFERWISE_ID)
|
||||
|| this.hasPaymentMethodWithId(UPHOLD_ID);
|
||||
}
|
||||
|
||||
public void setSingleTradeCurrency(TradeCurrency tradeCurrency) {
|
||||
tradeCurrencies.clear();
|
||||
tradeCurrencies.add(tradeCurrency);
|
||||
|
Loading…
Reference in New Issue
Block a user