mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-02 14:46:22 -04:00
UI cleanup, can confirm payment sent and received after dispute opened
show buyer and seller trade fee in dispute summary window remove "Error polling trade wallet warning" if disconnected show notification when dispute opened or closed in legacy app resolve disputes under Support > Arbitration, hide other views show "support ticket opened" when dispute request is acked rename all variations of TradingPeer to TradePeer rename "payment started" to "payment sent" for consistency
This commit is contained in:
parent
a50e151c98
commit
aafb47e2ce
112 changed files with 527 additions and 567 deletions
|
@ -136,7 +136,7 @@ public class AbstractTradeTest extends AbstractOfferTest {
|
|||
// it might be AVAILABLE, not OFFER_FEE_RESERVED.
|
||||
EXPECTED_PROTOCOL_STATUS.setState(BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG)
|
||||
.setPhase(PAYMENT_SENT)
|
||||
.setPaymentStartedMessageSent(true);
|
||||
.setPaymentSentMessageSent(true);
|
||||
verifyExpectedProtocolStatus(trade);
|
||||
logTrade(log, testInfo, userName + "'s view after confirming trade payment sent", trade);
|
||||
break;
|
||||
|
@ -185,7 +185,7 @@ public class AbstractTradeTest extends AbstractOfferTest {
|
|||
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositPublished, trade.getIsDepositsPublished());
|
||||
|
||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositConfirmed, trade.getIsDepositsUnlocked());
|
||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentStartedMessageSent, trade.getIsPaymentSent());
|
||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentSentMessageSent, trade.getIsPaymentSent());
|
||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentReceivedMessageSent, trade.getIsPaymentReceived());
|
||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isPayoutPublished, trade.getIsPayoutPublished());
|
||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isCompleted, trade.getIsCompleted());
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ExpectedProtocolStatus {
|
|||
Trade.Phase phase;
|
||||
boolean isDepositPublished;
|
||||
boolean isDepositConfirmed;
|
||||
boolean isPaymentStartedMessageSent;
|
||||
boolean isPaymentSentMessageSent;
|
||||
boolean isPaymentReceivedMessageSent;
|
||||
boolean isPayoutPublished;
|
||||
boolean isCompleted;
|
||||
|
@ -36,8 +36,8 @@ public class ExpectedProtocolStatus {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ExpectedProtocolStatus setPaymentStartedMessageSent(boolean paymentStartedMessageSent) {
|
||||
isPaymentStartedMessageSent = paymentStartedMessageSent;
|
||||
public ExpectedProtocolStatus setPaymentSentMessageSent(boolean paymentSentMessageSent) {
|
||||
isPaymentSentMessageSent = paymentSentMessageSent;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ExpectedProtocolStatus {
|
|||
phase = null;
|
||||
isDepositPublished = false;
|
||||
isDepositConfirmed = false;
|
||||
isPaymentStartedMessageSent = false;
|
||||
isPaymentSentMessageSent = false;
|
||||
isPaymentReceivedMessageSent = false;
|
||||
isPayoutPublished = false;
|
||||
isCompleted = false;
|
||||
|
|
|
@ -87,11 +87,11 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) {
|
||||
public void testAlicesConfirmPaymentSent(final TestInfo testInfo) {
|
||||
try {
|
||||
var trade = aliceClient.getTrade(tradeId);
|
||||
waitForDepositUnlocked(log, testInfo, aliceClient, trade.getTradeId());
|
||||
aliceClient.confirmPaymentStarted(trade.getTradeId());
|
||||
aliceClient.confirmPaymentSent(trade.getTradeId());
|
||||
sleep(6_000);
|
||||
waitForBuyerSeesPaymentInitiatedMessage(log, testInfo, aliceClient, tradeId);
|
||||
} catch (StatusRuntimeException e) {
|
||||
|
|
|
@ -173,11 +173,11 @@ public class TakeBuyBTCOfferWithNationalBankAcctTest extends AbstractTradeTest {
|
|||
|
||||
@Test
|
||||
@Order(3)
|
||||
public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) {
|
||||
public void testAlicesConfirmPaymentSent(final TestInfo testInfo) {
|
||||
try {
|
||||
var trade = aliceClient.getTrade(tradeId);
|
||||
waitForDepositUnlocked(log, testInfo, aliceClient, trade.getTradeId());
|
||||
aliceClient.confirmPaymentStarted(trade.getTradeId());
|
||||
aliceClient.confirmPaymentSent(trade.getTradeId());
|
||||
sleep(6_000);
|
||||
waitForBuyerSeesPaymentInitiatedMessage(log, testInfo, aliceClient, tradeId);
|
||||
trade = aliceClient.getTrade(tradeId);
|
||||
|
|
|
@ -95,13 +95,13 @@ public class TakeBuyXMROfferTest extends AbstractTradeTest {
|
|||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void testBobsConfirmPaymentStarted(final TestInfo testInfo) {
|
||||
public void testBobsConfirmPaymentSent(final TestInfo testInfo) {
|
||||
try {
|
||||
var trade = bobClient.getTrade(tradeId);
|
||||
|
||||
verifyTakerDepositConfirmed(trade);
|
||||
log.debug("Bob sends XMR payment to Alice for trade {}", trade.getTradeId());
|
||||
bobClient.confirmPaymentStarted(trade.getTradeId());
|
||||
bobClient.confirmPaymentSent(trade.getTradeId());
|
||||
sleep(3500);
|
||||
waitForBuyerSeesPaymentInitiatedMessage(log, testInfo, bobClient, tradeId);
|
||||
|
||||
|
|
|
@ -96,11 +96,11 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void testBobsConfirmPaymentStarted(final TestInfo testInfo) {
|
||||
public void testBobsConfirmPaymentSent(final TestInfo testInfo) {
|
||||
try {
|
||||
var trade = bobClient.getTrade(tradeId);
|
||||
verifyTakerDepositConfirmed(trade);
|
||||
bobClient.confirmPaymentStarted(tradeId);
|
||||
bobClient.confirmPaymentSent(tradeId);
|
||||
sleep(6_000);
|
||||
waitForBuyerSeesPaymentInitiatedMessage(log, testInfo, bobClient, tradeId);
|
||||
} catch (StatusRuntimeException e) {
|
||||
|
|
|
@ -103,12 +103,12 @@ public class TakeSellXMROfferTest extends AbstractTradeTest {
|
|||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) {
|
||||
public void testAlicesConfirmPaymentSent(final TestInfo testInfo) {
|
||||
try {
|
||||
var trade = aliceClient.getTrade(tradeId);
|
||||
waitForDepositUnlocked(log, testInfo, aliceClient, trade.getTradeId());
|
||||
log.debug("Alice sends XMR payment to Bob for trade {}", trade.getTradeId());
|
||||
aliceClient.confirmPaymentStarted(trade.getTradeId());
|
||||
aliceClient.confirmPaymentSent(trade.getTradeId());
|
||||
sleep(3500);
|
||||
|
||||
waitForBuyerSeesPaymentInitiatedMessage(log, testInfo, aliceClient, tradeId);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class LongRunningTradesTest extends AbstractTradeTest {
|
|||
TakeBuyBTCOfferTest test = new TakeBuyBTCOfferTest();
|
||||
setLongRunningTest(true);
|
||||
test.testTakeAlicesBuyOffer(testInfo);
|
||||
test.testAlicesConfirmPaymentStarted(testInfo);
|
||||
test.testAlicesConfirmPaymentSent(testInfo);
|
||||
test.testBobsConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class LongRunningTradesTest extends AbstractTradeTest {
|
|||
TakeSellBTCOfferTest test = new TakeSellBTCOfferTest();
|
||||
setLongRunningTest(true);
|
||||
test.testTakeAlicesSellOffer(testInfo);
|
||||
test.testBobsConfirmPaymentStarted(testInfo);
|
||||
test.testBobsConfirmPaymentSent(testInfo);
|
||||
test.testAlicesConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TradeTest extends AbstractTradeTest {
|
|||
public void testTakeBuyBTCOffer(final TestInfo testInfo) {
|
||||
TakeBuyBTCOfferTest test = new TakeBuyBTCOfferTest();
|
||||
test.testTakeAlicesBuyOffer(testInfo);
|
||||
test.testAlicesConfirmPaymentStarted(testInfo);
|
||||
test.testAlicesConfirmPaymentSent(testInfo);
|
||||
test.testBobsConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class TradeTest extends AbstractTradeTest {
|
|||
public void testTakeSellBTCOffer(final TestInfo testInfo) {
|
||||
TakeSellBTCOfferTest test = new TakeSellBTCOfferTest();
|
||||
test.testTakeAlicesSellOffer(testInfo);
|
||||
test.testBobsConfirmPaymentStarted(testInfo);
|
||||
test.testBobsConfirmPaymentSent(testInfo);
|
||||
test.testAlicesConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class TradeTest extends AbstractTradeTest {
|
|||
TakeBuyBTCOfferWithNationalBankAcctTest test = new TakeBuyBTCOfferWithNationalBankAcctTest();
|
||||
test.testTakeAlicesBuyOffer(testInfo);
|
||||
test.testBankAcctDetailsIncludedInContracts(testInfo);
|
||||
test.testAlicesConfirmPaymentStarted(testInfo);
|
||||
test.testAlicesConfirmPaymentSent(testInfo);
|
||||
test.testBobsConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class TradeTest extends AbstractTradeTest {
|
|||
TakeBuyXMROfferTest test = new TakeBuyXMROfferTest();
|
||||
TakeBuyXMROfferTest.createXmrPaymentAccounts();
|
||||
test.testTakeAlicesSellBTCForXMROffer(testInfo);
|
||||
test.testBobsConfirmPaymentStarted(testInfo);
|
||||
test.testBobsConfirmPaymentSent(testInfo);
|
||||
test.testAlicesConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class TradeTest extends AbstractTradeTest {
|
|||
TakeSellXMROfferTest test = new TakeSellXMROfferTest();
|
||||
TakeBuyXMROfferTest.createXmrPaymentAccounts();
|
||||
test.testTakeAlicesBuyBTCForXMROffer(testInfo);
|
||||
test.testAlicesConfirmPaymentStarted(testInfo);
|
||||
test.testAlicesConfirmPaymentSent(testInfo);
|
||||
test.testBobsConfirmPaymentReceived(testInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ public class BotClient {
|
|||
* @param tradeId a valid trade id
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isTradePaymentStartedSent(String tradeId) {
|
||||
public boolean isTradePaymentSentSent(String tradeId) {
|
||||
return grpcClient.getTrade(tradeId).getIsPaymentSent();
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,8 @@ public class BotClient {
|
|||
* or throws an exception.
|
||||
* @param tradeId
|
||||
*/
|
||||
public void sendConfirmPaymentStartedMessage(String tradeId) {
|
||||
grpcClient.confirmPaymentStarted(tradeId);
|
||||
public void sendConfirmPaymentSentMessage(String tradeId) {
|
||||
grpcClient.confirmPaymentSent(tradeId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -124,10 +124,10 @@ public abstract class BotProtocol {
|
|||
return trade;
|
||||
};
|
||||
|
||||
protected final Function<TradeInfo, TradeInfo> waitForPaymentStartedMessage = (trade) -> {
|
||||
initProtocolStep.accept(WAIT_FOR_PAYMENT_STARTED_MESSAGE);
|
||||
protected final Function<TradeInfo, TradeInfo> waitForPaymentSentMessage = (trade) -> {
|
||||
initProtocolStep.accept(WAIT_FOR_PAYMENT_SENT_MESSAGE);
|
||||
try {
|
||||
createPaymentStartedScript(trade);
|
||||
createPaymentSentScript(trade);
|
||||
log.info(" Waiting for a 'payment started' message from buyer for trade with id {}.", trade.getTradeId());
|
||||
while (isWithinProtocolStepTimeLimit()) {
|
||||
checkIfShutdownCalled("Interrupted before checking if 'payment started' message has been sent.");
|
||||
|
@ -152,10 +152,10 @@ public abstract class BotProtocol {
|
|||
}
|
||||
};
|
||||
|
||||
protected final Function<TradeInfo, TradeInfo> sendPaymentStartedMessage = (trade) -> {
|
||||
initProtocolStep.accept(SEND_PAYMENT_STARTED_MESSAGE);
|
||||
protected final Function<TradeInfo, TradeInfo> sendPaymentSentMessage = (trade) -> {
|
||||
initProtocolStep.accept(SEND_PAYMENT_SENT_MESSAGE);
|
||||
checkIfShutdownCalled("Interrupted before sending 'payment started' message.");
|
||||
this.getBotClient().sendConfirmPaymentStartedMessage(trade.getTradeId());
|
||||
this.getBotClient().sendConfirmPaymentSentMessage(trade.getTradeId());
|
||||
return trade;
|
||||
};
|
||||
|
||||
|
@ -222,8 +222,8 @@ public abstract class BotProtocol {
|
|||
}
|
||||
};
|
||||
|
||||
protected void createPaymentStartedScript(TradeInfo trade) {
|
||||
File script = bashScriptGenerator.createPaymentStartedScript(trade);
|
||||
protected void createPaymentSentScript(TradeInfo trade) {
|
||||
File script = bashScriptGenerator.createPaymentSentScript(trade);
|
||||
printCliHintAndOrScript(script, "The manual CLI side can send a 'payment started' message");
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ public class MakerBotProtocol extends BotProtocol {
|
|||
|
||||
var makerIsBuyer = trade.getOffer().getDirection().equalsIgnoreCase(BUY);
|
||||
Function<TradeInfo, TradeInfo> completeFiatTransaction = makerIsBuyer
|
||||
? sendPaymentStartedMessage.andThen(waitForPaymentReceivedConfirmation)
|
||||
: waitForPaymentStartedMessage.andThen(sendPaymentReceivedMessage);
|
||||
? sendPaymentSentMessage.andThen(waitForPaymentReceivedConfirmation)
|
||||
: waitForPaymentSentMessage.andThen(sendPaymentReceivedMessage);
|
||||
completeFiatTransaction.apply(trade);
|
||||
|
||||
currentProtocolStep = DONE;
|
||||
|
|
|
@ -7,8 +7,8 @@ public enum ProtocolStep {
|
|||
WAIT_FOR_OFFER_TAKER,
|
||||
WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED,
|
||||
WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED,
|
||||
SEND_PAYMENT_STARTED_MESSAGE,
|
||||
WAIT_FOR_PAYMENT_STARTED_MESSAGE,
|
||||
SEND_PAYMENT_SENT_MESSAGE,
|
||||
WAIT_FOR_PAYMENT_SENT_MESSAGE,
|
||||
SEND_PAYMENT_RECEIVED_CONFIRMATION_MESSAGE,
|
||||
WAIT_FOR_PAYMENT_RECEIVED_CONFIRMATION_MESSAGE,
|
||||
WAIT_FOR_PAYOUT_TX,
|
||||
|
|
|
@ -52,8 +52,8 @@ public class TakerBotProtocol extends BotProtocol {
|
|||
|
||||
var takerIsSeller = trade.getOffer().getDirection().equalsIgnoreCase(BUY);
|
||||
Function<TradeInfo, TradeInfo> completeFiatTransaction = takerIsSeller
|
||||
? waitForPaymentStartedMessage.andThen(sendPaymentReceivedMessage)
|
||||
: sendPaymentStartedMessage.andThen(waitForPaymentReceivedConfirmation);
|
||||
? waitForPaymentSentMessage.andThen(sendPaymentReceivedMessage)
|
||||
: sendPaymentSentMessage.andThen(waitForPaymentReceivedConfirmation);
|
||||
completeFiatTransaction.apply(trade);
|
||||
|
||||
currentProtocolStep = DONE;
|
||||
|
|
|
@ -140,34 +140,34 @@ public class BashScriptGenerator {
|
|||
getTradeCmd);
|
||||
}
|
||||
|
||||
public File createPaymentStartedScript(TradeInfo trade) {
|
||||
String paymentStartedCmd = format("%s confirmpaymentstarted --trade-id=%s",
|
||||
public File createPaymentSentScript(TradeInfo trade) {
|
||||
String paymentSentCmd = format("%s confirmpaymentsent --trade-id=%s",
|
||||
cliBase,
|
||||
trade.getTradeId());
|
||||
String getTradeCmd = format("%s gettrade --trade-id=%s", cliBase, trade.getTradeId());
|
||||
return createCliScript("confirmpaymentstarted.sh",
|
||||
paymentStartedCmd,
|
||||
return createCliScript("confirmpaymentsent.sh",
|
||||
paymentSentCmd,
|
||||
"sleep 2",
|
||||
getTradeCmd);
|
||||
}
|
||||
|
||||
public File createPaymentReceivedScript(TradeInfo trade) {
|
||||
String paymentStartedCmd = format("%s confirmpaymentreceived --trade-id=%s",
|
||||
String paymentSentCmd = format("%s confirmpaymentreceived --trade-id=%s",
|
||||
cliBase,
|
||||
trade.getTradeId());
|
||||
String getTradeCmd = format("%s gettrade --trade-id=%s", cliBase, trade.getTradeId());
|
||||
return createCliScript("confirmpaymentreceived.sh",
|
||||
paymentStartedCmd,
|
||||
paymentSentCmd,
|
||||
"sleep 2",
|
||||
getTradeCmd);
|
||||
}
|
||||
|
||||
public File createKeepFundsScript(TradeInfo trade) {
|
||||
String paymentStartedCmd = format("%s closetrade --trade-id=%s", cliBase, trade.getTradeId());
|
||||
String paymentSentCmd = format("%s closetrade --trade-id=%s", cliBase, trade.getTradeId());
|
||||
String getTradeCmd = format("%s gettrade --trade-id=%s", cliBase, trade.getTradeId());
|
||||
String getBalanceCmd = format("%s getbalance", cliBase);
|
||||
return createCliScript("closetrade.sh",
|
||||
paymentStartedCmd,
|
||||
paymentSentCmd,
|
||||
"sleep 2",
|
||||
getTradeCmd,
|
||||
getBalanceCmd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue