mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Populate SwiftAccount tradeCurrencies field inside constructor
The API uses reflection to figure out how to build a payment acct json form, and the tradeCurrencies field needs to be set after reflection API's onstructor.newInstance() is called.
This commit is contained in:
parent
a113b3ddfb
commit
1fcb751d8c
2 changed files with 9 additions and 9 deletions
|
@ -20,9 +20,9 @@ package bisq.core.payment;
|
|||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.payload.SwiftAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.payload.SwiftAccountPayload;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -34,6 +34,7 @@ import lombok.EqualsAndHashCode;
|
|||
public final class SwiftAccount extends PaymentAccount {
|
||||
public SwiftAccount() {
|
||||
super(PaymentMethod.SWIFT);
|
||||
selectAllTradeCurrencies();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,13 +46,6 @@ public final class SwiftAccount extends PaymentAccount {
|
|||
return ((SwiftAccountPayload) this.paymentAccountPayload);
|
||||
}
|
||||
|
||||
public void selectAllTradeCurrencies() {
|
||||
List<FiatCurrency> currencyCodesSorted = CurrencyUtil.getAllSortedFiatCurrencies().stream()
|
||||
.sorted(Comparator.comparing(TradeCurrency::getCode))
|
||||
.collect(Collectors.toList());
|
||||
tradeCurrencies.addAll(currencyCodesSorted);
|
||||
}
|
||||
|
||||
public String getMessageForBuyer() {
|
||||
return "payment.swift.info.buyer";
|
||||
}
|
||||
|
@ -63,4 +57,11 @@ public final class SwiftAccount extends PaymentAccount {
|
|||
public String getMessageForAccountCreation() {
|
||||
return "payment.swift.info.account";
|
||||
}
|
||||
|
||||
private void selectAllTradeCurrencies() {
|
||||
List<FiatCurrency> currencyCodesSorted = CurrencyUtil.getAllSortedFiatCurrencies().stream()
|
||||
.sorted(Comparator.comparing(TradeCurrency::getCode))
|
||||
.collect(Collectors.toList());
|
||||
tradeCurrencies.addAll(currencyCodesSorted);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ public class SwiftForm extends PaymentMethodForm {
|
|||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
((SwiftAccount) paymentAccount).selectAllTradeCurrencies();
|
||||
gridRowFrom = gridRow + 1;
|
||||
addFieldsForBankEdit(true, this::setBankSwiftCode, this::setBankName, this::setBankBranch, this::setBankAddress);
|
||||
addFieldsForBankEdit(false, this::setIntermediarySwiftCode, this::setIntermediaryName, this::setIntermediaryBranch, this::setIntermediaryAddress);
|
||||
|
|
Loading…
Add table
Reference in a new issue