Deactivate confirm payment or payment received buttons once a dispute

is opened.
This commit is contained in:
chimp1984 2020-09-05 19:18:33 -05:00
parent 57bed13cf8
commit 55e55d4f19
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
3 changed files with 51 additions and 34 deletions

View file

@ -390,7 +390,6 @@ public abstract class TradeStepView extends AnchorPane {
} }
private void updateDisputeState(Trade.DisputeState disputeState) { private void updateDisputeState(Trade.DisputeState disputeState) {
deactivatePaymentButtons(false);
Optional<Dispute> ownDispute; Optional<Dispute> ownDispute;
switch (disputeState) { switch (disputeState) {
case NO_DISPUTE: case NO_DISPUTE:
@ -406,7 +405,6 @@ public abstract class TradeStepView extends AnchorPane {
if (tradeStepInfo != null) if (tradeStepInfo != null)
tradeStepInfo.setState(TradeStepInfo.State.IN_MEDIATION_SELF_REQUESTED); tradeStepInfo.setState(TradeStepInfo.State.IN_MEDIATION_SELF_REQUESTED);
}); });
break; break;
case MEDIATION_STARTED_BY_PEER: case MEDIATION_STARTED_BY_PEER:
if (tradeStepInfo != null) { if (tradeStepInfo != null) {
@ -435,7 +433,6 @@ public abstract class TradeStepView extends AnchorPane {
updateMediationResultState(true); updateMediationResultState(true);
break; break;
case REFUND_REQUESTED: case REFUND_REQUESTED:
deactivatePaymentButtons(true);
if (tradeStepInfo != null) { if (tradeStepInfo != null) {
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText); tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
} }
@ -449,7 +446,6 @@ public abstract class TradeStepView extends AnchorPane {
break; break;
case REFUND_REQUEST_STARTED_BY_PEER: case REFUND_REQUEST_STARTED_BY_PEER:
deactivatePaymentButtons(true);
if (tradeStepInfo != null) { if (tradeStepInfo != null) {
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText); tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
} }
@ -462,9 +458,12 @@ public abstract class TradeStepView extends AnchorPane {
}); });
break; break;
case REFUND_REQUEST_CLOSED: case REFUND_REQUEST_CLOSED:
deactivatePaymentButtons(true); break;
default:
break; break;
} }
deactivatePaymentButtons(isDisputed());
} }
private void updateMediationResultState(boolean blockOpeningOfResultAcceptedPopup) { private void updateMediationResultState(boolean blockOpeningOfResultAcceptedPopup) {
@ -639,6 +638,11 @@ public abstract class TradeStepView extends AnchorPane {
} }
} }
protected boolean isDisputed() {
return trade.getDisputeState() != Trade.DisputeState.NO_DISPUTE;
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// TradeDurationLimitInfo // TradeDurationLimitInfo
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -193,6 +193,8 @@ public class BuyerStep2View extends TradeStepView {
} }
}); });
} }
confirmButton.setDisable(isDisputed());
} }
@Override @Override
@ -387,6 +389,10 @@ public class BuyerStep2View extends TradeStepView {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void onPaymentStarted() { private void onPaymentStarted() {
if (isDisputed()) {
return;
}
if (!model.dataModel.isBootstrappedOrShowPopup()) { if (!model.dataModel.isBootstrappedOrShowPopup()) {
return; return;
} }

View file

@ -164,6 +164,8 @@ public class SellerStep3View extends TradeStepView {
} }
applyAssetTxProofResult(trade.getAssetTxProofResult()); applyAssetTxProofResult(trade.getAssetTxProofResult());
confirmButton.setDisable(isDisputed());
} }
@Override @Override
@ -341,9 +343,15 @@ public class SellerStep3View extends TradeStepView {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void onPaymentReceived() { 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 // 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. // are well connected to the Bitcoin network before triggering the broadcast.
if (model.dataModel.isReadyForTxBroadcast()) { if (!model.dataModel.isReadyForTxBroadcast()) {
return;
}
String key = "confirmPaymentReceived"; String key = "confirmPaymentReceived";
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) { if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload(); PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
@ -376,7 +384,6 @@ public class SellerStep3View extends TradeStepView {
confirmPaymentReceived(); confirmPaymentReceived();
} }
} }
}
private void showPopup() { private void showPopup() {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload(); PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();