mirror of
https://github.com/haveno-dex/haveno.git
synced 2026-01-20 08:36:34 -05:00
Merge 807e4568e4 into eb492d3ebd
This commit is contained in:
commit
16eddecd55
34 changed files with 445 additions and 69 deletions
|
|
@ -40,7 +40,7 @@ public class GetPaymentMethodsTest extends MethodTest {
|
|||
.stream()
|
||||
.map(PaymentMethod::getId)
|
||||
.collect(Collectors.toList());
|
||||
assertTrue(paymentMethodIds.size() >= 20);
|
||||
assertTrue(paymentMethodIds.size() >= 56);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
|
|
|||
|
|
@ -86,7 +86,35 @@ public final class PaymentAccountForm implements PersistablePayload {
|
|||
AMAZON_GIFT_CARD,
|
||||
ACH_TRANSFER,
|
||||
INTERAC_E_TRANSFER,
|
||||
US_POSTAL_MONEY_ORDER;
|
||||
US_POSTAL_MONEY_ORDER,
|
||||
WESTERN_UNION,
|
||||
NATIONAL_BANK,
|
||||
SAME_BANK,
|
||||
SPECIFIC_BANKS,
|
||||
NEFT,
|
||||
RTGS,
|
||||
IMPS,
|
||||
UPI,
|
||||
PAYTM,
|
||||
DOMESTIC_WIRE_TRANSFER,
|
||||
JAPAN_BANK,
|
||||
PROMPT_PAY,
|
||||
VERSE,
|
||||
HAL_CASH,
|
||||
MONEY_BEAM,
|
||||
POPMONEY,
|
||||
CASH_DEPOSIT,
|
||||
PERFECT_MONEY,
|
||||
ADVANCED_CASH,
|
||||
PAYSERA,
|
||||
NEQUI,
|
||||
BIZUM,
|
||||
PIX,
|
||||
CAPITUAL,
|
||||
CELPAY,
|
||||
MONESE,
|
||||
SATISPAY,
|
||||
TIKKIE;
|
||||
|
||||
public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) {
|
||||
return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name());
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ public final class PaymentAccountFormField implements PersistablePayload {
|
|||
TRADE_CURRENCIES,
|
||||
USERNAME,
|
||||
EMAIL_OR_MOBILE_NR_OR_USERNAME,
|
||||
EMAIL_OR_MOBILE_NR_OR_CASHTAG;
|
||||
EMAIL_OR_MOBILE_NR_OR_CASHTAG,
|
||||
VIRTUAL_PAYMENT_ADDRESS;
|
||||
|
||||
public static PaymentAccountFormField.FieldId fromProto(protobuf.PaymentAccountFormField.FieldId fieldId) {
|
||||
return ProtoUtil.enumFromProto(PaymentAccountFormField.FieldId.class, fieldId.name());
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ public final class AdvancedCashAccount extends PaymentAccount {
|
|||
new TraditionalCurrency("UAH"),
|
||||
new TraditionalCurrency("USD"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public AdvancedCashAccount() {
|
||||
super(PaymentMethod.ADVANCED_CASH);
|
||||
}
|
||||
|
|
@ -58,7 +64,7 @@ public final class AdvancedCashAccount extends PaymentAccount {
|
|||
@NotNull
|
||||
@Override
|
||||
public List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ public final class BizumAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.MOBILE_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public BizumAccount() {
|
||||
super(PaymentMethod.BIZUM);
|
||||
}
|
||||
|
|
@ -72,6 +78,6 @@ public final class BizumAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ public final class CapitualAccount extends PaymentAccount {
|
|||
new TraditionalCurrency("USD")
|
||||
);
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public CapitualAccount() {
|
||||
super(PaymentMethod.CAPITUAL);
|
||||
}
|
||||
|
|
@ -56,7 +62,7 @@ public final class CapitualAccount extends PaymentAccount {
|
|||
@NotNull
|
||||
@Override
|
||||
public List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ public final class CashDepositAccount extends CountryBasedPaymentAccount impleme
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.EMAIL,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public CashDepositAccount() {
|
||||
super(PaymentMethod.CASH_DEPOSIT);
|
||||
}
|
||||
|
|
@ -48,7 +54,7 @@ public final class CashDepositAccount extends CountryBasedPaymentAccount impleme
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ public final class CelPayAccount extends PaymentAccount {
|
|||
new TraditionalCurrency("USD")
|
||||
);
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.EMAIL,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public CelPayAccount() {
|
||||
super(PaymentMethod.CELPAY);
|
||||
}
|
||||
|
|
@ -79,6 +85,6 @@ public final class CelPayAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,16 @@ public final class DomesticWireTransferAccount extends CountryBasedPaymentAccoun
|
|||
|
||||
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.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_NAME,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.HOLDER_ADDRESS,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public DomesticWireTransferAccount() {
|
||||
super(PaymentMethod.DOMESTIC_WIRE_TRANSFER);
|
||||
}
|
||||
|
|
@ -79,6 +89,6 @@ public final class DomesticWireTransferAccount extends CountryBasedPaymentAccoun
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ public final class HalCashAccount extends PaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public HalCashAccount() {
|
||||
super(PaymentMethod.HAL_CASH);
|
||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||
|
|
@ -50,7 +58,7 @@ public final class HalCashAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setMobileNr(String mobileNr) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ public final class ImpsAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("INR"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public ImpsAccount() {
|
||||
super(PaymentMethod.IMPS);
|
||||
}
|
||||
|
|
@ -64,6 +72,6 @@ public final class ImpsAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,18 @@ public final class JapanBankAccount extends PaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("JPY"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_CODE,
|
||||
PaymentAccountFormField.FieldId.BANK_BRANCH_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_BRANCH_CODE,
|
||||
PaymentAccountFormField.FieldId.BANK_ACCOUNT_TYPE,
|
||||
PaymentAccountFormField.FieldId.BANK_ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_ACCOUNT_NUMBER,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public JapanBankAccount() {
|
||||
super(PaymentMethod.JAPAN_BANK);
|
||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||
|
|
@ -48,7 +60,7 @@ public final class JapanBankAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
// bank code
|
||||
|
|
|
|||
|
|
@ -38,6 +38,13 @@ public final class MoneseAccount extends PaymentAccount {
|
|||
new TraditionalCurrency("RON")
|
||||
);
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.MOBILE_NR,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public MoneseAccount() {
|
||||
super(PaymentMethod.MONESE);
|
||||
}
|
||||
|
|
@ -85,6 +92,6 @@ public final class MoneseAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ public final class MoneyBeamAccount extends PaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_ID,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public MoneyBeamAccount() {
|
||||
super(PaymentMethod.MONEY_BEAM);
|
||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||
|
|
@ -51,7 +57,7 @@ public final class MoneyBeamAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setAccountId(String accountId) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,20 @@ public final class NationalBankAccount extends CountryBasedPaymentAccount implem
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_ID,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_TYPE,
|
||||
PaymentAccountFormField.FieldId.HOLDER_TAX_ID,
|
||||
PaymentAccountFormField.FieldId.NATIONAL_ACCOUNT_ID,
|
||||
PaymentAccountFormField.FieldId.COUNTRY,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public NationalBankAccount() {
|
||||
super(PaymentMethod.NATIONAL_BANK);
|
||||
}
|
||||
|
|
@ -50,7 +64,7 @@ public final class NationalBankAccount extends CountryBasedPaymentAccount implem
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -17,14 +17,26 @@
|
|||
|
||||
package haveno.core.payment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import haveno.core.api.model.PaymentAccountFormField;
|
||||
import haveno.core.payment.payload.NeftAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentMethod;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class NeftAccount extends IfscBasedAccount {
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public NeftAccount() {
|
||||
super(PaymentMethod.NEFT);
|
||||
}
|
||||
|
|
@ -34,6 +46,11 @@ public final class NeftAccount extends IfscBasedAccount {
|
|||
return new NeftAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public String getMessageForBuyer() {
|
||||
return "payment.neft.info.buyer";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ public final class NequiAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("COP"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.MOBILE_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public NequiAccount() {
|
||||
super(PaymentMethod.NEQUI);
|
||||
}
|
||||
|
|
@ -72,6 +78,6 @@ public final class NequiAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ import java.util.UUID;
|
|||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static haveno.core.payment.payload.PaymentMethod.TRANSFERWISE_ID;
|
||||
|
|
@ -426,17 +428,13 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
processValidationResult(new InputValidator().validate(value));
|
||||
break;
|
||||
case ACCOUNT_NAME:
|
||||
case ACCOUNT_OWNER:
|
||||
case ACCOUNT_TYPE:
|
||||
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||
break;
|
||||
case ACCOUNT_NR:
|
||||
processValidationResult(new AccountNrValidator("GB").validate(value));
|
||||
break;
|
||||
case ACCOUNT_OWNER:
|
||||
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||
break;
|
||||
case ACCOUNT_TYPE:
|
||||
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||
break;
|
||||
case ANSWER:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case BANK_ACCOUNT_NAME:
|
||||
|
|
@ -445,7 +443,8 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
case BANK_ACCOUNT_NUMBER:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case BANK_ACCOUNT_TYPE:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
processValidationResult(new LengthValidator(1, 100).validate(value));
|
||||
break;
|
||||
case BANK_ADDRESS:
|
||||
case INTERMEDIARY_ADDRESS:
|
||||
processValidationResult(new LengthValidator(1, 100).validate(value));
|
||||
|
|
@ -455,16 +454,16 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case BANK_BRANCH_CODE:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case BANK_BRANCH_NAME:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case BANK_CODE:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case BANK_ID:
|
||||
processValidationResult(new LengthValidator(1, 34).validate(value));
|
||||
break;
|
||||
case BANK_BRANCH_NAME:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case BANK_COUNTRY_CODE:
|
||||
if (!CountryUtil.findCountryByCode(value).isPresent()) throw new IllegalArgumentException("Invalid country code: " + value);
|
||||
break;
|
||||
case BANK_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case BANK_NAME:
|
||||
case INTERMEDIARY_NAME:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
|
|
@ -480,23 +479,15 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
processValidationResult(new LengthValidator(1, 100).validate(value));
|
||||
break;
|
||||
case BENEFICIARY_CITY:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case BENEFICIARY_NAME:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case BENEFICIARY_PHONE:
|
||||
case BRANCH_ID:
|
||||
case CITY:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case BIC:
|
||||
processValidationResult(new BICValidator().validate(value));
|
||||
break;
|
||||
case BRANCH_ID:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case CITY:
|
||||
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||
break;
|
||||
case CONTACT:
|
||||
processValidationResult(new InputValidator().validate(value));
|
||||
break;
|
||||
|
|
@ -528,7 +519,8 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||
break;
|
||||
case HOLDER_TAX_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
processValidationResult(new LengthValidator(2, 50).validate(value));
|
||||
break;
|
||||
case IBAN:
|
||||
processValidationResult(new IBANValidator().validate(value));
|
||||
break;
|
||||
|
|
@ -538,9 +530,13 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
if (!CountryUtil.findCountryByCode(value).isPresent()) throw new IllegalArgumentException("Invalid country code: " + value);
|
||||
break;
|
||||
case MOBILE_NR:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
String mobileTrim = value.trim();
|
||||
if (!mobileTrim.matches("^\\+?[0-9]{6,15}$"))
|
||||
throw new IllegalArgumentException("Invalid mobile number: " + value);
|
||||
break;
|
||||
case NATIONAL_ACCOUNT_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
processValidationResult(new LengthValidator(1, 50).validate(value));
|
||||
break;
|
||||
case PAYID:
|
||||
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||
break;
|
||||
|
|
@ -550,7 +546,8 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
processValidationResult(new InputValidator().validate(value));
|
||||
break;
|
||||
case PROMPT_PAY_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||
break;
|
||||
case QUESTION:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
case REQUIREMENTS:
|
||||
|
|
@ -590,6 +587,16 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
case ADDRESS:
|
||||
processValidationResult(new LengthValidator(10, 150).validate(value)); // TODO: validate crypto address
|
||||
break;
|
||||
case VIRTUAL_PAYMENT_ADDRESS: {
|
||||
String trimmedAddress = value.trim();
|
||||
if (trimmedAddress.length() < 3 || trimmedAddress.length() > 100)
|
||||
throw new IllegalArgumentException("Virtual Payment Address length must be between 3 and 100");
|
||||
Pattern p = Pattern.compile("^[^@\\s]{1,64}@[^@\\s]{1,64}$");
|
||||
Matcher m = p.matcher(trimmedAddress);
|
||||
if (!m.matches())
|
||||
throw new IllegalArgumentException("Invalid Virtual Payment Address format");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new RuntimeException("Unhandled form field: " + fieldId);
|
||||
}
|
||||
|
|
@ -640,9 +647,15 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
field.setMaxLength(100);
|
||||
break;
|
||||
case BANK_ACCOUNT_NUMBER:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.accountNr"));
|
||||
field.setMinLength(2);
|
||||
field.setMaxLength(40);
|
||||
break;
|
||||
case BANK_ACCOUNT_TYPE:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
|
||||
field.setLabel(Res.get("payment.select.account"));
|
||||
break;
|
||||
case BANK_ADDRESS:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
|
||||
field.setLabel(Res.get("payment.swift.address.bank"));
|
||||
|
|
@ -656,15 +669,24 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
field.setLabel(Res.get("payment.swift.swiftCode.bank"));
|
||||
break;
|
||||
case BANK_BRANCH_NAME:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.branch.name"));
|
||||
field.setMinLength(2);
|
||||
field.setMaxLength(100);
|
||||
break;
|
||||
case BANK_CODE:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.bankCode"));
|
||||
case BANK_COUNTRY_CODE:
|
||||
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
|
||||
field.setLabel(Res.get("payment.bank.country"));
|
||||
break;
|
||||
case BANK_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.bank.id"));
|
||||
field.setMinLength(1);
|
||||
field.setMaxLength(50);
|
||||
break;
|
||||
case BANK_NAME:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.swift.name.bank"));
|
||||
|
|
@ -738,7 +760,11 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
field.setMaxLength(100);
|
||||
break;
|
||||
case HOLDER_TAX_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
// TODO: set a label here
|
||||
field.setMinLength(2);
|
||||
field.setMaxLength(50);
|
||||
break;
|
||||
case IBAN:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel("IBAN");
|
||||
|
|
@ -770,7 +796,11 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
field.setLabel(Res.get("payment.mobile"));
|
||||
break;
|
||||
case NATIONAL_ACCOUNT_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
// TODO: set a label here
|
||||
field.setMinLength(2);
|
||||
field.setMaxLength(50);
|
||||
break;
|
||||
case PAYID:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.email.mobile"));
|
||||
|
|
@ -782,13 +812,21 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
field.setLabel(Res.get("payment.postal.address"));
|
||||
break;
|
||||
case PROMPT_PAY_ID:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
// TODO: set a label here
|
||||
field.setMinLength(3);
|
||||
field.setMaxLength(100);
|
||||
break;
|
||||
case QUESTION:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.secret"));
|
||||
break;
|
||||
case REQUIREMENTS:
|
||||
throw new IllegalArgumentException("Not implemented");
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.account.question"));
|
||||
field.setMinLength(2);
|
||||
field.setMaxLength(100);
|
||||
break;
|
||||
case SALT:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel("Salt");
|
||||
|
|
@ -836,6 +874,10 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
field.setMinLength(10);
|
||||
field.setMaxLength(150);
|
||||
break;
|
||||
case VIRTUAL_PAYMENT_ADDRESS:
|
||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||
field.setLabel(Res.get("payment.upi.virtualPaymentAddress"));
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unhandled form field: " + field);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ public final class PayseraAccount extends PaymentAccount {
|
|||
new TraditionalCurrency("ZAR")
|
||||
);
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.EMAIL,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public PayseraAccount() {
|
||||
super(PaymentMethod.PAYSERA);
|
||||
}
|
||||
|
|
@ -82,7 +88,7 @@ public final class PayseraAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setEmail(String accountId) {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,24 @@
|
|||
|
||||
package haveno.core.payment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import haveno.core.api.model.PaymentAccountFormField;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentMethod;
|
||||
import haveno.core.payment.payload.PaytmAccountPayload;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class PaytmAccount extends IfscBasedAccount {
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.MOBILE_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public PaytmAccount() {
|
||||
super(PaymentMethod.PAYTM);
|
||||
}
|
||||
|
|
@ -33,6 +44,11 @@ public final class PaytmAccount extends IfscBasedAccount {
|
|||
return new PaytmAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setEmailOrMobileNr(String emailOrMobileNr) {
|
||||
((PaytmAccountPayload) paymentAccountPayload).setEmailOrMobileNr(emailOrMobileNr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ public final class PerfectMoneyAccount 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.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public PerfectMoneyAccount() {
|
||||
super(PaymentMethod.PERFECT_MONEY);
|
||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||
|
|
@ -50,7 +56,7 @@ public final class PerfectMoneyAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setAccountNr(String accountNr) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ public final class PixAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("BRL"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_ID,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public PixAccount() {
|
||||
super(PaymentMethod.PIX);
|
||||
}
|
||||
|
|
@ -72,6 +79,6 @@ public final class PixAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ public final class PopmoneyAccount 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.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_ID,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public PopmoneyAccount() {
|
||||
super(PaymentMethod.POPMONEY);
|
||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||
|
|
@ -51,7 +58,7 @@ public final class PopmoneyAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setAccountId(String accountId) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ public final class PromptPayAccount extends PaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("THB"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.PROMPT_PAY_ID,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public PromptPayAccount() {
|
||||
super(PaymentMethod.PROMPT_PAY);
|
||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||
|
|
@ -50,7 +56,7 @@ public final class PromptPayAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setPromptPayId(String promptPayId) {
|
||||
|
|
|
|||
|
|
@ -17,14 +17,24 @@
|
|||
|
||||
package haveno.core.payment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import haveno.core.api.model.PaymentAccountFormField;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentMethod;
|
||||
import haveno.core.payment.payload.RtgsAccountPayload;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class RtgsAccount extends IfscBasedAccount {
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.MOBILE_NR,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public RtgsAccount() {
|
||||
super(PaymentMethod.RTGS);
|
||||
}
|
||||
|
|
@ -34,6 +44,11 @@ public final class RtgsAccount extends IfscBasedAccount {
|
|||
return new RtgsAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public String getMessageForBuyer() {
|
||||
return "payment.rtgs.info.buyer";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,20 @@ public final class SameBankAccount extends CountryBasedPaymentAccount implements
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_ID,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_TYPE,
|
||||
PaymentAccountFormField.FieldId.HOLDER_TAX_ID,
|
||||
PaymentAccountFormField.FieldId.NATIONAL_ACCOUNT_ID,
|
||||
PaymentAccountFormField.FieldId.COUNTRY,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public SameBankAccount() {
|
||||
super(PaymentMethod.SAME_BANK);
|
||||
}
|
||||
|
|
@ -50,7 +64,7 @@ public final class SameBankAccount extends CountryBasedPaymentAccount implements
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ public final class SatispayAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.MOBILE_NR,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
|
||||
public SatispayAccount() {
|
||||
super(PaymentMethod.SATISPAY);
|
||||
}
|
||||
|
|
@ -80,6 +88,6 @@ public final class SatispayAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import haveno.core.payment.payload.SpecificBanksAccountPayload;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
@ -50,11 +49,20 @@ public final class SpecificBanksAccount extends CountryBasedPaymentAccount imple
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return List.of(
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_NAME,
|
||||
PaymentAccountFormField.FieldId.BANK_ID,
|
||||
PaymentAccountFormField.FieldId.BRANCH_ID,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NR,
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_TYPE,
|
||||
PaymentAccountFormField.FieldId.HOLDER_TAX_ID,
|
||||
PaymentAccountFormField.FieldId.NATIONAL_ACCOUNT_ID,
|
||||
PaymentAccountFormField.FieldId.COUNTRY
|
||||
);
|
||||
}
|
||||
|
||||
// TODO change to List
|
||||
public ArrayList<String> getAcceptedBanks() {
|
||||
public List<String> getAcceptedBanks() {
|
||||
return ((SpecificBanksAccountPayload) paymentAccountPayload).getAcceptedBanks();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ import java.util.List;
|
|||
public final class TikkieAccount extends CountryBasedPaymentAccount {
|
||||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR"));
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.IBAN,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public TikkieAccount() {
|
||||
super(PaymentMethod.TIKKIE);
|
||||
|
|
@ -74,6 +80,6 @@ public final class TikkieAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,24 @@
|
|||
|
||||
package haveno.core.payment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import haveno.core.api.model.PaymentAccountFormField;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentMethod;
|
||||
import haveno.core.payment.payload.UpiAccountPayload;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class UpiAccount extends IfscBasedAccount {
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.VIRTUAL_PAYMENT_ADDRESS,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public UpiAccount() {
|
||||
super(PaymentMethod.UPI);
|
||||
}
|
||||
|
|
@ -33,6 +44,11 @@ public final class UpiAccount extends IfscBasedAccount {
|
|||
return new UpiAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public void setVirtualPaymentAddress(String virtualPaymentAddress) {
|
||||
((UpiAccountPayload) paymentAccountPayload).setVirtualPaymentAddress(virtualPaymentAddress);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ public final class VerseAccount extends PaymentAccount {
|
|||
new TraditionalCurrency("SEK")
|
||||
);
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public VerseAccount() {
|
||||
super(PaymentMethod.VERSE);
|
||||
}
|
||||
|
|
@ -79,6 +85,6 @@ public final class VerseAccount extends PaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,15 @@ public final class WesternUnionAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.EMAIL,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.CITY,
|
||||
PaymentAccountFormField.FieldId.STATE,
|
||||
PaymentAccountFormField.FieldId.SALT
|
||||
);
|
||||
|
||||
public WesternUnionAccount() {
|
||||
super(PaymentMethod.WESTERN_UNION);
|
||||
}
|
||||
|
|
@ -47,7 +56,7 @@ public final class WesternUnionAccount extends CountryBasedPaymentAccount {
|
|||
|
||||
@Override
|
||||
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
return INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ import haveno.core.payment.WesternUnionAccount;
|
|||
import haveno.core.trade.HavenoUtils;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -377,7 +377,35 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
|||
AMAZON_GIFT_CARD_ID,
|
||||
ACH_TRANSFER_ID,
|
||||
INTERAC_E_TRANSFER_ID,
|
||||
US_POSTAL_MONEY_ORDER_ID);
|
||||
US_POSTAL_MONEY_ORDER_ID,
|
||||
WESTERN_UNION_ID,
|
||||
NATIONAL_BANK_ID,
|
||||
SAME_BANK_ID,
|
||||
SPECIFIC_BANKS_ID,
|
||||
NEFT_ID,
|
||||
RTGS_ID,
|
||||
IMPS_ID,
|
||||
UPI_ID,
|
||||
PAYTM_ID,
|
||||
DOMESTIC_WIRE_TRANSFER_ID,
|
||||
JAPAN_BANK_ID,
|
||||
PROMPT_PAY_ID,
|
||||
VERSE_ID,
|
||||
HAL_CASH_ID,
|
||||
MONEY_BEAM_ID,
|
||||
POPMONEY_ID,
|
||||
CASH_DEPOSIT_ID,
|
||||
PERFECT_MONEY_ID,
|
||||
ADVANCED_CASH_ID,
|
||||
PAYSERA_ID,
|
||||
NEQUI_ID,
|
||||
BIZUM_ID,
|
||||
PIX_ID,
|
||||
CAPITUAL_ID,
|
||||
CELPAY_ID,
|
||||
MONESE_ID,
|
||||
SATISPAY_ID,
|
||||
TIKKIE_ID);
|
||||
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
@ -538,7 +566,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull PaymentMethod other) {
|
||||
public int compareTo(@NonNull PaymentMethod other) {
|
||||
return Res.get(id).compareTo(Res.get(other.id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1921,6 +1921,34 @@ message PaymentAccountForm {
|
|||
ACH_TRANSFER = 25;
|
||||
INTERAC_E_TRANSFER = 26;
|
||||
US_POSTAL_MONEY_ORDER = 27;
|
||||
WESTERN_UNION = 28;
|
||||
NATIONAL_BANK = 29;
|
||||
SAME_BANK = 30;
|
||||
SPECIFIC_BANKS = 31;
|
||||
NEFT = 32;
|
||||
RTGS = 33;
|
||||
IMPS = 34;
|
||||
UPI = 35;
|
||||
PAYTM = 36;
|
||||
DOMESTIC_WIRE_TRANSFER = 37;
|
||||
JAPAN_BANK = 38;
|
||||
PROMPT_PAY = 39;
|
||||
VERSE = 40;
|
||||
HAL_CASH = 41;
|
||||
MONEY_BEAM = 42;
|
||||
POPMONEY = 43;
|
||||
CASH_DEPOSIT = 44;
|
||||
PERFECT_MONEY = 45;
|
||||
ADVANCED_CASH = 46;
|
||||
PAYSERA = 47;
|
||||
NEQUI = 48;
|
||||
BIZUM = 49;
|
||||
PIX = 50;
|
||||
CAPITUAL = 51;
|
||||
CELPAY = 52;
|
||||
MONESE = 53;
|
||||
SATISPAY = 54;
|
||||
TIKKIE = 55;
|
||||
}
|
||||
FormId id = 1;
|
||||
repeated PaymentAccountFormField fields = 2;
|
||||
|
|
@ -1988,6 +2016,7 @@ message PaymentAccountFormField {
|
|||
USERNAME = 57;
|
||||
EMAIL_OR_MOBILE_NR_OR_USERNAME = 58;
|
||||
EMAIL_OR_MOBILE_NR_OR_CASHTAG = 59;
|
||||
VIRTUAL_PAYMENT_ADDRESS = 60;
|
||||
}
|
||||
enum Component {
|
||||
TEXT = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue