Skip to content

Commit

Permalink
Trade Info Popup
Browse files Browse the repository at this point in the history
Issue #3317
  • Loading branch information
niyid committed Sep 26, 2019
1 parent 490eaab commit b5f6d0d
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected AssetsAccountPayload(String paymentMethod,

@Override
public String getPaymentDetails() {
return Res.getWithCol("payment.altcoin.receiver.address") + " " + address;
return super.paymentDetails + " " + address;
}

@Override
Expand Down
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,6 +73,11 @@ public abstract class PaymentAccountPayload implements NetworkPayload, UsedForTr
@Nullable
protected final Map<String, String> excludeFromJsonDataMap;

@JsonExclude
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
protected String paymentDetails;


///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
Expand Down Expand Up @@ -117,6 +125,10 @@ protected protobuf.PaymentAccountPayload.Builder getPaymentAccountPayloadBuilder
///////////////////////////////////////////////////////////////////////////////////////////
// API
///////////////////////////////////////////////////////////////////////////////////////////

public void setPaymentDetails(String paymentDetails) {
this.paymentDetails = paymentDetails;
}

public abstract String getPaymentDetails();

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,6 +61,7 @@ protected void run() {
failed("Payment method is banned.\n" +
"Payment method=" + trade.getOffer().getPaymentMethod().getId());
} else if (filterManager.isPeersPaymentAccountDataAreBanned(paymentAccountPayload, appliedPaymentAccountFilter)) {
paymentAccountPayload.setPaymentDetails(Res.getWithCol("payment.altcoin.sender.address", trade.getOffer().getCurrencyCode()));
failed("Other trader is banned by their trading account data.\n" +
"paymentAccountPayload=" + paymentAccountPayload.getPaymentDetails() + "\n" +
"banFilter=" + appliedPaymentAccountFilter[0].toString());
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();
buyerPaymentAccountPayload.setPaymentDetails(Res.getWithCol("payment.altcoin.receiver.address", currencyCode));
sellerPaymentAccountPayload.setPaymentDetails(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,7 +179,7 @@ private void addContent() {
nrOfDisputesAsBuyer + " / " + nrOfDisputesAsSeller);

addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.buyer")),
contract.getBuyerPaymentAccountPayload().getPaymentDetails()).second.setMouseTransparent(false);
buyerPaymentAccountPayload.getPaymentDetails()).second.setMouseTransparent(false);
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.seller")),
sellerPaymentAccountPayload.getPaymentDetails()).second.setMouseTransparent(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ private void addContent() {
trade.getTradingPeerNodeAddress().getFullAddress());

if (contract != null) {
String currencyCode = contract.getTradePrice().getCurrencyCode();
if (buyerPaymentAccountPayload != null) {
buyerPaymentAccountPayload.setPaymentDetails(Res.getWithCol("payment.altcoin.sender.address", currencyCode));
String paymentDetails = buyerPaymentAccountPayload.getPaymentDetails();
long age = accountAgeWitnessService.getAccountAge(buyerPaymentAccountPayload, contract.getBuyerPubKeyRing());
buyersAccountAge = CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) ?
Expand All @@ -246,6 +248,7 @@ private void addContent() {
tf.setTooltip(new Tooltip(tf.getText()));
}
if (sellerPaymentAccountPayload != null) {
sellerPaymentAccountPayload.setPaymentDetails(Res.getWithCol("payment.altcoin.receiver.address", currencyCode));
String paymentDetails = sellerPaymentAccountPayload.getPaymentDetails();
long age = accountAgeWitnessService.getAccountAge(sellerPaymentAccountPayload, contract.getSellerPubKeyRing());
sellersAccountAge = CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,11 @@ 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);
contract.getBuyerPaymentAccountPayload().setPaymentDetails(Res.getWithCol("payment.altcoin.receiver.address", currencyCode));
contract.getSellerPaymentAccountPayload().setPaymentDetails(Res.getWithCol("payment.altcoin.sender.address", currencyCode));
matchesBuyersPaymentAccountData = contract.getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
matchesSellersPaymentAccountData = contract.getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ protected void addContent() {
peersTitle = Res.get("portfolio.pending.step3_seller.buyersAddress", nameByCode);
isBlockChain = true;
} else {
String currencyCode = contract.getTradePrice().getCurrencyCode();
myPaymentAccountPayload.setPaymentDetails(Res.getWithCol("payment.altcoin.sender.address", currencyCode));
myPaymentDetails = myPaymentAccountPayload.getPaymentDetails();
peersPaymentAccountPayload.setPaymentDetails(Res.getWithCol("payment.altcoin.receiver.address", currencyCode));
peersPaymentDetails = peersPaymentAccountPayload.getPaymentDetails();
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,10 +79,14 @@ 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();
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);
dispute.getContract().getBuyerPaymentAccountPayload().setPaymentDetails(Res.getWithCol("payment.altcoin.receiver.address", currencyCode));
dispute.getContract().getSellerPaymentAccountPayload().setPaymentDetails(Res.getWithCol("payment.altcoin.sender.address", currencyCode));

boolean matchesBuyersPaymentAccountData = dispute.getContract().getBuyerPaymentAccountPayload().getPaymentDetails().contains(filterString);
boolean matchesSellersPaymentAccountData = dispute.getContract().getSellerPaymentAccountPayload().getPaymentDetails().contains(filterString);

Expand Down

0 comments on commit b5f6d0d

Please sign in to comment.