[bisq-network/bisq] Let API user set currencies in some payment account json forms (#5685)
sqrrm
notifications at github.com
Thu Sep 16 12:56:00 CEST 2021
@sqrrm commented on this pull request.
Some comments, looks generally good
> + else if (account.hasPaymentMethodWithId(REVOLUT_ID))
+ return getTradeCurrenciesInList(currencyCodes, getAllRevolutCurrencies());
+ /*else if (account.hasPaymentMethodWithId(SWIFT_ID))
+ return getTradeCurrenciesInList(currencyCodes, new ArrayList<>(getAllSortedFiatCurrencies()));*/
+ else if (account.hasPaymentMethodWithId(TRANSFERWISE_ID))
+ return getTradeCurrenciesInList(currencyCodes, getAllTransferwiseCurrencies());
+ else if (account.hasPaymentMethodWithId(UPHOLD_ID))
+ return getTradeCurrenciesInList(currencyCodes, getAllUpholdCurrencies());
+ else
+ return Optional.empty();
+ }
+
+ private boolean didReadSelectedTradeCurrencyField(JsonReader in,
+ PaymentAccount account,
+ String fieldName) {
+ if (fieldName.equals("selectedTradeCurrency")) {
Prefer return early, eg
```
if (!fieldName.equals("selectedTradeCurrency")) {
return false;
}
...
```
> + else if (account.hasPaymentMethodWithId(UPHOLD_ID))
+ return getTradeCurrenciesInList(currencyCodes, getAllUpholdCurrencies());
+ else
+ return Optional.empty();
+ }
+
+ private boolean didReadSelectedTradeCurrencyField(JsonReader in,
+ PaymentAccount account,
+ String fieldName) {
+ if (fieldName.equals("selectedTradeCurrency")) {
+ String fieldValue = nextStringOrNull(in);
+ if (fieldValue != null && !fieldValue.isEmpty()) {
+ Optional<TradeCurrency> tradeCurrency = getTradeCurrency(fieldValue.toUpperCase());
+ if (tradeCurrency.isPresent()) {
+ account.setSelectedTradeCurrency(tradeCurrency.get());
+ } else {
It does read the field, but should it return true even when it's not defined?
> @@ -125,7 +145,13 @@ protected final void verifyEmptyForm(File jsonForm, String paymentMethodId, Stri
PAYMENT_ACCOUNT_FORM.toJsonString(jsonForm),
Object.class);
assertNotNull(emptyForm);
- assertEquals(PROPERTY_VALUE_JSON_COMMENTS, emptyForm.get(PROPERTY_NAME_JSON_COMMENTS));
+
+ if (false && paymentMethodId.equals("SWIFT_ID")) {
Maybe a TODO if this is a placeholder for future swift test
> @@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
What does this file do?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5685#pullrequestreview-756144414
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210916/34d1be6c/attachment-0001.htm>
More information about the bisq-github
mailing list