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,40 +343,45 @@ 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()) {
String key = "confirmPaymentReceived"; return;
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) { }
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload(); String key = "confirmPaymentReceived";
String message = Res.get("portfolio.pending.step3_seller.onPaymentReceived.part1", CurrencyUtil.getNameByCode(model.dataModel.getCurrencyCode())); if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
if (!(paymentAccountPayload instanceof AssetsAccountPayload)) { PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
if (!(paymentAccountPayload instanceof WesternUnionAccountPayload) && String message = Res.get("portfolio.pending.step3_seller.onPaymentReceived.part1", CurrencyUtil.getNameByCode(model.dataModel.getCurrencyCode()));
!(paymentAccountPayload instanceof HalCashAccountPayload) && if (!(paymentAccountPayload instanceof AssetsAccountPayload)) {
!(paymentAccountPayload instanceof F2FAccountPayload)) { if (!(paymentAccountPayload instanceof WesternUnionAccountPayload) &&
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId()); !(paymentAccountPayload instanceof HalCashAccountPayload) &&
} !(paymentAccountPayload instanceof F2FAccountPayload)) {
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId());
}
Optional<String> optionalHolderName = getOptionalHolderName(); Optional<String> optionalHolderName = getOptionalHolderName();
if (optionalHolderName.isPresent()) { if (optionalHolderName.isPresent()) {
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.name", optionalHolderName.get()); message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.name", optionalHolderName.get());
}
} }
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();
} }
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();
} }
} }