Add email to bank accounts. Add warning and info for bank accounts regarding chargeback risk and id verification. Add warning to CXC accounts.

This commit is contained in:
Manfred Karrer 2017-06-27 21:05:47 +02:00
parent d4269adda7
commit e11b314bbb
31 changed files with 367 additions and 177 deletions

View File

@ -221,6 +221,17 @@ public class BankUtil {
}
}
public static String getHolderIdLabelShort(String countryCode) {
switch (countryCode) {
case "BR":
return "CPF:"; // do not translate as it is used in portuguese only
case "CL":
return "RUT:"; // do not translate as it is used in spanish only
default:
return "ID";
}
}
// Validation
public static boolean useValidation(String countryCode) {
switch (countryCode) {

View File

@ -503,15 +503,14 @@ message OfferPayload {
int64 seller_security_deposit = 28;
int64 max_trade_limit = 29;
int64 max_trade_period = 30;
bool supportsDirectContact = 31;
bool use_auto_close = 32;
bool use_re_open_after_auto_close = 33;
int64 lower_close_price = 34;
int64 upper_close_price = 35;
bool is_private_offer = 36;
string hash_of_challenge = 37;
map<string, string> extra_data = 38;
int32 protocol_version = 39;
bool use_auto_close = 31;
bool use_re_open_after_auto_close = 32;
int64 lower_close_price = 33;
int64 upper_close_price = 34;
bool is_private_offer = 35;
string hash_of_challenge = 36;
map<string, string> extra_data = 37;
int32 protocol_version = 38;
}
// TODO not fully verified as impl. is not completed
@ -709,10 +708,11 @@ message BankAccountPayload {
string account_nr = 5;
string account_type = 6;
string holder_tax_id = 7;
string email = 8;
oneof message {
NationalBankAccountPayload national_bank_account_payload = 8;
SameBankAccountPayload same_bank_accont_payload = 9;
SpecificBanksAccountPayload specific_banks_account_payload = 10;
NationalBankAccountPayload national_bank_account_payload = 9;
SameBankAccountPayload same_bank_accont_payload = 10;
SpecificBanksAccountPayload specific_banks_account_payload = 11;
}
}
@ -742,7 +742,8 @@ message SepaAccountPayload {
string holder_name = 1;
string iban = 2;
string bic = 3;
repeated string accepted_country_codes = 4;
string email = 4;
repeated string accepted_country_codes = 5;
}
message CryptoCurrencyAccountPayload {
@ -752,6 +753,7 @@ message CryptoCurrencyAccountPayload {
message FasterPaymentsAccountPayload {
string sort_code = 1;
string account_nr = 2;
string email = 3;
}
message InteracETransferAccountPayload {
@ -1108,7 +1110,6 @@ message PreferencesPayload {
bool use_animations = 31;
PaymentAccount selectedPayment_account_for_createOffer = 32;
bool pay_fee_in_Btc = 33;
bool supportsDirectContact = 34;
}

View File

@ -1431,7 +1431,6 @@ payment.account.name=Account name:
payment.account.owner=Account holder name
payment.bank.country=Country of bank:
payment.account.name.email=Account holder name / email
payment.account.name.holderId=Account holder name / {0}
payment.account.name.emailAndHolderId=Account holder name / email / {0}
payment.bank.name=Bank name:
payment.select.account=Select account type
@ -1442,7 +1441,6 @@ payment.foreign.currency=Are you sure you want to choose a currency other than t
payment.restore.default=No, restore default currency
payment.email=Email:
payment.country=Country:
payment.owner.email=Account holder email:
payment.extras=Extra requirements:
payment.us.info=Bank transfer with WIRE or ACH is not supported for the US because WIRE is too expensive and ACH has a high chargeback risk.\n\nPlease use payment methods \"ClearXchange\", \"US Postal Money Order\" or \"Cash Deposit\" instead.
payment.email.mobile=Email or mobile no.:
@ -1457,7 +1455,7 @@ payment.limitations=Limitations:
payment.accept.euro=Accept trades from these Euro countries:
payment.accept.nonEuro=Accept trades from these non-Euro countries:
payment.accepted.countries=Accepted countries:
payment.accepted.banks=Accepted banks:
payment.accepted.banks=Accepted banks (ID):
payment.mobile=Mobile no.:
payment.postal.address=Postal address:
@ -1488,17 +1486,27 @@ payment.clearXchange.info=Please be sure that you fulfill the requirements for t
1. You need to have your ClearXchange account verified at their platform \
before starting a trade or creating an offer.\n\n\
2. You need to have a bank account at one of the following member banks:\n\
Bank of America\n\
Capital One P2P Payments\n\
Chase QuickPay\n\
FirstBank Person to Person Transfers\n\
Frost Send Money\n\
U.S. Bank Send Money\n\
Wells Fargo SurePay\n\n\
\tBank of America\n\
\tCapital One P2P Payments\n\
\tChase QuickPay\n\
\tFirstBank Person to Person Transfers\n\
\tFrost Send Money\n\
\tU.S. Bank Send Money\n\
\tWells Fargo SurePay\n\n\
Please use ClearXchange only if you fulfill those requirements, \
otherwise it is very likely that the ClearXchange transfer fails and the trade ends up in a dispute.\n\
If you have not fulfilled the above requirements you would lose your security deposit in such a case.
If you have not fulfilled the above requirements you would lose your security deposit in such a case.\n\n\
Please be also aware of a higher chargeback risk when using ClearXchange.\n\
For the {0} seller it is highly recommended \
to verify the identity of the {1} buyer by contacting the peer using the provided email address or mobile number.
payment.chargeback.info=Any bank transfer carries some chargeback risks (reversal of payment).\n\n\
To protect {0} sellers against fraudulent payments the traders can get in touch using the email address from in the payment \
account for verifying the peers identity (e.g. by providing government issued ID, utility bill,...).\n\n\
When receiving an email please check with Anti-Virus software to be sure to not get exposed to malware or phishing attacks. \
Also be aware of risks from social engineering scam attempts.\n\
In doubt contact the arbitrator or get in touch with the community on the Bisq Forum.\n\n\
By confirming with the button below you agree to exercise identity verification with the peer if requested.
# We use constants from the code so we do not use our normal naming convention
# dynamic values are not recognized by IntelliJ
@ -1595,7 +1603,7 @@ validation.bic.invalidLocationCode=BIC contains invalid location code
validation.bic.invalidBranchCode=BIC contains invalid branch code
validation.btc.invalidFormat=Invalid format of the bitcoin address.
validation.bsq.invalidFormat=Invalid format of the BSQ address.
validation.email.invalidAddress=Invalid address=
validation.email.invalidAddress=Invalid address
validation.iban.invalidCountryCode=Country code invalid
validation.iban.checkSumNotNumeric=Checksum must be numeric
validation.iban.nonNumericChars=Non-alphanumeric character detected

View File

@ -116,7 +116,6 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
private final long sellerSecurityDeposit;
private final long maxTradeLimit;
private final long maxTradePeriod;
private final boolean supportsDirectContact;
// reserved for future use cases
// Close offer when certain price is reached
@ -174,7 +173,6 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
long sellerSecurityDeposit,
long maxTradeLimit,
long maxTradePeriod,
boolean supportsDirectContact,
boolean useAutoClose,
boolean useReOpenAfterAutoClose,
long lowerClosePrice,
@ -213,7 +211,6 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
this.sellerSecurityDeposit = sellerSecurityDeposit;
this.maxTradeLimit = maxTradeLimit;
this.maxTradePeriod = maxTradePeriod;
this.supportsDirectContact = supportsDirectContact;
this.useAutoClose = useAutoClose;
this.useReOpenAfterAutoClose = useReOpenAfterAutoClose;
this.lowerClosePrice = lowerClosePrice;
@ -260,7 +257,6 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
.setSellerSecurityDeposit(sellerSecurityDeposit)
.setMaxTradeLimit(maxTradeLimit)
.setMaxTradePeriod(maxTradePeriod)
.setSupportsDirectContact(supportsDirectContact)
.setUseAutoClose(useAutoClose)
.setUseReOpenAfterAutoClose(useReOpenAfterAutoClose)
.setLowerClosePrice(lowerClosePrice)
@ -324,7 +320,6 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
proto.getSellerSecurityDeposit(),
proto.getMaxTradeLimit(),
proto.getMaxTradePeriod(),
proto.getSupportsDirectContact(),
proto.getUseAutoClose(),
proto.getUseReOpenAfterAutoClose(),
proto.getLowerClosePrice(),

View File

@ -50,4 +50,12 @@ public final class FasterPaymentsAccount extends PaymentAccount {
public String getAccountNr() {
return ((FasterPaymentsAccountPayload) paymentAccountPayload).getAccountNr();
}
public void setEmail(String value) {
((FasterPaymentsAccountPayload) paymentAccountPayload).setEmail(value);
}
public String getEmail() {
return ((FasterPaymentsAccountPayload) paymentAccountPayload).getEmail();
}
}

View File

@ -43,4 +43,12 @@ public final class NationalBankAccount extends CountryBasedPaymentAccount implem
public String getCountryCode() {
return getCountry() != null ? getCountry().code : "";
}
public void setEmail(String value) {
((BankAccountPayload) paymentAccountPayload).setEmail(value);
}
public String getEmail() {
return ((BankAccountPayload) paymentAccountPayload).getEmail();
}
}

View File

@ -43,4 +43,12 @@ public final class SameBankAccount extends CountryBasedPaymentAccount implements
public String getCountryCode() {
return getCountry() != null ? getCountry().code : "";
}
public void setEmail(String value) {
((BankAccountPayload) paymentAccountPayload).setEmail(value);
}
public String getEmail() {
return ((BankAccountPayload) paymentAccountPayload).getEmail();
}
}

View File

@ -50,6 +50,14 @@ public final class SepaAccount extends CountryBasedPaymentAccount implements Ban
return ((SepaAccountPayload) paymentAccountPayload).getHolderName();
}
public void setEmail(String value) {
((SepaAccountPayload) paymentAccountPayload).setEmail(value);
}
public String getEmail() {
return ((SepaAccountPayload) paymentAccountPayload).getEmail();
}
public void setIban(String iban) {
((SepaAccountPayload) paymentAccountPayload).setIban(iban);
}

View File

@ -17,6 +17,7 @@
package io.bisq.core.payment;
import io.bisq.core.payment.payload.BankAccountPayload;
import io.bisq.core.payment.payload.PaymentAccountPayload;
import io.bisq.core.payment.payload.PaymentMethod;
import io.bisq.core.payment.payload.SpecificBanksAccountPayload;
@ -48,4 +49,12 @@ public final class SpecificBanksAccount extends CountryBasedPaymentAccount imple
public String getCountryCode() {
return getCountry() != null ? getCountry().code : "";
}
public void setEmail(String value) {
((BankAccountPayload) paymentAccountPayload).setEmail(value);
}
public String getEmail() {
return ((BankAccountPayload) paymentAccountPayload).getEmail();
}
}

View File

@ -19,6 +19,7 @@ package io.bisq.core.payment.payload;
import io.bisq.common.locale.BankUtil;
import io.bisq.common.locale.CountryUtil;
import io.bisq.common.locale.Res;
import io.bisq.generated.protobuffer.PB;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@ -48,6 +49,8 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
protected String holderTaxId;
@Nullable
protected String bankId;
@Nullable
protected String email;
public BankAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
super(paymentMethod, id, maxTradePeriod);
@ -68,7 +71,8 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
String accountNr,
String accountType,
String holderTaxId,
String bankId) {
String bankId,
String email) {
super(paymentMethodName, id, maxTradePeriod, countryCode);
this.holderName = holderName;
this.bankName = bankName;
@ -77,6 +81,7 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
this.accountType = accountType;
this.holderTaxId = holderTaxId;
this.bankId = bankId;
this.email = email;
}
@Override
@ -90,6 +95,7 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
Optional.ofNullable(accountNr).ifPresent(builder::setAccountNr);
Optional.ofNullable(accountType).ifPresent(builder::setAccountType);
Optional.ofNullable(bankId).ifPresent(builder::setBankId);
Optional.ofNullable(email).ifPresent(builder::setEmail);
final PB.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayloadBuilder = super.getPaymentAccountPayloadBuilder()
.getCountryBasedPaymentAccountPayloadBuilder()
.setBankAccountPayload(builder);
@ -117,8 +123,11 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ?
(BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
String emailString = email != null ?
(Res.get("payment.email") + " " + email + "\n") : "";
return "Holder name: " + holderName + "\n" +
emailString +
bankName +
bankId +
branchId +

View File

@ -20,6 +20,7 @@ package io.bisq.core.payment.payload;
import com.google.protobuf.Message;
import io.bisq.common.locale.BankUtil;
import io.bisq.common.locale.CountryUtil;
import io.bisq.common.locale.Res;
import io.bisq.generated.protobuffer.PB;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@ -154,9 +155,11 @@ public class CashDepositAccountPayload extends CountryBasedPaymentAccountPayload
(BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
String requirementsString = requirements != null && !requirements.isEmpty() ?
("Extra requirements: " + requirements + "\n") : "";
String emailString = holderEmail != null ?
(Res.get("payment.email") + " " + holderEmail + "\n") : "";
return "Holder name: " + holderName + "\n" +
"Holder email: " + holderEmail + "\n" +
emailString +
bankName +
bankId +
branchId +

View File

@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j;
public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
private String sortCode;
private String accountNr;
private String email;
public FasterPaymentsAccountPayload(String paymentMethod, String id, long maxTradePeriod) {
super(paymentMethod, id, maxTradePeriod);
@ -47,11 +48,13 @@ public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
String id,
long maxTradePeriod,
String sortCode,
String accountNr) {
String accountNr,
String email) {
this(paymentMethod, id, maxTradePeriod);
this.sortCode = sortCode;
this.accountNr = accountNr;
this.email = email;
}
@Override
@ -59,7 +62,8 @@ public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
return getPaymentAccountPayloadBuilder()
.setFasterPaymentsAccountPayload(PB.FasterPaymentsAccountPayload.newBuilder()
.setSortCode(sortCode)
.setAccountNr(accountNr))
.setAccountNr(accountNr)
.setEmail(email))
.build();
}
@ -68,7 +72,8 @@ public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
proto.getId(),
proto.getMaxTradePeriod(),
proto.getFasterPaymentsAccountPayload().getSortCode(),
proto.getFasterPaymentsAccountPayload().getAccountNr());
proto.getFasterPaymentsAccountPayload().getAccountNr(),
proto.getFasterPaymentsAccountPayload().getEmail());
}
@ -78,12 +83,13 @@ public final class FasterPaymentsAccountPayload extends PaymentAccountPayload {
@Override
public String getPaymentDetails() {
return "FasterPayments - UK Sort code: " + sortCode + ", Account number: " + accountNr;
return "FasterPayments - UK Sort code: " + sortCode + ", Account number: " + accountNr + ", Email: " + email;
}
@Override
public String getPaymentDetailsForTradePopup() {
return "UK Sort code: " + sortCode + "\n" +
"Account number: " + accountNr;
"Account number: " + accountNr + "\n" +
"Email: " + email;
}
}

View File

@ -47,7 +47,8 @@ public final class NationalBankAccountPayload extends BankAccountPayload {
String accountNr,
String accountType,
String holderTaxId,
String bankId) {
String bankId,
String email) {
super(paymentMethodName,
id,
maxTradePeriod,
@ -58,7 +59,8 @@ public final class NationalBankAccountPayload extends BankAccountPayload {
accountNr,
accountType,
holderTaxId,
bankId);
bankId,
email);
}
@Override
@ -90,7 +92,8 @@ public final class NationalBankAccountPayload extends BankAccountPayload {
bankAccountPayload.getAccountNr().isEmpty() ? null : bankAccountPayload.getAccountNr(),
bankAccountPayload.getAccountType().isEmpty() ? null : bankAccountPayload.getAccountType(),
bankAccountPayload.getHolderTaxId().isEmpty() ? null : bankAccountPayload.getHolderTaxId(),
bankAccountPayload.getBankId().isEmpty() ? null : bankAccountPayload.getBankId());
bankAccountPayload.getBankId().isEmpty() ? null : bankAccountPayload.getBankId(),
bankAccountPayload.getEmail().isEmpty() ? null : bankAccountPayload.getEmail());
}
@Override

View File

@ -147,30 +147,29 @@ public final class PaymentMethod implements PersistablePayload, Comparable {
// EUR
SEPA = new PaymentMethod(SEPA_ID, 6 * DAY, maxTradeLimitMidRisk),
// Global
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 4 * DAY, maxTradeLimitMidRisk),
SAME_BANK = new PaymentMethod(SAME_BANK_ID, 2 * DAY, maxTradeLimitMidRisk),
SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 4 * DAY, maxTradeLimitMidRisk),
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 4 * DAY, maxTradeLimitMidRisk),
// Trans national
OK_PAY = new PaymentMethod(OK_PAY_ID, DAY, maxTradeLimitLowRisk),
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, DAY, maxTradeLimitLowRisk),
// UK
FASTER_PAYMENTS = new PaymentMethod(FASTER_PAYMENTS_ID, DAY, maxTradeLimitMidRisk),
// Sweden
SWISH = new PaymentMethod(SWISH_ID, DAY, maxTradeLimitLowRisk),
// US
CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 4 * DAY, maxTradeLimitMidRisk),
CHASE_QUICK_PAY = new PaymentMethod(CHASE_QUICK_PAY_ID, DAY, maxTradeLimitMidRisk),
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 8 * DAY, maxTradeLimitMidRisk),
// Canada
INTERAC_E_TRANSFER = new PaymentMethod(INTERAC_E_TRANSFER_ID, DAY, maxTradeLimitMidRisk),
// US
// CXC is to risky regarding chargeback
// CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 4 * DAY, maxTradeLimitMidRisk),
CHASE_QUICK_PAY = new PaymentMethod(CHASE_QUICK_PAY_ID, DAY, maxTradeLimitMidRisk),
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 8 * DAY, maxTradeLimitMidRisk),
// Global
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 4 * DAY, maxTradeLimitMidRisk),
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 4 * DAY, maxTradeLimitMidRisk),
SAME_BANK = new PaymentMethod(SAME_BANK_ID, 2 * DAY, maxTradeLimitMidRisk),
SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 4 * DAY, maxTradeLimitMidRisk),
// Sweden
SWISH = new PaymentMethod(SWISH_ID, DAY, maxTradeLimitLowRisk),
// Trans national
OK_PAY = new PaymentMethod(OK_PAY_ID, DAY, maxTradeLimitLowRisk),
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, DAY, maxTradeLimitLowRisk),
// China
ALI_PAY = new PaymentMethod(ALI_PAY_ID, DAY, maxTradeLimitLowRisk),

View File

@ -47,7 +47,8 @@ public final class SameBankAccountPayload extends BankAccountPayload {
String accountNr,
String accountType,
String holderTaxId,
String bankId) {
String bankId,
String email) {
super(paymentMethodName,
id,
maxTradePeriod,
@ -58,7 +59,8 @@ public final class SameBankAccountPayload extends BankAccountPayload {
accountNr,
accountType,
holderTaxId,
bankId);
bankId,
email);
}
@Override
@ -90,7 +92,8 @@ public final class SameBankAccountPayload extends BankAccountPayload {
bankAccountPayload.getAccountNr().isEmpty() ? null : bankAccountPayload.getAccountNr(),
bankAccountPayload.getAccountType().isEmpty() ? null : bankAccountPayload.getAccountType(),
bankAccountPayload.getHolderTaxId().isEmpty() ? null : bankAccountPayload.getHolderTaxId(),
bankAccountPayload.getBankId().isEmpty() ? null : bankAccountPayload.getBankId());
bankAccountPayload.getBankId().isEmpty() ? null : bankAccountPayload.getBankId(),
bankAccountPayload.getEmail().isEmpty() ? null : bankAccountPayload.getEmail());
}
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -43,6 +43,8 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
private String iban;
@Setter
private String bic;
@Setter
private String email;
// Dont use a set here as we need a deterministic ordering, otherwise the contract hash does not match
private final List<String> acceptedCountryCodes;
@ -66,11 +68,13 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
String holderName,
String iban,
String bic,
String email,
List<String> acceptedCountryCodes) {
super(paymentMethodName, id, maxTradePeriod, countryCode);
this.holderName = holderName;
this.iban = iban;
this.bic = bic;
this.email = email;
this.acceptedCountryCodes = acceptedCountryCodes;
}
@ -81,6 +85,7 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
.setHolderName(holderName)
.setIban(iban)
.setBic(bic)
.setEmail(email)
.addAllAcceptedCountryCodes(acceptedCountryCodes);
final PB.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
.getCountryBasedPaymentAccountPayloadBuilder()
@ -100,6 +105,7 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
sepaAccountPayload.getHolderName(),
sepaAccountPayload.getIban(),
sepaAccountPayload.getBic(),
sepaAccountPayload.getEmail(),
new ArrayList<>(sepaAccountPayload.getAcceptedCountryCodesList()));
}
@ -120,7 +126,7 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
@Override
public String getPaymentDetails() {
return "SEPA - Holder name: " + holderName + ", IBAN: " + iban + ", BIC: " + bic + ", country code: " + getCountryCode();
return "SEPA - Holder name: " + holderName + ", IBAN: " + iban + ", BIC: " + bic + ", Email: " + email + ", country code: " + getCountryCode();
}
@Override
@ -128,6 +134,7 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
return "Holder name: " + holderName + "\n" +
"IBAN: " + iban + "\n" +
"BIC: " + bic + "\n" +
"Email: " + email + "\n" +
"Country of bank: " + CountryUtil.getNameByCode(countryCode);
}
}

View File

@ -55,6 +55,7 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
String accountType,
String holderTaxId,
String bankId,
String email,
ArrayList<String> acceptedBanks) {
super(paymentMethodName,
id,
@ -66,7 +67,8 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
accountNr,
accountType,
holderTaxId,
bankId);
bankId,
email);
this.acceptedBanks = acceptedBanks;
}
@ -104,6 +106,7 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
bankAccountPayload.getAccountType().isEmpty() ? null : bankAccountPayload.getAccountType(),
bankAccountPayload.getHolderTaxId().isEmpty() ? null : bankAccountPayload.getHolderTaxId(),
bankAccountPayload.getBankId().isEmpty() ? null : bankAccountPayload.getBankId(),
bankAccountPayload.getEmail().isEmpty() ? null : bankAccountPayload.getEmail(),
new ArrayList<>(specificBanksAccountPayload.getAcceptedBanksList())
);
}

View File

@ -67,7 +67,6 @@ public final class PreferencesPayload implements PersistableEnvelope {
@Nullable
private PaymentAccount selectedPaymentAccountForCreateOffer;
private boolean payFeeInBtc = true;
private boolean supportsDirectContact = true;
///////////////////////////////////////////////////////////////////////////////////////////
@ -114,8 +113,7 @@ public final class PreferencesPayload implements PersistableEnvelope {
.setDirectoryChooserPath(directoryChooserPath)
.setBuyerSecurityDepositAsLong(buyerSecurityDepositAsLong)
.setUseAnimations(useAnimations)
.setPayFeeInBtc(payFeeInBtc)
.setSupportsDirectContact(supportsDirectContact);
.setPayFeeInBtc(payFeeInBtc);
Optional.ofNullable(backupDirectory).ifPresent(builder::setBackupDirectory);
Optional.ofNullable(preferredTradeCurrency).ifPresent(e -> builder.setPreferredTradeCurrency((PB.TradeCurrency) e.toProtoMessage()));
@ -173,7 +171,6 @@ public final class PreferencesPayload implements PersistableEnvelope {
proto.getBuyerSecurityDepositAsLong(),
proto.getUseAnimations(),
paymentAccount,
proto.getPayFeeInBtc(),
proto.getSupportsDirectContact());
proto.getPayFeeInBtc());
}
}

View File

@ -29,10 +29,7 @@ import io.bisq.gui.components.InputTextField;
import io.bisq.gui.main.overlays.popups.Popup;
import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.Layout;
import io.bisq.gui.util.validation.AccountNrValidator;
import io.bisq.gui.util.validation.BankIdValidator;
import io.bisq.gui.util.validation.BranchIdValidator;
import io.bisq.gui.util.validation.InputValidator;
import io.bisq.gui.util.validation.*;
import javafx.collections.FXCollections;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
@ -48,38 +45,21 @@ import static io.bisq.gui.util.FormBuilder.*;
abstract class BankForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(BankForm.class);
protected final BankAccountPayload bankAccountPayload;
private InputTextField bankNameInputTextField, bankIdInputTextField, branchIdInputTextField, accountNrInputTextField, holderIdInputTextField;
private Label holderIdLabel;
protected InputTextField holderNameInputTextField;
private Label bankIdLabel;
private Label branchIdLabel;
private Label accountNrLabel;
private Tuple2<Label, InputTextField> bankIdTuple;
private Tuple2<Label, InputTextField> accountNrTuple;
private Tuple2<Label, InputTextField> branchIdTuple;
private Tuple2<Label, InputTextField> bankNameTuple;
private Tuple2<Label, ComboBox> accountTypeTuple;
private Label accountTypeLabel;
private ComboBox<String> accountTypeComboBox;
private boolean validatorsApplied;
private boolean useHolderID;
private final Runnable closeHandler;
private ComboBox<TradeCurrency> currencyComboBox;
static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
BankAccountPayload data = (BankAccountPayload) paymentAccountPayload;
String countryCode = ((BankAccountPayload) paymentAccountPayload).getCountryCode();
if (data.getHolderTaxId() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
Res.get("payment.account.name.holderId", BankUtil.getHolderIdLabel(countryCode)),
data.getHolderName() + " / " + data.getHolderTaxId());
else
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"),
data.getHolderName());
if (data.getHolderTaxId() != null) {
final String title = Res.get("payment.account.owner") + " / " + Res.get("payment.email") + " / " + BankUtil.getHolderIdLabelShort(countryCode);
final String value = data.getHolderName() + " / " + data.getEmail() + " / " + data.getHolderTaxId();
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, title, value);
} else {
final String title = Res.get("payment.account.owner") + " / " + Res.get("payment.email");
final String value = data.getHolderName() + " / " + data.getEmail();
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, title, value);
}
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.bank.country"),
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.bank.country"),
CountryUtil.getNameAndCode(countryCode));
// We don't want to display more than 6 rows to avoid scrolling, so if we get too many fields we combine them horizontally
@ -200,11 +180,33 @@ abstract class BankForm extends PaymentMethodForm {
return gridRow;
}
protected final BankAccountPayload bankAccountPayload;
private InputTextField bankNameInputTextField, bankIdInputTextField, branchIdInputTextField, accountNrInputTextField, holderIdInputTextField;
private Label holderIdLabel;
protected InputTextField holderNameInputTextField;
private Label bankIdLabel;
private Label branchIdLabel;
private Label accountNrLabel;
private Tuple2<Label, InputTextField> bankIdTuple;
private Tuple2<Label, InputTextField> accountNrTuple;
private Tuple2<Label, InputTextField> branchIdTuple;
private Tuple2<Label, InputTextField> bankNameTuple;
private Tuple2<Label, ComboBox> accountTypeTuple;
private Label accountTypeLabel;
private ComboBox<String> accountTypeComboBox;
private boolean validatorsApplied;
private boolean useHolderID;
private final Runnable closeHandler;
private ComboBox<TradeCurrency> currencyComboBox;
protected final EmailValidator emailValidator;
BankForm(PaymentAccount paymentAccount, InputValidator inputValidator,
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
this.closeHandler = closeHandler;
this.bankAccountPayload = (BankAccountPayload) paymentAccount.paymentAccountPayload;
emailValidator = new EmailValidator();
}
@Override
@ -214,6 +216,8 @@ abstract class BankForm extends PaymentMethodForm {
addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addEmailForDisplayAccount();
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"),
Res.get(paymentAccount.getPaymentMethod().getId()));
addLabelTextField(gridPane, ++gridRow, Res.get("payment.country"),
@ -339,7 +343,7 @@ abstract class BankForm extends PaymentMethodForm {
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
if (requiresHolderId) {
holderNameInputTextField.minWidthProperty().unbind();
holderNameInputTextField.setMinWidth(300);
holderNameInputTextField.setMinWidth(250);
} else {
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
}
@ -507,7 +511,7 @@ abstract class BankForm extends PaymentMethodForm {
Tuple4<Label, InputTextField, Label, InputTextField> tuple = addLabelInputTextFieldLabelInputTextField(gridPane,
++gridRow, Res.getWithCol("payment.account.owner"), BankUtil.getHolderIdLabel(""));
holderNameInputTextField = tuple.second;
holderNameInputTextField.setMinWidth(300);
holderNameInputTextField.setMinWidth(250);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
bankAccountPayload.setHolderName(newValue);
updateFromInputs();
@ -527,6 +531,14 @@ abstract class BankForm extends PaymentMethodForm {
bankAccountPayload.setHolderTaxId(newValue);
updateFromInputs();
});
InputTextField emailTextField = addLabelInputTextField(gridPane,
++gridRow, Res.get("payment.email")).second;
emailTextField.textProperty().addListener((ov, oldValue, newValue) -> {
bankAccountPayload.setEmail(newValue);
updateFromInputs();
});
emailTextField.setValidator(emailValidator);
}
@Override
@ -567,7 +579,8 @@ abstract class BankForm extends PaymentMethodForm {
boolean result = isAccountNameValid()
&& paymentAccount.getSingleTradeCurrency() != null
&& getCountryBasedPaymentAccount().getCountry() != null
&& holderNameInputTextField.getValidator().validate(bankAccountPayload.getHolderName()).isValid;
&& holderNameInputTextField.getValidator().validate(bankAccountPayload.getHolderName()).isValid
&& emailValidator.validate(bankAccountPayload.getEmail()).isValid;
String countryCode = bankAccountPayload.getCountryCode();
if (validatorsApplied && BankUtil.useValidation(countryCode)) {
@ -599,11 +612,13 @@ abstract class BankForm extends PaymentMethodForm {
Res.getWithCol("payment.account.owner"), BankUtil.getHolderIdLabel(countryCode));
TextField holderNameTextField = tuple.second;
holderNameTextField.setText(bankAccountPayload.getHolderName());
holderNameTextField.setMinWidth(300);
holderNameTextField.setMinWidth(250);
tuple.forth.setText(bankAccountPayload.getHolderTaxId());
} else {
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), bankAccountPayload.getHolderName());
}
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), bankAccountPayload.getEmail());
}
protected void addAcceptedBanksForAddAccount() {
@ -611,4 +626,7 @@ abstract class BankForm extends PaymentMethodForm {
public void addAcceptedBanksForDisplayAccount() {
}
public void addEmailForDisplayAccount() {
}
}

View File

@ -30,10 +30,7 @@ import io.bisq.gui.main.overlays.popups.Popup;
import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.FormBuilder;
import io.bisq.gui.util.Layout;
import io.bisq.gui.util.validation.AccountNrValidator;
import io.bisq.gui.util.validation.BankIdValidator;
import io.bisq.gui.util.validation.BranchIdValidator;
import io.bisq.gui.util.validation.InputValidator;
import io.bisq.gui.util.validation.*;
import javafx.collections.FXCollections;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
@ -48,24 +45,6 @@ import org.slf4j.LoggerFactory;
public class CashDepositForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(CashDepositForm.class);
protected final CashDepositAccountPayload cashDepositAccountPayload;
private InputTextField bankNameInputTextField, bankIdInputTextField, branchIdInputTextField, accountNrInputTextField, holderIdInputTextField;
private Label holderIdLabel;
protected InputTextField holderNameInputTextField, holderEmailInputTextField;
private Label bankIdLabel;
private Label branchIdLabel;
private Label accountNrLabel;
private Tuple2<Label, InputTextField> bankIdTuple;
private Tuple2<Label, InputTextField> accountNrTuple;
private Tuple2<Label, InputTextField> branchIdTuple;
private Tuple2<Label, InputTextField> bankNameTuple;
private Tuple2<Label, ComboBox> accountTypeTuple;
private Label accountTypeLabel;
private ComboBox<String> accountTypeComboBox;
private boolean validatorsApplied;
private boolean useHolderID;
private ComboBox<TradeCurrency> currencyComboBox;
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
CashDepositAccountPayload data = (CashDepositAccountPayload) paymentAccountPayload;
String countryCode = data.getCountryCode();
@ -212,10 +191,32 @@ public class CashDepositForm extends PaymentMethodForm {
return gridRow;
}
protected final CashDepositAccountPayload cashDepositAccountPayload;
private InputTextField bankNameInputTextField, bankIdInputTextField, branchIdInputTextField, accountNrInputTextField, holderIdInputTextField;
private Label holderIdLabel;
protected InputTextField holderNameInputTextField, emailInputTextField;
private Label bankIdLabel;
private Label branchIdLabel;
private Label accountNrLabel;
private Tuple2<Label, InputTextField> bankIdTuple;
private Tuple2<Label, InputTextField> accountNrTuple;
private Tuple2<Label, InputTextField> branchIdTuple;
private Tuple2<Label, InputTextField> bankNameTuple;
private Tuple2<Label, ComboBox> accountTypeTuple;
private Label accountTypeLabel;
private ComboBox<String> accountTypeComboBox;
private boolean validatorsApplied;
private boolean useHolderID;
private ComboBox<TradeCurrency> currencyComboBox;
private final EmailValidator emailValidator;
public CashDepositForm(PaymentAccount paymentAccount, InputValidator inputValidator,
GridPane gridPane, int gridRow, BSFormatter formatter) {
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
this.cashDepositAccountPayload = (CashDepositAccountPayload) paymentAccount.paymentAccountPayload;
emailValidator = new EmailValidator();
}
@Override
@ -234,7 +235,7 @@ public class CashDepositForm extends PaymentMethodForm {
nameAndCode);
addAcceptedBanksForDisplayAccount();
addHolderNameAndIdForDisplayAccount();
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.owner.email"),
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"),
cashDepositAccountPayload.getHolderEmail());
if (BankUtil.isBankNameRequired(countryCode))
@ -349,7 +350,7 @@ public class CashDepositForm extends PaymentMethodForm {
accountNrInputTextField.setValidator(null);
}
holderNameInputTextField.resetValidation();
holderEmailInputTextField.resetValidation();
emailInputTextField.resetValidation();
bankNameInputTextField.resetValidation();
bankIdInputTextField.resetValidation();
branchIdInputTextField.resetValidation();
@ -540,13 +541,13 @@ public class CashDepositForm extends PaymentMethodForm {
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
holderNameInputTextField.setValidator(inputValidator);
holderEmailInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.owner.email")).second;
holderEmailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
emailInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.email")).second;
emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountPayload.setHolderEmail(newValue);
updateFromInputs();
});
holderEmailInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
holderEmailInputTextField.setValidator(inputValidator);
emailInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
emailInputTextField.setValidator(emailValidator);
useHolderID = true;
holderIdLabel = tuple.third;
@ -601,7 +602,7 @@ public class CashDepositForm extends PaymentMethodForm {
&& paymentAccount.getSingleTradeCurrency() != null
&& getCountryBasedPaymentAccount().getCountry() != null
&& holderNameInputTextField.getValidator().validate(cashDepositAccountPayload.getHolderName()).isValid
&& holderEmailInputTextField.getValidator().validate(cashDepositAccountPayload.getHolderEmail()).isValid;
&& emailInputTextField.getValidator().validate(cashDepositAccountPayload.getHolderEmail()).isValid;
String countryCode = cashDepositAccountPayload.getCountryCode();
if (validatorsApplied && BankUtil.useValidation(countryCode)) {

View File

@ -28,6 +28,7 @@ import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.Layout;
import io.bisq.gui.util.validation.AccountNrValidator;
import io.bisq.gui.util.validation.BranchIdValidator;
import io.bisq.gui.util.validation.EmailValidator;
import io.bisq.gui.util.validation.InputValidator;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
@ -35,16 +36,11 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bisq.gui.util.FormBuilder.addLabelInputTextField;
import static io.bisq.gui.util.FormBuilder.addLabelTextField;
import static io.bisq.gui.util.FormBuilder.*;
public class FasterPaymentsForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(FasterPaymentsForm.class);
private final FasterPaymentsAccount fasterPaymentsAccount;
private InputTextField accountNrInputTextField;
private InputTextField sortCodeInputTextField;
public static int addFormForBuyer(GridPane gridPane, int gridRow,
PaymentAccountPayload paymentAccountPayload) {
// do not translate as it is used in english only
@ -52,13 +48,23 @@ public class FasterPaymentsForm extends PaymentMethodForm {
((FasterPaymentsAccountPayload) paymentAccountPayload).getSortCode());
addLabelTextField(gridPane, ++gridRow, Res.get("payment.accountNr"),
((FasterPaymentsAccountPayload) paymentAccountPayload).getAccountNr());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.email"),
((FasterPaymentsAccountPayload) paymentAccountPayload).getEmail());
return gridRow;
}
private final FasterPaymentsAccount fasterPaymentsAccount;
private InputTextField accountNrInputTextField;
private InputTextField sortCodeInputTextField;
private final EmailValidator emailValidator;
public FasterPaymentsForm(PaymentAccount paymentAccount, InputValidator inputValidator, GridPane gridPane,
int gridRow, BSFormatter formatter) {
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
this.fasterPaymentsAccount = (FasterPaymentsAccount) paymentAccount;
emailValidator = new EmailValidator();
}
@Override
@ -80,6 +86,14 @@ public class FasterPaymentsForm extends PaymentMethodForm {
updateFromInputs();
});
InputTextField emailTextField = addLabelInputTextField(gridPane,
++gridRow, Res.get("payment.email")).second;
emailTextField.textProperty().addListener((ov, oldValue, newValue) -> {
fasterPaymentsAccount.setEmail(newValue);
updateFromInputs();
});
emailTextField.setValidator(emailValidator);
TradeCurrency singleTradeCurrency = fasterPaymentsAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"),
@ -103,6 +117,7 @@ public class FasterPaymentsForm extends PaymentMethodForm {
gridRowFrom = gridRow;
addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
fasterPaymentsAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), fasterPaymentsAccount.getEmail());
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"),
Res.get(fasterPaymentsAccount.getPaymentMethod().getId()));
// do not translate as it is used in english only
@ -119,6 +134,7 @@ public class FasterPaymentsForm extends PaymentMethodForm {
@Override
public void updateAllInputsValid() {
allInputsValid.set(isAccountNameValid()
&& emailValidator.validate(fasterPaymentsAccount.getEmail()).isValid
&& sortCodeInputTextField.getValidator().validate(fasterPaymentsAccount.getSortCode()).isValid
&& accountNrInputTextField.getValidator().validate(fasterPaymentsAccount.getAccountNr()).isValid
&& fasterPaymentsAccount.getTradeCurrencies().size() > 0);

View File

@ -17,17 +17,16 @@
package io.bisq.gui.components.paymentmethods;
import io.bisq.common.locale.Res;
import io.bisq.core.payment.PaymentAccount;
import io.bisq.core.payment.payload.PaymentAccountPayload;
import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.validation.InputValidator;
import javafx.scene.layout.GridPane;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bisq.gui.util.FormBuilder.addLabelTextField;
public class NationalBankForm extends BankForm {
private static final Logger log = LoggerFactory.getLogger(NationalBankForm.class);
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
return BankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
}
@ -36,4 +35,9 @@ public class NationalBankForm extends BankForm {
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
super(paymentAccount, inputValidator, gridPane, gridRow, formatter, closeHandler);
}
@Override
public void addEmailForDisplayAccount() {
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), bankAccountPayload.getEmail()).second.setMouseTransparent(false);
}
}

View File

@ -56,12 +56,21 @@ public class SameBankForm extends BankForm {
bankAccountPayload.setHolderName(newValue);
updateFromInputs();
});
InputTextField emailTextField = addLabelInputTextField(gridPane,
++gridRow, Res.get("payment.email")).second;
emailTextField.textProperty().addListener((ov, oldValue, newValue) -> {
bankAccountPayload.setEmail(newValue);
updateFromInputs();
});
emailTextField.setValidator(emailValidator);
}
@Override
public void updateAllInputsValid() {
boolean result = isAccountNameValid()
&& inputValidator.validate(bankAccountPayload.getHolderName()).isValid
&& emailValidator.validate(bankAccountPayload.getEmail()).isValid
&& paymentAccount.getSingleTradeCurrency() != null
&& ((CountryBasedPaymentAccount) paymentAccount).getCountry() != null;
@ -82,12 +91,19 @@ public class SameBankForm extends BankForm {
allInputsValid.set(result);
}
@Override
public void addEmailForDisplayAccount() {
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), bankAccountPayload.getEmail()).second.setMouseTransparent(false);
}
@Override
protected void addHolderNameAndIdForDisplayAccount() {
Tuple2<Label, TextField> tuple = addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"));
TextField holderNameTextField = tuple.second;
holderNameTextField.setMinWidth(300);
holderNameTextField.setText(bankAccountPayload.getHolderName());
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), bankAccountPayload.getEmail());
}
}

View File

@ -28,6 +28,7 @@ import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.FormBuilder;
import io.bisq.gui.util.Layout;
import io.bisq.gui.util.validation.BICValidator;
import io.bisq.gui.util.validation.EmailValidator;
import io.bisq.gui.util.validation.IBANValidator;
import io.bisq.gui.util.validation.InputValidator;
import javafx.collections.FXCollections;
@ -41,30 +42,21 @@ import javafx.scene.layout.HBox;
import javafx.scene.text.TextAlignment;
import javafx.util.StringConverter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import static io.bisq.gui.util.FormBuilder.*;
public class SepaForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(SepaForm.class);
private final SepaAccount sepaAccount;
private final IBANValidator ibanValidator;
private final BICValidator bicValidator;
private InputTextField ibanInputTextField;
private TextField currencyTextField;
private final List<CheckBox> euroCountryCheckBoxes = new ArrayList<>();
private final List<CheckBox> nonEuroCountryCheckBoxes = new ArrayList<>();
private ComboBox<TradeCurrency> currencyComboBox;
public static int addFormForBuyer(GridPane gridPane, int gridRow,
PaymentAccountPayload paymentAccountPayload) {
SepaAccountPayload sepaAccountPayload = (SepaAccountPayload) paymentAccountPayload;
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
Res.getWithCol("payment.account.owner"),
sepaAccountPayload.getHolderName());
final String title = Res.get("payment.account.owner") + " / " + Res.get("payment.email");
final String value = sepaAccountPayload.getHolderName() + " / " + sepaAccountPayload.getEmail();
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, title, value);
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
Res.getWithCol("payment.bank.country"),
CountryUtil.getNameAndCode(sepaAccountPayload.getCountryCode()));
@ -74,6 +66,16 @@ public class SepaForm extends PaymentMethodForm {
return gridRow;
}
private final SepaAccount sepaAccount;
private final IBANValidator ibanValidator;
private final BICValidator bicValidator;
private InputTextField ibanInputTextField;
private TextField currencyTextField;
private final List<CheckBox> euroCountryCheckBoxes = new ArrayList<>();
private final List<CheckBox> nonEuroCountryCheckBoxes = new ArrayList<>();
private ComboBox<TradeCurrency> currencyComboBox;
private final EmailValidator emailValidator;
public SepaForm(PaymentAccount paymentAccount, IBANValidator ibanValidator,
BICValidator bicValidator, InputValidator inputValidator,
GridPane gridPane, int gridRow, BSFormatter formatter) {
@ -81,6 +83,8 @@ public class SepaForm extends PaymentMethodForm {
this.sepaAccount = (SepaAccount) paymentAccount;
this.ibanValidator = ibanValidator;
this.bicValidator = bicValidator;
emailValidator = new EmailValidator();
}
@Override
@ -95,6 +99,15 @@ public class SepaForm extends PaymentMethodForm {
updateFromInputs();
});
InputTextField emailTextField = addLabelInputTextField(gridPane,
++gridRow, Res.get("payment.email")).second;
emailTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaAccount.setEmail(newValue);
updateFromInputs();
});
emailTextField.setValidator(emailValidator);
ibanInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
ibanInputTextField.setValidator(ibanValidator);
ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
@ -315,6 +328,7 @@ public class SepaForm extends PaymentMethodForm {
@Override
public void updateAllInputsValid() {
allInputsValid.set(isAccountNameValid()
&& emailValidator.validate(sepaAccount.getEmail()).isValid
&& bicValidator.validate(sepaAccount.getBic()).isValid
&& ibanValidator.validate(sepaAccount.getIban()).isValid
&& inputValidator.validate(sepaAccount.getHolderName()).isValid
@ -327,6 +341,7 @@ public class SepaForm extends PaymentMethodForm {
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), sepaAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), sepaAccount.getEmail()).second.setMouseTransparent(false);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"),
Res.get(sepaAccount.getPaymentMethod().getId()));
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), sepaAccount.getHolderName());

View File

@ -32,14 +32,10 @@ import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.GridPane;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bisq.gui.util.FormBuilder.*;
public class SpecificBankForm extends BankForm {
private static final Logger log = LoggerFactory.getLogger(SpecificBankForm.class);
private final SpecificBanksAccountPayload specificBanksAccountPayload;
private TextField acceptedBanksTextField;
private Tooltip acceptedBanksTooltip;
@ -104,6 +100,11 @@ public class SpecificBankForm extends BankForm {
Joiner.on(", ").join(specificBanksAccountPayload.getAcceptedBanks())).second.setMouseTransparent(false);
}
@Override
public void addEmailForDisplayAccount() {
addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), bankAccountPayload.getEmail()).second.setMouseTransparent(false);
}
@Override
public void updateAllInputsValid() {
super.updateAllInputsValid();

View File

@ -21,9 +21,8 @@ import io.bisq.common.UserThread;
import io.bisq.common.locale.Res;
import io.bisq.common.util.Tuple2;
import io.bisq.common.util.Tuple3;
import io.bisq.core.payment.ClearXchangeAccount;
import io.bisq.core.payment.PaymentAccount;
import io.bisq.core.payment.PaymentAccountFactory;
import io.bisq.core.app.BisqEnvironment;
import io.bisq.core.payment.*;
import io.bisq.core.payment.payload.PaymentMethod;
import io.bisq.gui.common.view.ActivatableViewAndModel;
import io.bisq.gui.common.view.FxmlView;
@ -144,12 +143,31 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
///////////////////////////////////////////////////////////////////////////////////////////
private void onSaveNewAccount(PaymentAccount paymentAccount) {
if (paymentAccount instanceof ClearXchangeAccount) {
new Popup<>().information(Res.get("payment.clearXchange.info"))
.width(900)
final String currencyName = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyName();
if (paymentAccount instanceof SepaAccount ||
paymentAccount instanceof BankAccount ||
paymentAccount instanceof ClearXchangeAccount ||
paymentAccount instanceof FasterPaymentsAccount ||
paymentAccount instanceof ChaseQuickPayAccount ||
paymentAccount instanceof InteracETransferAccount) {
new Popup<>().information(Res.get("payment.chargeback.info", currencyName))
.width(800)
.closeButtonText(Res.get("shared.cancel"))
.actionButtonText(Res.get("shared.iConfirm"))
.onAction(() -> doSaveNewAccount(paymentAccount))
.onAction(() -> {
if (paymentAccount instanceof ClearXchangeAccount) {
UserThread.runAfter(() -> {
new Popup<>().information(Res.get("payment.clearXchange.info", currencyName, currencyName))
.width(900)
.closeButtonText(Res.get("shared.cancel"))
.actionButtonText(Res.get("shared.iConfirm"))
.onAction(() -> doSaveNewAccount(paymentAccount))
.show();
}, 1);
} else {
doSaveNewAccount(paymentAccount);
}
})
.show();
} else {
doSaveNewAccount(paymentAccount);

View File

@ -336,7 +336,6 @@ class CreateOfferDataModel extends ActivatableDataModel {
// reserved for future use cases
// Use null values if not set
boolean supportsDirectContact = true;
boolean isPrivateOffer = false;
boolean useAutoClose = false;
boolean useReOpenAfterAutoClose = false;
@ -383,7 +382,6 @@ class CreateOfferDataModel extends ActivatableDataModel {
sellerSecurityDeposit.value,
maxTradeLimit,
maxTradePeriod,
supportsDirectContact,
useAutoClose,
useReOpenAfterAutoClose,
upperClosePrice,

View File

@ -371,7 +371,8 @@ public class GUIUtil {
public static void showClearXchangeWarning() {
String key = "confirmClearXchangeRequirements";
new Popup<>().information(Res.get("payment.clearXchange.selected") + "\n" + Res.get("payment.clearXchange.info"))
final String currencyName = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyName();
new Popup<>().information(Res.get("payment.clearXchange.info", currencyName, currencyName))
.width(900)
.closeButtonText(Res.get("shared.iConfirm"))
.dontShowAgainId(key)

View File

@ -20,14 +20,29 @@ package io.bisq.gui.util.validation;
public final class ClearXchangeValidator extends InputValidator {
private final EmailValidator emailValidator;
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
public ClearXchangeValidator() {
emailValidator = new EmailValidator();
}
@Override
public ValidationResult validate(String input) {
// TODO
return super.validate(input);
ValidationResult result = validateIfNotEmpty(input);
if (!result.isValid) {
return result;
} else {
ValidationResult emailResult = emailValidator.validate(input);
if (emailResult.isValid)
return emailResult;
else
return validatePhoneNumber(input);
}
}
@ -35,5 +50,8 @@ public final class ClearXchangeValidator extends InputValidator {
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
// TODO not impl yet -> see InteracETransferValidator
private ValidationResult validatePhoneNumber(String input) {
return super.validate(input);
}
}

View File

@ -71,7 +71,6 @@ public class TradesChartsViewModelTest {
0,
false,
false,
false,
0,
0,
false,

View File

@ -297,7 +297,6 @@ public class OfferBookViewModelTest {
0,
false,
false,
false,
0,
0,
false,