diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java index c03987aa9d2..186a6e5cbbe 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java @@ -41,6 +41,7 @@ import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; @@ -76,6 +77,11 @@ public class TakeBuyBTCOfferWithNationalBankAcctTest extends AbstractTradeTest { private static PaymentAccount alicesPaymentAccount; private static PaymentAccount bobsPaymentAccount; + @BeforeAll + public static void setUp() { + setUp(false); + } + @Test @Order(1) public void testTakeAlicesBuyOffer(final TestInfo testInfo) { @@ -156,13 +162,19 @@ public void testBankAcctDetailsIncludedInContracts(final TestInfo testInfo) { assertNotNull(alicesPaymentAccount); assertNotNull(bobsPaymentAccount); - var alicesContract = aliceClient.getTrade(tradeId).getContractAsJson(); - verifyJsonContractIncludesBankAccountDetails(alicesContract, alicesPaymentAccount); - verifyJsonContractIncludesBankAccountDetails(alicesContract, bobsPaymentAccount); - - var bobsContract = bobClient.getTrade(tradeId).getContractAsJson(); - verifyJsonContractIncludesBankAccountDetails(bobsContract, alicesPaymentAccount); - verifyJsonContractIncludesBankAccountDetails(bobsContract, bobsPaymentAccount); + var alicesTrade = aliceClient.getTrade(tradeId); + assertNotEquals("", alicesTrade.getContract().getMakerPaymentAccountPayload().getPaymentDetails()); + assertNotEquals("", alicesTrade.getContract().getTakerPaymentAccountPayload().getPaymentDetails()); + var alicesContractJson = alicesTrade.getContractAsJson(); + verifyJsonContractIncludesBankAccountDetails(alicesContractJson, alicesPaymentAccount); + verifyJsonContractIncludesBankAccountDetails(alicesContractJson, bobsPaymentAccount); + + var bobsTrade = bobClient.getTrade(tradeId); + assertNotEquals("", bobsTrade.getContract().getMakerPaymentAccountPayload().getPaymentDetails()); + assertNotEquals("", bobsTrade.getContract().getTakerPaymentAccountPayload().getPaymentDetails()); + var bobsContractJson = bobsTrade.getContractAsJson(); + verifyJsonContractIncludesBankAccountDetails(bobsContractJson, alicesPaymentAccount); + verifyJsonContractIncludesBankAccountDetails(bobsContractJson, bobsPaymentAccount); } @Test @@ -207,7 +219,7 @@ public void testBobsConfirmPaymentReceived(final TestInfo testInfo) { @Test @Order(5) - public void testKeepFunds(final TestInfo testInfo) { + public void testCloseTrade(final TestInfo testInfo) { try { genBtcBlocksThenWait(1, 1_000); diff --git a/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java b/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java index cfe7e74e4aa..3631e6f6cec 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java +++ b/apitest/src/test/java/bisq/apitest/scenario/TradeTest.java @@ -88,7 +88,7 @@ public void testTakeBuyBTCOfferWithNationalBankAcct(final TestInfo testInfo) { test.testBankAcctDetailsIncludedInContracts(testInfo); test.testAlicesConfirmPaymentStarted(testInfo); test.testBobsConfirmPaymentReceived(testInfo); - test.testKeepFunds(testInfo); + test.testCloseTrade(testInfo); } @Test diff --git a/core/src/main/java/bisq/core/api/model/PaymentAccountPayloadInfo.java b/core/src/main/java/bisq/core/api/model/PaymentAccountPayloadInfo.java index a429a4344c9..a7d06947225 100644 --- a/core/src/main/java/bisq/core/api/model/PaymentAccountPayloadInfo.java +++ b/core/src/main/java/bisq/core/api/model/PaymentAccountPayloadInfo.java @@ -37,13 +37,17 @@ public class PaymentAccountPayloadInfo implements Payload { private final String paymentMethodId; @Nullable private final String address; + @Nullable + private final String paymentDetails; public PaymentAccountPayloadInfo(String id, String paymentMethodId, - @Nullable String address) { + @Nullable String address, + @Nullable String paymentDetails) { this.id = id; this.paymentMethodId = paymentMethodId; this.address = address; + this.paymentDetails = paymentDetails; } public static PaymentAccountPayloadInfo toPaymentAccountPayloadInfo( @@ -57,21 +61,30 @@ public static PaymentAccountPayloadInfo toPaymentAccountPayloadInfo( else if (paymentAccountPayload instanceof InstantCryptoCurrencyPayload) address = Optional.of(((InstantCryptoCurrencyPayload) paymentAccountPayload).getAddress()); + String prettyPaymentDetails = paymentAccountPayload.getPaymentDetailsForTradePopup(); + Optional paymentDetails = prettyPaymentDetails.isBlank() + ? Optional.empty() + : Optional.of(prettyPaymentDetails); + return new PaymentAccountPayloadInfo(paymentAccountPayload.getId(), paymentAccountPayload.getPaymentMethodId(), - address.orElse("")); + address.orElse(""), + paymentDetails.orElse("")); } // For transmitting TradeInfo messages when the contract or the contract's payload is not yet available. public static Supplier emptyPaymentAccountPayload = () -> - new PaymentAccountPayloadInfo("", "", ""); + new PaymentAccountPayloadInfo("", "", "", ""); /////////////////////////////////////////////////////////////////////////////////////////// // PROTO BUFFER /////////////////////////////////////////////////////////////////////////////////////////// public static PaymentAccountPayloadInfo fromProto(bisq.proto.grpc.PaymentAccountPayloadInfo proto) { - return new PaymentAccountPayloadInfo(proto.getId(), proto.getPaymentMethodId(), proto.getAddress()); + return new PaymentAccountPayloadInfo(proto.getId(), + proto.getPaymentMethodId(), + proto.getAddress(), + proto.getPaymentDetails()); } @Override @@ -80,6 +93,7 @@ public bisq.proto.grpc.PaymentAccountPayloadInfo toProtoMessage() { .setId(id) .setPaymentMethodId(paymentMethodId) .setAddress(address != null ? address : "") + .setPaymentDetails(paymentDetails != null ? paymentDetails : "") .build(); } } diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index 2ec72b559ce..b0277a5e250 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -667,6 +667,7 @@ message PaymentAccountPayloadInfo { string id = 1; // The unique identifier of the payment account. string payment_method_id = 2; // The unique identifier of the payment method. string address = 3; // The optional altcoin wallet address associated with the (altcoin) payment account. + string payment_details = 4; // The optional payment details, if available. } message TxFeeRateInfo {