mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 18:33:43 +01:00
Remove default values in case of null, apply Lombok annotations
This commit is contained in:
parent
5fee4b0b66
commit
de7b73f7a9
@ -25,7 +25,7 @@ import lombok.ToString;
|
||||
import java.util.Currency;
|
||||
import java.util.Locale;
|
||||
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Getter
|
||||
public final class FiatCurrency extends TradeCurrency {
|
||||
|
@ -30,7 +30,6 @@ import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.security.PublicKey;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -80,8 +79,6 @@ public class Offer implements Serializable {
|
||||
@Setter
|
||||
@Nullable
|
||||
transient private PriceFeedService priceFeedService;
|
||||
@JsonExclude
|
||||
transient private DecimalFormat decimalFormat;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -90,10 +87,6 @@ public class Offer implements Serializable {
|
||||
|
||||
public Offer(OfferPayload offerPayload) {
|
||||
this.offerPayload = offerPayload;
|
||||
|
||||
// we don't need to fill it as the error message is only relevant locally, so we don't store it in the transmitted object
|
||||
decimalFormat = new DecimalFormat("#.#");
|
||||
decimalFormat.setMaximumFractionDigits(Fiat.SMALLEST_UNIT_EXPONENT);
|
||||
}
|
||||
|
||||
// TODO still needed as we get the offer from persistence serialized
|
||||
@ -105,8 +98,6 @@ public class Offer implements Serializable {
|
||||
|
||||
// we don't need to fill it as the error message is only relevant locally, so we don't store it in the transmitted object
|
||||
errorMessageProperty = new SimpleStringProperty();
|
||||
decimalFormat = new DecimalFormat("#.#");
|
||||
decimalFormat.setMaximumFractionDigits(Fiat.SMALLEST_UNIT_EXPONENT);
|
||||
} catch (Throwable t) {
|
||||
log.warn("Cannot be deserialized." + t.getMessage());
|
||||
}
|
||||
|
@ -23,18 +23,17 @@ import io.bisq.common.app.Version;
|
||||
import io.bisq.common.storage.Storage;
|
||||
import io.bisq.core.trade.Tradable;
|
||||
import io.bisq.core.trade.TradableList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
public final class OpenOffer implements Tradable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OpenOffer.class);
|
||||
|
||||
// Timeout for offer reservation during takeoffer process. If deposit tx is not completed in that time we reset the offer to AVAILABLE state.
|
||||
private static final long TIMEOUT_SEC = 30;
|
||||
transient private Timer timeoutTimer;
|
||||
@ -46,7 +45,9 @@ public final class OpenOffer implements Tradable {
|
||||
CANCELED
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final Offer offer;
|
||||
@Getter
|
||||
private State state = State.AVAILABLE;
|
||||
|
||||
transient private Storage<TradableList<OpenOffer>> storage;
|
||||
@ -83,10 +84,6 @@ public final class OpenOffer implements Tradable {
|
||||
return offer.getShortId();
|
||||
}
|
||||
|
||||
public Offer getOffer() {
|
||||
return offer;
|
||||
}
|
||||
|
||||
public void setStorage(Storage<TradableList<OpenOffer>> storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
@ -105,11 +102,6 @@ public final class OpenOffer implements Tradable {
|
||||
stopTimeout();
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
private void startTimeout() {
|
||||
stopTimeout();
|
||||
|
||||
@ -127,13 +119,30 @@ public final class OpenOffer implements Tradable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
OpenOffer openOffer = (OpenOffer) o;
|
||||
|
||||
if (offer != null ? !offer.equals(openOffer.offer) : openOffer.offer != null) return false;
|
||||
return state == openOffer.state;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = offer != null ? offer.hashCode() : 0;
|
||||
result = 31 * result + (state != null ? state.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OpenOffer{" +
|
||||
"\n\ttimeoutTimer=" + timeoutTimer +
|
||||
"\n\toffer=" + offer +
|
||||
"\n\tstate=" + state +
|
||||
"\n\tstorage=" + storage +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +75,6 @@ import static io.bisq.wire.proto.Messages.Envelope.MessageCase.*;
|
||||
*/
|
||||
@Slf4j
|
||||
public class ProtoBufferUtilities {
|
||||
|
||||
|
||||
public static Optional<Message> fromProtoBuf(Messages.Envelope envelope) {
|
||||
if (Objects.isNull(envelope)) {
|
||||
log.warn("fromProtoBuf called with empty envelope.");
|
||||
|
@ -27,6 +27,7 @@ import javafx.beans.property.SimpleBooleanProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.ArrayList;
|
||||
@ -56,7 +57,7 @@ public final class DisputeCommunicationMessage extends DisputeMessage {
|
||||
transient private BooleanProperty storedInMailboxProperty = new SimpleBooleanProperty();
|
||||
|
||||
public DisputeCommunicationMessage(String tradeId, int traderId, boolean senderIsTrader, String message,
|
||||
List<Attachment> attachments, NodeAddress myNodeAddress, long date,
|
||||
@Nullable List<Attachment> attachments, NodeAddress myNodeAddress, long date,
|
||||
boolean arrived, boolean storedInMailbox) {
|
||||
this.tradeId = tradeId;
|
||||
this.traderId = traderId;
|
||||
@ -66,7 +67,7 @@ public final class DisputeCommunicationMessage extends DisputeMessage {
|
||||
this.date = date;
|
||||
this.arrived = arrived;
|
||||
this.storedInMailbox = storedInMailbox;
|
||||
Optional.ofNullable(attachments).ifPresent(attachments1 -> addAllAttachments(attachments));
|
||||
Optional.ofNullable(attachments).ifPresent(e -> addAllAttachments(attachments));
|
||||
updateBooleanProperties();
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public final class Alert implements StoragePayload {
|
||||
this(message, isUpdateInfo, version);
|
||||
this.storagePublicKeyBytes = storagePublicKeyBytes;
|
||||
this.signatureAsBase64 = signatureAsBase64;
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.extraDataMap = extraDataMap;
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package io.bisq.wire.payload.arbitration;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.protobuf.ByteString;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.payload.StoragePayload;
|
||||
@ -80,7 +79,7 @@ public final class Arbitrator implements StoragePayload {
|
||||
this.registrationDate = registrationDate.getTime();
|
||||
this.registrationPubKey = registrationPubKey;
|
||||
this.registrationSignature = registrationSignature;
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.extraDataMap = extraDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -98,7 +97,7 @@ public final class Arbitrator implements StoragePayload {
|
||||
final Messages.Arbitrator.Builder builder = Messages.Arbitrator.newBuilder()
|
||||
.setTTL(TTL)
|
||||
.setBtcPubKey(ByteString.copyFrom(btcPubKey))
|
||||
.setPubKeyRing((Messages.PubKeyRing) pubKeyRing.toProtoBuf())
|
||||
.setPubKeyRing(pubKeyRing.toProtoBuf())
|
||||
.setArbitratorNodeAddress(arbitratorNodeAddress.toProtoBuf())
|
||||
.addAllLanguageCodes(languageCodes)
|
||||
.setBtcAddress(btcAddress)
|
||||
|
@ -90,7 +90,8 @@ public final class Dispute implements Payload {
|
||||
|
||||
// Domain
|
||||
transient private Storage<DisputeList<Dispute>> storage;
|
||||
transient private ObservableList<DisputeCommunicationMessage> observableList = FXCollections.observableArrayList(disputeCommunicationMessages);
|
||||
transient private ObservableList<DisputeCommunicationMessage> observableList = FXCollections.observableArrayList(
|
||||
disputeCommunicationMessages);
|
||||
transient private BooleanProperty isClosedProperty = new SimpleBooleanProperty(isClosed);
|
||||
transient private ObjectProperty<DisputeResult> disputeResultProperty = new SimpleObjectProperty<>(disputeResult);
|
||||
|
||||
@ -117,10 +118,23 @@ public final class Dispute implements Payload {
|
||||
@Nullable String takerContractSignature,
|
||||
PubKeyRing arbitratorPubKeyRing,
|
||||
boolean isSupportTicket) {
|
||||
this(tradeId, traderId, disputeOpenerIsBuyer, disputeOpenerIsOfferer, traderPubKeyRing, tradeDate,
|
||||
contract, contractHash, depositTxSerialized, payoutTxSerialized, depositTxId,
|
||||
payoutTxId, contractAsJson, offererContractSignature, takerContractSignature,
|
||||
arbitratorPubKeyRing, isSupportTicket);
|
||||
this(tradeId,
|
||||
traderId,
|
||||
disputeOpenerIsBuyer,
|
||||
disputeOpenerIsOfferer,
|
||||
traderPubKeyRing,
|
||||
tradeDate,
|
||||
contract,
|
||||
contractHash,
|
||||
depositTxSerialized,
|
||||
payoutTxSerialized,
|
||||
depositTxId,
|
||||
payoutTxId,
|
||||
contractAsJson,
|
||||
offererContractSignature,
|
||||
takerContractSignature,
|
||||
arbitratorPubKeyRing,
|
||||
isSupportTicket);
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package io.bisq.wire.payload.dao.compensation;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.crypto.Sig;
|
||||
import io.bisq.common.util.JsonExclude;
|
||||
@ -149,7 +148,7 @@ public final class CompensationRequestPayload implements LazyProcessedStoragePay
|
||||
this.nodeAddress = nodeAddress.getFullAddress();
|
||||
this.p2pStorageSignaturePubKeyBytes = p2pStorageSignaturePubKeyBytes;
|
||||
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.extraDataMap = extraDataMap;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public final class Filter implements StoragePayload {
|
||||
this(bannedOfferIds, bannedNodeAddress, bannedPaymentAccounts);
|
||||
this.signatureAsBase64 = signatureAsBase64;
|
||||
this.publicKeyBytes = publicKeyBytes;
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.extraDataMap = extraDataMap;
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -2,15 +2,16 @@ package io.bisq.wire.payload.filter;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ToString
|
||||
@Slf4j
|
||||
public class PaymentAccountFilter implements Serializable {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(PaymentAccountFilter.class);
|
||||
|
||||
// Payload
|
||||
public final String paymentMethodId;
|
||||
@ -23,15 +24,6 @@ public class PaymentAccountFilter implements Serializable {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PaymentAccountFilter{" +
|
||||
"paymentMethodId='" + paymentMethodId + '\'' +
|
||||
", getMethodName='" + getMethodName + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Messages.PaymentAccountFilter toProtoBuf() {
|
||||
return Messages.PaymentAccountFilter.newBuilder()
|
||||
.setPaymentMethodId(paymentMethodId)
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
package io.bisq.wire.payload.offer;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.locale.CurrencyUtil;
|
||||
@ -238,11 +236,11 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
|
||||
this.arbitratorNodeAddresses = arbitratorNodeAddresses;
|
||||
this.paymentMethodId = paymentMethodId;
|
||||
this.offererPaymentAccountId = offererPaymentAccountId;
|
||||
this.offerFeePaymentTxId = Optional.ofNullable(offerFeePaymentTxId).orElse("");
|
||||
this.countryCode = Optional.ofNullable(countryCode).orElse("");
|
||||
this.acceptedCountryCodes = Optional.ofNullable(acceptedCountryCodes).orElse(Lists.newArrayList());
|
||||
this.bankId = Optional.ofNullable(bankId).orElse("");
|
||||
this.acceptedBankIds = Optional.ofNullable(acceptedBankIds).orElse(Lists.newArrayList());
|
||||
this.offerFeePaymentTxId = offerFeePaymentTxId;
|
||||
this.countryCode = countryCode;
|
||||
this.acceptedCountryCodes = acceptedCountryCodes;
|
||||
this.bankId = bankId;
|
||||
this.acceptedBankIds = acceptedBankIds;
|
||||
this.versionNr = versionNr;
|
||||
this.blockHeightAtOfferCreation = blockHeightAtOfferCreation;
|
||||
this.txFee = txFee;
|
||||
@ -256,8 +254,8 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
|
||||
this.lowerClosePrice = lowerClosePrice;
|
||||
this.upperClosePrice = upperClosePrice;
|
||||
this.isPrivateOffer = isPrivateOffer;
|
||||
this.hashOfChallenge = Optional.ofNullable(hashOfChallenge).orElse("");
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.hashOfChallenge = hashOfChallenge;
|
||||
this.extraDataMap = extraDataMap;
|
||||
this.protocolVersion = Version.TRADE_PROTOCOL_VERSION;
|
||||
}
|
||||
|
||||
@ -323,11 +321,12 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
|
||||
} else {
|
||||
throw new RuntimeException("OfferPayload is in invalid state: offerFeePaymentTxID is not set when adding to P2P network.");
|
||||
}
|
||||
|
||||
Optional.ofNullable(countryCode).ifPresent(offerBuilder::setCountryCode);
|
||||
Optional.ofNullable(bankId).ifPresent(offerBuilder::setBankId);
|
||||
Optional.ofNullable(acceptedCountryCodes).ifPresent(offerBuilder::addAllAcceptedCountryCodes);
|
||||
Optional.ofNullable(getAcceptedBankIds()).ifPresent(offerBuilder::addAllAcceptedBankIds);
|
||||
Optional.ofNullable(acceptedBankIds).ifPresent(offerBuilder::addAllAcceptedBankIds);
|
||||
Optional.ofNullable(hashOfChallenge).ifPresent(offerBuilder::setHashOfChallenge);
|
||||
Optional.ofNullable(acceptedCountryCodes).ifPresent(offerBuilder::addAllAcceptedCountryCodes);
|
||||
Optional.ofNullable(extraDataMap).ifPresent(offerBuilder::putAllExtraDataMap);
|
||||
|
||||
return Messages.StoragePayload.newBuilder().setOfferPayload(offerBuilder).build();
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.bisq.wire.payload.p2p.storage;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.protobuf.ByteString;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.crypto.Sig;
|
||||
@ -82,7 +81,7 @@ public final class MailboxStoragePayload implements StoragePayload {
|
||||
this.prefixedSealedAndSignedMessage = prefixedSealedAndSignedMessage;
|
||||
this.senderPubKeyForAddOperationBytes = senderPubKeyForAddOperationBytes;
|
||||
this.receiverPubKeyForRemoveOperationBytes = receiverPubKeyForRemoveOperationBytes;
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.extraDataMap = extraDataMap;
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -19,7 +19,15 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
public final class AliPayAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -35,14 +43,6 @@ public final class AliPayAccountPayload extends PaymentAccountPayload {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public String getAccountNr() {
|
||||
return accountNr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "AliPay - Account no.: " + accountNr;
|
||||
@ -65,11 +65,4 @@ public final class AliPayAccountPayload extends PaymentAccountPayload {
|
||||
.setAliPayAccountPayload(thisClass);
|
||||
return paymentAccountPayload.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AliPayAccountPayload{" +
|
||||
"accountNr='" + accountNr + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -19,26 +19,38 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.locale.BankUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Locale;
|
||||
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Slf4j
|
||||
public abstract class BankAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(BankAccountPayload.class);
|
||||
|
||||
@Getter
|
||||
protected String holderName;
|
||||
@Getter
|
||||
protected String bankName;
|
||||
protected String bankId;
|
||||
@Getter
|
||||
protected String branchId;
|
||||
@Getter
|
||||
protected String accountNr;
|
||||
@Getter
|
||||
protected String accountType;
|
||||
@Nullable
|
||||
@Getter
|
||||
protected String holderTaxId;
|
||||
// Custom getter
|
||||
protected String bankId;
|
||||
|
||||
public BankAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
@ -51,12 +63,18 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup(Locale locale) {
|
||||
String bankName = BankUtil.isBankNameRequired(countryCode) ? BankUtil.getBankNameLabel(countryCode) + " " + this.bankName + "\n" : "";
|
||||
String bankId = BankUtil.isBankIdRequired(countryCode) ? BankUtil.getBankIdLabel(countryCode) + " " + this.bankId + "\n" : "";
|
||||
String branchId = BankUtil.isBranchIdRequired(countryCode) ? BankUtil.getBranchIdLabel(countryCode) + " " + this.branchId + "\n" : "";
|
||||
String accountNr = BankUtil.isAccountNrRequired(countryCode) ? BankUtil.getAccountNrLabel(countryCode) + " " + this.accountNr + "\n" : "";
|
||||
String accountType = BankUtil.isAccountTypeRequired(countryCode) ? BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
|
||||
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ? (BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
|
||||
String bankName = BankUtil.isBankNameRequired(countryCode) ?
|
||||
BankUtil.getBankNameLabel(countryCode) + " " + this.bankName + "\n" : "";
|
||||
String bankId = BankUtil.isBankIdRequired(countryCode) ?
|
||||
BankUtil.getBankIdLabel(countryCode) + " " + this.bankId + "\n" : "";
|
||||
String branchId = BankUtil.isBranchIdRequired(countryCode) ?
|
||||
BankUtil.getBranchIdLabel(countryCode) + " " + this.branchId + "\n" : "";
|
||||
String accountNr = BankUtil.isAccountNrRequired(countryCode) ?
|
||||
BankUtil.getAccountNrLabel(countryCode) + " " + this.accountNr + "\n" : "";
|
||||
String accountType = BankUtil.isAccountTypeRequired(countryCode) ?
|
||||
BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
|
||||
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ?
|
||||
(BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
|
||||
|
||||
return "Holder name: " + holderName + "\n" +
|
||||
bankName +
|
||||
@ -68,70 +86,12 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
|
||||
"Country of bank: " + new Locale(locale.getLanguage(), countryCode).getDisplayCountry();
|
||||
}
|
||||
|
||||
|
||||
protected String getHolderIdLabel() {
|
||||
return BankUtil.getHolderIdLabel(countryCode);
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankId(String bankId) {
|
||||
this.bankId = bankId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBankId() {
|
||||
return BankUtil.isBankIdRequired(countryCode) ? bankId : bankName;
|
||||
}
|
||||
|
||||
public void setBranchId(String branchId) {
|
||||
this.branchId = branchId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBranchId() {
|
||||
return branchId;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAccountNr() {
|
||||
return accountNr;
|
||||
}
|
||||
|
||||
public void setHolderTaxId(String holderTaxId) {
|
||||
this.holderTaxId = holderTaxId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getHolderTaxId() {
|
||||
return holderTaxId;
|
||||
}
|
||||
|
||||
public void setAccountType(String accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
}
|
||||
|
@ -20,29 +20,43 @@ package io.bisq.wire.payload.payment;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.locale.BankUtil;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Locale;
|
||||
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Slf4j
|
||||
public class CashDepositAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(CashDepositAccountPayload.class);
|
||||
|
||||
@Getter
|
||||
protected String holderName;
|
||||
@Getter
|
||||
protected String holderEmail;
|
||||
@Getter
|
||||
protected String bankName;
|
||||
protected String bankId;
|
||||
@Getter
|
||||
protected String branchId;
|
||||
@Getter
|
||||
protected String accountNr;
|
||||
@Getter
|
||||
protected String accountType;
|
||||
@Nullable
|
||||
@Getter
|
||||
protected String requirements;
|
||||
@Nullable
|
||||
@Getter
|
||||
protected String holderTaxId;
|
||||
// Custom getter
|
||||
protected String bankId;
|
||||
|
||||
public CashDepositAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
@ -55,13 +69,20 @@ public class CashDepositAccountPayload extends CountryBasedPaymentAccountPayload
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup(Locale locale) {
|
||||
String bankName = BankUtil.isBankNameRequired(countryCode) ? BankUtil.getBankNameLabel(countryCode) + " " + this.bankName + "\n" : "";
|
||||
String bankId = BankUtil.isBankIdRequired(countryCode) ? BankUtil.getBankIdLabel(countryCode) + " " + this.bankId + "\n" : "";
|
||||
String branchId = BankUtil.isBranchIdRequired(countryCode) ? BankUtil.getBranchIdLabel(countryCode) + " " + this.branchId + "\n" : "";
|
||||
String accountNr = BankUtil.isAccountNrRequired(countryCode) ? BankUtil.getAccountNrLabel(countryCode) + " " + this.accountNr + "\n" : "";
|
||||
String accountType = BankUtil.isAccountTypeRequired(countryCode) ? BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
|
||||
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ? (BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
|
||||
String requirementsString = requirements != null && !requirements.isEmpty() ? ("Extra requirements: " + requirements + "\n") : "";
|
||||
String bankName = BankUtil.isBankNameRequired(countryCode) ?
|
||||
BankUtil.getBankNameLabel(countryCode) + " " + this.bankName + "\n" : "";
|
||||
String bankId = BankUtil.isBankIdRequired(countryCode) ?
|
||||
BankUtil.getBankIdLabel(countryCode) + " " + this.bankId + "\n" : "";
|
||||
String branchId = BankUtil.isBranchIdRequired(countryCode) ?
|
||||
BankUtil.getBranchIdLabel(countryCode) + " " + this.branchId + "\n" : "";
|
||||
String accountNr = BankUtil.isAccountNrRequired(countryCode) ?
|
||||
BankUtil.getAccountNrLabel(countryCode) + " " + this.accountNr + "\n" : "";
|
||||
String accountType = BankUtil.isAccountTypeRequired(countryCode) ?
|
||||
BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
|
||||
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ?
|
||||
(BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
|
||||
String requirementsString = requirements != null && !requirements.isEmpty() ?
|
||||
("Extra requirements: " + requirements + "\n") : "";
|
||||
|
||||
return "Holder name: " + holderName + "\n" +
|
||||
"Holder email: " + holderEmail + "\n" +
|
||||
@ -105,83 +126,10 @@ public class CashDepositAccountPayload extends CountryBasedPaymentAccountPayload
|
||||
return BankUtil.getHolderIdLabel(countryCode);
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderEmail(String holderEmail) {
|
||||
this.holderEmail = holderEmail;
|
||||
}
|
||||
|
||||
public String getHolderEmail() {
|
||||
return holderEmail;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankId(String bankId) {
|
||||
this.bankId = bankId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBankId() {
|
||||
return BankUtil.isBankIdRequired(countryCode) ? bankId : bankName;
|
||||
}
|
||||
|
||||
public void setBranchId(String branchId) {
|
||||
this.branchId = branchId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBranchId() {
|
||||
return branchId;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAccountNr() {
|
||||
return accountNr;
|
||||
}
|
||||
|
||||
public void setHolderTaxId(String holderTaxId) {
|
||||
this.holderTaxId = holderTaxId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getHolderTaxId() {
|
||||
return holderTaxId;
|
||||
}
|
||||
|
||||
public void setAccountType(String accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getRequirements() {
|
||||
return requirements;
|
||||
}
|
||||
|
||||
public void setRequirements(String requirements) {
|
||||
this.requirements = requirements;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class ChaseQuickPayAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -38,22 +48,6 @@ public final class ChaseQuickPayAccountPayload extends PaymentAccountPayload {
|
||||
setHolderName(holderName);
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Chase QuickPay - Holder name: " + holderName + ", email: " + email;
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class ClearXchangeAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -38,22 +48,6 @@ public final class ClearXchangeAccountPayload extends PaymentAccountPayload {
|
||||
setEmailOrMobileNr(emailOrMobileNr);
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public void setEmailOrMobileNr(String emailOrMobileNr) {
|
||||
this.emailOrMobileNr = emailOrMobileNr;
|
||||
}
|
||||
|
||||
public String getEmailOrMobileNr() {
|
||||
return emailOrMobileNr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "ClearXchange - Holder name: " + holderName + ", email or mobile no.: " + emailOrMobileNr;
|
||||
|
@ -18,41 +18,30 @@
|
||||
package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public abstract class CountryBasedPaymentAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
|
||||
protected String countryCode = "";
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CountryBasedPaymentAccountPayload(String paymentMethodName, String id, long maxTradePeriod) {
|
||||
super(paymentMethodName, id, maxTradePeriod);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter, Setter
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setCountryCode(String countryCode) {
|
||||
this.countryCode = countryCode;
|
||||
}
|
||||
|
||||
public String getCountryCode() {
|
||||
return countryCode;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
public String getPaymentDetails() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -67,30 +56,4 @@ public abstract class CountryBasedPaymentAccountPayload extends PaymentAccountPa
|
||||
}
|
||||
|
||||
abstract public String getPaymentDetailsForTradePopup(Locale locale);
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof CountryBasedPaymentAccountPayload)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
|
||||
CountryBasedPaymentAccountPayload that = (CountryBasedPaymentAccountPayload) o;
|
||||
|
||||
return countryCode.equals(that.countryCode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + countryCode.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CountryBasedPaymentAccountPayload{" +
|
||||
"countryCode='" + countryCode + '\'' +
|
||||
"} " + super.toString();
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class CryptoCurrencyAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -35,14 +45,6 @@ public final class CryptoCurrencyAccountPayload extends PaymentAccountPayload {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Receivers altcoin address: " + address;
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -38,22 +48,6 @@ public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public String getAccountNr() {
|
||||
return accountNr;
|
||||
}
|
||||
|
||||
public String getSortCode() {
|
||||
return sortCode;
|
||||
}
|
||||
|
||||
public void setSortCode(String sortCode) {
|
||||
this.sortCode = sortCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "FasterPayments - UK Sort code: " + sortCode + ", Account number: " + accountNr;
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class InteracETransferAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -42,38 +52,6 @@ public final class InteracETransferAccountPayload extends PaymentAccountPayload
|
||||
this.answer = answer;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
public void setQuestion(String question) {
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
public String getAnswer() {
|
||||
return answer;
|
||||
}
|
||||
|
||||
public void setAnswer(String answer) {
|
||||
this.answer = answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Interac e-Transfer - Holder name: " + holderName + ", email: " + email + ", secret question: " + question + ", answer: " + answer;
|
||||
|
@ -19,15 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Slf4j
|
||||
public final class NationalBankAccountPayload extends BankAccountPayload {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(NationalBankAccountPayload.class);
|
||||
|
||||
public NationalBankAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
}
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class OKPayAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -35,14 +45,6 @@ public final class OKPayAccountPayload extends PaymentAccountPayload {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public String getAccountNr() {
|
||||
return accountNr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "OKPay - Account no.: " + accountNr;
|
||||
|
@ -19,7 +19,13 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.payload.Payload;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
public abstract class PaymentAccountPayload implements Payload {
|
||||
// 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;
|
||||
@ -43,50 +49,7 @@ public abstract class PaymentAccountPayload implements Payload {
|
||||
// Getter
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getPaymentMethodId() {
|
||||
return paymentMethodId;
|
||||
}
|
||||
|
||||
abstract public String getPaymentDetails();
|
||||
|
||||
abstract public String getPaymentDetailsForTradePopup();
|
||||
|
||||
public long getMaxTradePeriod() {
|
||||
return maxTradePeriod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PaymentAccountPayload)) return false;
|
||||
|
||||
PaymentAccountPayload that = (PaymentAccountPayload) o;
|
||||
|
||||
if (maxTradePeriod != that.maxTradePeriod) return false;
|
||||
if (paymentMethodId != null ? !paymentMethodId.equals(that.paymentMethodId) : that.paymentMethodId != null)
|
||||
return false;
|
||||
return !(id != null ? !id.equals(that.id) : that.id != null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = paymentMethodId != null ? paymentMethodId.hashCode() : 0;
|
||||
result = 31 * result + (id != null ? id.hashCode() : 0);
|
||||
result = 31 * result + (int) (maxTradePeriod ^ (maxTradePeriod >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PaymentAccountPayload{" +
|
||||
"paymentMethodName='" + paymentMethodId + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", maxTradePeriod=" + maxTradePeriod +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,12 @@ package io.bisq.wire.payload.payment;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.common.persistance.Persistable;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -32,12 +34,14 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
// Don't use Enum as it breaks serialisation when changing entries and we want to stay flexible here
|
||||
@Slf4j
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
public final class PaymentMethod implements Persistable, Comparable {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
|
||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
// time in blocks (average 10 min for one block confirmation
|
||||
private static final long HOUR = 3600_000;
|
||||
private static final long DAY = HOUR * 24;
|
||||
@ -76,7 +80,8 @@ public final class PaymentMethod implements Persistable, Comparable {
|
||||
|
||||
public static final List<PaymentMethod> ALL_VALUES = new ArrayList<>(Arrays.asList(
|
||||
// EUR
|
||||
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY, Coin.parseCoin("0.5")), // sepa takes 1-3 business days. We use 8 days to include safety for holidays
|
||||
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY, Coin.parseCoin("0.5")),
|
||||
// sepa takes 1-3 business days. We use 8 days to include safety for holidays
|
||||
|
||||
// Global
|
||||
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
@ -152,22 +157,6 @@ public final class PaymentMethod implements Persistable, Comparable {
|
||||
return new PaymentMethod(Res.get("shared.na"), 1, DAY, Coin.parseCoin("0"));
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getMaxTradePeriod() {
|
||||
return maxTradePeriod;
|
||||
}
|
||||
|
||||
public long getLockTime() {
|
||||
return lockTime;
|
||||
}
|
||||
|
||||
public Coin getMaxTradeLimit() {
|
||||
return maxTradeLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull Object other) {
|
||||
if (id != null)
|
||||
@ -175,37 +164,4 @@ public final class PaymentMethod implements Persistable, Comparable {
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PaymentMethod)) return false;
|
||||
|
||||
PaymentMethod that = (PaymentMethod) o;
|
||||
|
||||
if (lockTime != that.lockTime) return false;
|
||||
if (maxTradePeriod != that.maxTradePeriod) return false;
|
||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
||||
return !(maxTradeLimit != null ? !maxTradeLimit.equals(that.maxTradeLimit) : that.maxTradeLimit != null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id != null ? id.hashCode() : 0;
|
||||
result = 31 * result + (int) (lockTime ^ (lockTime >>> 32));
|
||||
result = 31 * result + (int) (maxTradePeriod ^ (maxTradePeriod >>> 32));
|
||||
result = 31 * result + (maxTradeLimit != null ? maxTradeLimit.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PaymentMethod{" +
|
||||
"id='" + id + '\'' +
|
||||
", lockTime=" + lockTime +
|
||||
", maxTradePeriod=" + maxTradePeriod +
|
||||
", maxTradeLimitInBitcoin=" + maxTradeLimit +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class PerfectMoneyAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -35,14 +45,6 @@ public final class PerfectMoneyAccountPayload extends PaymentAccountPayload {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
this.accountNr = accountNr;
|
||||
}
|
||||
|
||||
public String getAccountNr() {
|
||||
return accountNr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "PerfectMoney - Account no.: " + accountNr;
|
||||
|
@ -19,15 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Slf4j
|
||||
public final class SameBankAccountPayload extends BankAccountPayload {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(SameBankAccountPayload.class);
|
||||
|
||||
|
||||
public SameBankAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
|
@ -20,8 +20,11 @@ package io.bisq.wire.payload.payment;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.locale.Country;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -29,15 +32,19 @@ import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// TODO refactor with BankAccountPayload
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(SepaAccountPayload.class);
|
||||
|
||||
@Setter
|
||||
private String holderName;
|
||||
@Setter
|
||||
private String iban;
|
||||
@Setter
|
||||
private String bic;
|
||||
// Dont use a set here as we need a deterministic ordering, otherwise the contract hash does not match
|
||||
private final List<String> acceptedCountryCodes;
|
||||
@ -50,30 +57,6 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||
acceptedCountryCodes.sort(String::compareTo);
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setIban(String iban) {
|
||||
this.iban = iban;
|
||||
}
|
||||
|
||||
public String getIban() {
|
||||
return iban;
|
||||
}
|
||||
|
||||
public void setBic(String bic) {
|
||||
this.bic = bic;
|
||||
}
|
||||
|
||||
public String getBic() {
|
||||
return bic;
|
||||
}
|
||||
|
||||
public void addAcceptedCountry(String countryCode) {
|
||||
if (!acceptedCountryCodes.contains(countryCode))
|
||||
acceptedCountryCodes.add(countryCode);
|
||||
@ -84,10 +67,6 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||
acceptedCountryCodes.remove(countryCode);
|
||||
}
|
||||
|
||||
public List<String> getAcceptedCountryCodes() {
|
||||
return acceptedCountryCodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails(Locale locale) {
|
||||
return "SEPA - Holder name: " + holderName + ", IBAN: " + iban + ", BIC: " + bic + ", country code: " + getCountryCode();
|
||||
|
@ -20,19 +20,22 @@ package io.bisq.wire.payload.payment;
|
||||
import com.google.common.base.Joiner;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class SpecificBanksAccountPayload extends BankAccountPayload {
|
||||
// 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 static final Logger log = LoggerFactory.getLogger(SpecificBanksAccountPayload.class);
|
||||
|
||||
|
||||
// Dont use a set here as we need a deterministic ordering, otherwise the contract hash does not match
|
||||
private ArrayList<String> acceptedBanks;
|
||||
|
||||
@ -50,11 +53,6 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
|
||||
acceptedBanks.add(bankName);
|
||||
}
|
||||
|
||||
public ArrayList<String> getAcceptedBanks() {
|
||||
return acceptedBanks;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Transfers with specific banks - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class SwishAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -38,22 +48,6 @@ public final class SwishAccountPayload extends PaymentAccountPayload {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public void setMobileNr(String mobileNr) {
|
||||
this.mobileNr = mobileNr;
|
||||
}
|
||||
|
||||
public String getMobileNr() {
|
||||
return mobileNr;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Swish - Holder name: " + holderName + ", mobile no.: " + mobileNr;
|
||||
|
@ -19,7 +19,17 @@ package io.bisq.wire.payload.payment;
|
||||
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.wire.proto.Messages;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public final class USPostalMoneyOrderAccountPayload extends PaymentAccountPayload {
|
||||
// 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;
|
||||
@ -27,7 +37,6 @@ public final class USPostalMoneyOrderAccountPayload extends PaymentAccountPayloa
|
||||
private String postalAddress;
|
||||
private String holderName;
|
||||
|
||||
|
||||
public USPostalMoneyOrderAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
}
|
||||
@ -39,22 +48,6 @@ public final class USPostalMoneyOrderAccountPayload extends PaymentAccountPayloa
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public void setPostalAddress(String postalAddress) {
|
||||
this.postalAddress = postalAddress;
|
||||
}
|
||||
|
||||
public String getPostalAddress() {
|
||||
return postalAddress;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "US Postal Money Order - Holder name: " + holderName + ", postal address: " + postalAddress;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.bisq.wire.payload.trade.statistics;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import io.bisq.common.app.Capabilities;
|
||||
import io.bisq.common.app.Version;
|
||||
import io.bisq.common.locale.CurrencyUtil;
|
||||
@ -119,7 +118,7 @@ public final class TradeStatistics implements LazyProcessedStoragePayload, Capab
|
||||
this.tradeDate = tradeDate;
|
||||
this.depositTxId = depositTxId;
|
||||
this.pubKeyRing = pubKeyRing;
|
||||
this.extraDataMap = Optional.ofNullable(extraDataMap).orElse(Maps.newHashMap());
|
||||
this.extraDataMap = extraDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user