From 55e55d4f19528489f9e6b29d83140e7b335671a2 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sat, 5 Sep 2020 19:18:33 -0500 Subject: [PATCH 1/6] Deactivate confirm payment or payment received buttons once a dispute is opened. --- .../pendingtrades/steps/TradeStepView.java | 14 ++-- .../steps/buyer/BuyerStep2View.java | 6 ++ .../steps/seller/SellerStep3View.java | 65 ++++++++++--------- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java index dc9a93ec49d..ad352e2eb34 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java @@ -390,7 +390,6 @@ protected void applyOnDisputeOpened() { } private void updateDisputeState(Trade.DisputeState disputeState) { - deactivatePaymentButtons(false); Optional ownDispute; switch (disputeState) { case NO_DISPUTE: @@ -406,7 +405,6 @@ private void updateDisputeState(Trade.DisputeState disputeState) { if (tradeStepInfo != null) tradeStepInfo.setState(TradeStepInfo.State.IN_MEDIATION_SELF_REQUESTED); }); - break; case MEDIATION_STARTED_BY_PEER: if (tradeStepInfo != null) { @@ -435,7 +433,6 @@ private void updateDisputeState(Trade.DisputeState disputeState) { updateMediationResultState(true); break; case REFUND_REQUESTED: - deactivatePaymentButtons(true); if (tradeStepInfo != null) { tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText); } @@ -449,7 +446,6 @@ private void updateDisputeState(Trade.DisputeState disputeState) { break; case REFUND_REQUEST_STARTED_BY_PEER: - deactivatePaymentButtons(true); if (tradeStepInfo != null) { tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText); } @@ -462,9 +458,12 @@ private void updateDisputeState(Trade.DisputeState disputeState) { }); break; case REFUND_REQUEST_CLOSED: - deactivatePaymentButtons(true); + break; + default: break; } + + deactivatePaymentButtons(isDisputed()); } private void updateMediationResultState(boolean blockOpeningOfResultAcceptedPopup) { @@ -639,6 +638,11 @@ private void updateTradePeriodState(Trade.TradePeriodState tradePeriodState) { } } + protected boolean isDisputed() { + return trade.getDisputeState() != Trade.DisputeState.NO_DISPUTE; + } + + /////////////////////////////////////////////////////////////////////////////////////////// // TradeDurationLimitInfo /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java index 562c716ebec..5189d535b56 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java @@ -193,6 +193,8 @@ public void activate() { } }); } + + confirmButton.setDisable(isDisputed()); } @Override @@ -387,6 +389,10 @@ protected void applyOnDisputeOpened() { /////////////////////////////////////////////////////////////////////////////////////////// private void onPaymentStarted() { + if (isDisputed()) { + return; + } + if (!model.dataModel.isBootstrappedOrShowPopup()) { return; } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java index b0e0fa57c22..942dd7acec8 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java @@ -164,6 +164,8 @@ public void activate() { } applyAssetTxProofResult(trade.getAssetTxProofResult()); + + confirmButton.setDisable(isDisputed()); } @Override @@ -341,40 +343,45 @@ protected void applyOnDisputeOpened() { /////////////////////////////////////////////////////////////////////////////////////////// private void onPaymentReceived() { + if (isDisputed()) { + return; + } + // The confirmPaymentReceived call will trigger the trade protocol to do the payout tx. We want to be sure that we // are well connected to the Bitcoin network before triggering the broadcast. - if (model.dataModel.isReadyForTxBroadcast()) { - String key = "confirmPaymentReceived"; - if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) { - PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload(); - String message = Res.get("portfolio.pending.step3_seller.onPaymentReceived.part1", CurrencyUtil.getNameByCode(model.dataModel.getCurrencyCode())); - if (!(paymentAccountPayload instanceof AssetsAccountPayload)) { - if (!(paymentAccountPayload instanceof WesternUnionAccountPayload) && - !(paymentAccountPayload instanceof HalCashAccountPayload) && - !(paymentAccountPayload instanceof F2FAccountPayload)) { - message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId()); - } - - Optional optionalHolderName = getOptionalHolderName(); - if (optionalHolderName.isPresent()) { - message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.name", optionalHolderName.get()); - } + if (!model.dataModel.isReadyForTxBroadcast()) { + return; + } + String key = "confirmPaymentReceived"; + if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) { + PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload(); + String message = Res.get("portfolio.pending.step3_seller.onPaymentReceived.part1", CurrencyUtil.getNameByCode(model.dataModel.getCurrencyCode())); + if (!(paymentAccountPayload instanceof AssetsAccountPayload)) { + if (!(paymentAccountPayload instanceof WesternUnionAccountPayload) && + !(paymentAccountPayload instanceof HalCashAccountPayload) && + !(paymentAccountPayload instanceof F2FAccountPayload)) { + message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId()); } - message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.note"); - if (model.dataModel.isSignWitnessTrade()) { - message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.signer"); + + Optional optionalHolderName = getOptionalHolderName(); + if (optionalHolderName.isPresent()) { + message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.name", optionalHolderName.get()); } - new Popup() - .headLine(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.headline")) - .confirmation(message) - .width(700) - .actionButtonText(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.yes")) - .onAction(this::confirmPaymentReceived) - .closeButtonText(Res.get("shared.cancel")) - .show(); - } else { - confirmPaymentReceived(); } + message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.note"); + if (model.dataModel.isSignWitnessTrade()) { + message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.signer"); + } + new Popup() + .headLine(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.headline")) + .confirmation(message) + .width(700) + .actionButtonText(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.yes")) + .onAction(this::confirmPaymentReceived) + .closeButtonText(Res.get("shared.cancel")) + .show(); + } else { + confirmPaymentReceived(); } } From 9908bcf33abec5c52c320d444c97decb4cb63df3 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sat, 5 Sep 2020 19:19:49 -0500 Subject: [PATCH 2/6] Rename method --- .../main/portfolio/pendingtrades/steps/TradeStepView.java | 4 ++-- .../portfolio/pendingtrades/steps/buyer/BuyerStep2View.java | 2 +- .../portfolio/pendingtrades/steps/seller/SellerStep3View.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java index ad352e2eb34..8dcea1ee77f 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java @@ -463,7 +463,7 @@ private void updateDisputeState(Trade.DisputeState disputeState) { break; } - deactivatePaymentButtons(isDisputed()); + updateConfirmButtonDisableState(isDisputed()); } private void updateMediationResultState(boolean blockOpeningOfResultAcceptedPopup) { @@ -603,7 +603,7 @@ private void openMediationResultPopup(String headLine) { acceptMediationResultPopup.show(); } - protected void deactivatePaymentButtons(boolean isDisabled) { + protected void updateConfirmButtonDisableState(boolean isDisabled) { } private void updateTradePeriodState(Trade.TradePeriodState tradePeriodState) { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java index 5189d535b56..b7783cac737 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java @@ -637,7 +637,7 @@ private void showPopup() { } @Override - protected void deactivatePaymentButtons(boolean isDisabled) { + protected void updateConfirmButtonDisableState(boolean isDisabled) { confirmButton.setDisable(isDisabled); } } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java index 942dd7acec8..c94317c17b1 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java @@ -515,7 +515,7 @@ private Label createPopoverLabel(String text) { } @Override - protected void deactivatePaymentButtons(boolean isDisabled) { + protected void updateConfirmButtonDisableState(boolean isDisabled) { confirmButton.setDisable(isDisabled); } } From 1419f05152dc9ff97db52637c19ce03670b4a4ec Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 6 Sep 2020 23:06:27 -0500 Subject: [PATCH 3/6] Add comment to empty method --- .../main/portfolio/pendingtrades/steps/TradeStepView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java index 8dcea1ee77f..7e1e9ff1190 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java @@ -604,6 +604,7 @@ private void openMediationResultPopup(String headLine) { } protected void updateConfirmButtonDisableState(boolean isDisabled) { + // By default do nothing. Only overwritten in certain trade steps } private void updateTradePeriodState(Trade.TradePeriodState tradePeriodState) { From 087dde0e9df51b86e8b5c733e17ae9ef4378c7c2 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 6 Sep 2020 23:09:45 -0500 Subject: [PATCH 4/6] Add check if trade have been dispute to protocol classes --- .../bisq/core/trade/protocol/BuyerAsMakerProtocol.java | 4 ++++ .../bisq/core/trade/protocol/BuyerAsTakerProtocol.java | 4 ++++ .../core/trade/protocol/SellerAsMakerProtocol.java | 4 ++++ .../core/trade/protocol/SellerAsTakerProtocol.java | 4 ++++ .../java/bisq/core/trade/protocol/TradeProtocol.java | 10 ++++++++++ .../pendingtrades/PendingTradesDataModel.java | 2 +- 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java index ec5d5547937..19dde182b7b 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java @@ -212,6 +212,10 @@ private void handle() { // User clicked the "bank transfer started" button @Override public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { + if (wasDisputed(errorMessageHandler)) { + return; + } + if (trade.isDepositConfirmed() && !trade.isFiatSent()) { buyerAsMakerTrade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_FIAT_PAYMENT_INITIATED); TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade, diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java index 6665c001ec6..5e4c17d2563 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java @@ -237,6 +237,10 @@ private void handle() { // User clicked the "bank transfer started" button @Override public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { + if (wasDisputed(errorMessageHandler)) { + return; + } + if (!trade.isFiatSent()) { buyerAsTakerTrade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_FIAT_PAYMENT_INITIATED); diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java index 3a5ae4df9b8..c7620fccf8c 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java @@ -204,6 +204,10 @@ private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddr // User clicked the "bank transfer received" button, so we release the funds for payout @Override public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { + if (wasDisputed(errorMessageHandler)) { + return; + } + if (trade.getPayoutTx() == null) { sellerAsMakerTrade.setState(Trade.State.SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT); TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade, diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java index fd42d66b7c0..6f2f9815c1e 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java @@ -196,6 +196,10 @@ private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddr // User clicked the "bank transfer received" button, so we release the funds for payout @Override public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { + if (wasDisputed(errorMessageHandler)) { + return; + } + if (trade.getPayoutTx() == null) { sellerAsTakerTrade.setState(Trade.State.SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT); TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade, diff --git a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java index 4cf78045db2..6c3d29b5d8f 100644 --- a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java @@ -345,6 +345,16 @@ protected void handleTaskRunnerFault(@Nullable TradeMessage tradeMessage, String cleanup(); } + protected boolean wasDisputed(ErrorMessageHandler errorMessageHandler) { + if (trade.getDisputeState() != Trade.DisputeState.NO_DISPUTE) { + String msg = "Dispute have been opened once. We do not allow anymore to confirm payment by button click."; + log.error(msg); + errorMessageHandler.handleErrorMessage(msg); + return true; + } + return false; + } + private void sendAckMessage(@Nullable TradeMessage tradeMessage, boolean result, @Nullable String errorMessage) { // We complete at initial protocol setup with the setup listener tasks. // Other cases are if we start from an UI event the task runner (payment started, confirmed). diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java index fb03b413f8a..6d1a288f118 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java @@ -185,7 +185,7 @@ void onSelectItem(PendingTradesListItem item) { } public void onPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { - final Trade trade = getTrade(); + Trade trade = getTrade(); checkNotNull(trade, "trade must not be null"); checkArgument(trade instanceof BuyerTrade, "Check failed: trade instanceof BuyerTrade"); ((BuyerTrade) trade).onFiatPaymentStarted(resultHandler, errorMessageHandler); From 0bf433350ac1b6bc41034a960e1bd5b617929867 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 6 Sep 2020 23:22:31 -0500 Subject: [PATCH 5/6] Use a checkArgument to ensure that the methods are not called once a dispute has been opened. This will cause a Runtime exception but that is justified as the caller need to ensure to do the check and do not allow to get to that point. --- .../bisq/core/trade/protocol/BuyerAsMakerProtocol.java | 7 ++++--- .../bisq/core/trade/protocol/BuyerAsTakerProtocol.java | 6 +++--- .../core/trade/protocol/SellerAsMakerProtocol.java | 7 ++++--- .../core/trade/protocol/SellerAsTakerProtocol.java | 6 +++--- .../java/bisq/core/trade/protocol/TradeProtocol.java | 10 ++-------- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java index 19dde182b7b..6f475f6734e 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerAsMakerProtocol.java @@ -55,6 +55,8 @@ import lombok.extern.slf4j.Slf4j; +import static com.google.common.base.Preconditions.checkArgument; + @Slf4j public class BuyerAsMakerProtocol extends TradeProtocol implements BuyerProtocol, MakerProtocol { private final BuyerAsMakerTrade buyerAsMakerTrade; @@ -212,9 +214,8 @@ private void handle() { // User clicked the "bank transfer started" button @Override public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { - if (wasDisputed(errorMessageHandler)) { - return; - } + checkArgument(!wasDisputed(), "A call to onFiatPaymentStarted is not permitted once a " + + "dispute has been opened."); if (trade.isDepositConfirmed() && !trade.isFiatSent()) { buyerAsMakerTrade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_FIAT_PAYMENT_INITIATED); diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java index 5e4c17d2563..4d17d4c47fa 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java @@ -59,6 +59,7 @@ import lombok.extern.slf4j.Slf4j; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @Slf4j @@ -237,9 +238,8 @@ private void handle() { // User clicked the "bank transfer started" button @Override public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { - if (wasDisputed(errorMessageHandler)) { - return; - } + checkArgument(!wasDisputed(), "A call to onFiatPaymentStarted is not permitted once a " + + "dispute has been opened."); if (!trade.isFiatSent()) { buyerAsTakerTrade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_FIAT_PAYMENT_INITIATED); diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java index c7620fccf8c..29ecde1c005 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java @@ -57,6 +57,8 @@ import lombok.extern.slf4j.Slf4j; +import static com.google.common.base.Preconditions.checkArgument; + @Slf4j public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtocol, MakerProtocol { private final SellerAsMakerTrade sellerAsMakerTrade; @@ -204,9 +206,8 @@ private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddr // User clicked the "bank transfer received" button, so we release the funds for payout @Override public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { - if (wasDisputed(errorMessageHandler)) { - return; - } + checkArgument(!wasDisputed(), "A call to onFiatPaymentReceived is not permitted once a " + + "dispute has been opened."); if (trade.getPayoutTx() == null) { sellerAsMakerTrade.setState(Trade.State.SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT); diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java index 6f2f9815c1e..8979a61b28c 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java @@ -56,6 +56,7 @@ import lombok.extern.slf4j.Slf4j; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @Slf4j @@ -196,9 +197,8 @@ private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddr // User clicked the "bank transfer received" button, so we release the funds for payout @Override public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { - if (wasDisputed(errorMessageHandler)) { - return; - } + checkArgument(!wasDisputed(), "A call to onFiatPaymentReceived is not permitted once a " + + "dispute has been opened."); if (trade.getPayoutTx() == null) { sellerAsTakerTrade.setState(Trade.State.SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT); diff --git a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java index 6c3d29b5d8f..c561b242741 100644 --- a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java @@ -345,14 +345,8 @@ protected void handleTaskRunnerFault(@Nullable TradeMessage tradeMessage, String cleanup(); } - protected boolean wasDisputed(ErrorMessageHandler errorMessageHandler) { - if (trade.getDisputeState() != Trade.DisputeState.NO_DISPUTE) { - String msg = "Dispute have been opened once. We do not allow anymore to confirm payment by button click."; - log.error(msg); - errorMessageHandler.handleErrorMessage(msg); - return true; - } - return false; + protected boolean wasDisputed() { + return trade.getDisputeState() != Trade.DisputeState.NO_DISPUTE; } private void sendAckMessage(@Nullable TradeMessage tradeMessage, boolean result, @Nullable String errorMessage) { From c40bcfedfc780853359536deacd81da24dc00982 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Sun, 6 Sep 2020 23:51:24 -0500 Subject: [PATCH 6/6] Fix merge mistake --- .../portfolio/pendingtrades/steps/seller/SellerStep3View.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java index 6524be8fc58..59824075fb1 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java @@ -313,7 +313,7 @@ protected void addContent() { } @Override - protected void deactivatePaymentButtons(boolean isDisabled) { + protected void updateConfirmButtonDisableState(boolean isDisabled) { confirmButton.setDisable(isDisabled); }