Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trade Info Popup #3329

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import bisq.common.proto.network.NetworkPayload;
import bisq.common.util.JsonExclude;
import bisq.common.util.Utilities;
import bisq.core.locale.Res;

import org.apache.commons.lang3.ArrayUtils;

Expand All @@ -31,8 +32,10 @@
import java.util.Map;
import java.util.Optional;

import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -70,7 +73,6 @@ public abstract class PaymentAccountPayload implements NetworkPayload, UsedForTr
@Nullable
protected final Map<String, String> excludeFromJsonDataMap;


///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import bisq.core.filter.FilterManager;
import bisq.core.filter.PaymentAccountFilter;
import bisq.core.locale.Res;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.trade.Trade;

Expand Down Expand Up @@ -60,8 +61,9 @@ protected void run() {
failed("Payment method is banned.\n" +
"Payment method=" + trade.getOffer().getPaymentMethod().getId());
} else if (filterManager.isPeersPaymentAccountDataAreBanned(paymentAccountPayload, appliedPaymentAccountFilter)) {
String paymentDetails = Res.getWithCol("payment.altcoin.sender.address", trade.getOffer().getCurrencyCode());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This absolutely wrong it would change the paymentDetails displayed e.g. for MoneyBeam you would replace Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account") + " " + accountId; with Res.getWithCol("payment.altcoin.sender.address", trade.getOffer().getCurrencyCode());

failed("Other trader is banned by their trading account data.\n" +
"paymentAccountPayload=" + paymentAccountPayload.getPaymentDetails() + "\n" +
"paymentAccountPayload=" + paymentDetails + "\n" +
"banFilter=" + appliedPaymentAccountFilter[0].toString());
} else if (filterManager.requireUpdateToNewVersionForTrading()) {
failed("Your version of Bisq is not compatible for trading anymore. " +
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2752,7 +2752,8 @@ payment.national.account.id.AR=CBU number

#new
payment.altcoin.address.dyn={0} address
payment.altcoin.receiver.address=Receiver's altcoin address
payment.altcoin.sender.address=Sender''s {0} address
payment.altcoin.receiver.address=Receiver''s {0} address
payment.accountNr=Account number
payment.emailOrMobile=Email or mobile nr
payment.useCustomAccountName=Use custom account name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,17 @@ private void addContent() {
if (showAcceptedBanks)
rows++;

String currencyCode = offer.getCurrencyCode();
PaymentAccountPayload sellerPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
PaymentAccountPayload buyerPaymentAccountPayload = contract.getBuyerPaymentAccountPayload();
String buyerPaymentDetails = Res.getWithCol("payment.altcoin.receiver.address", currencyCode);
String sellerPaymentDetails = Res.getWithCol("payment.altcoin.sender.address", currencyCode);

addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("contractWindow.title"));
addConfirmationLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.get("shared.offerId"), offer.getId(),
Layout.TWICE_FIRST_ROW_DISTANCE).second.setMouseTransparent(false);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("contractWindow.dates"),
DisplayUtils.formatDateTime(offer.getDate()) + " / " + DisplayUtils.formatDateTime(dispute.getTradeDate()));
String currencyCode = offer.getCurrencyCode();
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.offerType"),
DisplayUtils.getDirectionBothSides(offer.getDirection(), currencyCode));
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradePrice"),
Expand Down Expand Up @@ -175,9 +179,9 @@ private void addContent() {
nrOfDisputesAsBuyer + " / " + nrOfDisputesAsSeller);

addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.buyer")),
contract.getBuyerPaymentAccountPayload().getPaymentDetails()).second.setMouseTransparent(false);
buyerPaymentDetails).second.setMouseTransparent(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are removing the real payment details with e.g. Sender's BTC address

addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.seller")),
sellerPaymentAccountPayload.getPaymentDetails()).second.setMouseTransparent(false);
sellerPaymentDetails).second.setMouseTransparent(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


// TODO update in next release to shared.selectedArbitrator and delete shared.arbitrator entry
String title = dispute.isMediationDispute() ? Res.get("shared.selectedMediator") : Res.get("shared.arbitrator");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ private void addContent() {
trade.getTradingPeerNodeAddress().getFullAddress());

if (contract != null) {
String currencyCode = contract.getTradePrice().getCurrencyCode();
if (buyerPaymentAccountPayload != null) {
String paymentDetails = buyerPaymentAccountPayload.getPaymentDetails();
String paymentDetails = Res.getWithCol("payment.altcoin.sender.address", currencyCode);
long age = accountAgeWitnessService.getAccountAge(buyerPaymentAccountPayload, contract.getBuyerPubKeyRing());
buyersAccountAge = CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) ?
age > -1 ? Res.get("peerInfoIcon.tooltip.age", DisplayUtils.formatAccountAge(age)) :
Expand All @@ -246,7 +247,7 @@ private void addContent() {
tf.setTooltip(new Tooltip(tf.getText()));
}
if (sellerPaymentAccountPayload != null) {
String paymentDetails = sellerPaymentAccountPayload.getPaymentDetails();
String paymentDetails = Res.getWithCol("payment.altcoin.receiver.address", currencyCode);
long age = accountAgeWitnessService.getAccountAge(sellerPaymentAccountPayload, contract.getSellerPubKeyRing());
sellersAccountAge = CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) ?
age > -1 ? Res.get("peerInfoIcon.tooltip.age", DisplayUtils.formatAccountAge(age)) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,13 @@ private void applyFilteredListPredicate(String filterString) {
boolean matchesTradeDate = DisplayUtils.formatDate(trade.getTakeOfferDate()).contains(filterString);
Contract contract = trade.getContract();
if (contract != null) {
String currencyCode = contract.getTradePrice().getCurrencyCode();
isBuyerOnion = contract.getBuyerNodeAddress().getFullAddress().contains(filterString);
isSellerOnion = contract.getSellerNodeAddress().getFullAddress().contains(filterString);
matchesBuyersPaymentAccountData = contract.getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesSellersPaymentAccountData = contract.getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);
String buyerPaymentDetails = Res.getWithCol("payment.altcoin.receiver.address", currencyCode);
String sellerPaymentDetails = Res.getWithCol("payment.altcoin.sender.address", currencyCode);
matchesBuyersPaymentAccountData = buyerPaymentDetails.contains(filterString);
matchesSellersPaymentAccountData = sellerPaymentDetails.contains(filterString);
}
return matchesId || matchesOfferDate || isMakerOnion ||
matchesTradeDate || isBuyerOnion || isSellerOnion ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ protected void addContent() {
peersTitle = Res.get("portfolio.pending.step3_seller.buyersAddress", nameByCode);
isBlockChain = true;
} else {
myPaymentDetails = myPaymentAccountPayload.getPaymentDetails();
peersPaymentDetails = peersPaymentAccountPayload.getPaymentDetails();
String currencyCode = contract.getTradePrice().getCurrencyCode();
myPaymentDetails = Res.getWithCol("payment.altcoin.sender.address", currencyCode);
peersPaymentDetails = Res.getWithCol("payment.altcoin.receiver.address", currencyCode);
myTitle = Res.get("portfolio.pending.step3_seller.yourAccount");
peersTitle = Res.get("portfolio.pending.step3_seller.buyersAccount");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,16 @@ public void initialize() {
protected void applyFilteredListPredicate(String filterString) {
// If in arbitrator view we must only display disputes where we are selected as arbitrator (must not receive others anyway)
filteredList.setPredicate(dispute -> {
String currencyCode = dispute.getContract().getTradePrice().getCurrencyCode();
String buyerPaymentDetails = Res.getWithCol("payment.altcoin.receiver.address", currencyCode);
String sellerPaymentDetails = Res.getWithCol("payment.altcoin.sender.address", currencyCode);
boolean matchesTradeId = dispute.getTradeId().contains(filterString);
boolean matchesDate = DisplayUtils.formatDate(dispute.getOpeningDate()).contains(filterString);
boolean isBuyerOnion = dispute.getContract().getBuyerNodeAddress().getFullAddress().contains(filterString);
boolean isSellerOnion = dispute.getContract().getSellerNodeAddress().getFullAddress().contains(filterString);
boolean matchesBuyersPaymentAccountData = dispute.getContract().getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
boolean matchesSellersPaymentAccountData = dispute.getContract().getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);

boolean matchesBuyersPaymentAccountData = buyerPaymentDetails.contains(filterString);
boolean matchesSellersPaymentAccountData = sellerPaymentDetails.contains(filterString);

boolean anyMatch = matchesTradeId || matchesDate || isBuyerOnion || isSellerOnion ||
matchesBuyersPaymentAccountData || matchesSellersPaymentAccountData;
Expand Down