disable payment sent button on click

This commit is contained in:
woodser 2023-04-20 09:42:06 -04:00
parent 567ef6784d
commit 2b7a461411
2 changed files with 11 additions and 4 deletions

View File

@ -422,11 +422,17 @@ public class BuyerStep2View extends TradeStepView {
HBox hBox = tuple3.fourth;
GridPane.setColumnSpan(hBox, 2);
confirmButton = tuple3.first;
confirmButton.setDisable(!confirmPaymentSentPermitted());
confirmButton.setOnAction(e -> onPaymentSent());
busyAnimation = tuple3.second;
statusLabel = tuple3.third;
}
private boolean confirmPaymentSentPermitted() {
if (!trade.confirmPermitted()) return false;
return trade.isDepositsUnlocked() && trade.getState().ordinal() < Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Warning
///////////////////////////////////////////////////////////////////////////////////////////
@ -454,8 +460,7 @@ public class BuyerStep2View extends TradeStepView {
@Override
protected void updateDisputeState(Trade.DisputeState disputeState) {
super.updateDisputeState(disputeState);
confirmButton.setDisable(!trade.confirmPermitted());
confirmButton.setDisable(!confirmPaymentSentPermitted());
}
@ -596,11 +601,14 @@ public class BuyerStep2View extends TradeStepView {
private void confirmPaymentSent() {
busyAnimation.play();
statusLabel.setText(Res.get("shared.sendingConfirmation"));
confirmButton.setDisable(true);
model.dataModel.onPaymentSent(() -> {
}, errorMessage -> {
busyAnimation.stop();
new Popup().warning(Res.get("popup.warning.sendMsgFailed")).show();
confirmButton.setDisable(!confirmPaymentSentPermitted());
UserThread.execute(() -> statusLabel.setText("Error confirming payment sent."));
});
}

View File

@ -307,7 +307,7 @@ public class SellerStep3View extends TradeStepView {
private boolean confirmPaymentReceivedPermitted() {
if (!trade.confirmPermitted()) return false;
return trade.getState().ordinal() >= Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal() && trade.getState().ordinal() < Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG.ordinal(); // TODO: test that can resen with same payout tx hex if delivery failed
return trade.getState().ordinal() >= Trade.State.BUYER_SENT_PAYMENT_SENT_MSG.ordinal() && trade.getState().ordinal() < Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG.ordinal();
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -354,7 +354,6 @@ public class SellerStep3View extends TradeStepView {
@Override
protected void updateDisputeState(Trade.DisputeState disputeState) {
super.updateDisputeState(disputeState);
confirmButton.setDisable(!confirmPaymentReceivedPermitted());
}