update buyer seller step view even if error

This commit is contained in:
woodser 2023-04-01 21:35:58 -04:00
parent fd69f4250b
commit a03941817e
2 changed files with 66 additions and 76 deletions

View file

@ -150,46 +150,41 @@ public class BuyerStep2View extends TradeStepView {
if (trade.isDepositsUnlocked() && !trade.isPaymentSent()) { if (trade.isDepositsUnlocked() && !trade.isPaymentSent()) {
showPopup(); showPopup();
} else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG.ordinal()) { } else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG.ordinal()) {
if (!trade.hasFailed()) { switch (state) {
switch (state) { case BUYER_CONFIRMED_IN_UI_PAYMENT_SENT:
case BUYER_CONFIRMED_IN_UI_PAYMENT_SENT: busyAnimation.play();
busyAnimation.play(); statusLabel.setText(Res.get("shared.preparingConfirmation"));
statusLabel.setText(Res.get("shared.preparingConfirmation")); break;
break; case BUYER_SENT_PAYMENT_SENT_MSG:
case BUYER_SENT_PAYMENT_SENT_MSG: busyAnimation.play();
busyAnimation.play(); statusLabel.setText(Res.get("shared.sendingConfirmation"));
statusLabel.setText(Res.get("shared.sendingConfirmation")); model.setMessageStateProperty(MessageState.SENT);
model.setMessageStateProperty(MessageState.SENT); timeoutTimer = UserThread.runAfter(() -> {
timeoutTimer = UserThread.runAfter(() -> {
busyAnimation.stop();
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
}, 10);
break;
case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG:
busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageArrived"));
model.setMessageStateProperty(MessageState.ARRIVED);
break;
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG:
busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
model.setMessageStateProperty(MessageState.STORED_IN_MAILBOX);
break;
case BUYER_SEND_FAILED_PAYMENT_SENT_MSG:
// We get a popup and the trade closed, so we dont need to show anything here
busyAnimation.stop();
statusLabel.setText("");
model.setMessageStateProperty(MessageState.FAILED);
break;
default:
log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId());
busyAnimation.stop(); busyAnimation.stop();
statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
break; }, 10);
} break;
} else { case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG:
log.warn("Trade contains error message {}", trade.getErrorMessage()); busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageArrived"));
model.setMessageStateProperty(MessageState.ARRIVED);
break;
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG:
busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
model.setMessageStateProperty(MessageState.STORED_IN_MAILBOX);
break;
case BUYER_SEND_FAILED_PAYMENT_SENT_MSG:
// We get a popup and the trade closed, so we dont need to show anything here
busyAnimation.stop();
statusLabel.setText(""); statusLabel.setText("");
model.setMessageStateProperty(MessageState.FAILED);
break;
default:
log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId());
busyAnimation.stop();
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
break;
} }
} }
}); });

View file

@ -114,48 +114,43 @@ public class SellerStep3View extends TradeStepView {
if (trade.isPaymentSent() && !trade.isPaymentReceived()) { if (trade.isPaymentSent() && !trade.isPaymentReceived()) {
showPopup(); showPopup();
} else if (trade.isPaymentReceived()) { } else if (trade.isPaymentReceived()) {
if (!trade.hasFailed()) { switch (state) {
switch (state) { case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT:
case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT: busyAnimation.play();
busyAnimation.play(); statusLabel.setText(Res.get("shared.preparingConfirmation"));
statusLabel.setText(Res.get("shared.preparingConfirmation")); break;
break; case SELLER_SENT_PAYMENT_RECEIVED_MSG:
case SELLER_SENT_PAYMENT_RECEIVED_MSG: busyAnimation.play();
busyAnimation.play(); statusLabel.setText(Res.get("shared.sendingConfirmation"));
statusLabel.setText(Res.get("shared.sendingConfirmation"));
timeoutTimer = UserThread.runAfter(() -> { timeoutTimer = UserThread.runAfter(() -> {
busyAnimation.stop();
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
}, 10);
break;
case SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG:
busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageArrived"));
break;
case SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG:
busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
break;
case SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG:
// We get a popup and the trade closed, so we dont need to show anything here
busyAnimation.stop();
statusLabel.setText("");
break;
case TRADE_COMPLETED:
if (!trade.isPayoutPublished()) log.warn("Payout is expected to be published for {} {} state {}", trade.getClass().getSimpleName(), trade.getId(), trade.getState());
busyAnimation.stop();
statusLabel.setText("");
break;
default:
log.warn("Unexpected case: State={}, tradeId={} " + state.name(), trade.getId());
busyAnimation.stop(); busyAnimation.stop();
statusLabel.setText(Res.get("shared.sendingConfirmationAgain")); statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
break; }, 10);
} break;
} else { case SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG:
log.warn("Trade contains error message {}", trade.getErrorMessage()); busyAnimation.stop();
statusLabel.setText(""); statusLabel.setText(Res.get("shared.messageArrived"));
break;
case SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG:
busyAnimation.stop();
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
break;
case SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG:
// We get a popup and the trade closed, so we dont need to show anything here
busyAnimation.stop();
statusLabel.setText("");
break;
case TRADE_COMPLETED:
if (!trade.isPayoutPublished()) log.warn("Payout is expected to be published for {} {} state {}", trade.getClass().getSimpleName(), trade.getId(), trade.getState());
busyAnimation.stop();
statusLabel.setText("");
break;
default:
log.warn("Unexpected case: State={}, tradeId={} " + state.name(), trade.getId());
busyAnimation.stop();
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
break;
} }
} }
}); });