diff --git a/apitest/src/test/java/haveno/apitest/method/payment/CreatePaymentAccountTest.java b/apitest/src/test/java/haveno/apitest/method/payment/CreatePaymentAccountTest.java index 8d637cba4f..e1ee0113b0 100644 --- a/apitest/src/test/java/haveno/apitest/method/payment/CreatePaymentAccountTest.java +++ b/apitest/src/test/java/haveno/apitest/method/payment/CreatePaymentAccountTest.java @@ -676,7 +676,7 @@ public class CreatePaymentAccountTest extends AbstractPaymentAccountTest { assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_SELECTED_TRADE_CURRENCY), paymentAccount.getSelectedTradeCurrency().getCode()); verifyCommonFormEntries(paymentAccount); - assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_USERNAME), paymentAccount.getUserName()); + assertEquals(COMPLETED_FORM_MAP.get(PROPERTY_NAME_USERNAME), paymentAccount.getUsername()); print(paymentAccount); } diff --git a/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java b/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java index e890d74f01..6650265fbb 100644 --- a/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java +++ b/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java @@ -74,7 +74,10 @@ public final class PaymentAccountForm implements PersistablePayload { TRANSFERWISE, UPHOLD, ZELLE, - AUSTRALIA_PAYID; + AUSTRALIA_PAYID, + CASH_APP, + PAYPAL, + VENMO; public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) { return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name()); diff --git a/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java b/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java index 70af0032eb..8fb4d5b4ad 100644 --- a/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java +++ b/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java @@ -98,7 +98,9 @@ public final class PaymentAccountFormField implements PersistablePayload { SPECIAL_INSTRUCTIONS, STATE, TRADE_CURRENCIES, - USER_NAME; + USERNAME, + EMAIL_OR_MOBILE_NR_OR_USERNAME, + EMAIL_OR_MOBILE_NR_OR_CASHTAG; public static PaymentAccountFormField.FieldId fromProto(protobuf.PaymentAccountFormField.FieldId fieldId) { return ProtoUtil.enumFromProto(PaymentAccountFormField.FieldId.class, fieldId.name()); diff --git a/core/src/main/java/haveno/core/app/DomainInitialisation.java b/core/src/main/java/haveno/core/app/DomainInitialisation.java index 91312715a2..646d80d9dd 100644 --- a/core/src/main/java/haveno/core/app/DomainInitialisation.java +++ b/core/src/main/java/haveno/core/app/DomainInitialisation.java @@ -217,7 +217,7 @@ public class DomainInitialisation { revolutAccountsUpdateHandler.accept(user.getPaymentAccountsAsObservable().stream() .filter(paymentAccount -> paymentAccount instanceof RevolutAccount) .map(paymentAccount -> (RevolutAccount) paymentAccount) - .filter(RevolutAccount::userNameNotSet) + .filter(RevolutAccount::usernameNotSet) .collect(Collectors.toList())); } if (amazonGiftCardAccountsUpdateHandler != null && user.getPaymentAccountsAsObservable() != null) { diff --git a/core/src/main/java/haveno/core/payment/CashAppAccount.java b/core/src/main/java/haveno/core/payment/CashAppAccount.java index 4c42f42dd8..e11e0dffae 100644 --- a/core/src/main/java/haveno/core/payment/CashAppAccount.java +++ b/core/src/main/java/haveno/core/payment/CashAppAccount.java @@ -28,17 +28,22 @@ import lombok.NonNull; import java.util.List; -// Removed due too high chargeback risk -// Cannot be deleted as it would break old trade history entries -@Deprecated @EqualsAndHashCode(callSuper = true) public final class CashAppAccount extends PaymentAccount { - public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); + public static final List SUPPORTED_CURRENCIES = List.of( + new TraditionalCurrency("USD"), + new TraditionalCurrency("GBP")); + + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.EMAIL_OR_MOBILE_NR_OR_CASHTAG, + PaymentAccountFormField.FieldId.TRADE_CURRENCIES, + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.SALT); public CashAppAccount() { super(PaymentMethod.CASH_APP); - setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0)); + tradeCurrencies.addAll(getSupportedCurrencies()); } @Override @@ -53,14 +58,14 @@ public final class CashAppAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } - public void setCashTag(String cashTag) { - ((CashAppAccountPayload) paymentAccountPayload).setCashTag(cashTag); + public void setEmailOrMobileNrOrCashtag(String emailOrMobileNrOrCashtag) { + ((CashAppAccountPayload) paymentAccountPayload).setEmailOrMobileNrOrCashtag(emailOrMobileNrOrCashtag); } - public String getCashTag() { - return ((CashAppAccountPayload) paymentAccountPayload).getCashTag(); + public String getEmailOrMobileNrOrCashtag() { + return ((CashAppAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrCashtag(); } } diff --git a/core/src/main/java/haveno/core/payment/PayPalAccount.java b/core/src/main/java/haveno/core/payment/PayPalAccount.java new file mode 100644 index 0000000000..451fc7b7c1 --- /dev/null +++ b/core/src/main/java/haveno/core/payment/PayPalAccount.java @@ -0,0 +1,95 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.core.payment; + +import haveno.core.api.model.PaymentAccountFormField; +import haveno.core.locale.TraditionalCurrency; +import haveno.core.locale.TradeCurrency; +import haveno.core.payment.payload.PaymentAccountPayload; +import haveno.core.payment.payload.PaymentMethod; +import haveno.core.payment.payload.PayPalAccountPayload; +import lombok.EqualsAndHashCode; +import lombok.NonNull; + +import java.util.List; + +@EqualsAndHashCode(callSuper = true) +public final class PayPalAccount extends PaymentAccount { + + // https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/ + public static final List SUPPORTED_CURRENCIES = List.of( + new TraditionalCurrency("AUD"), + new TraditionalCurrency("BRL"), + new TraditionalCurrency("CAD"), + new TraditionalCurrency("CNY"), + new TraditionalCurrency("CZK"), + new TraditionalCurrency("DKK"), + new TraditionalCurrency("EUR"), + new TraditionalCurrency("HKD"), + new TraditionalCurrency("HUF"), + new TraditionalCurrency("ILS"), + new TraditionalCurrency("JPY"), + new TraditionalCurrency("MYR"), + new TraditionalCurrency("MXN"), + new TraditionalCurrency("TWD"), + new TraditionalCurrency("NZD"), + new TraditionalCurrency("NOK"), + new TraditionalCurrency("PHP"), + new TraditionalCurrency("PLN"), + new TraditionalCurrency("GBP"), + new TraditionalCurrency("SGD"), + new TraditionalCurrency("SEK"), + new TraditionalCurrency("CHF"), + new TraditionalCurrency("THB"), + new TraditionalCurrency("USD")); + + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.EMAIL_OR_MOBILE_NR_OR_USERNAME, + PaymentAccountFormField.FieldId.TRADE_CURRENCIES, + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.SALT); + + public PayPalAccount() { + super(PaymentMethod.PAYPAL); + tradeCurrencies.addAll(SUPPORTED_CURRENCIES); + } + + @Override + protected PaymentAccountPayload createPayload() { + return new PayPalAccountPayload(paymentMethod.getId(), id); + } + + @Override + public @NonNull List getSupportedCurrencies() { + return SUPPORTED_CURRENCIES; + } + + @Override + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; + } + + public void setEmailOrMobileNrOrUsername(String emailOrMobileNrOrUsername) { + ((PayPalAccountPayload) paymentAccountPayload) + .setEmailOrMobileNrOrUsername(emailOrMobileNrOrUsername); + } + + public String getEmailOrMobileNrOrUsername() { + return ((PayPalAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername(); + } +} diff --git a/core/src/main/java/haveno/core/payment/PaymentAccount.java b/core/src/main/java/haveno/core/payment/PaymentAccount.java index 1d740155cc..6a293b3452 100644 --- a/core/src/main/java/haveno/core/payment/PaymentAccount.java +++ b/core/src/main/java/haveno/core/payment/PaymentAccount.java @@ -552,7 +552,13 @@ public abstract class PaymentAccount implements PersistablePayload { Optional> tradeCurrencies = CurrencyUtil.getTradeCurrenciesInList(currencyCodes, getSupportedCurrencies()); if (!tradeCurrencies.isPresent()) throw new IllegalArgumentException("No trade currencies were found in the " + getPaymentMethod().getDisplayString() + " account form"); break; - case USER_NAME: + case USERNAME: + processValidationResult(new LengthValidator(3, 100).validate(value)); + break; + case EMAIL_OR_MOBILE_NR_OR_USERNAME: + processValidationResult(new LengthValidator(3, 100).validate(value)); + break; + case EMAIL_OR_MOBILE_NR_OR_CASHTAG: processValidationResult(new LengthValidator(3, 100).validate(value)); break; case ADDRESS: @@ -768,9 +774,21 @@ public abstract class PaymentAccount implements PersistablePayload { field.setSupportedCurrencies(getSupportedCurrencies()); field.setValue(String.join(",", getSupportedCurrencies().stream().map(TradeCurrency::getCode).collect(Collectors.toList()))); break; - case USER_NAME: + case USERNAME: field.setComponent(PaymentAccountFormField.Component.TEXT); - field.setLabel(Res.get("payment.account.userName")); + field.setLabel(Res.get("payment.account.username")); + field.setMinLength(3); + field.setMaxLength(100); + break; + case EMAIL_OR_MOBILE_NR_OR_USERNAME: + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.email.mobile.username")); + field.setMinLength(3); + field.setMaxLength(100); + break; + case EMAIL_OR_MOBILE_NR_OR_CASHTAG: + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.email.mobile.cashtag")); field.setMinLength(3); field.setMaxLength(100); break; diff --git a/core/src/main/java/haveno/core/payment/PaymentAccountFactory.java b/core/src/main/java/haveno/core/payment/PaymentAccountFactory.java index 15d4b24edd..6d39b65f54 100644 --- a/core/src/main/java/haveno/core/payment/PaymentAccountFactory.java +++ b/core/src/main/java/haveno/core/payment/PaymentAccountFactory.java @@ -86,6 +86,8 @@ public class PaymentAccountFactory { return new TransferwiseAccount(); case PaymentMethod.TRANSFERWISE_USD_ID: return new TransferwiseUsdAccount(); + case PaymentMethod.PAYPAL_ID: + return new PayPalAccount(); case PaymentMethod.PAYSERA_ID: return new PayseraAccount(); case PaymentMethod.PAXUM_ID: diff --git a/core/src/main/java/haveno/core/payment/PaymentAccountUtil.java b/core/src/main/java/haveno/core/payment/PaymentAccountUtil.java index 244926bd4b..4d7b4ad0c4 100644 --- a/core/src/main/java/haveno/core/payment/PaymentAccountUtil.java +++ b/core/src/main/java/haveno/core/payment/PaymentAccountUtil.java @@ -66,6 +66,7 @@ import static haveno.core.payment.payload.PaymentMethod.NATIONAL_BANK_ID; import static haveno.core.payment.payload.PaymentMethod.NEFT_ID; import static haveno.core.payment.payload.PaymentMethod.NEQUI_ID; import static haveno.core.payment.payload.PaymentMethod.PAXUM_ID; +import static haveno.core.payment.payload.PaymentMethod.PAYPAL_ID; import static haveno.core.payment.payload.PaymentMethod.PAYSERA_ID; import static haveno.core.payment.payload.PaymentMethod.PAYTM_ID; import static haveno.core.payment.payload.PaymentMethod.PERFECT_MONEY_ID; @@ -214,6 +215,8 @@ public class PaymentAccountUtil { return USPostalMoneyOrderAccount.SUPPORTED_CURRENCIES; case VENMO_ID: return VenmoAccount.SUPPORTED_CURRENCIES; + case PAYPAL_ID: + return PayPalAccount.SUPPORTED_CURRENCIES; case JAPAN_BANK_ID: return JapanBankAccount.SUPPORTED_CURRENCIES; case WECHAT_PAY_ID: diff --git a/core/src/main/java/haveno/core/payment/RevolutAccount.java b/core/src/main/java/haveno/core/payment/RevolutAccount.java index 0a0f3f50ab..6119c2f3d9 100644 --- a/core/src/main/java/haveno/core/payment/RevolutAccount.java +++ b/core/src/main/java/haveno/core/payment/RevolutAccount.java @@ -32,7 +32,7 @@ import java.util.List; public final class RevolutAccount extends PaymentAccount { private static final List INPUT_FIELD_IDS = List.of( - PaymentAccountFormField.FieldId.USER_NAME, + PaymentAccountFormField.FieldId.USERNAME, PaymentAccountFormField.FieldId.TRADE_CURRENCIES, PaymentAccountFormField.FieldId.ACCOUNT_NAME, PaymentAccountFormField.FieldId.SALT @@ -82,16 +82,16 @@ public final class RevolutAccount extends PaymentAccount { return new RevolutAccountPayload(paymentMethod.getId(), id); } - public void setUserName(String userName) { - revolutAccountPayload().setUserName(userName); + public void setUsername(String userame) { + revolutAccountPayload().setUserName(userame); } - public String getUserName() { - return (revolutAccountPayload()).getUserName(); + public String getUsername() { + return (revolutAccountPayload()).getUsername(); } - public boolean userNameNotSet() { - return (revolutAccountPayload()).userNameNotSet(); + public boolean usernameNotSet() { + return (revolutAccountPayload()).usernameNotSet(); } private RevolutAccountPayload revolutAccountPayload() { diff --git a/core/src/main/java/haveno/core/payment/VenmoAccount.java b/core/src/main/java/haveno/core/payment/VenmoAccount.java index c1d8f22955..870438b38c 100644 --- a/core/src/main/java/haveno/core/payment/VenmoAccount.java +++ b/core/src/main/java/haveno/core/payment/VenmoAccount.java @@ -28,14 +28,16 @@ import lombok.NonNull; import java.util.List; -// Removed due too high chargeback risk -// Cannot be deleted as it would break old trade history entries -@Deprecated @EqualsAndHashCode(callSuper = true) public final class VenmoAccount extends PaymentAccount { public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.EMAIL_OR_MOBILE_NR_OR_USERNAME, + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.SALT); + public VenmoAccount() { super(PaymentMethod.VENMO); setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0)); @@ -53,22 +55,15 @@ public final class VenmoAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } - public void setVenmoUserName(String venmoUserName) { - ((VenmoAccountPayload) paymentAccountPayload).setVenmoUserName(venmoUserName); + public void setNameOrUsernameOrEmailOrMobileNr(String usernameOrEmailOrMobileNr) { + ((VenmoAccountPayload) paymentAccountPayload) + .setEmailOrMobileNrOrUsername(usernameOrEmailOrMobileNr); } - public String getVenmoUserName() { - return ((VenmoAccountPayload) paymentAccountPayload).getVenmoUserName(); - } - - public void setHolderName(String holderName) { - ((VenmoAccountPayload) paymentAccountPayload).setHolderName(holderName); - } - - public String getHolderName() { - return ((VenmoAccountPayload) paymentAccountPayload).getHolderName(); + public String getNameOrUsernameOrEmailOrMobileNr() { + return ((VenmoAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername(); } } diff --git a/core/src/main/java/haveno/core/payment/payload/CashAppAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/CashAppAccountPayload.java index 040616acee..d9f7494013 100644 --- a/core/src/main/java/haveno/core/payment/payload/CashAppAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/CashAppAccountPayload.java @@ -29,29 +29,25 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -// Cannot be deleted as it would break old trade history entries -// Removed due too high chargeback risk -@Deprecated @EqualsAndHashCode(callSuper = true) @ToString @Setter @Getter @Slf4j public final class CashAppAccountPayload extends PaymentAccountPayload { - private String cashTag = ""; + private String emailOrMobileNrOrCashtag = ""; public CashAppAccountPayload(String paymentMethod, String id) { super(paymentMethod, id); } - /////////////////////////////////////////////////////////////////////////////////////////// // PROTO BUFFER /////////////////////////////////////////////////////////////////////////////////////////// private CashAppAccountPayload(String paymentMethod, String id, - String cashTag, + String emailOrMobileNrOrCashtag, long maxTradePeriod, Map excludeFromJsonDataMap) { super(paymentMethod, @@ -59,21 +55,21 @@ public final class CashAppAccountPayload extends PaymentAccountPayload { maxTradePeriod, excludeFromJsonDataMap); - this.cashTag = cashTag; + this.emailOrMobileNrOrCashtag = emailOrMobileNrOrCashtag; } @Override public Message toProtoMessage() { return getPaymentAccountPayloadBuilder() .setCashAppAccountPayload(protobuf.CashAppAccountPayload.newBuilder() - .setCashTag(cashTag)) + .setEmailOrMobileNrOrCashtag(emailOrMobileNrOrCashtag)) .build(); } public static CashAppAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { return new CashAppAccountPayload(proto.getPaymentMethodId(), proto.getId(), - proto.getCashAppAccountPayload().getCashTag(), + proto.getCashAppAccountPayload().getEmailOrMobileNrOrCashtag(), proto.getMaxTradePeriod(), new HashMap<>(proto.getExcludeFromJsonDataMap())); } @@ -85,7 +81,7 @@ public final class CashAppAccountPayload extends PaymentAccountPayload { @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account") + " " + cashTag; + return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.email.mobile.cashtag") + " " + emailOrMobileNrOrCashtag; } @Override @@ -95,6 +91,6 @@ public final class CashAppAccountPayload extends PaymentAccountPayload { @Override public byte[] getAgeWitnessInputData() { - return super.getAgeWitnessInputData(cashTag.getBytes(StandardCharsets.UTF_8)); + return super.getAgeWitnessInputData(emailOrMobileNrOrCashtag.getBytes(StandardCharsets.UTF_8)); } } diff --git a/core/src/main/java/haveno/core/payment/payload/MoneseAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/MoneseAccountPayload.java index cf23929e47..02ef13eb6a 100644 --- a/core/src/main/java/haveno/core/payment/payload/MoneseAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/MoneseAccountPayload.java @@ -77,7 +77,7 @@ public final class MoneseAccountPayload extends PaymentAccountPayload { @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.userName") + " " + holderName; + return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.username") + " " + holderName; } @Override diff --git a/core/src/main/java/haveno/core/payment/payload/PayPalAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/PayPalAccountPayload.java new file mode 100644 index 0000000000..31765f49a0 --- /dev/null +++ b/core/src/main/java/haveno/core/payment/payload/PayPalAccountPayload.java @@ -0,0 +1,96 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.core.payment.payload; + +import com.google.protobuf.Message; +import haveno.core.locale.Res; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; + +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +@EqualsAndHashCode(callSuper = true) +@ToString +@Setter +@Getter +@Slf4j +public final class PayPalAccountPayload extends PaymentAccountPayload { + private String emailOrMobileNrOrUsername = ""; + + public PayPalAccountPayload(String paymentMethod, String id) { + super(paymentMethod, id); + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // PROTO BUFFER + /////////////////////////////////////////////////////////////////////////////////////////// + + private PayPalAccountPayload(String paymentMethod, + String id, + String emailOrMobileNrOrUsername, + long maxTradePeriod, + Map excludeFromJsonDataMap) { + super(paymentMethod, + id, + maxTradePeriod, + excludeFromJsonDataMap); + + this.emailOrMobileNrOrUsername = emailOrMobileNrOrUsername; + } + + @Override + public Message toProtoMessage() { + return getPaymentAccountPayloadBuilder() + .setPaypalAccountPayload(protobuf.PayPalAccountPayload.newBuilder() + .setEmailOrMobileNrOrUsername(emailOrMobileNrOrUsername)) + .build(); + } + + public static PayPalAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { + return new PayPalAccountPayload(proto.getPaymentMethodId(), + proto.getId(), + proto.getPaypalAccountPayload().getEmailOrMobileNrOrUsername(), + proto.getMaxTradePeriod(), + new HashMap<>(proto.getExcludeFromJsonDataMap())); + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // API + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public String getPaymentDetails() { + return Res.getWithCol("payment.email.mobile.username") + " " + + emailOrMobileNrOrUsername; + } + + @Override + public String getPaymentDetailsForTradePopup() { + return getPaymentDetails(); + } + + @Override + public byte[] getAgeWitnessInputData() { + return super.getAgeWitnessInputData(emailOrMobileNrOrUsername.getBytes(StandardCharsets.UTF_8)); + } +} diff --git a/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java b/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java index da8bd94a8e..cf75df3652 100644 --- a/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java +++ b/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java @@ -47,8 +47,10 @@ import haveno.core.payment.AmazonGiftCardAccount; import haveno.core.payment.AustraliaPayidAccount; import haveno.core.payment.BizumAccount; import haveno.core.payment.CapitualAccount; +import haveno.core.payment.CashAppAccount; import haveno.core.payment.CashAtAtmAccount; import haveno.core.payment.PayByMailAccount; +import haveno.core.payment.PayPalAccount; import haveno.core.payment.CashDepositAccount; import haveno.core.payment.CelPayAccount; import haveno.core.payment.ZelleAccount; @@ -89,6 +91,7 @@ import haveno.core.payment.TransferwiseUsdAccount; import haveno.core.payment.USPostalMoneyOrderAccount; import haveno.core.payment.UpholdAccount; import haveno.core.payment.UpiAccount; +import haveno.core.payment.VenmoAccount; import haveno.core.payment.VerseAccount; import haveno.core.payment.WeChatPayAccount; import haveno.core.payment.WesternUnionAccount; @@ -190,14 +193,11 @@ public final class PaymentMethod implements PersistablePayload, Comparable paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList()); } @@ -581,7 +586,10 @@ public final class PaymentMethod implements PersistablePayload, Comparable excludeFromJsonDataMap) { super(paymentMethod, @@ -70,13 +70,13 @@ public final class RevolutAccountPayload extends PaymentAccountPayload { maxTradePeriod, excludeFromJsonDataMap); - this.userName = userName; + this.username = username; } @Override public Message toProtoMessage() { protobuf.RevolutAccountPayload.Builder revolutBuilder = protobuf.RevolutAccountPayload.newBuilder() - .setUserName(userName); + .setUsername(username); return getPaymentAccountPayloadBuilder().setRevolutAccountPayload(revolutBuilder).build(); } @@ -85,7 +85,7 @@ public final class RevolutAccountPayload extends PaymentAccountPayload { protobuf.RevolutAccountPayload revolutAccountPayload = proto.getRevolutAccountPayload(); return new RevolutAccountPayload(proto.getPaymentMethodId(), proto.getId(), - revolutAccountPayload.getUserName(), + revolutAccountPayload.getUsername(), proto.getMaxTradePeriod(), new HashMap<>(proto.getExcludeFromJsonDataMap())); } @@ -104,9 +104,9 @@ public final class RevolutAccountPayload extends PaymentAccountPayload { private Tuple2 getLabelValueTuple() { String label; String value; - checkArgument(!userName.isEmpty(), "Username must be set"); - label = Res.get("payment.account.userName"); - value = userName; + checkArgument(!username.isEmpty(), "Username must be set"); + label = Res.get("payment.account.username"); + value = username; return new Tuple2<>(label, value); } @@ -123,14 +123,14 @@ public final class RevolutAccountPayload extends PaymentAccountPayload { @Override public byte[] getAgeWitnessInputData() { - return super.getAgeWitnessInputData(userName.getBytes(StandardCharsets.UTF_8)); + return super.getAgeWitnessInputData(username.getBytes(StandardCharsets.UTF_8)); } - public boolean userNameNotSet() { - return userName.isEmpty(); + public boolean usernameNotSet() { + return username.isEmpty(); } - public void setUserName(String userName) { - this.userName = userName; + public void setUserName(String username) { + this.username = username; } } diff --git a/core/src/main/java/haveno/core/payment/payload/SatispayAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/SatispayAccountPayload.java index de481f4072..5a96316058 100644 --- a/core/src/main/java/haveno/core/payment/payload/SatispayAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/SatispayAccountPayload.java @@ -91,7 +91,7 @@ public final class SatispayAccountPayload extends CountryBasedPaymentAccountPayl @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.userName") + " " + holderName; + return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.username") + " " + holderName; } @Override diff --git a/core/src/main/java/haveno/core/payment/payload/StrikeAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/StrikeAccountPayload.java index 45c74e7d9b..342f771f79 100644 --- a/core/src/main/java/haveno/core/payment/payload/StrikeAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/StrikeAccountPayload.java @@ -86,7 +86,7 @@ public final class StrikeAccountPayload extends CountryBasedPaymentAccountPayloa @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.userName") + " " + holderName; + return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.username") + " " + holderName; } @Override diff --git a/core/src/main/java/haveno/core/payment/payload/TransferwiseUsdAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/TransferwiseUsdAccountPayload.java index 3d4e0c2818..1daba610db 100644 --- a/core/src/main/java/haveno/core/payment/payload/TransferwiseUsdAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/TransferwiseUsdAccountPayload.java @@ -96,7 +96,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.userName") + " " + holderName; + return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.username") + " " + holderName; } @Override diff --git a/core/src/main/java/haveno/core/payment/payload/VenmoAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/VenmoAccountPayload.java index feae14e820..7daee3dc43 100644 --- a/core/src/main/java/haveno/core/payment/payload/VenmoAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/VenmoAccountPayload.java @@ -29,17 +29,13 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -// Cannot be deleted as it would break old trade history entries -// Removed due too high chargeback risk -@Deprecated @EqualsAndHashCode(callSuper = true) @ToString @Setter @Getter @Slf4j public final class VenmoAccountPayload extends PaymentAccountPayload { - private String venmoUserName = ""; - private String holderName = ""; + private String emailOrMobileNrOrUsername = ""; public VenmoAccountPayload(String paymentMethod, String id) { super(paymentMethod, id); @@ -52,8 +48,7 @@ public final class VenmoAccountPayload extends PaymentAccountPayload { private VenmoAccountPayload(String paymentMethod, String id, - String venmoUserName, - String holderName, + String emailOrMobileNrOrUsername, long maxTradePeriod, Map excludeFromJsonDataMap) { super(paymentMethod, @@ -61,24 +56,21 @@ public final class VenmoAccountPayload extends PaymentAccountPayload { maxTradePeriod, excludeFromJsonDataMap); - this.venmoUserName = venmoUserName; - this.holderName = holderName; + this.emailOrMobileNrOrUsername = emailOrMobileNrOrUsername; } @Override public Message toProtoMessage() { return getPaymentAccountPayloadBuilder() .setVenmoAccountPayload(protobuf.VenmoAccountPayload.newBuilder() - .setVenmoUserName(venmoUserName) - .setHolderName(holderName)) + .setEmailOrMobileNrOrUsername(emailOrMobileNrOrUsername)) .build(); } public static VenmoAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { return new VenmoAccountPayload(proto.getPaymentMethodId(), proto.getId(), - proto.getVenmoAccountPayload().getVenmoUserName(), - proto.getVenmoAccountPayload().getHolderName(), + proto.getVenmoAccountPayload().getEmailOrMobileNrOrUsername(), proto.getMaxTradePeriod(), new HashMap<>(proto.getExcludeFromJsonDataMap())); } @@ -90,8 +82,7 @@ public final class VenmoAccountPayload extends PaymentAccountPayload { @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.owner") + " " + holderName + ", " + - Res.getWithCol("payment.venmo.venmoUserName") + " " + venmoUserName; + return Res.getWithCol("payment.email.mobile.username") + " " + emailOrMobileNrOrUsername; } @Override @@ -101,11 +92,6 @@ public final class VenmoAccountPayload extends PaymentAccountPayload { @Override public byte[] getAgeWitnessInputData() { - return super.getAgeWitnessInputData(venmoUserName.getBytes(StandardCharsets.UTF_8)); - } - - @Override - public String getOwnerId() { - return holderName; + return super.getAgeWitnessInputData(emailOrMobileNrOrUsername.getBytes(StandardCharsets.UTF_8)); } } diff --git a/core/src/main/java/haveno/core/payment/payload/VerseAccountPayload.java b/core/src/main/java/haveno/core/payment/payload/VerseAccountPayload.java index 8f3ac8090b..4dc0ad24a8 100644 --- a/core/src/main/java/haveno/core/payment/payload/VerseAccountPayload.java +++ b/core/src/main/java/haveno/core/payment/payload/VerseAccountPayload.java @@ -71,7 +71,7 @@ public final class VerseAccountPayload extends PaymentAccountPayload { @Override public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.userName") + " " + holderName; + return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account.username") + " " + holderName; } @Override diff --git a/core/src/main/java/haveno/core/payment/validation/EmailOrMobileNrOrCashtagValidator.java b/core/src/main/java/haveno/core/payment/validation/EmailOrMobileNrOrCashtagValidator.java new file mode 100644 index 0000000000..04750ccb0f --- /dev/null +++ b/core/src/main/java/haveno/core/payment/validation/EmailOrMobileNrOrCashtagValidator.java @@ -0,0 +1,56 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.core.payment.validation; + +import haveno.core.util.validation.InputValidator; + +public final class EmailOrMobileNrOrCashtagValidator extends InputValidator { + + private final EmailOrMobileNrValidator emailOrMobileNrValidator; + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public methods + /////////////////////////////////////////////////////////////////////////////////////////// + + public EmailOrMobileNrOrCashtagValidator() { + emailOrMobileNrValidator = new EmailOrMobileNrValidator(); + } + + @Override + public ValidationResult validate(String input) { + ValidationResult result = validateIfNotEmpty(input); + if (!result.isValid) { + return result; + } else { + ValidationResult emailOrMobileResult = emailOrMobileNrValidator.validate(input); + if (emailOrMobileResult.isValid) + return emailOrMobileResult; + else + return validateCashtag(input); + } + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + // TODO not impl yet -> see InteracETransferValidator + private ValidationResult validateCashtag(String input) { + return super.validate(input); + } +} diff --git a/core/src/main/java/haveno/core/payment/validation/EmailOrMobileNrOrUsernameValidator.java b/core/src/main/java/haveno/core/payment/validation/EmailOrMobileNrOrUsernameValidator.java new file mode 100644 index 0000000000..c01dfd302c --- /dev/null +++ b/core/src/main/java/haveno/core/payment/validation/EmailOrMobileNrOrUsernameValidator.java @@ -0,0 +1,56 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.core.payment.validation; + +import haveno.core.util.validation.InputValidator; + +public final class EmailOrMobileNrOrUsernameValidator extends InputValidator { + + private final EmailOrMobileNrValidator emailOrMobileNrValidator; + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public methods + /////////////////////////////////////////////////////////////////////////////////////////// + + public EmailOrMobileNrOrUsernameValidator() { + emailOrMobileNrValidator = new EmailOrMobileNrValidator(); + } + + @Override + public ValidationResult validate(String input) { + ValidationResult result = validateIfNotEmpty(input); + if (!result.isValid) { + return result; + } else { + ValidationResult emailOrMobileResult = emailOrMobileNrValidator.validate(input); + if (emailOrMobileResult.isValid) + return emailOrMobileResult; + else + return validateName(input); + } + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // Private methods + /////////////////////////////////////////////////////////////////////////////////////////// + + // TODO: properly implement username validation + private ValidationResult validateName(String input) { + return super.validate(input); + } +} diff --git a/core/src/main/java/haveno/core/payment/validation/RevolutValidator.java b/core/src/main/java/haveno/core/payment/validation/RevolutValidator.java index 9af02d3d6a..543fd61d00 100644 --- a/core/src/main/java/haveno/core/payment/validation/RevolutValidator.java +++ b/core/src/main/java/haveno/core/payment/validation/RevolutValidator.java @@ -19,8 +19,8 @@ package haveno.core.payment.validation; public final class RevolutValidator extends LengthValidator { public RevolutValidator() { - // Not sure what are requirements for Revolut user names - // Please keep in mind that even we force users to set user name at startup we should handle also the case + // Not sure what are requirements for Revolut usernames + // Please keep in mind that even we force users to set username at startup we should handle also the case // that the old accountID as phone number or email is displayed at the username text field and we do not // want to break validation in those cases. So being too strict on the validators might cause more troubles // as its worth... diff --git a/core/src/main/java/haveno/core/proto/CoreProtoResolver.java b/core/src/main/java/haveno/core/proto/CoreProtoResolver.java index 360e4f6bd9..504d59dc58 100644 --- a/core/src/main/java/haveno/core/proto/CoreProtoResolver.java +++ b/core/src/main/java/haveno/core/proto/CoreProtoResolver.java @@ -54,6 +54,7 @@ import haveno.core.payment.payload.NequiAccountPayload; import haveno.core.payment.payload.OKPayAccountPayload; import haveno.core.payment.payload.PaxumAccountPayload; import haveno.core.payment.payload.PaymentAccountPayload; +import haveno.core.payment.payload.PayPalAccountPayload; import haveno.core.payment.payload.PayseraAccountPayload; import haveno.core.payment.payload.PaytmAccountPayload; import haveno.core.payment.payload.PerfectMoneyAccountPayload; @@ -236,6 +237,8 @@ public class CoreProtoResolver implements ProtoResolver { return CashAppAccountPayload.fromProto(proto); case VENMO_ACCOUNT_PAYLOAD: return VenmoAccountPayload.fromProto(proto); + case PAYPAL_ACCOUNT_PAYLOAD: + return PayPalAccountPayload.fromProto(proto); default: throw new ProtobufferRuntimeException("Unknown proto message case(PB.PaymentAccountPayload). messageCase=" + messageCase); diff --git a/core/src/main/java/haveno/core/support/dispute/agent/DisputeAgentLookupMap.java b/core/src/main/java/haveno/core/support/dispute/agent/DisputeAgentLookupMap.java index 14656727f5..551dbfc9ef 100644 --- a/core/src/main/java/haveno/core/support/dispute/agent/DisputeAgentLookupMap.java +++ b/core/src/main/java/haveno/core/support/dispute/agent/DisputeAgentLookupMap.java @@ -45,7 +45,7 @@ public class DisputeAgentLookupMap { case "6c4cim7h7t3bm4bnchbf727qrhdfrfr6lhod25wjtizm2sifpkktvwad.onion:9999": return "pazza83"; default: - log.warn("No user name for dispute agent with address {} found.", fullAddress); + log.warn("No username for dispute agent with address {} found.", fullAddress); return Res.get("shared.na"); } } diff --git a/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3.java b/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3.java index 61cd5eb9f7..75db58808a 100644 --- a/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3.java +++ b/core/src/main/java/haveno/core/trade/statistics/TradeStatistics3.java @@ -155,7 +155,8 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl TIKKIE, TRANSFERWISE_USD, ACH_TRANSFER, - DOMESTIC_WIRE_TRANSFER + DOMESTIC_WIRE_TRANSFER, + PAYPAL } @Getter diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index afc22fdda7..e0c28fb8dd 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -2479,7 +2479,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=Account payment.account.no=Account no. payment.account.name=Account name -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=Account owner full name payment.account.fullName=Full name (first, middle, last) @@ -2500,6 +2500,8 @@ payment.email=Email payment.country=Country payment.extras=Extra requirements payment.email.mobile=Email or mobile no. +payment.email.mobile.cashtag=Cashtag, email, or mobile no. +payment.email.mobile.username=Username, email, or mobile no. payment.crypto.address=Cryptocurrency address payment.crypto.tradeInstantCheckbox=Trade instant (within 1 hour) with this Cryptocurrency payment.crypto.tradeInstant.popup=For instant trading it is required that both trading peers are online to be able \ @@ -2554,7 +2556,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=Username or email or phone no. payment.moneyBeam.accountId=Email or phone no. -payment.venmo.venmoUserName=Venmo username payment.popmoney.accountId=Email or phone no. payment.promptPay.promptPayId=Citizen ID/Tax ID or phone no. payment.supportedCurrencies=Supported currencies @@ -2658,13 +2659,17 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=Please confirm your bank allows you to send cash deposits into other peoples' accounts. \ For example, Bank of America and Wells Fargo no longer allow such deposits. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. payment.account.revolut.addUserNameInfo={0}\n\ - Your existing Revolut account ({1}) does not have a ''User name''.\n\ - Please enter your Revolut ''User name'' to update your account data.\n\ + Your existing Revolut account ({1}) does not have a ''Username''.\n\ + Please enter your Revolut ''Username'' to update your account data.\n\ This will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account +payment.cashapp.info=Cash App has higher chargeback risk than most bank transfers. Please be aware of this when trading with Cash App. +payment.venmo.info=Venmo has higher chargeback risk than most bank transfers. Please be aware of this when trading with Venmo. +payment.paypal.info=PayPal has higher chargeback risk than most bank transfers. Please be aware of this when trading with PayPal. + payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. payment.account.amazonGiftCard.addCountryInfo={0}\n\ Your existing Amazon Gift Card account ({1}) does not have a Country specified.\n\ @@ -3159,7 +3164,7 @@ OK_PAY=OKPay CASH_APP=Cash App # suppress inspection "UnusedProperty" VENMO=Venmo - +PAYPAL=PayPal # suppress inspection "UnusedProperty" UPHOLD_SHORT=Uphold @@ -3255,6 +3260,7 @@ OK_PAY_SHORT=OKPay CASH_APP_SHORT=Cash App # suppress inspection "UnusedProperty" VENMO_SHORT=Venmo +PAYPAL_SHORT=PayPal #################################################################### diff --git a/core/src/main/resources/i18n/displayStrings_cs.properties b/core/src/main/resources/i18n/displayStrings_cs.properties index adaae46c53..3849693d1b 100644 --- a/core/src/main/resources/i18n/displayStrings_cs.properties +++ b/core/src/main/resources/i18n/displayStrings_cs.properties @@ -1875,7 +1875,7 @@ seed.restore.openOffers.warn=Máte otevřené nabídky, které budou odstraněny payment.account=Účet payment.account.no=Číslo účtu payment.account.name=Název účtu -payment.account.userName=Uživatelské jméno +payment.account.username=Uživatelské jméno payment.account.phoneNr=Telefonní číslo payment.account.owner=Celé jméno vlastníka účtu payment.account.fullName=Celé jméno (křestní, střední, příjmení) @@ -1907,7 +1907,6 @@ payment.amazon.site=Kupte Amazon eGift zde: payment.ask=Zjistěte pomocí obchodního chatu payment.uphold.accountId=Uživatelské jméno, e-mail nebo číslo telefonu payment.moneyBeam.accountId=E-mail nebo číslo telefonu -payment.venmo.venmoUserName=Uživatelské jméno Venmo payment.popmoney.accountId=E-mail nebo číslo telefonu payment.promptPay.promptPayId=Občanské/daňové identifikační číslo nebo telefonní číslo payment.supportedCurrencies=Podporované měny diff --git a/core/src/main/resources/i18n/displayStrings_de.properties b/core/src/main/resources/i18n/displayStrings_de.properties index 7fcb7b45e1..93a8edb198 100644 --- a/core/src/main/resources/i18n/displayStrings_de.properties +++ b/core/src/main/resources/i18n/displayStrings_de.properties @@ -1876,7 +1876,7 @@ seed.restore.openOffers.warn=Sie haben noch offene Angebote die entfernt werden payment.account=Konto payment.account.no=Kontonummer payment.account.name=Kontoname -payment.account.userName=Benutzername +payment.account.username=Benutzername payment.account.phoneNr=Telefonnummer payment.account.owner=Vollständiger Name des Kontoinhabers payment.account.fullName=Vollständiger Name (vor, zweit, nach) @@ -1908,7 +1908,6 @@ payment.amazon.site=Kaufe Geschenkkarte auf payment.ask=Im Trader Chat fragen payment.uphold.accountId=Nutzername oder Email oder Telefonnr. payment.moneyBeam.accountId=E-Mail oder Telefonnummer -payment.venmo.venmoUserName=Venmo Nutzername payment.popmoney.accountId=E-Mail oder Telefonnummer payment.promptPay.promptPayId=Personalausweis/Steuernummer oder Telefonnr. payment.supportedCurrencies=Unterstützte Währungen diff --git a/core/src/main/resources/i18n/displayStrings_es.properties b/core/src/main/resources/i18n/displayStrings_es.properties index 6414db0eda..990ef7941c 100644 --- a/core/src/main/resources/i18n/displayStrings_es.properties +++ b/core/src/main/resources/i18n/displayStrings_es.properties @@ -1876,7 +1876,7 @@ seed.restore.openOffers.warn=Tiene ofertas abiertas que serán eliminadas si res payment.account=Cuenta payment.account.no=Número de cuenta payment.account.name=Nombre de cuenta -payment.account.userName=Nombre de usuario +payment.account.username=Nombre de usuario payment.account.phoneNr=Número de teléfono payment.account.owner=Nombre completo del propietario de la cuenta payment.account.fullName=Nombre completo @@ -1908,7 +1908,6 @@ payment.amazon.site=Compre una tarjeta regalo en payment.ask=Pregunte en el Chat de Intercambio payment.uphold.accountId=Nombre de usuario, correo electrónico o núm de teléfono payment.moneyBeam.accountId=Correo electrónico o núm. de telefóno -payment.venmo.venmoUserName=Nombre de usuario Venmo payment.popmoney.accountId=Correo electrónico o núm. de telefóno payment.promptPay.promptPayId=Citizen ID/Tax ID o número de teléfono payment.supportedCurrencies=Monedas soportadas diff --git a/core/src/main/resources/i18n/displayStrings_fa.properties b/core/src/main/resources/i18n/displayStrings_fa.properties index 220e8f9ace..eaf7147ae2 100644 --- a/core/src/main/resources/i18n/displayStrings_fa.properties +++ b/core/src/main/resources/i18n/displayStrings_fa.properties @@ -1869,7 +1869,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=حساب payment.account.no=شماره حساب payment.account.name=نام حساب -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=نام کامل مالک حساب payment.account.fullName=نام کامل (اول، وسط، آخر) @@ -1901,7 +1901,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=نام کاربری یا ایمیل یا شماره تلفن payment.moneyBeam.accountId=ایمیل یا شماره تلفن -payment.venmo.venmoUserName=نام کاربری Venmo payment.popmoney.accountId=ایمیل یا شماره تلفن payment.promptPay.promptPayId=شناسه شهروندی/شناسه مالیاتی یا شماره تلفن payment.supportedCurrencies=ارزهای مورد حمایت @@ -1956,8 +1955,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=لطفا مطمئن شوید که بانک شما اجازه پرداخت سپرده نفد به حساب دیگر افراد را می‌دهد. برای مثال، Bank of America و Wells Fargo دیگر اجازه چنین پرداخت‌هایی را نمی‌دهند. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_fr.properties b/core/src/main/resources/i18n/displayStrings_fr.properties index 6c53abd159..462bcef554 100644 --- a/core/src/main/resources/i18n/displayStrings_fr.properties +++ b/core/src/main/resources/i18n/displayStrings_fr.properties @@ -1877,7 +1877,7 @@ seed.restore.openOffers.warn=Vous avez des offres ouvertes qui seront retirées payment.account=Compte payment.account.no=N° de compte payment.account.name=Nom du compte -payment.account.userName=Nom de l'utilisateur +payment.account.username=Nom de l'utilisateur payment.account.phoneNr=Numéro de téléphone payment.account.owner=Nom et prénoms du propriétaire du compte payment.account.fullName=Nom complet (prénom, deuxième prénom, nom de famille) @@ -1909,7 +1909,6 @@ payment.amazon.site=Acheter la carte cadeau à payment.ask=Demander dans le chat de trade payment.uphold.accountId=Nom d'utilisateur ou email ou N° de téléphone payment.moneyBeam.accountId=Email ou N° de téléphone -payment.venmo.venmoUserName=Nom d'utilisateur Venmo payment.popmoney.accountId=Email ou N° de téléphone payment.promptPay.promptPayId=N° de carte d'identité/d'identification du contribuable ou numéro de téléphone payment.supportedCurrencies=Devises acceptées diff --git a/core/src/main/resources/i18n/displayStrings_it.properties b/core/src/main/resources/i18n/displayStrings_it.properties index ab396f9746..97b7fb6b15 100644 --- a/core/src/main/resources/i18n/displayStrings_it.properties +++ b/core/src/main/resources/i18n/displayStrings_it.properties @@ -1871,7 +1871,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=Account payment.account.no=Account n° payment.account.name=Nome conto -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=Nome completo del proprietario del conto payment.account.fullName=Nome completo (nome, secondo nome, cognome) @@ -1903,7 +1903,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=Nome utente o e-mail o n. di telefono payment.moneyBeam.accountId=Email o numero di telefono fisso -payment.venmo.venmoUserName=Nome utente Venmo payment.popmoney.accountId=Email o numero di telefono fisso payment.promptPay.promptPayId=Codice fiscale/P.IVA o n. di telefono payment.supportedCurrencies=Valute supportate @@ -1958,8 +1957,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=Conferma che la tua banca ti consente di inviare depositi in contanti su conti di altre persone. Ad esempio, Bank of America e Wells Fargo non consentono più tali depositi. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_ja.properties b/core/src/main/resources/i18n/displayStrings_ja.properties index 61ed7bb0d8..a0a71e4c1d 100644 --- a/core/src/main/resources/i18n/displayStrings_ja.properties +++ b/core/src/main/resources/i18n/displayStrings_ja.properties @@ -1875,7 +1875,7 @@ seed.restore.openOffers.warn=シードワードから復元すると削除され payment.account=アカウント payment.account.no=アカウント番号 payment.account.name=アカウント名 -payment.account.userName=ユーザ名 +payment.account.username=ユーザ名 payment.account.phoneNr=電話番号 payment.account.owner=アカウント所有者の氏名 payment.account.fullName=氏名(名、ミドルネーム、姓) @@ -1907,7 +1907,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=ユーザーネームかメールか電話番号 payment.moneyBeam.accountId=メールか電話番号 -payment.venmo.venmoUserName=Venmo ユーザー名 payment.popmoney.accountId=メールか電話番号 payment.promptPay.promptPayId=市民ID/納税者番号または電話番号 payment.supportedCurrencies=サポートされている通貨 diff --git a/core/src/main/resources/i18n/displayStrings_pt-br.properties b/core/src/main/resources/i18n/displayStrings_pt-br.properties index 2b2debe623..177f3dc674 100644 --- a/core/src/main/resources/i18n/displayStrings_pt-br.properties +++ b/core/src/main/resources/i18n/displayStrings_pt-br.properties @@ -1879,7 +1879,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=Conta payment.account.no=Nº da conta payment.account.name=Nome da conta -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=Nome completo do titular da conta payment.account.fullName=Nome completo (nome e sobrenome) @@ -1911,7 +1911,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=Nome de usuário, e-mail ou nº de telefone payment.moneyBeam.accountId=E-mail ou nº de telefone -payment.venmo.venmoUserName=Nome do usuário do Venmo payment.popmoney.accountId=E-mail ou nº de telefone payment.promptPay.promptPayId=ID de cidadão/ID de impostos ou nº de telefone payment.supportedCurrencies=Moedas disponíveis @@ -1966,8 +1965,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=Certifique-se de que o seu banco permite a realização de depósitos em espécie na conta de terceiros. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_pt.properties b/core/src/main/resources/i18n/displayStrings_pt.properties index aa40299fbc..6841f97cbd 100644 --- a/core/src/main/resources/i18n/displayStrings_pt.properties +++ b/core/src/main/resources/i18n/displayStrings_pt.properties @@ -1869,7 +1869,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=Conta payment.account.no=Nº da conta payment.account.name=Nome da conta -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=Nome completo do titular da conta payment.account.fullName=Nome completo (primeiro, nome do meio, último) @@ -1901,7 +1901,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=Nome de utilizador, email ou nº de telemóvel payment.moneyBeam.accountId=Email ou nº de telemóvel -payment.venmo.venmoUserName=Nome de utilizador do Venmo payment.popmoney.accountId=Email ou nº de telemóvel payment.promptPay.promptPayId=ID de cidadão/ID de impostos ou nº de telemóvel payment.supportedCurrencies=Moedas suportadas @@ -1956,8 +1955,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=Por favor, confirme que seu banco permite-lhe enviar depósitos em dinheiro para contas de outras pessoas. Por exemplo, o Bank of America e o Wells Fargo não permitem mais esses depósitos. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_ru.properties b/core/src/main/resources/i18n/displayStrings_ru.properties index 396a257754..ccdcd4d6fb 100644 --- a/core/src/main/resources/i18n/displayStrings_ru.properties +++ b/core/src/main/resources/i18n/displayStrings_ru.properties @@ -1870,7 +1870,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=Счёт payment.account.no=Номер счёта payment.account.name=Название счёта -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=Полное имя владельца счёта payment.account.fullName=Полное имя (имя, отчество, фамилия) @@ -1902,7 +1902,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=Имя пользователя, эл. адрес или тел. номер payment.moneyBeam.accountId=Эл. адрес или тел. номер -payment.venmo.venmoUserName=Имя пользователя Venmo payment.popmoney.accountId=Эл. адрес или тел. номер payment.promptPay.promptPayId=Удостовер. личности / налог. номер или номер телефона payment.supportedCurrencies=Поддерживаемые валюты @@ -1957,8 +1956,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=Убедитесь, что ваш банк позволяет отправлять денежные переводы на счета других лиц. Например, Bank of America и Wells Fargo больше не разрешают такие переводы. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_th.properties b/core/src/main/resources/i18n/displayStrings_th.properties index 6a9873720a..b23765c34a 100644 --- a/core/src/main/resources/i18n/displayStrings_th.properties +++ b/core/src/main/resources/i18n/displayStrings_th.properties @@ -1870,7 +1870,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=บัญชี payment.account.no=หมายเลขบัญชี payment.account.name=ชื่อบัญชี -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=ชื่อเต็มของเจ้าของบัญชี payment.account.fullName=ชื่อเต็ม (ชื่อจริง, ชื่อกลาง, นามสกุล) @@ -1902,7 +1902,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=ชื่อผู้ใช้ หรือ อีเมล หรือ หมายเลขโทรศัพท์ payment.moneyBeam.accountId=อีเมลหรือหมายเลขโทรศัพท์ -payment.venmo.venmoUserName=ชื่อผู้ใช้ Venmo payment.popmoney.accountId=อีเมลหรือหมายเลขโทรศัพท์ payment.promptPay.promptPayId=รหัสบัตรประชาชน/รหัสประจำตัวผู้เสียภาษี หรือเบอร์โทรศัพท์ payment.supportedCurrencies=สกุลเงินที่ได้รับการสนับสนุน @@ -1957,8 +1956,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=โปรดยืนยันว่าธนาคารของคุณได้อนุมัติให้คุณสามารถส่งเงินสดให้กับบัญชีบุคคลอื่นได้ ตัวอย่างเช่น บางธนาคารที่ไม่ได้มีการบริการถ่ายโอนเงินสดอย่าง Bank of America และ Wells Fargo -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_vi.properties b/core/src/main/resources/i18n/displayStrings_vi.properties index 269482db43..a1978b79cc 100644 --- a/core/src/main/resources/i18n/displayStrings_vi.properties +++ b/core/src/main/resources/i18n/displayStrings_vi.properties @@ -1872,7 +1872,7 @@ seed.restore.openOffers.warn=You have open offers which will be removed if you r payment.account=Tài khoản payment.account.no=Tài khoản số payment.account.name=Tên tài khoản -payment.account.userName=User name +payment.account.username=Username payment.account.phoneNr=Phone number payment.account.owner=Họ tên chủ tài khoản payment.account.fullName=Họ tên (họ, tên lót, tên) @@ -1904,7 +1904,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=Tên người dùng hoặc email hoặc số điện thoại payment.moneyBeam.accountId=Email hoặc số điện thoại -payment.venmo.venmoUserName=Tên người dùng Venmo payment.popmoney.accountId=Email hoặc số điện thoại payment.promptPay.promptPayId=ID công dân/ ID thuế hoặc số điện thoại payment.supportedCurrencies=Tiền tệ hỗ trợ @@ -1959,8 +1958,8 @@ payment.limits.info.withSigning=To limit chargeback risk, Haveno sets per-trade payment.cashDeposit.info=Vui lòng xác nhận rằng ngân hàng của bạn cho phép nạp tiền mặt vào tài khoản của người khác. Chẳng hạn, Ngân Hàng Mỹ và Wells Fargo không còn cho phép nạp tiền như vậy nữa. -payment.revolut.info=Revolut requires the 'User name' as account ID not the phone number or email as it was the case in the past. -payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''User name''.\nPlease enter your Revolut ''User name'' to update your account data.\nThis will not affect your account age signing status. +payment.revolut.info=Revolut requires the 'Username' as account ID not the phone number or email as it was the case in the past. +payment.account.revolut.addUserNameInfo={0}\nYour existing Revolut account ({1}) does not have a ''Username''.\nPlease enter your Revolut ''Username'' to update your account data.\nThis will not affect your account age signing status. payment.revolut.addUserNameInfo.headLine=Update Revolut account payment.amazonGiftCard.upgrade=Amazon gift cards payment method requires the country to be specified. diff --git a/core/src/main/resources/i18n/displayStrings_zh-hans.properties b/core/src/main/resources/i18n/displayStrings_zh-hans.properties index 63a7bfd95a..e809a3104c 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hans.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hans.properties @@ -1879,7 +1879,7 @@ seed.restore.openOffers.warn=您有公开报价,如果您从种子词恢复, payment.account=账户 payment.account.no=账户编号 payment.account.name=账户名称 -payment.account.userName=用户昵称 +payment.account.username=用户昵称 payment.account.phoneNr=电话号码 payment.account.owner=账户拥有者姓名: payment.account.fullName=全称(名,中间名,姓) @@ -1911,7 +1911,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=用户名或电子邮箱或电话号码 payment.moneyBeam.accountId=电子邮箱或者电话号码 -payment.venmo.venmoUserName=Venmo 用户名: payment.popmoney.accountId=电子邮箱或者电话号码 payment.promptPay.promptPayId=公民身份证/税号或电话号码 payment.supportedCurrencies=支持的货币 diff --git a/core/src/main/resources/i18n/displayStrings_zh-hant.properties b/core/src/main/resources/i18n/displayStrings_zh-hant.properties index dafaf65f0d..435da337a2 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hant.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hant.properties @@ -1873,7 +1873,7 @@ seed.restore.openOffers.warn=您有公開報價,如果您從種子詞恢復, payment.account=賬户 payment.account.no=賬户編號 payment.account.name=賬户名稱 -payment.account.userName=用户暱稱 +payment.account.username=用户暱稱 payment.account.phoneNr=電話號碼 payment.account.owner=賬户擁有者姓名: payment.account.fullName=全稱(名,中間名,姓) @@ -1905,7 +1905,6 @@ payment.amazon.site=Buy giftcard at payment.ask=Ask in Trader Chat payment.uphold.accountId=用户名或電子郵箱或電話號碼 payment.moneyBeam.accountId=電子郵箱或者電話號碼 -payment.venmo.venmoUserName=Venmo 用户名: payment.popmoney.accountId=電子郵箱或者電話號碼 payment.promptPay.promptPayId=公民身份證/税號或電話號碼 payment.supportedCurrencies=支持的貨幣 diff --git a/desktop/src/main/java/haveno/desktop/components/paymentmethods/CashAppForm.java b/desktop/src/main/java/haveno/desktop/components/paymentmethods/CashAppForm.java new file mode 100644 index 0000000000..a36ca330ae --- /dev/null +++ b/desktop/src/main/java/haveno/desktop/components/paymentmethods/CashAppForm.java @@ -0,0 +1,111 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.desktop.components.paymentmethods; + +import haveno.core.account.witness.AccountAgeWitnessService; +import haveno.core.locale.Res; +import haveno.core.payment.CashAppAccount; +import haveno.core.payment.PaymentAccount; +import haveno.core.payment.payload.CashAppAccountPayload; +import haveno.core.payment.payload.PaymentAccountPayload; +import haveno.core.payment.validation.EmailOrMobileNrOrCashtagValidator; +import haveno.core.util.coin.CoinFormatter; +import haveno.core.util.validation.InputValidator; +import haveno.desktop.components.InputTextField; +import haveno.desktop.util.FormBuilder; +import haveno.desktop.util.Layout; +import javafx.scene.control.TextField; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.GridPane; + +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField; +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon; +import static haveno.desktop.util.FormBuilder.addTopLabelFlowPane; + +public class CashAppForm extends PaymentMethodForm { + private final CashAppAccount cashAppAccount; + private final EmailOrMobileNrOrCashtagValidator cashAppValidator; + + public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { + addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.email.mobile.cashtag"), + ((CashAppAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrCashtag()); + return gridRow; + } + + public CashAppForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, + EmailOrMobileNrOrCashtagValidator cashAppValidator, InputValidator inputValidator, GridPane gridPane, + int gridRow, + CoinFormatter formatter) { + super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); + this.cashAppAccount = (CashAppAccount) paymentAccount; + this.cashAppValidator = cashAppValidator; + } + + @Override + public void addFormForAddAccount() { + gridRowFrom = gridRow + 1; + + InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, + Res.get("payment.email.mobile.cashtag")); + mobileNrInputTextField.setValidator(cashAppValidator); + mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { + cashAppAccount.setEmailOrMobileNrOrCashtag(newValue.trim()); + updateFromInputs(); + }); + addCurrenciesGrid(true); + addLimitations(false); + addAccountNameTextFieldWithAutoFillToggleButton(); + } + + private void addCurrenciesGrid(boolean isEditable) { + FlowPane flowPane = addTopLabelFlowPane(gridPane, ++gridRow, + Res.get("payment.supportedCurrencies"), Layout.FLOATING_LABEL_DISTANCE * 3, + Layout.FLOATING_LABEL_DISTANCE * 3).second; + + if (isEditable) + flowPane.setId("flow-pane-checkboxes-bg"); + else + flowPane.setId("flow-pane-checkboxes-non-editable-bg"); + + cashAppAccount.getSupportedCurrencies().forEach(e -> + fillUpFlowPaneWithCurrencies(isEditable, flowPane, e, cashAppAccount)); + } + + @Override + protected void autoFillNameTextField() { + setAccountNameWithString(cashAppAccount.getEmailOrMobileNrOrCashtag()); + } + + @Override + public void addFormForEditAccount() { + gridRowFrom = gridRow; + addAccountNameTextFieldWithAutoFillToggleButton(); + TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email.mobile.cashtag"), + cashAppAccount.getEmailOrMobileNrOrCashtag()).second; + field.setMouseTransparent(false); + addLimitations(true); + addCurrenciesGrid(false); + } + + @Override + public void updateAllInputsValid() { + allInputsValid.set(isAccountNameValid() + && cashAppValidator.validate(cashAppAccount.getEmailOrMobileNrOrCashtag()).isValid + && cashAppAccount.getTradeCurrencies().size() > 0); + } +} diff --git a/desktop/src/main/java/haveno/desktop/components/paymentmethods/PayPalForm.java b/desktop/src/main/java/haveno/desktop/components/paymentmethods/PayPalForm.java new file mode 100644 index 0000000000..5968b2f53e --- /dev/null +++ b/desktop/src/main/java/haveno/desktop/components/paymentmethods/PayPalForm.java @@ -0,0 +1,114 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.desktop.components.paymentmethods; + +import haveno.core.account.witness.AccountAgeWitnessService; +import haveno.core.locale.Res; +import haveno.core.payment.PayPalAccount; +import haveno.core.payment.PaymentAccount; +import haveno.core.payment.payload.PayPalAccountPayload; +import haveno.core.payment.payload.PaymentAccountPayload; +import haveno.core.payment.validation.EmailOrMobileNrOrUsernameValidator; +import haveno.core.util.coin.CoinFormatter; +import haveno.core.util.validation.InputValidator; +import haveno.desktop.components.InputTextField; +import haveno.desktop.util.FormBuilder; +import haveno.desktop.util.Layout; +import javafx.scene.control.TextField; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.GridPane; + +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField; +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon; +import static haveno.desktop.util.FormBuilder.addTopLabelFlowPane; + +public class PayPalForm extends PaymentMethodForm { + private final PayPalAccount paypalAccount; + private final EmailOrMobileNrOrUsernameValidator paypalValidator; + + public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { + addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.email.mobile.username"), + ((PayPalAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername()); + return gridRow; + } + + public PayPalForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, + EmailOrMobileNrOrUsernameValidator paypalValidator, InputValidator inputValidator, GridPane gridPane, + int gridRow, + CoinFormatter formatter) { + super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); + this.paypalAccount = (PayPalAccount) paymentAccount; + this.paypalValidator = paypalValidator; + } + + @Override + public void addFormForAddAccount() { + gridRowFrom = gridRow + 1; + + InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, + Res.get("payment.email.mobile.username")); + mobileNrInputTextField.setValidator(paypalValidator); + mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { + paypalAccount.setEmailOrMobileNrOrUsername(newValue.trim()); + updateFromInputs(); + }); + addCurrenciesGrid(true); + addLimitations(false); + addAccountNameTextFieldWithAutoFillToggleButton(); + } + + private void addCurrenciesGrid(boolean isEditable) { + FlowPane flowPane = addTopLabelFlowPane(gridPane, ++gridRow, + Res.get("payment.supportedCurrencies"), Layout.FLOATING_LABEL_DISTANCE * 3, + Layout.FLOATING_LABEL_DISTANCE * 3).second; + + if (isEditable) + flowPane.setId("flow-pane-checkboxes-bg"); + else + flowPane.setId("flow-pane-checkboxes-non-editable-bg"); + + paypalAccount.getSupportedCurrencies().forEach(e -> + fillUpFlowPaneWithCurrencies(isEditable, flowPane, e, paypalAccount)); + } + + @Override + protected void autoFillNameTextField() { + setAccountNameWithString(paypalAccount.getEmailOrMobileNrOrUsername()); + } + + @Override + public void addFormForEditAccount() { + gridRowFrom = gridRow; + addAccountNameTextFieldWithAutoFillToggleButton(); + addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), + Res.get(paypalAccount.getPaymentMethod().getId())); + TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, + Res.get("payment.email.mobile.username"), + paypalAccount.getEmailOrMobileNrOrUsername()).second; + field.setMouseTransparent(false); + addLimitations(true); + addCurrenciesGrid(false); + } + + @Override + public void updateAllInputsValid() { + allInputsValid.set(isAccountNameValid() + && paypalValidator.validate(paypalAccount.getEmailOrMobileNrOrUsername()).isValid + && paypalAccount.getTradeCurrencies().size() > 0); + } +} diff --git a/desktop/src/main/java/haveno/desktop/components/paymentmethods/RevolutForm.java b/desktop/src/main/java/haveno/desktop/components/paymentmethods/RevolutForm.java index 1af7786499..e11d06fca7 100644 --- a/desktop/src/main/java/haveno/desktop/components/paymentmethods/RevolutForm.java +++ b/desktop/src/main/java/haveno/desktop/components/paymentmethods/RevolutForm.java @@ -63,10 +63,10 @@ public class RevolutForm extends PaymentMethodForm { public void addFormForAddAccount() { gridRowFrom = gridRow + 1; - InputTextField userNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.userName")); + InputTextField userNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.username")); userNameInputTextField.setValidator(validator); userNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { - account.setUserName(newValue.trim()); + account.setUsername(newValue.trim()); updateFromInputs(); }); @@ -91,7 +91,7 @@ public class RevolutForm extends PaymentMethodForm { @Override protected void autoFillNameTextField() { - setAccountNameWithString(account.getUserName()); + setAccountNameWithString(account.getUsername()); } @Override @@ -101,8 +101,8 @@ public class RevolutForm extends PaymentMethodForm { addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(account.getPaymentMethod().getId())); - String userName = account.getUserName(); - TextField userNameTf = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.userName"), userName).second; + String userName = account.getUsername(); + TextField userNameTf = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.username"), userName).second; userNameTf.setMouseTransparent(false); addLimitations(true); @@ -112,7 +112,7 @@ public class RevolutForm extends PaymentMethodForm { @Override public void updateAllInputsValid() { allInputsValid.set(isAccountNameValid() - && validator.validate(account.getUserName()).isValid + && validator.validate(account.getUsername()).isValid && account.getTradeCurrencies().size() > 0); } } diff --git a/desktop/src/main/java/haveno/desktop/components/paymentmethods/StrikeForm.java b/desktop/src/main/java/haveno/desktop/components/paymentmethods/StrikeForm.java index bb79b1daa7..f496e1de93 100644 --- a/desktop/src/main/java/haveno/desktop/components/paymentmethods/StrikeForm.java +++ b/desktop/src/main/java/haveno/desktop/components/paymentmethods/StrikeForm.java @@ -41,7 +41,7 @@ public class StrikeForm extends PaymentMethodForm { public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { - addTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.account.userName"), + addTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.account.username"), ((StrikeAccountPayload) paymentAccountPayload).getHolderName(), Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE); return gridRow; } @@ -60,7 +60,7 @@ public class StrikeForm extends PaymentMethodForm { gridRowFrom = gridRow + 1; - InputTextField holderNameField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.userName")); + InputTextField holderNameField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.username")); holderNameField.setValidator(inputValidator); holderNameField.textProperty().addListener((ov, oldValue, newValue) -> { account.setHolderName(newValue.trim()); @@ -84,7 +84,7 @@ public class StrikeForm extends PaymentMethodForm { addAccountNameTextFieldWithAutoFillToggleButton(); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(account.getPaymentMethod().getId())); - TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.userName"), + TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.username"), account.getHolderName()).second; field.setMouseTransparent(false); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), account.getSingleTradeCurrency().getNameAndCode()); diff --git a/desktop/src/main/java/haveno/desktop/components/paymentmethods/VenmoForm.java b/desktop/src/main/java/haveno/desktop/components/paymentmethods/VenmoForm.java new file mode 100644 index 0000000000..737e9b1ceb --- /dev/null +++ b/desktop/src/main/java/haveno/desktop/components/paymentmethods/VenmoForm.java @@ -0,0 +1,105 @@ +/* + * This file is part of Haveno. + * + * Haveno is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Haveno is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Haveno. If not, see . + */ + +package haveno.desktop.components.paymentmethods; + +import haveno.core.account.witness.AccountAgeWitnessService; +import haveno.core.locale.Res; +import haveno.core.locale.TradeCurrency; +import haveno.core.payment.VenmoAccount; +import haveno.core.payment.PaymentAccount; +import haveno.core.payment.payload.VenmoAccountPayload; +import haveno.core.payment.payload.PaymentAccountPayload; +import haveno.core.payment.validation.EmailOrMobileNrOrUsernameValidator; +import haveno.core.util.coin.CoinFormatter; +import haveno.core.util.validation.InputValidator; +import haveno.desktop.components.InputTextField; +import haveno.desktop.util.FormBuilder; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; + +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField; +import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon; +import static haveno.desktop.util.FormBuilder.addTopLabelTextField; + +public class VenmoForm extends PaymentMethodForm { + private final VenmoAccount venmoAccount; + private final EmailOrMobileNrOrUsernameValidator venmoValidator; + + public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { + addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.email.mobile.username"), + ((VenmoAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername()); + return gridRow; + } + + public VenmoForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, + EmailOrMobileNrOrUsernameValidator venmoValidator, InputValidator inputValidator, GridPane gridPane, + int gridRow, + CoinFormatter formatter) { + super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); + this.venmoAccount = (VenmoAccount) paymentAccount; + this.venmoValidator = venmoValidator; + } + + @Override + public void addFormForAddAccount() { + gridRowFrom = gridRow + 1; + + InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, + Res.get("payment.email.mobile.username")); + mobileNrInputTextField.setValidator(venmoValidator); + mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { + venmoAccount.setNameOrUsernameOrEmailOrMobileNr(newValue.trim()); + updateFromInputs(); + }); + final TradeCurrency singleTradeCurrency = venmoAccount.getSingleTradeCurrency(); + final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : ""; + addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), + nameAndCode); + addLimitations(false); + addAccountNameTextFieldWithAutoFillToggleButton(); + } + + @Override + protected void autoFillNameTextField() { + setAccountNameWithString(venmoAccount.getNameOrUsernameOrEmailOrMobileNr()); + } + + @Override + public void addFormForEditAccount() { + gridRowFrom = gridRow; + addAccountNameTextFieldWithAutoFillToggleButton(); + addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), + Res.get(venmoAccount.getPaymentMethod().getId())); + TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, + Res.get("payment.email.mobile.username"), + venmoAccount.getNameOrUsernameOrEmailOrMobileNr()).second; + field.setMouseTransparent(false); + final TradeCurrency singleTradeCurrency = venmoAccount.getSingleTradeCurrency(); + final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : ""; + addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), + nameAndCode); + addLimitations(true); + } + + @Override + public void updateAllInputsValid() { + allInputsValid.set(isAccountNameValid() + && venmoValidator.validate(venmoAccount.getNameOrUsernameOrEmailOrMobileNr()).isValid + && venmoAccount.getTradeCurrencies().size() > 0); + } +} diff --git a/desktop/src/main/java/haveno/desktop/components/paymentmethods/VerseForm.java b/desktop/src/main/java/haveno/desktop/components/paymentmethods/VerseForm.java index 73ea4358f8..823ea81615 100644 --- a/desktop/src/main/java/haveno/desktop/components/paymentmethods/VerseForm.java +++ b/desktop/src/main/java/haveno/desktop/components/paymentmethods/VerseForm.java @@ -39,7 +39,7 @@ public class VerseForm extends PaymentMethodForm { public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { - addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.userName"), + addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.username"), ((VerseAccountPayload) paymentAccountPayload).getHolderName()); return gridRow; } @@ -55,7 +55,7 @@ public class VerseForm extends PaymentMethodForm { public void addFormForAddAccount() { gridRowFrom = gridRow + 1; - InputTextField holderNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.userName")); + InputTextField holderNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.username")); holderNameInputTextField.setValidator(inputValidator); holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { account.setHolderName(newValue.trim()); @@ -92,7 +92,7 @@ public class VerseForm extends PaymentMethodForm { addAccountNameTextFieldWithAutoFillToggleButton(); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(account.getPaymentMethod().getId())); - TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.userName"), + TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.username"), account.getHolderName()).second; field.setMouseTransparent(false); addLimitations(true); diff --git a/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java b/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java index 4636065766..3962d559c9 100644 --- a/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java +++ b/desktop/src/main/java/haveno/desktop/main/account/content/traditionalaccounts/TraditionalAccountsView.java @@ -28,16 +28,19 @@ import haveno.core.locale.Res; import haveno.core.offer.OfferRestrictions; import haveno.core.payment.AmazonGiftCardAccount; import haveno.core.payment.AustraliaPayidAccount; +import haveno.core.payment.CashAppAccount; import haveno.core.payment.CashAtAtmAccount; import haveno.core.payment.CashDepositAccount; import haveno.core.payment.F2FAccount; import haveno.core.payment.HalCashAccount; import haveno.core.payment.MoneyGramAccount; import haveno.core.payment.PayByMailAccount; +import haveno.core.payment.PayPalAccount; import haveno.core.payment.PaymentAccount; import haveno.core.payment.PaymentAccountFactory; import haveno.core.payment.RevolutAccount; import haveno.core.payment.USPostalMoneyOrderAccount; +import haveno.core.payment.VenmoAccount; import haveno.core.payment.WesternUnionAccount; import haveno.core.payment.ZelleAccount; import haveno.core.payment.payload.PaymentMethod; @@ -48,6 +51,8 @@ import haveno.core.payment.validation.BICValidator; import haveno.core.payment.validation.CapitualValidator; import haveno.core.payment.validation.ChaseQuickPayValidator; import haveno.core.payment.validation.EmailOrMobileNrValidator; +import haveno.core.payment.validation.EmailOrMobileNrOrCashtagValidator; +import haveno.core.payment.validation.EmailOrMobileNrOrUsernameValidator; import haveno.core.payment.validation.F2FValidator; import haveno.core.payment.validation.HalCashValidator; import haveno.core.payment.validation.InteracETransferValidator; @@ -75,6 +80,7 @@ import haveno.desktop.components.paymentmethods.AmazonGiftCardForm; import haveno.desktop.components.paymentmethods.AustraliaPayidForm; import haveno.desktop.components.paymentmethods.BizumForm; import haveno.desktop.components.paymentmethods.CapitualForm; +import haveno.desktop.components.paymentmethods.CashAppForm; import haveno.desktop.components.paymentmethods.CashAtAtmForm; import haveno.desktop.components.paymentmethods.CashDepositForm; import haveno.desktop.components.paymentmethods.CelPayForm; @@ -94,6 +100,7 @@ import haveno.desktop.components.paymentmethods.NeftForm; import haveno.desktop.components.paymentmethods.NequiForm; import haveno.desktop.components.paymentmethods.PaxumForm; import haveno.desktop.components.paymentmethods.PayByMailForm; +import haveno.desktop.components.paymentmethods.PayPalForm; import haveno.desktop.components.paymentmethods.PaymentMethodForm; import haveno.desktop.components.paymentmethods.PayseraForm; import haveno.desktop.components.paymentmethods.PaytmForm; @@ -117,6 +124,7 @@ import haveno.desktop.components.paymentmethods.TransferwiseUsdForm; import haveno.desktop.components.paymentmethods.USPostalMoneyOrderForm; import haveno.desktop.components.paymentmethods.UpholdForm; import haveno.desktop.components.paymentmethods.UpiForm; +import haveno.desktop.components.paymentmethods.VenmoForm; import haveno.desktop.components.paymentmethods.VerseForm; import haveno.desktop.components.paymentmethods.WeChatPayForm; import haveno.desktop.components.paymentmethods.WesternUnionForm; @@ -158,6 +166,9 @@ public class TraditionalAccountsView extends PaymentAccountsView doSaveNewAccount(paymentAccount)) .show(); + } else if (paymentAccount instanceof CashAppAccount) { + new Popup().warning(Res.get("payment.cashapp.info")) + .width(700) + .closeButtonText(Res.get("shared.cancel")) + .actionButtonText(Res.get("shared.iUnderstand")) + .onAction(() -> doSaveNewAccount(paymentAccount)) + .show(); + } else if (paymentAccount instanceof VenmoAccount) { + new Popup().warning(Res.get("payment.venmo.info")) + .width(700) + .closeButtonText(Res.get("shared.cancel")) + .actionButtonText(Res.get("shared.iUnderstand")) + .onAction(() -> doSaveNewAccount(paymentAccount)) + .show(); + } else if (paymentAccount instanceof PayPalAccount) { + new Popup().warning(Res.get("payment.paypal.info")) + .width(700) + .closeButtonText(Res.get("shared.cancel")) + .actionButtonText(Res.get("shared.iUnderstand")) + .onAction(() -> doSaveNewAccount(paymentAccount)) + .show(); } else { doSaveNewAccount(paymentAccount); } @@ -624,6 +661,12 @@ public class TraditionalAccountsView extends PaymentAccountsView actionButton.setDisable(!revolutValidator.validate(newValue).isValid)); @@ -81,7 +81,7 @@ public class UpdateRevolutAccountWindow extends Overlay { String userName = userNameInputTextField.getText(); if (revolutValidator.validate(userName).isValid) { - revolutAccount.setUserName(userName); + revolutAccount.setUsername(userName); user.requestPersistence(); closeHandlerOptional.ifPresent(Runnable::run); hide(); diff --git a/proto/src/main/proto/pb.proto b/proto/src/main/proto/pb.proto index 1ec7f0461d..8e988bbe57 100644 --- a/proto/src/main/proto/pb.proto +++ b/proto/src/main/proto/pb.proto @@ -856,9 +856,9 @@ message PaymentAccountPayload { SwishAccountPayload swish_account_payload = 14; USPostalMoneyOrderAccountPayload u_s_postal_money_order_account_payload = 15; UpholdAccountPayload uphold_account_payload = 16; - CashAppAccountPayload cash_app_account_payload = 17 [deprecated = true]; + CashAppAccountPayload cash_app_account_payload = 17; MoneyBeamAccountPayload money_beam_account_payload = 18; - VenmoAccountPayload venmo_account_payload = 19 [deprecated = true]; + VenmoAccountPayload venmo_account_payload = 19; PopmoneyAccountPayload popmoney_account_payload = 20; RevolutAccountPayload revolut_account_payload = 21; WeChatPayAccountPayload we_chat_pay_account_payload = 22; @@ -880,6 +880,7 @@ message PaymentAccountPayload { MoneseAccountPayload monese_account_payload = 38; VerseAccountPayload verse_account_payload = 39; CashAtAtmAccountPayload cash_at_atm_account_payload = 40; + PayPalAccountPayload paypal_account_payload = 41; } } @@ -1058,19 +1059,19 @@ message UpholdAccountPayload { string account_owner = 2; } -// Deprecated, not used anymore message CashAppAccountPayload { - string cash_tag = 1; + string email_or_mobile_nr_or_cashtag = 1; } message MoneyBeamAccountPayload { string account_id = 1; } -// Deprecated, not used anymore message VenmoAccountPayload { - string venmo_user_name = 1; - string holder_name = 2; + string email_or_mobile_nr_or_username = 1; +} +message PayPalAccountPayload { + string email_or_mobile_nr_or_username = 1; } message PopmoneyAccountPayload { @@ -1079,7 +1080,7 @@ message PopmoneyAccountPayload { } message RevolutAccountPayload { - string user_name = 1; + string username = 1; } message PerfectMoneyAccountPayload { @@ -1332,8 +1333,8 @@ message XmrAddressEntry { TRADE_PAYOUT = 5; } - int32 subaddress_index = 7; - string address_string = 8; + int32 subaddress_index = 7; + string address_string = 8; string offer_id = 9; Context context = 10; int64 coin_locked_in_multi_sig = 11; @@ -1544,7 +1545,7 @@ message SellerAsTakerTrade { } message ArbitratorTrade { - Trade trade = 1; + Trade trade = 1; } message ProcessModel { @@ -1872,6 +1873,9 @@ message PaymentAccountForm { PAY_BY_MAIL = 13; CASH_AT_ATM = 14; AUSTRALIA_PAYID = 15; + CASH_APP = 16; + PAYPAL = 17; + VENMO = 18; } FormId id = 1; repeated PaymentAccountFormField fields = 2; @@ -1936,7 +1940,9 @@ message PaymentAccountFormField { SPECIAL_INSTRUCTIONS = 54; STATE = 55; TRADE_CURRENCIES = 56; - USER_NAME = 57; + USERNAME = 57; + EMAIL_OR_MOBILE_NR_OR_USERNAME = 58; + EMAIL_OR_MOBILE_NR_OR_CASHTAG = 59; } enum Component { TEXT = 0;