Adjust to grpc.proto TradeInfo field name changes

See commit b9b66b4826.
This commit is contained in:
ghubstan 2022-02-27 18:13:54 -03:00
parent b9b66b4826
commit 82a0f0060c
No known key found for this signature in database
GPG Key ID: E35592D6800A861E
9 changed files with 57 additions and 59 deletions

View File

@ -133,7 +133,7 @@ public class AbstractTradeTest extends AbstractOfferTest {
String userName = toUserName.apply(grpcClient);
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
TradeInfo trade = grpcClient.getTrade(tradeId);
if (!trade.getIsFiatSent()) {
if (!trade.getIsPaymentStartedMessageSent()) {
log.warn("{} still waiting for trade {} {}, attempt # {}",
userName,
trade.getShortId(),
@ -194,10 +194,10 @@ public class AbstractTradeTest extends AbstractOfferTest {
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositPublished, trade.getIsDepositPublished());
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositConfirmed, trade.getIsDepositConfirmed());
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatSent, trade.getIsFiatSent());
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatReceived, trade.getIsFiatReceived());
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatSent, trade.getIsPaymentStartedMessageSent());
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatReceived, trade.getIsPaymentReceivedMessageSent());
assertEquals(EXPECTED_PROTOCOL_STATUS.isPayoutPublished, trade.getIsPayoutPublished());
assertEquals(EXPECTED_PROTOCOL_STATUS.isWithdrawn, trade.getIsWithdrawn());
assertEquals(EXPECTED_PROTOCOL_STATUS.isWithdrawn, trade.getIsCompleted());
}
protected final void sendBsqPayment(Logger log,

View File

@ -243,7 +243,7 @@ public class BotClient {
* @return boolean
*/
public boolean isTradePaymentStartedSent(String tradeId) {
return grpcClient.getTrade(tradeId).getIsFiatSent();
return grpcClient.getTrade(tradeId).getIsPaymentStartedMessageSent();
}
/**
@ -252,7 +252,7 @@ public class BotClient {
* @return boolean
*/
public boolean isTradePaymentReceivedConfirmationSent(String tradeId) {
return grpcClient.getTrade(tradeId).getIsFiatReceived();
return grpcClient.getTrade(tradeId).getIsPaymentReceivedMessageSent();
}
/**

View File

@ -133,7 +133,7 @@ public abstract class BotProtocol {
checkIfShutdownCalled("Interrupted before checking if 'payment started' message has been sent.");
try {
var t = this.getBotClient().getTrade(trade.getTradeId());
if (t.getIsFiatSent()) {
if (t.getIsPaymentStartedMessageSent()) {
log.info("Buyer has started payment for trade:\n{}",
new TableBuilder(TRADE_DETAIL_TBL, t).build().toString());
return t;
@ -168,7 +168,7 @@ public abstract class BotProtocol {
checkIfShutdownCalled("Interrupted before checking if 'payment received confirmation' message has been sent.");
try {
var t = this.getBotClient().getTrade(trade.getTradeId());
if (t.getIsFiatReceived()) {
if (t.getIsPaymentReceivedMessageSent()) {
log.info("Seller has received payment for trade:\n{}",
new TableBuilder(TRADE_DETAIL_TBL, t).build().toString());
return t;

View File

@ -88,16 +88,15 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
@Nullable
protected final Column<Boolean> colIsPayoutPublished;
@Nullable
protected final Column<Boolean> colIsFundsWithdrawn;
protected final Column<Boolean> colIsCompleted;
@Nullable
protected final Column<Long> colBisqTradeFee;
@Nullable
protected final Column<String> colTradeCost;
//protected final Column<Long> colTradeCost;
@Nullable
protected final Column<Boolean> colIsPaymentSent;
protected final Column<Boolean> colIsPaymentStartedMessageSent;
@Nullable
protected final Column<Boolean> colIsPaymentReceived;
protected final Column<Boolean> colIsPaymentReceivedMessageSent;
@Nullable
protected final Column<String> colAltcoinReceiveAddressColumn;
@ -139,11 +138,11 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
this.colIsDepositPublished = colSupplier.depositPublishedColumn.get();
this.colIsDepositConfirmed = colSupplier.depositConfirmedColumn.get();
this.colIsPayoutPublished = colSupplier.payoutPublishedColumn.get();
this.colIsFundsWithdrawn = colSupplier.fundsWithdrawnColumn.get();
this.colIsCompleted = colSupplier.fundsWithdrawnColumn.get();
this.colBisqTradeFee = colSupplier.bisqTradeDetailFeeColumn.get();
this.colTradeCost = colSupplier.tradeCostColumn.get();
this.colIsPaymentSent = colSupplier.paymentSentColumn.get();
this.colIsPaymentReceived = colSupplier.paymentReceivedColumn.get();
this.colIsPaymentStartedMessageSent = colSupplier.paymentStartedMessageSentColumn.get();
this.colIsPaymentReceivedMessageSent = colSupplier.paymentReceivedMessageSentColumn.get();
//noinspection ConstantConditions
this.colAltcoinReceiveAddressColumn = colSupplier.altcoinReceiveAddressColumn.get();

View File

@ -83,10 +83,10 @@ class TradeDetailTableBuilder extends AbstractTradeListBuilder {
colIsDepositPublished.addRow(trade.getIsDepositPublished());
colIsDepositConfirmed.addRow(trade.getIsDepositConfirmed());
colTradeCost.addRow(toTradeVolumeAsString.apply(trade));
colIsPaymentSent.addRow(trade.getIsFiatSent());
colIsPaymentReceived.addRow(trade.getIsFiatReceived());
colIsPaymentStartedMessageSent.addRow(trade.getIsPaymentStartedMessageSent());
colIsPaymentReceivedMessageSent.addRow(trade.getIsPaymentReceivedMessageSent());
colIsPayoutPublished.addRow(trade.getIsPayoutPublished());
colIsFundsWithdrawn.addRow(trade.getIsWithdrawn());
colIsCompleted.addRow(trade.getIsCompleted());
if (colAltcoinReceiveAddressColumn != null)
colAltcoinReceiveAddressColumn.addRow(toAltcoinReceiveAddress.apply(trade));
}
@ -126,10 +126,10 @@ class TradeDetailTableBuilder extends AbstractTradeListBuilder {
add(colIsDepositPublished.asStringColumn());
add(colIsDepositConfirmed.asStringColumn());
add(colTradeCost.justify());
add(colIsPaymentSent.asStringColumn());
add(colIsPaymentReceived.asStringColumn());
add(colIsPaymentStartedMessageSent.asStringColumn());
add(colIsPaymentReceivedMessageSent.asStringColumn());
add(colIsPayoutPublished.asStringColumn());
add(colIsFundsWithdrawn.asStringColumn());
add(colIsCompleted.asStringColumn());
}};
if (colAltcoinReceiveAddressColumn != null)

View File

@ -226,7 +226,7 @@ class TradeTableColumnSupplier {
? t.getOffer().getCounterCurrencyCode()
: t.getOffer().getBaseCurrencyCode();
final Supplier<Column<Boolean>> paymentSentColumn = () -> {
final Supplier<Column<Boolean>> paymentStartedMessageSentColumn = () -> {
if (isTradeDetailTblBuilder.get()) {
String headerCurrencyCode = toPaymentCurrencyCode.apply(firstRow.get());
String colHeader = format(COL_HEADER_TRADE_PAYMENT_SENT, headerCurrencyCode);
@ -236,7 +236,7 @@ class TradeTableColumnSupplier {
}
};
final Supplier<Column<Boolean>> paymentReceivedColumn = () -> {
final Supplier<Column<Boolean>> paymentReceivedMessageSentColumn = () -> {
if (isTradeDetailTblBuilder.get()) {
String headerCurrencyCode = toPaymentCurrencyCode.apply(firstRow.get());
String colHeader = format(COL_HEADER_TRADE_PAYMENT_RECEIVED, headerCurrencyCode);

View File

@ -60,10 +60,10 @@ public class CanceledTradeInfo {
.withTradePeriodState("") // Ignored
.withIsDepositPublished(false) // Ignored
.withIsDepositConfirmed(false) // Ignored
.withIsFiatSent(false) // Ignored
.withIsFiatReceived(false) // Ignored
.withIsPaymentStartedMessageSent(false) // Ignored
.withIsPaymentReceivedMessageSent(false) // Ignored
.withIsPayoutPublished(false) // Ignored
.withIsWithdrawn(false) // Ignored
.withIsCompleted(false) // Ignored
.withContractAsJson("") // Ignored
.withContract(emptyContract.get()) // Ignored
.withClosingStatus(capitalize(CANCELED.name().toLowerCase()))

View File

@ -87,10 +87,10 @@ public class TradeInfo implements Payload {
private final String tradePeriodState;
private final boolean isDepositPublished;
private final boolean isDepositConfirmed;
private final boolean isFiatSent;
private final boolean isFiatReceived;
private final boolean isPaymentStartedMessageSent;
private final boolean isPaymentReceivedMessageSent;
private final boolean isPayoutPublished;
private final boolean isWithdrawn;
private final boolean isCompleted;
private final String contractAsJson;
private final ContractInfo contract;
// Optional BSQ swap trade protocol details (post v1).
@ -118,10 +118,10 @@ public class TradeInfo implements Payload {
this.tradePeriodState = builder.getTradePeriodState();
this.isDepositPublished = builder.isDepositPublished();
this.isDepositConfirmed = builder.isDepositConfirmed();
this.isFiatSent = builder.isFiatSent();
this.isFiatReceived = builder.isFiatReceived();
this.isPaymentStartedMessageSent = builder.isPaymentStartedMessageSent();
this.isPaymentReceivedMessageSent = builder.isPaymentReceivedMessageSent();
this.isPayoutPublished = builder.isPayoutPublished();
this.isWithdrawn = builder.isWithdrawn();
this.isCompleted = builder.isCompleted();
this.contractAsJson = builder.getContractAsJson();
this.contract = builder.getContract();
this.bsqSwapTradeInfo = null;
@ -172,19 +172,19 @@ public class TradeInfo implements Payload {
.withShortId(bsqSwapTrade.getShortId())
.withDate(bsqSwapTrade.getDate().getTime())
.withRole(role == null ? "" : role)
.withIsCurrencyForTakerFeeBtc(false) // BSQ Swap fees always paid in BSQ.
.withIsCurrencyForTakerFeeBtc(false) // BSQ Swap fee is always paid in BSQ.
.withTxFeeAsLong(txFeeInBtc)
.withTakerFeeAsLong(takerFeeInBsq)
// N/A for bsq-swaps: .withTakerFeeTxId(""), .withDepositTxId(""), .withPayoutTxId("")
// N/A for bsq-swaps: takerFeeTxId, depositTxId, payoutTxId
.withTradeAmountAsLong(bsqSwapTrade.getAmountAsLong())
.withTradePrice(toPreciseTradePrice.apply(bsqSwapTrade))
.withTradeVolume(toRoundedVolume.apply(bsqSwapTrade))
.withTradingPeerNodeAddress(toPeerNodeAddress.apply(bsqSwapTrade))
.withState(bsqSwapTrade.getTradeState().name())
.withPhase(bsqSwapTrade.getTradePhase().name())
// N/A for bsq-swaps: .withTradePeriodState(""), .withIsDepositPublished(false), .withIsDepositConfirmed(false)
// N/A for bsq-swaps: .withIsFiatSent(false), .withIsFiatReceived(false), .withIsPayoutPublished(false)
// N/A for bsq-swaps: .withIsWithdrawn(false), .withContractAsJson(""), .withContract(null)
// N/A for bsq-swaps: tradePeriodState, isDepositPublished, isDepositConfirmed
// N/A for bsq-swaps: isPaymentStartedMessageSent, isPaymentReceivedMessageSent, isPayoutPublished
// N/A for bsq-swaps: isCompleted, contractAsJson, contract
.withClosingStatus(closingStatus)
.build();
tradeInfo.bsqSwapTradeInfo = toBsqSwapTradeInfo(bsqSwapTrade, isMyOffer, numConfirmations);
@ -236,10 +236,10 @@ public class TradeInfo implements Payload {
.withTradePeriodState(trade.getTradePeriodState().name())
.withIsDepositPublished(trade.isDepositPublished())
.withIsDepositConfirmed(trade.isDepositConfirmed())
.withIsFiatSent(trade.isFiatSent())
.withIsFiatReceived(trade.isFiatReceived())
.withIsPaymentStartedMessageSent(trade.isFiatSent())
.withIsPaymentReceivedMessageSent(trade.isFiatReceived())
.withIsPayoutPublished(trade.isPayoutPublished())
.withIsWithdrawn(trade.isWithdrawn())
.withIsCompleted(trade.isWithdrawn())
.withContractAsJson(trade.getContractAsJson())
.withContract(contractInfo)
.withClosingStatus(closingStatus)
@ -274,10 +274,10 @@ public class TradeInfo implements Payload {
.setTradePeriodState(tradePeriodState == null ? "" : tradePeriodState)
.setIsDepositPublished(isDepositPublished)
.setIsDepositConfirmed(isDepositConfirmed)
.setIsFiatSent(isFiatSent)
.setIsFiatReceived(isFiatReceived)
.setIsPaymentStartedMessageSent(isPaymentStartedMessageSent)
.setIsPaymentReceivedMessageSent(isPaymentReceivedMessageSent)
.setIsPayoutPublished(isPayoutPublished)
.setIsWithdrawn(isWithdrawn)
.setIsCompleted(isCompleted)
.setClosingStatus(closingStatus);
if (offer.isBsqSwapOffer()) {
protoBuilder.setBsqSwapTradeInfo(bsqSwapTradeInfo.toProtoMessage());
@ -311,10 +311,10 @@ public class TradeInfo implements Payload {
.withTradingPeerNodeAddress(proto.getTradingPeerNodeAddress())
.withIsDepositPublished(proto.getIsDepositPublished())
.withIsDepositConfirmed(proto.getIsDepositConfirmed())
.withIsFiatSent(proto.getIsFiatSent())
.withIsFiatReceived(proto.getIsFiatReceived())
.withIsPaymentStartedMessageSent(proto.getIsPaymentStartedMessageSent())
.withIsPaymentReceivedMessageSent(proto.getIsPaymentReceivedMessageSent())
.withIsPayoutPublished(proto.getIsPayoutPublished())
.withIsWithdrawn(proto.getIsWithdrawn())
.withIsCompleted(proto.getIsCompleted())
.withContractAsJson(proto.getContractAsJson())
.withContract((ContractInfo.fromProto(proto.getContract())))
.withClosingStatus(proto.getClosingStatus())
@ -348,10 +348,10 @@ public class TradeInfo implements Payload {
", tradePeriodState='" + tradePeriodState + '\'' + "\n" +
", isDepositPublished=" + isDepositPublished + "\n" +
", isDepositConfirmed=" + isDepositConfirmed + "\n" +
", isFiatSent=" + isFiatSent + "\n" +
", isFiatReceived=" + isFiatReceived + "\n" +
", isPaymentStartedMessageSent=" + isPaymentStartedMessageSent + "\n" +
", isPaymentReceivedMessageSent=" + isPaymentReceivedMessageSent + "\n" +
", isPayoutPublished=" + isPayoutPublished + "\n" +
", isWithdrawn=" + isWithdrawn + "\n" +
", isCompleted=" + isCompleted + "\n" +
", offer=" + offer + "\n" +
", contractAsJson=" + contractAsJson + "\n" +
", contract=" + contract + "\n" +

View File

@ -52,10 +52,10 @@ public final class TradeInfoV1Builder {
private String tradePeriodState;
private boolean isDepositPublished;
private boolean isDepositConfirmed;
private boolean isFiatSent;
private boolean isFiatReceived;
private boolean isPaymentStartedMessageSent;
private boolean isPaymentReceivedMessageSent;
private boolean isPayoutPublished;
private boolean isWithdrawn;
private boolean isCompleted;
private String contractAsJson;
private ContractInfo contract;
private String closingStatus;
@ -160,13 +160,13 @@ public final class TradeInfoV1Builder {
return this;
}
public TradeInfoV1Builder withIsFiatSent(boolean isFiatSent) {
this.isFiatSent = isFiatSent;
public TradeInfoV1Builder withIsPaymentStartedMessageSent(boolean isPaymentStartedMessageSent) {
this.isPaymentStartedMessageSent = isPaymentStartedMessageSent;
return this;
}
public TradeInfoV1Builder withIsFiatReceived(boolean isFiatReceived) {
this.isFiatReceived = isFiatReceived;
public TradeInfoV1Builder withIsPaymentReceivedMessageSent(boolean isPaymentReceivedMessageSent) {
this.isPaymentReceivedMessageSent = isPaymentReceivedMessageSent;
return this;
}
@ -175,8 +175,8 @@ public final class TradeInfoV1Builder {
return this;
}
public TradeInfoV1Builder withIsWithdrawn(boolean isWithdrawn) {
this.isWithdrawn = isWithdrawn;
public TradeInfoV1Builder withIsCompleted(boolean isCompleted) {
this.isCompleted = isCompleted;
return this;
}
@ -190,7 +190,6 @@ public final class TradeInfoV1Builder {
return this;
}
public TradeInfoV1Builder withClosingStatus(String closingStatus) {
this.closingStatus = closingStatus;
return this;