resend payment sent/received messages on startup if not arrived

This commit is contained in:
woodser 2023-01-12 15:14:30 -05:00
parent 21fcdc7e00
commit 5db80eac17
2 changed files with 4 additions and 6 deletions

View file

@ -54,11 +54,10 @@ public class BuyerProtocol extends DisputeProtocol {
super.onInitialized(); super.onInitialized();
// re-send payment sent message if not arrived // re-send payment sent message if not arrived
if (trade.getState() == Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG || trade.getState() == Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG) {
synchronized (trade) { synchronized (trade) {
if (trade.getState().ordinal() >= Trade.State.BUYER_CONFIRMED_IN_UI_PAYMENT_SENT.ordinal() && trade.getState().ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG.ordinal()) {
latchTrade(); latchTrade();
given(anyPhase(Trade.Phase.PAYMENT_SENT) given(anyPhase(Trade.Phase.PAYMENT_SENT)
.anyState(Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG, Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG)
.with(BuyerEvent.STARTUP)) .with(BuyerEvent.STARTUP))
.setup(tasks( .setup(tasks(
BuyerSendPaymentSentMessageToSeller.class, BuyerSendPaymentSentMessageToSeller.class,

View file

@ -50,11 +50,10 @@ public class SellerProtocol extends DisputeProtocol {
super.onInitialized(); super.onInitialized();
// re-send payment received message if not arrived // re-send payment received message if not arrived
if (trade.getState() == Trade.State.SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG || trade.getState() == Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG) {
synchronized (trade) { synchronized (trade) {
if (trade.getState().ordinal() >= Trade.State.SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT.ordinal() && trade.getState().ordinal() <= Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG.ordinal()) {
latchTrade(); latchTrade();
given(anyPhase(Trade.Phase.PAYMENT_RECEIVED) given(anyPhase(Trade.Phase.PAYMENT_RECEIVED)
.anyState(Trade.State.SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG, Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG)
.with(SellerEvent.STARTUP)) .with(SellerEvent.STARTUP))
.setup(tasks( .setup(tasks(
SellerSendPaymentReceivedMessageToBuyer.class, SellerSendPaymentReceivedMessageToBuyer.class,