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

Bernard Labno notifications at github.com
Tue Nov 19 16:37:47 UTC 2019


blabno commented on this pull request.



> +
+            }
+            accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
+        }
+        return paymentAccount;
+    }
+
+    public void removePaymentAccount(String id) {
+        PaymentAccount paymentAccount = user.getPaymentAccount(id);
+        if (paymentAccount == null) {
+            throw new NotFoundException(format("Payment account %s not found", id));
+        }
+        boolean isPaymentAccountUsed = openOfferManager.getObservableList().stream()
+                .anyMatch(openOffer -> id.equals(openOffer.getOffer().getMakerPaymentAccountId()));
+        if (isPaymentAccountUsed) {
+            throw new PaymentAccountInUseException(format("Payment account %s is used for open offer", id));

Validation is completely different case. When you call `validate` method the main thing you want to know is the result of the validation.
Look at classic example of ArrayList: http://www.docjar.com/html/api/java/util/ArrayList.java.html#441

Does remove method return RemoveMethodResult? No it returns the removed object, which is the main intended thing. In order to tell user that object cannot be removed, because index is wrong it uses IndexOutOfBoundsException.

-- 
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_r348036212
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191119/02ef1cb2/attachment.html>


More information about the bisq-github mailing list