set payment sent message state after sending message
This commit is contained in:
parent
fabec9d396
commit
c908294250
@ -486,7 +486,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
||||
synchronized (trade) {
|
||||
if (!trade.isInitialized() || trade.isShutDown()) return;
|
||||
if (trade.getPhase().ordinal() >= Trade.Phase.PAYMENT_SENT.ordinal()) {
|
||||
log.warn("Received another PaymentSentMessage which was already processed, ACKing");
|
||||
log.warn("Received another PaymentSentMessage which was already processed for {} {}, ACKing", trade.getClass().getSimpleName(), trade.getId());
|
||||
handleTaskRunnerSuccess(peer, message);
|
||||
return;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package haveno.core.trade.protocol.tasks;
|
||||
|
||||
import haveno.common.taskrunner.TaskRunner;
|
||||
import haveno.core.network.MessageState;
|
||||
import haveno.core.trade.Trade;
|
||||
import haveno.core.trade.messages.TradeMessage;
|
||||
import haveno.core.trade.protocol.TradePeer;
|
||||
@ -37,6 +38,30 @@ public class BuyerSendPaymentSentMessageToSeller extends BuyerSendPaymentSentMes
|
||||
return trade.getSeller();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStateSent() {
|
||||
trade.getProcessModel().setPaymentSentMessageState(MessageState.SENT);
|
||||
super.setStateSent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStateArrived() {
|
||||
trade.getProcessModel().setPaymentSentMessageState(MessageState.ARRIVED);
|
||||
super.setStateArrived();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStateStoredInMailbox() {
|
||||
trade.getProcessModel().setPaymentSentMessageState(MessageState.STORED_IN_MAILBOX);
|
||||
super.setStateStoredInMailbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStateFault() {
|
||||
trade.getProcessModel().setPaymentSentMessageState(MessageState.FAILED);
|
||||
super.setStateFault();
|
||||
}
|
||||
|
||||
// continue execution on fault so payment sent message is sent to arbitrator
|
||||
@Override
|
||||
protected void onFault(String errorMessage, TradeMessage message) {
|
||||
|
@ -194,18 +194,6 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageStatePropertyIfNotAcked(MessageState messageState) {
|
||||
|
||||
// skip if already acked
|
||||
if (messageStateProperty.get() == MessageState.ACKNOWLEDGED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trade != null) {
|
||||
trade.getProcessModel().setPaymentSentMessageState(messageState);
|
||||
}
|
||||
}
|
||||
|
||||
private void onMessageStateChanged(MessageState messageState) {
|
||||
messageStateProperty.set(messageState);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import haveno.common.UserThread;
|
||||
import haveno.common.app.DevEnv;
|
||||
import haveno.common.util.Tuple4;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.network.MessageState;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.payment.PaymentAccountUtil;
|
||||
@ -158,7 +157,6 @@ public class BuyerStep2View extends TradeStepView {
|
||||
case BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG:
|
||||
busyAnimation.play();
|
||||
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
||||
model.setMessageStatePropertyIfNotAcked(MessageState.SENT);
|
||||
timeoutTimer = UserThread.runAfter(() -> {
|
||||
busyAnimation.stop();
|
||||
statusLabel.setText(Res.get("shared.sendingConfirmationAgain"));
|
||||
@ -167,18 +165,15 @@ public class BuyerStep2View extends TradeStepView {
|
||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG:
|
||||
busyAnimation.stop();
|
||||
statusLabel.setText(Res.get("shared.messageStoredInMailbox"));
|
||||
model.setMessageStatePropertyIfNotAcked(MessageState.STORED_IN_MAILBOX);
|
||||
break;
|
||||
case SELLER_RECEIVED_PAYMENT_SENT_MSG:
|
||||
busyAnimation.stop();
|
||||
statusLabel.setText(Res.get("shared.messageArrived"));
|
||||
model.setMessageStatePropertyIfNotAcked(MessageState.ARRIVED);
|
||||
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.setMessageStatePropertyIfNotAcked(MessageState.FAILED);
|
||||
break;
|
||||
default:
|
||||
log.warn("Unexpected case: State={}, tradeId={} ", state.name(), trade.getId());
|
||||
|
Loading…
Reference in New Issue
Block a user