mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Add check if trade have been dispute to protocol classes
This commit is contained in:
parent
1419f05152
commit
087dde0e9d
@ -212,6 +212,10 @@ 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;
|
||||
}
|
||||
|
||||
if (trade.isDepositConfirmed() && !trade.isFiatSent()) {
|
||||
buyerAsMakerTrade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_FIAT_PAYMENT_INITIATED);
|
||||
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade,
|
||||
|
@ -237,6 +237,10 @@ 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;
|
||||
}
|
||||
|
||||
if (!trade.isFiatSent()) {
|
||||
buyerAsTakerTrade.setState(Trade.State.BUYER_CONFIRMED_IN_UI_FIAT_PAYMENT_INITIATED);
|
||||
|
||||
|
@ -204,6 +204,10 @@ 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;
|
||||
}
|
||||
|
||||
if (trade.getPayoutTx() == null) {
|
||||
sellerAsMakerTrade.setState(Trade.State.SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT);
|
||||
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
|
||||
|
@ -196,6 +196,10 @@ 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;
|
||||
}
|
||||
|
||||
if (trade.getPayoutTx() == null) {
|
||||
sellerAsTakerTrade.setState(Trade.State.SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT);
|
||||
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade,
|
||||
|
@ -345,6 +345,16 @@ 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;
|
||||
}
|
||||
|
||||
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).
|
||||
|
@ -185,7 +185,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
|
||||
}
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user