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) {
deactivatePaymentButtons(false);
Optional<Dispute> ownDispute;
switch (disputeState) {
case NO_DISPUTE:
@ -406,7 +405,6 @@ public abstract class TradeStepView extends AnchorPane {
if (tradeStepInfo != null)
tradeStepInfo.setState(TradeStepInfo.State.IN_MEDIATION_SELF_REQUESTED);
});
break;
case MEDIATION_STARTED_BY_PEER:
if (tradeStepInfo != null) {
@ -435,7 +433,6 @@ public abstract class TradeStepView extends AnchorPane {
updateMediationResultState(true);
break;
case REFUND_REQUESTED:
deactivatePaymentButtons(true);
if (tradeStepInfo != null) {
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
@ -449,7 +446,6 @@ public abstract class TradeStepView extends AnchorPane {
break;
case REFUND_REQUEST_STARTED_BY_PEER:
deactivatePaymentButtons(true);
if (tradeStepInfo != null) {
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
@ -462,9 +458,12 @@ public abstract class TradeStepView extends AnchorPane {
});
break;
case REFUND_REQUEST_CLOSED:
deactivatePaymentButtons(true);
break;
default:
break;
}
deactivatePaymentButtons(isDisputed());
}
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
///////////////////////////////////////////////////////////////////////////////////////////

View file

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

View file

@ -164,6 +164,8 @@ public class SellerStep3View extends TradeStepView {
}
applyAssetTxProofResult(trade.getAssetTxProofResult());
confirmButton.setDisable(isDisputed());
}
@Override
@ -341,40 +343,45 @@ public class SellerStep3View extends TradeStepView {
///////////////////////////////////////////////////////////////////////////////////////////
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());
}
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());
}
Optional<String> optionalHolderName = getOptionalHolderName();
if (optionalHolderName.isPresent()) {
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.name", optionalHolderName.get());
}
Optional<String> optionalHolderName = getOptionalHolderName();
if (optionalHolderName.isPresent()) {
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();
}
}