mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
support paypal, cashapp, venmo
Co-authored-by: preland <89992615+preland@users.noreply.github.com>
This commit is contained in:
parent
26c32a8ff4
commit
fea804086b
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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) {
|
||||
|
@ -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<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD"));
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(
|
||||
new TraditionalCurrency("USD"),
|
||||
new TraditionalCurrency("GBP"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> 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<PaymentAccountFormField.FieldId> 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();
|
||||
}
|
||||
}
|
||||
|
95
core/src/main/java/haveno/core/payment/PayPalAccount.java
Normal file
95
core/src/main/java/haveno/core/payment/PayPalAccount.java
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<TradeCurrency> 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<PaymentAccountFormField.FieldId> 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<TradeCurrency> getSupportedCurrencies() {
|
||||
return SUPPORTED_CURRENCIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setEmailOrMobileNrOrUsername(String emailOrMobileNrOrUsername) {
|
||||
((PayPalAccountPayload) paymentAccountPayload)
|
||||
.setEmailOrMobileNrOrUsername(emailOrMobileNrOrUsername);
|
||||
}
|
||||
|
||||
public String getEmailOrMobileNrOrUsername() {
|
||||
return ((PayPalAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername();
|
||||
}
|
||||
}
|
@ -552,7 +552,13 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||
Optional<List<TradeCurrency>> 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;
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -32,7 +32,7 @@ import java.util.List;
|
||||
public final class RevolutAccount extends PaymentAccount {
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> 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() {
|
||||
|
@ -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<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> 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<PaymentAccountFormField.FieldId> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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<String, String> 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));
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<String, String> 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));
|
||||
}
|
||||
}
|
@ -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<Payme
|
||||
public static final String SWIFT_ID = "SWIFT";
|
||||
public static final String ACH_TRANSFER_ID = "ACH_TRANSFER";
|
||||
public static final String DOMESTIC_WIRE_TRANSFER_ID = "DOMESTIC_WIRE_TRANSFER";
|
||||
|
||||
// Cannot be deleted as it would break old trade history entries
|
||||
@Deprecated
|
||||
public static final String OK_PAY_ID = "OK_PAY";
|
||||
@Deprecated
|
||||
public static final String CASH_APP_ID = "CASH_APP"; // Removed due too high chargeback risk
|
||||
@Deprecated
|
||||
public static final String VENMO_ID = "VENMO"; // Removed due too high chargeback risk
|
||||
public static final String OK_PAY_ID = "OK_PAY"; // Cannot be deleted as it would break old trade history entries
|
||||
public static final String CASH_APP_ID = "CASH_APP";
|
||||
public static final String VENMO_ID = "VENMO";
|
||||
public static final String PAYPAL_ID = "PAYPAL";
|
||||
|
||||
public static PaymentMethod UPHOLD;
|
||||
public static PaymentMethod MONEY_BEAM;
|
||||
@ -254,14 +254,13 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
public static PaymentMethod ACH_TRANSFER;
|
||||
public static PaymentMethod DOMESTIC_WIRE_TRANSFER;
|
||||
public static PaymentMethod BSQ_SWAP;
|
||||
public static PaymentMethod PAYPAL;
|
||||
public static PaymentMethod CASH_APP;
|
||||
public static PaymentMethod VENMO;
|
||||
|
||||
// Cannot be deleted as it would break old trade history entries
|
||||
@Deprecated
|
||||
public static PaymentMethod OK_PAY = getDummyPaymentMethod(OK_PAY_ID);
|
||||
@Deprecated
|
||||
public static PaymentMethod CASH_APP = getDummyPaymentMethod(CASH_APP_ID); // Removed due too high chargeback risk
|
||||
@Deprecated
|
||||
public static PaymentMethod VENMO = getDummyPaymentMethod(VENMO_ID); // Removed due too high chargeback risk
|
||||
|
||||
// The limit and duration assignment must not be changed as that could break old offers (if amount would be higher
|
||||
// than new trade limit) and violate the maker expectation when he created the offer (duration).
|
||||
@ -280,9 +279,9 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
|
||||
// US
|
||||
ZELLE = new PaymentMethod(ZELLE_ID, 4 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(ZelleAccount.SUPPORTED_CURRENCIES)),
|
||||
|
||||
POPMONEY = new PaymentMethod(POPMONEY_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(PopmoneyAccount.SUPPORTED_CURRENCIES)),
|
||||
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 8 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(USPostalMoneyOrderAccount.SUPPORTED_CURRENCIES)),
|
||||
VENMO = new PaymentMethod(VENMO_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(VenmoAccount.SUPPORTED_CURRENCIES)),
|
||||
|
||||
// Canada
|
||||
INTERAC_E_TRANSFER = new PaymentMethod(INTERAC_E_TRANSFER_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(InteracETransferAccount.SUPPORTED_CURRENCIES)),
|
||||
@ -326,6 +325,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
SWIFT = new PaymentMethod(SWIFT_ID, 7 * DAY, DEFAULT_TRADE_LIMIT_MID_RISK, getAssetCodes(SwiftAccount.SUPPORTED_CURRENCIES)),
|
||||
ACH_TRANSFER = new PaymentMethod(ACH_TRANSFER_ID, 5 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(AchTransferAccount.SUPPORTED_CURRENCIES)),
|
||||
DOMESTIC_WIRE_TRANSFER = new PaymentMethod(DOMESTIC_WIRE_TRANSFER_ID, 3 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(DomesticWireTransferAccount.SUPPORTED_CURRENCIES)),
|
||||
PAYPAL = new PaymentMethod(PAYPAL_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(PayPalAccount.SUPPORTED_CURRENCIES)),
|
||||
CASH_APP = new PaymentMethod(CASH_APP_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(CashAppAccount.SUPPORTED_CURRENCIES)),
|
||||
|
||||
// Japan
|
||||
JAPAN_BANK = new PaymentMethod(JAPAN_BANK_ID, DAY, DEFAULT_TRADE_LIMIT_LOW_RISK, getAssetCodes(JapanBankAccount.SUPPORTED_CURRENCIES)),
|
||||
@ -342,6 +343,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
|
||||
// Cryptos
|
||||
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, DAY, DEFAULT_TRADE_LIMIT_VERY_LOW_RISK, Arrays.asList()),
|
||||
|
||||
// Cryptos with 1 hour trade period
|
||||
BLOCK_CHAINS_INSTANT = new PaymentMethod(BLOCK_CHAINS_INSTANT_ID, TimeUnit.HOURS.toMillis(1), DEFAULT_TRADE_LIMIT_VERY_LOW_RISK, Arrays.asList())
|
||||
);
|
||||
@ -364,7 +366,10 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
TRANSFERWISE_ID,
|
||||
UPHOLD_ID,
|
||||
ZELLE_ID,
|
||||
AUSTRALIA_PAYID_ID);
|
||||
AUSTRALIA_PAYID_ID,
|
||||
CASH_APP_ID,
|
||||
PAYPAL_ID,
|
||||
VENMO_ID);
|
||||
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@ -581,7 +586,10 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
id.equals(PaymentMethod.CHASE_QUICK_PAY_ID) ||
|
||||
id.equals(PaymentMethod.POPMONEY_ID) ||
|
||||
id.equals(PaymentMethod.MONEY_BEAM_ID) ||
|
||||
id.equals(PaymentMethod.UPHOLD_ID);
|
||||
id.equals(PaymentMethod.UPHOLD_ID) ||
|
||||
id.equals(PaymentMethod.CASH_APP_ID) ||
|
||||
id.equals(PaymentMethod.PAYPAL_ID) ||
|
||||
id.equals(PaymentMethod.VENMO_ID);
|
||||
}
|
||||
|
||||
public static boolean isRoundedForAtmCash(String id) {
|
||||
|
@ -40,16 +40,16 @@ public final class RevolutAccountPayload extends PaymentAccountPayload {
|
||||
|
||||
// Was added in 1.3.8
|
||||
// To not break signed accounts we keep accountId as internal id used for signing.
|
||||
// Old accounts get a popup to add the new required field userName but accountId is
|
||||
// left unchanged. Newly created accounts fill accountId with the value of userName.
|
||||
// In the UI we only use userName.
|
||||
// Old accounts get a popup to add the new required field username but accountId is
|
||||
// left unchanged. Newly created accounts fill accountId with the value of username.
|
||||
// In the UI we only use username.
|
||||
|
||||
// For backward compatibility we need to exclude the new field for the contract json.
|
||||
// We can remove that after a while when risk that users with pre 1.3.8 version trade with updated
|
||||
// users is very low.
|
||||
@JsonExclude
|
||||
@Getter
|
||||
private String userName = "";
|
||||
private String username = "";
|
||||
|
||||
public RevolutAccountPayload(String paymentMethod, String id) {
|
||||
super(paymentMethod, id);
|
||||
@ -62,7 +62,7 @@ public final class RevolutAccountPayload extends PaymentAccountPayload {
|
||||
|
||||
private RevolutAccountPayload(String paymentMethod,
|
||||
String id,
|
||||
@Nullable String userName,
|
||||
@Nullable String username,
|
||||
long maxTradePeriod,
|
||||
Map<String, String> 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<String, String> 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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<String, String> 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));
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -155,7 +155,8 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
||||
TIKKIE,
|
||||
TRANSFERWISE_USD,
|
||||
ACH_TRANSFER,
|
||||
DOMESTIC_WIRE_TRANSFER
|
||||
DOMESTIC_WIRE_TRANSFER,
|
||||
PAYPAL
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
@ -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
|
||||
@ -2665,6 +2666,10 @@ payment.account.revolut.addUserNameInfo={0}\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
|
||||
|
||||
|
||||
####################################################################
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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=ارزهای مورد حمایت
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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=サポートされている通貨
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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=Поддерживаемые валюты
|
||||
|
@ -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=สกุลเงินที่ได้รับการสนับสนุน
|
||||
|
@ -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ợ
|
||||
|
@ -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=支持的货币
|
||||
|
@ -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=支持的貨幣
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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<GridPane, Tradi
|
||||
private final PerfectMoneyValidator perfectMoneyValidator;
|
||||
private final SwishValidator swishValidator;
|
||||
private final EmailOrMobileNrValidator zelleValidator;
|
||||
private final EmailOrMobileNrOrUsernameValidator paypalValidator;
|
||||
private final EmailOrMobileNrOrUsernameValidator venmoValidator;
|
||||
private final EmailOrMobileNrOrCashtagValidator cashAppValidator;
|
||||
private final ChaseQuickPayValidator chaseQuickPayValidator;
|
||||
private final InteracETransferValidator interacETransferValidator;
|
||||
private final JapanBankTransferValidator japanBankTransferValidator;
|
||||
@ -189,6 +200,8 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
||||
PerfectMoneyValidator perfectMoneyValidator,
|
||||
SwishValidator swishValidator,
|
||||
EmailOrMobileNrValidator zelleValidator,
|
||||
EmailOrMobileNrOrCashtagValidator cashAppValidator,
|
||||
EmailOrMobileNrOrUsernameValidator emailMobileUsernameValidator,
|
||||
ChaseQuickPayValidator chaseQuickPayValidator,
|
||||
InteracETransferValidator interacETransferValidator,
|
||||
JapanBankTransferValidator japanBankTransferValidator,
|
||||
@ -217,6 +230,9 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
||||
this.perfectMoneyValidator = perfectMoneyValidator;
|
||||
this.swishValidator = swishValidator;
|
||||
this.zelleValidator = zelleValidator;
|
||||
this.paypalValidator = emailMobileUsernameValidator;
|
||||
this.venmoValidator = emailMobileUsernameValidator;
|
||||
this.cashAppValidator = cashAppValidator;
|
||||
this.chaseQuickPayValidator = chaseQuickPayValidator;
|
||||
this.interacETransferValidator = interacETransferValidator;
|
||||
this.japanBankTransferValidator = japanBankTransferValidator;
|
||||
@ -362,6 +378,27 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
||||
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||
.onAction(() -> 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<GridPane, Tradi
|
||||
return new AchTransferForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.DOMESTIC_WIRE_TRANSFER_ID:
|
||||
return new DomesticWireTransferForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.PAYPAL_ID:
|
||||
return new PayPalForm(paymentAccount, accountAgeWitnessService, paypalValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.VENMO_ID:
|
||||
return new VenmoForm(paymentAccount, accountAgeWitnessService, venmoValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CASH_APP_ID:
|
||||
return new CashAppForm(paymentAccount, accountAgeWitnessService, cashAppValidator, inputValidator, root, gridRow, formatter);
|
||||
default:
|
||||
log.error("Not supported PaymentMethod: " + paymentMethod);
|
||||
return null;
|
||||
@ -669,4 +712,3 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class UpdateRevolutAccountWindow extends Overlay<UpdateRevolutAccountWind
|
||||
|
||||
private void addContent() {
|
||||
addLabel(gridPane, ++rowIndex, Res.get("payment.account.revolut.addUserNameInfo", Res.get("payment.revolut.info"), revolutAccount.getAccountName()));
|
||||
userNameInputTextField = addInputTextField(gridPane, ++rowIndex, Res.get("payment.account.userName"), Layout.COMPACT_FIRST_ROW_DISTANCE);
|
||||
userNameInputTextField = addInputTextField(gridPane, ++rowIndex, Res.get("payment.account.username"), Layout.COMPACT_FIRST_ROW_DISTANCE);
|
||||
userNameInputTextField.setValidator(revolutValidator);
|
||||
userNameInputTextField.textProperty().addListener((observable, oldValue, newValue) ->
|
||||
actionButton.setDisable(!revolutValidator.validate(newValue).isValid));
|
||||
@ -81,7 +81,7 @@ public class UpdateRevolutAccountWindow extends Overlay<UpdateRevolutAccountWind
|
||||
actionButton.setOnAction(event -> {
|
||||
String userName = userNameInputTextField.getText();
|
||||
if (revolutValidator.validate(userName).isValid) {
|
||||
revolutAccount.setUserName(userName);
|
||||
revolutAccount.setUsername(userName);
|
||||
user.requestPersistence();
|
||||
closeHandlerOptional.ifPresent(Runnable::run);
|
||||
hide();
|
||||
|
@ -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 {
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user