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 19dde182b7..6f475f6734 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 bisq.common.handlers.ResultHandler; 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 @@ public class BuyerAsMakerProtocol extends TradeProtocol implements BuyerProtocol // 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 5e4c17d256..4d17d4c47f 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 bisq.common.handlers.ResultHandler; 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 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol // 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 c7620fccf8..29ecde1c00 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 bisq.common.handlers.ResultHandler; 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 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc // 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 6f2f9815c1..8979a61b28 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 bisq.common.handlers.ResultHandler; 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 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc // 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 6c3d29b5d8..c561b24274 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 @@ public abstract class TradeProtocol { 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) {