mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-20 07:46:05 -04:00
Remove payment ID for cryptoNote coins
This commit is contained in:
parent
3a61409b5c
commit
b917d90a70
@ -199,10 +199,6 @@ public class CurrencyUtil {
|
||||
return getAllSortedCryptoCurrencies().stream().filter(e -> e.getCode().equals(currencyCode)).findAny();
|
||||
}
|
||||
|
||||
public static boolean isCryptoNoteCoin(String currencyCode) {
|
||||
return currencyCode.equals("XMR") || currencyCode.equals("BCN");
|
||||
}
|
||||
|
||||
public static FiatCurrency getCurrencyByCountryCode(String countryCode) {
|
||||
return new FiatCurrency(Currency.getInstance(new Locale(LanguageUtil.getDefaultLanguage(), countryCode)).getCurrencyCode());
|
||||
}
|
||||
|
@ -19,16 +19,13 @@ package io.bitsquare.payment;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class CryptoCurrencyAccountContractData extends PaymentAccountContractData {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private String address;
|
||||
// used in crypto note coins. not supported now but hopefully in future, so leave it for now to avoid
|
||||
// incompatibility from serialized data.
|
||||
@Nullable
|
||||
|
||||
// TODO Not needed. Remove when we have an update which breaks backward compatibility
|
||||
private String paymentId;
|
||||
|
||||
public CryptoCurrencyAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
|
||||
@ -52,13 +49,4 @@ public final class CryptoCurrencyAccountContractData extends PaymentAccountContr
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return getPaymentDetails();
|
||||
}
|
||||
|
||||
public void setPaymentId(@Nullable String paymentId) {
|
||||
this.paymentId = paymentId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPaymentId() {
|
||||
return paymentId;
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,7 @@
|
||||
|
||||
package io.bitsquare.trade.protocol.trade.tasks.offerer;
|
||||
|
||||
import io.bitsquare.common.crypto.Hash;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.payment.CryptoCurrencyAccountContractData;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PayDepositRequest;
|
||||
@ -64,12 +61,6 @@ public class ProcessPayDepositRequest extends TradeTask {
|
||||
|
||||
PaymentAccountContractData paymentAccountContractData = checkNotNull(payDepositRequest.takerPaymentAccountContractData);
|
||||
processModel.tradingPeer.setPaymentAccountContractData(paymentAccountContractData);
|
||||
// We apply the payment ID in case its a cryptoNote coin. It is created form the hash of the trade ID
|
||||
if (paymentAccountContractData instanceof CryptoCurrencyAccountContractData &&
|
||||
CurrencyUtil.isCryptoNoteCoin(processModel.getOffer().getCurrencyCode())) {
|
||||
String paymentId = Hash.getHashAsHex(trade.getId()).substring(0, Math.min(32, trade.getId().length()));
|
||||
((CryptoCurrencyAccountContractData) paymentAccountContractData).setPaymentId(paymentId);
|
||||
}
|
||||
|
||||
processModel.tradingPeer.setAccountId(nonEmptyStringOf(payDepositRequest.takerAccountId));
|
||||
trade.setTakeOfferFeeTxId(nonEmptyStringOf(payDepositRequest.takeOfferFeeTxId));
|
||||
|
@ -17,10 +17,7 @@
|
||||
|
||||
package io.bitsquare.trade.protocol.trade.tasks.taker;
|
||||
|
||||
import io.bitsquare.common.crypto.Hash;
|
||||
import io.bitsquare.common.taskrunner.TaskRunner;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.payment.CryptoCurrencyAccountContractData;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.protocol.trade.messages.PublishDepositTxRequest;
|
||||
@ -51,12 +48,6 @@ public class ProcessPublishDepositTxRequest extends TradeTask {
|
||||
|
||||
PaymentAccountContractData paymentAccountContractData = checkNotNull(publishDepositTxRequest.offererPaymentAccountContractData);
|
||||
processModel.tradingPeer.setPaymentAccountContractData(paymentAccountContractData);
|
||||
// We apply the payment ID in case its a cryptoNote coin. It is created form the hash of the trade ID
|
||||
if (paymentAccountContractData instanceof CryptoCurrencyAccountContractData &&
|
||||
CurrencyUtil.isCryptoNoteCoin(processModel.getOffer().getCurrencyCode())) {
|
||||
String paymentId = Hash.getHashAsHex(trade.getId()).substring(0, Math.min(32, trade.getId().length()));
|
||||
((CryptoCurrencyAccountContractData) paymentAccountContractData).setPaymentId(paymentId);
|
||||
}
|
||||
|
||||
processModel.tradingPeer.setAccountId(nonEmptyStringOf(publishDepositTxRequest.offererAccountId));
|
||||
processModel.tradingPeer.setMultiSigPubKey(checkNotNull(publishDepositTxRequest.offererMultiSigPubKey));
|
||||
|
@ -59,9 +59,6 @@ public class CryptoCurrencyForm extends PaymentMethodForm {
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData, String labelTitle) {
|
||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, labelTitle, ((CryptoCurrencyAccountContractData) paymentAccountContractData).getAddress());
|
||||
if (((CryptoCurrencyAccountContractData) paymentAccountContractData).getPaymentId() != null)
|
||||
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Payment ID:", ((CryptoCurrencyAccountContractData) paymentAccountContractData).getPaymentId());
|
||||
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.payment.CryptoCurrencyAccountContractData;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import io.bitsquare.payment.PaymentMethod;
|
||||
import io.bitsquare.trade.Contract;
|
||||
@ -110,13 +109,7 @@ public class ContractWindow extends Overlay<ContractWindow> {
|
||||
if (showAcceptedBanks)
|
||||
rows++;
|
||||
|
||||
boolean isPaymentIdAvailable = false;
|
||||
PaymentAccountContractData sellerPaymentAccountContractData = contract.getSellerPaymentAccountContractData();
|
||||
if (sellerPaymentAccountContractData instanceof CryptoCurrencyAccountContractData &&
|
||||
((CryptoCurrencyAccountContractData) sellerPaymentAccountContractData).getPaymentId() != null) {
|
||||
rows++;
|
||||
isPaymentIdAvailable = true;
|
||||
}
|
||||
addTitledGroupBg(gridPane, ++rowIndex, rows, "Contract");
|
||||
addLabelTextFieldWithCopyIcon(gridPane, rowIndex, "Offer ID:", offer.getId(),
|
||||
Layout.FIRST_ROW_DISTANCE).second.setMouseTransparent(false);
|
||||
@ -138,9 +131,6 @@ public class ContractWindow extends Overlay<ContractWindow> {
|
||||
BSResources.get(contract.getBuyerPaymentAccountContractData().getPaymentDetails())).second.setMouseTransparent(false);
|
||||
addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Seller payment details:",
|
||||
BSResources.get(sellerPaymentAccountContractData.getPaymentDetails())).second.setMouseTransparent(false);
|
||||
if (isPaymentIdAvailable)
|
||||
addLabelTextField(gridPane, ++rowIndex, "Seller payment ID:",
|
||||
((CryptoCurrencyAccountContractData) sellerPaymentAccountContractData).getPaymentId());
|
||||
|
||||
if (showAcceptedCountryCodes) {
|
||||
String countries;
|
||||
|
Loading…
x
Reference in New Issue
Block a user