[bisq-network/bisq] Let API user set currencies in some payment account json forms (#5685)
Stan
notifications at github.com
Thu Sep 16 14:17:10 CEST 2021
@ghubstan commented on this pull request.
> + 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 {
If the json field is not defined, it can't be read. If it is defined, it is always read.
`if (fieldName.equals("selectedTradeCurrency")) ` fails, this method needs to return false so the calling read loop does not `continue` to the next json field.
Look at `PaymentAccount read(JsonReader in)` [Line 215-254]:
If `didReadSelectedTradeCurrencyField()` returns false, the `currentFieldName` might be read in `didReadCommonField()` or `didReadCountryField()`.
If `didReadSelectedTradeCurrencyField()` returns true, the `currentFieldName` cannot be read in `didReadCommonField()` or `didReadCountryField()`.
--
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#discussion_r710060666
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210916/425a479e/attachment.htm>
More information about the bisq-github
mailing list