[bisq-network/bisq] Let API user set currencies in some payment account json forms (#5685)

Stan notifications at github.com
Mon Sep 6 17:51:28 CEST 2021

Several payment methods support multiple trade currencies and a selected trade currency, but the API has not let CLI users specify them in the json form passed to the `createpaymentacct` command.

This change adds `tradeCurrencies` and `selectedTradeCurrency` fields to the appropriate json forms.

Summary of changes:

- Added support for reading/writing trade currency info from/to json forms to `PaymentAccountTypeAdapter`.

- Added new boolean convenience methods to `PaymentAccount` to aid in correctly defining and validating pay account json from currency lists and selections.

- Adjusted `CorePaymentAccountsService`, `CreateOfferService` `MutableOfferDataModel`, `MutableOfferView`, `MutableOfferViewModel`, `TakeOfferDataModel` to `PaymentAccount` refactoring.

- Added `Res # List<String> getWrappedAsList(String key, int wrapLength)` and `Utilities # List<String> toListOfWrappedStrings(String s, int wrapLength)` to convert long, multi-line i18n strings to wrapped strings the API can use.

- Added constants to apitest's `AbstractPaymentAccountTest` for new `SwiftAccount` test case to be added after [PR 5672](https://github.com/bisq-network/bisq/pull/5672) is merged.

- Added asserts to existing  `CreatePaymentAccountTest` cases:  check new account instances' `tradeCurrencies` and `selectedTradeCurrency` field values written to payment account creation json forms.

- Added new `CreatePaymentAccountTest` cases, including commented out case `testCreateSwiftAccount` --  in anticipation of the [new Swift payment method](https://github.com/bisq-network/bisq/pull/5672) merge.

- Added `apitest/src/test/resources/logback.xml` for configuring apitest case logging.

- Removed dead/commented code in some of the touched classes.

Based on branch `detault-api-testharness-callrate-config`, which was merged earlier today in [PR 5683](https://github.com/bisq-network/bisq/pull/5683)    
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * Wrap long i18n strings for use in API
  * Format comments, add one
  * Replace growing # of instanceof checks with boolean hasPaymentMethodWithId
  * Adjust to PaymentAccount changes in commit de23fc0
  * Do single trade currency check in api generated payment acct
  * Adjust to PaymentAccount change in commit de23fc0
  * Let users specify trade ccys and selected trade ccy in json form
  * Do pay acct ccy checks, add tests, anticipate swift pay method

-- File Changes --

    M apitest/src/test/java/bisq/apitest/method/payment/AbstractPaymentAccountTest.java (75)
    M apitest/src/test/java/bisq/apitest/method/payment/CreatePaymentAccountTest.java (212)
    M apitest/src/test/java/bisq/apitest/scenario/PaymentAccountTest.java (7)
    A apitest/src/test/resources/logback.xml (20)
    M common/src/main/java/bisq/common/util/Utilities.java (16)
    M core/src/main/java/bisq/core/api/CorePaymentAccountsService.java (7)
    M core/src/main/java/bisq/core/api/model/PaymentAccountForm.java (8)
    M core/src/main/java/bisq/core/api/model/PaymentAccountTypeAdapter.java (141)
    M core/src/main/java/bisq/core/locale/Res.java (28)
    M core/src/main/java/bisq/core/offer/CreateOfferService.java (4)
    M core/src/main/java/bisq/core/payment/PaymentAccount.java (32)
    M desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java (13)
    M desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java (5)
    M desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java (31)
    M desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java (5)
    M desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java (14)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210906/69f0419b/attachment-0001.htm>

More information about the bisq-github mailing list