[bisq-network/bisq] Move Payment account creation and removal from UI to core (#3586)

chimp1984 notifications at github.com
Mon Nov 18 12:49:33 UTC 2019


chimp1984 commented on this pull request.



> +    }
+
+    public PaymentAccount addPaymentAccount(PaymentAccount paymentAccount) {
+        if (paymentAccount instanceof CryptoCurrencyAccount) {
+            CryptoCurrencyAccount cryptoCurrencyAccount = (CryptoCurrencyAccount) paymentAccount;
+            TradeCurrency tradeCurrency = cryptoCurrencyAccount.getSingleTradeCurrency();
+            if (tradeCurrency == null) {
+                throw new ValidationException("CryptoCurrency account must have exactly one trade currency");
+            }
+            altCoinAddressValidator.setCurrencyCode(tradeCurrency.getCode());
+            InputValidator.ValidationResult validationResult = altCoinAddressValidator.validate(cryptoCurrencyAccount.getAddress());
+            if (!validationResult.isValid) {
+                throw new ValidationException(validationResult.errorMessage);
+            }
+        }
+//        TODO we should validate payment account here as well

> Maybe removePaymentAccount method can return boolean directly ?

That would be consistent with classical `remove` methods which return a boolean as well about the success of the intended remove. In that case the client (e.g. UI) need to know why it was not possible. For that I recommend using custom methods.

-- 
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/3586#discussion_r347361345
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191118/d0d3648d/attachment.html>


More information about the bisq-github mailing list