diff --git a/apitest/src/test/java/haveno/apitest/method/payment/GetPaymentMethodsTest.java b/apitest/src/test/java/haveno/apitest/method/payment/GetPaymentMethodsTest.java index 6b2e5a8019..6871c2b7de 100644 --- a/apitest/src/test/java/haveno/apitest/method/payment/GetPaymentMethodsTest.java +++ b/apitest/src/test/java/haveno/apitest/method/payment/GetPaymentMethodsTest.java @@ -40,7 +40,7 @@ public class GetPaymentMethodsTest extends MethodTest { .stream() .map(PaymentMethod::getId) .collect(Collectors.toList()); - assertTrue(paymentMethodIds.size() >= 20); + assertTrue(paymentMethodIds.size() >= 55); } @AfterAll diff --git a/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java b/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java index 6b1b494047..83dc13fedf 100644 --- a/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java +++ b/core/src/main/java/haveno/core/api/model/PaymentAccountForm.java @@ -78,7 +78,42 @@ public final class PaymentAccountForm implements PersistablePayload { CASH_APP, PAYPAL, VENMO, - PAYSAFE; + PAYSAFE, + HAL_CASH, + MONEY_BEAM, + SWISH, + POPMONEY, + US_POSTAL_MONEY_ORDER, + INTERAC_E_TRANSFER, + CASH_DEPOSIT, + WESTERN_UNION, + NATIONAL_BANK, + SAME_BANK, + SPECIFIC_BANKS, + AMAZON_GIFT_CARD, + PERFECT_MONEY, + ADVANCED_CASH, + PAYSERA, + NEFT, + RTGS, + IMPS, + UPI, + PAYTM, + NEQUI, + BIZUM, + PIX, + CAPITUAL, + CELPAY, + MONESE, + SATISPAY, + TIKKIE, + VERSE, + ACH_TRANSFER, + DOMESTIC_WIRE_TRANSFER, + JAPAN_BANK, + ALI_PAY, + WECHAT_PAY, + PROMPT_PAY; public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) { return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name()); diff --git a/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java b/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java index 8fb4d5b4ad..5c1c8cf71d 100644 --- a/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java +++ b/core/src/main/java/haveno/core/api/model/PaymentAccountFormField.java @@ -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()); diff --git a/core/src/main/java/haveno/core/payment/AchTransferAccount.java b/core/src/main/java/haveno/core/payment/AchTransferAccount.java index 9f04e4e076..a8724da5ee 100644 --- a/core/src/main/java/haveno/core/payment/AchTransferAccount.java +++ b/core/src/main/java/haveno/core/payment/AchTransferAccount.java @@ -32,6 +32,17 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class AchTransferAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount { + private static final List 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.ACCOUNT_TYPE, + PaymentAccountFormField.FieldId.HOLDER_ADDRESS, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); public AchTransferAccount() { @@ -79,6 +90,6 @@ public final class AchTransferAccount extends CountryBasedPaymentAccount impleme @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/AdvancedCashAccount.java b/core/src/main/java/haveno/core/payment/AdvancedCashAccount.java index 1dce0bd4c8..3ef62ec749 100644 --- a/core/src/main/java/haveno/core/payment/AdvancedCashAccount.java +++ b/core/src/main/java/haveno/core/payment/AdvancedCashAccount.java @@ -24,13 +24,19 @@ import haveno.core.payment.payload.AdvancedCashAccountPayload; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class AdvancedCashAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("BRL"), new TraditionalCurrency("EUR"), @@ -49,16 +55,14 @@ public final class AdvancedCashAccount extends PaymentAccount { return new AdvancedCashAccountPayload(paymentMethod.getId(), id); } - @NotNull @Override - public List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } - @NotNull @Override - public List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } public void setAccountNr(String accountNr) { diff --git a/core/src/main/java/haveno/core/payment/AliPayAccount.java b/core/src/main/java/haveno/core/payment/AliPayAccount.java index 1bff92b5cd..e2b415258f 100644 --- a/core/src/main/java/haveno/core/payment/AliPayAccount.java +++ b/core/src/main/java/haveno/core/payment/AliPayAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class AliPayAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("AED"), new TraditionalCurrency("AUD"), @@ -77,7 +83,7 @@ public final class AliPayAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setAccountNr(String accountNr) { diff --git a/core/src/main/java/haveno/core/payment/AmazonGiftCardAccount.java b/core/src/main/java/haveno/core/payment/AmazonGiftCardAccount.java index cb3eb35c70..9cdedcd0c9 100644 --- a/core/src/main/java/haveno/core/payment/AmazonGiftCardAccount.java +++ b/core/src/main/java/haveno/core/payment/AmazonGiftCardAccount.java @@ -25,13 +25,20 @@ import haveno.core.locale.TradeCurrency; import haveno.core.payment.payload.AmazonGiftCardAccountPayload; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import javax.annotation.Nullable; import java.util.List; public final class AmazonGiftCardAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.EMAIL_OR_MOBILE_NR, + PaymentAccountFormField.FieldId.COUNTRY, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("AUD"), new TraditionalCurrency("CAD"), @@ -59,13 +66,13 @@ public final class AmazonGiftCardAccount extends PaymentAccount { } @Override - public @NotNull List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } @Override - public @NotNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } public String getEmailOrMobileNr() { @@ -89,7 +96,7 @@ public final class AmazonGiftCardAccount extends PaymentAccount { return country; } - public void setCountry(@NotNull Country country) { + public void setCountry(@NonNull Country country) { this.country = country; getAmazonGiftCardAccountPayload().setCountryCode(country.code); } diff --git a/core/src/main/java/haveno/core/payment/BizumAccount.java b/core/src/main/java/haveno/core/payment/BizumAccount.java index 04757ecd5a..893c523476 100644 --- a/core/src/main/java/haveno/core/payment/BizumAccount.java +++ b/core/src/main/java/haveno/core/payment/BizumAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class BizumAccount extends CountryBasedPaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.MOBILE_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR")); public BizumAccount() { @@ -72,6 +78,6 @@ public final class BizumAccount extends CountryBasedPaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/CapitualAccount.java b/core/src/main/java/haveno/core/payment/CapitualAccount.java index 28b47859e7..499fdc1c0e 100644 --- a/core/src/main/java/haveno/core/payment/CapitualAccount.java +++ b/core/src/main/java/haveno/core/payment/CapitualAccount.java @@ -24,13 +24,19 @@ import haveno.core.payment.payload.CapitualAccountPayload; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class CapitualAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("BRL"), new TraditionalCurrency("EUR"), @@ -47,16 +53,14 @@ public final class CapitualAccount extends PaymentAccount { return new CapitualAccountPayload(paymentMethod.getId(), id); } - @NotNull @Override - public List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } - @NotNull @Override - public List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } public void setAccountNr(String accountNr) { diff --git a/core/src/main/java/haveno/core/payment/CashDepositAccount.java b/core/src/main/java/haveno/core/payment/CashDepositAccount.java index b263c906df..eb7b94a5bd 100644 --- a/core/src/main/java/haveno/core/payment/CashDepositAccount.java +++ b/core/src/main/java/haveno/core/payment/CashDepositAccount.java @@ -30,6 +30,13 @@ import java.util.List; public final class CashDepositAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.BANK_ID, + PaymentAccountFormField.FieldId.REQUIREMENTS, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public CashDepositAccount() { @@ -48,7 +55,7 @@ public final class CashDepositAccount extends CountryBasedPaymentAccount impleme @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } @Override diff --git a/core/src/main/java/haveno/core/payment/CelPayAccount.java b/core/src/main/java/haveno/core/payment/CelPayAccount.java index a21ca3e0e3..74da8eecdc 100644 --- a/core/src/main/java/haveno/core/payment/CelPayAccount.java +++ b/core/src/main/java/haveno/core/payment/CelPayAccount.java @@ -24,13 +24,19 @@ import haveno.core.payment.payload.CelPayAccountPayload; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class CelPayAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.EMAIL, + PaymentAccountFormField.FieldId.SALT + ); + // https://github.com/bisq-network/growth/issues/231 public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("AUD"), @@ -73,12 +79,12 @@ public final class CelPayAccount extends PaymentAccount { } @Override - public @NotNull List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } @Override - public @NotNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/DomesticWireTransferAccount.java b/core/src/main/java/haveno/core/payment/DomesticWireTransferAccount.java index 0707db411e..07055f5574 100644 --- a/core/src/main/java/haveno/core/payment/DomesticWireTransferAccount.java +++ b/core/src/main/java/haveno/core/payment/DomesticWireTransferAccount.java @@ -32,6 +32,16 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class DomesticWireTransferAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); public DomesticWireTransferAccount() { @@ -79,6 +89,6 @@ public final class DomesticWireTransferAccount extends CountryBasedPaymentAccoun @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/HalCashAccount.java b/core/src/main/java/haveno/core/payment/HalCashAccount.java index f2de687fe0..c84801de33 100644 --- a/core/src/main/java/haveno/core/payment/HalCashAccount.java +++ b/core/src/main/java/haveno/core/payment/HalCashAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class HalCashAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.MOBILE_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR")); public HalCashAccount() { @@ -50,7 +56,7 @@ public final class HalCashAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setMobileNr(String mobileNr) { diff --git a/core/src/main/java/haveno/core/payment/ImpsAccount.java b/core/src/main/java/haveno/core/payment/ImpsAccount.java index 42dd116668..ba688b524a 100644 --- a/core/src/main/java/haveno/core/payment/ImpsAccount.java +++ b/core/src/main/java/haveno/core/payment/ImpsAccount.java @@ -31,6 +31,14 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class ImpsAccount extends CountryBasedPaymentAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("INR")); public ImpsAccount() { @@ -64,6 +72,6 @@ public final class ImpsAccount extends CountryBasedPaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/InteracETransferAccount.java b/core/src/main/java/haveno/core/payment/InteracETransferAccount.java index 579167c276..de75a08feb 100644 --- a/core/src/main/java/haveno/core/payment/InteracETransferAccount.java +++ b/core/src/main/java/haveno/core/payment/InteracETransferAccount.java @@ -24,13 +24,22 @@ import haveno.core.payment.payload.InteracETransferAccountPayload; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class InteracETransferAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.EMAIL, + PaymentAccountFormField.FieldId.ANSWER, + PaymentAccountFormField.FieldId.QUESTION, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("CAD")); public InteracETransferAccount() { @@ -44,13 +53,13 @@ public final class InteracETransferAccount extends PaymentAccount { } @Override - public @NotNull List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } @Override - public @NotNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } public void setEmail(String email) { diff --git a/core/src/main/java/haveno/core/payment/JapanBankAccount.java b/core/src/main/java/haveno/core/payment/JapanBankAccount.java index 51c15ea931..53a56de501 100644 --- a/core/src/main/java/haveno/core/payment/JapanBankAccount.java +++ b/core/src/main/java/haveno/core/payment/JapanBankAccount.java @@ -29,6 +29,18 @@ import java.util.List; public final class JapanBankAccount extends PaymentAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("JPY")); public JapanBankAccount() { @@ -48,7 +60,7 @@ public final class JapanBankAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } // bank code diff --git a/core/src/main/java/haveno/core/payment/MoneseAccount.java b/core/src/main/java/haveno/core/payment/MoneseAccount.java index e7fe518bc9..c247c649b4 100644 --- a/core/src/main/java/haveno/core/payment/MoneseAccount.java +++ b/core/src/main/java/haveno/core/payment/MoneseAccount.java @@ -31,6 +31,13 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class MoneseAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.MOBILE_NR, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + // https://github.com/bisq-network/growth/issues/227 public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("EUR"), @@ -85,6 +92,6 @@ public final class MoneseAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/MoneyBeamAccount.java b/core/src/main/java/haveno/core/payment/MoneyBeamAccount.java index 97fbcccf3b..05b0ee7af3 100644 --- a/core/src/main/java/haveno/core/payment/MoneyBeamAccount.java +++ b/core/src/main/java/haveno/core/payment/MoneyBeamAccount.java @@ -32,6 +32,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class MoneyBeamAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_ID, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR")); public MoneyBeamAccount() { @@ -51,7 +57,7 @@ public final class MoneyBeamAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setAccountId(String accountId) { diff --git a/core/src/main/java/haveno/core/payment/NationalBankAccount.java b/core/src/main/java/haveno/core/payment/NationalBankAccount.java index 16b2633689..d8ec50124e 100644 --- a/core/src/main/java/haveno/core/payment/NationalBankAccount.java +++ b/core/src/main/java/haveno/core/payment/NationalBankAccount.java @@ -32,6 +32,20 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class NationalBankAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public NationalBankAccount() { @@ -50,7 +64,7 @@ public final class NationalBankAccount extends CountryBasedPaymentAccount implem @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } @Override diff --git a/core/src/main/java/haveno/core/payment/NeftAccount.java b/core/src/main/java/haveno/core/payment/NeftAccount.java index 4f4a2a4deb..bc13bfc514 100644 --- a/core/src/main/java/haveno/core/payment/NeftAccount.java +++ b/core/src/main/java/haveno/core/payment/NeftAccount.java @@ -17,14 +17,26 @@ package haveno.core.payment; +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; + +import java.util.List; @EqualsAndHashCode(callSuper = true) public final class NeftAccount extends IfscBasedAccount { + private static final List 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 getInputFieldIds() { + return INPUT_FIELD_IDS; + } + public String getMessageForBuyer() { return "payment.neft.info.buyer"; } diff --git a/core/src/main/java/haveno/core/payment/NequiAccount.java b/core/src/main/java/haveno/core/payment/NequiAccount.java index d74f509319..659209f2ca 100644 --- a/core/src/main/java/haveno/core/payment/NequiAccount.java +++ b/core/src/main/java/haveno/core/payment/NequiAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class NequiAccount extends CountryBasedPaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.MOBILE_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("COP")); public NequiAccount() { @@ -72,6 +78,6 @@ public final class NequiAccount extends CountryBasedPaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/PaymentAccount.java b/core/src/main/java/haveno/core/payment/PaymentAccount.java index 14dd88482b..ebccb3d2f3 100644 --- a/core/src/main/java/haveno/core/payment/PaymentAccount.java +++ b/core/src/main/java/haveno/core/payment/PaymentAccount.java @@ -348,7 +348,7 @@ public abstract class PaymentAccount implements PersistablePayload { if (paymentAccountPayload != null) { String payloadJson = paymentAccountPayload.toJson(); Map payloadMap = gson.fromJson(payloadJson, new TypeToken>() {}.getType()); - + for (Map.Entry entry : payloadMap.entrySet()) { Object value = entry.getValue(); if (value instanceof List) { @@ -360,7 +360,7 @@ public abstract class PaymentAccount implements PersistablePayload { jsonMap.putAll(payloadMap); } - + jsonMap.put("accountName", getAccountName()); jsonMap.put("accountId", getId()); if (paymentAccountPayload != null) jsonMap.put("salt", getSaltAsHex()); @@ -435,17 +435,22 @@ public abstract class PaymentAccount implements PersistablePayload { processValidationResult(new LengthValidator(2, 100).validate(value)); break; case ACCOUNT_TYPE: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(1, 100).validate(value)); + break; case ANSWER: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(2, 100).validate(value)); case BANK_ACCOUNT_NAME: processValidationResult(new LengthValidator(2, 100).validate(value)); break; case BANK_ACCOUNT_NUMBER: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(1, 100).validate(value)); + break; case BANK_ACCOUNT_TYPE: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(1, 100).validate(value)); + break; case BANK_ADDRESS: + processValidationResult(new LengthValidator(1, 100).validate(value)); + break; case INTERMEDIARY_ADDRESS: processValidationResult(new LengthValidator(1, 100).validate(value)); break; @@ -454,17 +459,22 @@ public abstract class PaymentAccount implements PersistablePayload { processValidationResult(new LengthValidator(2, 34).validate(value)); break; case BANK_BRANCH_CODE: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(1, 11).validate(value)); + break; case BANK_BRANCH_NAME: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(1, 11).validate(value)); + break; case BANK_CODE: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(1, 11).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"); + processValidationResult(new LengthValidator(2, 34).validate(value)); case BANK_NAME: + processValidationResult(new LengthValidator(2, 34).validate(value)); + break; case INTERMEDIARY_NAME: processValidationResult(new LengthValidator(2, 34).validate(value)); break; @@ -491,7 +501,8 @@ public abstract class PaymentAccount implements PersistablePayload { processValidationResult(new BICValidator().validate(value)); break; case BRANCH_ID: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(2, 34).validate(value)); + break; case CITY: processValidationResult(new LengthValidator(2, 34).validate(value)); break; @@ -518,14 +529,16 @@ public abstract class PaymentAccount implements PersistablePayload { case EXTRA_INFO: break; case HOLDER_ADDRESS: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new InputValidator().validate(value)); + break; case HOLDER_EMAIL: throw new IllegalArgumentException("Not implemented"); case HOLDER_NAME: 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; @@ -535,23 +548,27 @@ 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"); + processValidationResult(new LengthValidator(2, 100).validate(value)); + break; case NATIONAL_ACCOUNT_ID: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(2, 50).validate(value)); + break; case PAYID: processValidationResult(new LengthValidator(2, 100).validate(value)); break; case PIX_KEY: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new InputValidator().validate(value)); + break; case POSTAL_ADDRESS: processValidationResult(new InputValidator().validate(value)); break; case PROMPT_PAY_ID: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new InputValidator().validate(value)); + break; case QUESTION: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(2, 100).validate(value)); case REQUIREMENTS: - throw new IllegalArgumentException("Not implemented"); + processValidationResult(new LengthValidator(2, 100).validate(value)); case SALT: if (!value.equals("")) throw new IllegalArgumentException("Salt must be empty"); break; @@ -623,9 +640,15 @@ public abstract class PaymentAccount implements PersistablePayload { field.setLabel(Res.get("payment.account.owner")); break; case ACCOUNT_TYPE: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.account.type")); + break; case ANSWER: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.account.answer")); + field.setMinLength(2); + field.setMaxLength(100); + break; case BANK_ACCOUNT_NAME: field.setComponent(PaymentAccountFormField.Component.TEXT); field.setLabel(Res.get("payment.account.owner")); @@ -633,9 +656,13 @@ 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.account.bank.number")); + break; case BANK_ACCOUNT_TYPE: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.account.bank.type")); + break; case BANK_ADDRESS: field.setComponent(PaymentAccountFormField.Component.TEXTAREA); field.setLabel(Res.get("payment.swift.address.bank")); @@ -649,15 +676,21 @@ 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.account.bank.branch.name")); + break; case BANK_CODE: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.account.bank.code")); + break; 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.SELECT_ONE); + field.setLabel(Res.get("payment.account.bank.id")); + break; case BANK_NAME: field.setComponent(PaymentAccountFormField.Component.TEXT); field.setLabel(Res.get("payment.swift.name.bank")); @@ -691,7 +724,9 @@ public abstract class PaymentAccount implements PersistablePayload { field.setLabel("BIC"); break; case BRANCH_ID: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.account.branch.id")); + break; case CITY: field.setComponent(PaymentAccountFormField.Component.TEXT); field.setLabel(Res.get("payment.account.city")); @@ -717,7 +752,9 @@ public abstract class PaymentAccount implements PersistablePayload { field.setLabel(Res.get("payment.shared.optionalExtra")); break; case HOLDER_ADDRESS: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXTAREA); + field.setLabel(Res.get("payment.account.holder.address")); + break; case HOLDER_EMAIL: throw new IllegalArgumentException("Not implemented"); case HOLDER_NAME: @@ -727,7 +764,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); + field.setLabel(Res.get("payment.account.holder.tax.id")); + field.setMinLength(2); + field.setMaxLength(50); + break; case IBAN: field.setComponent(PaymentAccountFormField.Component.TEXT); field.setLabel("IBAN"); @@ -755,25 +796,45 @@ public abstract class PaymentAccount implements PersistablePayload { field.setLabel(Res.get("payment.swift.swiftCode.intermediary")); break; case MOBILE_NR: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.mobile")); + field.setMinLength(3); + field.setMaxLength(100); + break; case NATIONAL_ACCOUNT_ID: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel(Res.get("payment.account.national.account.id")); + field.setMinLength(2); + field.setMaxLength(50); + break; case PAYID: field.setComponent(PaymentAccountFormField.Component.TEXT); field.setLabel(Res.get("payment.email.mobile")); break; case PIX_KEY: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel("payment.accountNr"); + break; case POSTAL_ADDRESS: field.setComponent(PaymentAccountFormField.Component.TEXTAREA); field.setLabel(Res.get("payment.postal.address")); break; case PROMPT_PAY_ID: - throw new IllegalArgumentException("Not implemented"); + field.setComponent(PaymentAccountFormField.Component.TEXT); + field.setLabel("payment.accountNr"); + break; case QUESTION: - 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 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"); @@ -821,6 +882,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); } diff --git a/core/src/main/java/haveno/core/payment/PayseraAccount.java b/core/src/main/java/haveno/core/payment/PayseraAccount.java index 0254cd7c71..1b89ae1507 100644 --- a/core/src/main/java/haveno/core/payment/PayseraAccount.java +++ b/core/src/main/java/haveno/core/payment/PayseraAccount.java @@ -24,13 +24,19 @@ import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import haveno.core.payment.payload.PayseraAccountPayload; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class PayseraAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.EMAIL, + PaymentAccountFormField.FieldId.SALT + ); + // https://github.com/bisq-network/growth/issues/233 public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("AUD"), @@ -76,13 +82,13 @@ public final class PayseraAccount extends PaymentAccount { } @Override - public @NotNull List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } @Override - public @NotNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } public void setEmail(String accountId) { diff --git a/core/src/main/java/haveno/core/payment/PaytmAccount.java b/core/src/main/java/haveno/core/payment/PaytmAccount.java index e434179137..7f7cab8453 100644 --- a/core/src/main/java/haveno/core/payment/PaytmAccount.java +++ b/core/src/main/java/haveno/core/payment/PaytmAccount.java @@ -17,13 +17,24 @@ package haveno.core.payment; +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; + +import java.util.List; @EqualsAndHashCode(callSuper = true) public final class PaytmAccount extends IfscBasedAccount { + + private static final List 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 getInputFieldIds() { + return INPUT_FIELD_IDS; + } + public void setEmailOrMobileNr(String emailOrMobileNr) { ((PaytmAccountPayload) paymentAccountPayload).setEmailOrMobileNr(emailOrMobileNr); } diff --git a/core/src/main/java/haveno/core/payment/PerfectMoneyAccount.java b/core/src/main/java/haveno/core/payment/PerfectMoneyAccount.java index 84a51bff02..80eea98745 100644 --- a/core/src/main/java/haveno/core/payment/PerfectMoneyAccount.java +++ b/core/src/main/java/haveno/core/payment/PerfectMoneyAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class PerfectMoneyAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); public PerfectMoneyAccount() { @@ -50,7 +56,7 @@ public final class PerfectMoneyAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setAccountNr(String accountNr) { diff --git a/core/src/main/java/haveno/core/payment/PixAccount.java b/core/src/main/java/haveno/core/payment/PixAccount.java index c0e3b72c82..de8feff749 100644 --- a/core/src/main/java/haveno/core/payment/PixAccount.java +++ b/core/src/main/java/haveno/core/payment/PixAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class PixAccount extends CountryBasedPaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.PIX_KEY, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("BRL")); public PixAccount() { @@ -72,6 +78,6 @@ public final class PixAccount extends CountryBasedPaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/PopmoneyAccount.java b/core/src/main/java/haveno/core/payment/PopmoneyAccount.java index 22fd446257..c1c435a0ee 100644 --- a/core/src/main/java/haveno/core/payment/PopmoneyAccount.java +++ b/core/src/main/java/haveno/core/payment/PopmoneyAccount.java @@ -32,6 +32,13 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class PopmoneyAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_ID, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); public PopmoneyAccount() { @@ -51,7 +58,7 @@ public final class PopmoneyAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setAccountId(String accountId) { diff --git a/core/src/main/java/haveno/core/payment/PromptPayAccount.java b/core/src/main/java/haveno/core/payment/PromptPayAccount.java index 026a643fba..af121a5441 100644 --- a/core/src/main/java/haveno/core/payment/PromptPayAccount.java +++ b/core/src/main/java/haveno/core/payment/PromptPayAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class PromptPayAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.PROMPT_PAY_ID, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("THB")); public PromptPayAccount() { @@ -50,7 +56,7 @@ public final class PromptPayAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setPromptPayId(String promptPayId) { diff --git a/core/src/main/java/haveno/core/payment/RtgsAccount.java b/core/src/main/java/haveno/core/payment/RtgsAccount.java index e7bc4831b2..c8c55f1a08 100644 --- a/core/src/main/java/haveno/core/payment/RtgsAccount.java +++ b/core/src/main/java/haveno/core/payment/RtgsAccount.java @@ -17,14 +17,24 @@ package haveno.core.payment; +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; + +import java.util.List; @EqualsAndHashCode(callSuper = true) public final class RtgsAccount extends IfscBasedAccount { + private static final List 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 getInputFieldIds() { + return INPUT_FIELD_IDS; + } + public String getMessageForBuyer() { return "payment.rtgs.info.buyer"; } diff --git a/core/src/main/java/haveno/core/payment/SameBankAccount.java b/core/src/main/java/haveno/core/payment/SameBankAccount.java index 3a2af39946..747131e719 100644 --- a/core/src/main/java/haveno/core/payment/SameBankAccount.java +++ b/core/src/main/java/haveno/core/payment/SameBankAccount.java @@ -32,6 +32,20 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class SameBankAccount extends CountryBasedPaymentAccount implements BankNameRestrictedBankAccount, SameCountryRestrictedBankAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public SameBankAccount() { @@ -50,7 +64,7 @@ public final class SameBankAccount extends CountryBasedPaymentAccount implements @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } @Override diff --git a/core/src/main/java/haveno/core/payment/SatispayAccount.java b/core/src/main/java/haveno/core/payment/SatispayAccount.java index 2a93ceed4c..18bb6c86ed 100644 --- a/core/src/main/java/haveno/core/payment/SatispayAccount.java +++ b/core/src/main/java/haveno/core/payment/SatispayAccount.java @@ -31,6 +31,13 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class SatispayAccount extends CountryBasedPaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.MOBILE_NR, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR")); public SatispayAccount() { @@ -80,6 +87,6 @@ public final class SatispayAccount extends CountryBasedPaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java b/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java index d74fd36a15..b8b35a8335 100644 --- a/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java +++ b/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java @@ -32,6 +32,20 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class SpecificBanksAccount extends CountryBasedPaymentAccount implements BankNameRestrictedBankAccount, SameCountryRestrictedBankAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public SpecificBanksAccount() { @@ -50,7 +64,7 @@ public final class SpecificBanksAccount extends CountryBasedPaymentAccount imple @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } // TODO change to List diff --git a/core/src/main/java/haveno/core/payment/SwishAccount.java b/core/src/main/java/haveno/core/payment/SwishAccount.java index a726a9a14a..0aae885190 100644 --- a/core/src/main/java/haveno/core/payment/SwishAccount.java +++ b/core/src/main/java/haveno/core/payment/SwishAccount.java @@ -31,6 +31,13 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class SwishAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.MOBILE_NR, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("SEK")); public SwishAccount() { @@ -50,7 +57,7 @@ public final class SwishAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setMobileNr(String mobileNr) { diff --git a/core/src/main/java/haveno/core/payment/TikkieAccount.java b/core/src/main/java/haveno/core/payment/TikkieAccount.java index 123b2a0d58..ff718e8e01 100644 --- a/core/src/main/java/haveno/core/payment/TikkieAccount.java +++ b/core/src/main/java/haveno/core/payment/TikkieAccount.java @@ -24,13 +24,19 @@ import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import haveno.core.payment.payload.TikkieAccountPayload; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class TikkieAccount extends CountryBasedPaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.IBAN, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("EUR")); public TikkieAccount() { @@ -68,12 +74,12 @@ public final class TikkieAccount extends CountryBasedPaymentAccount { } @Override - public @NotNull List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } @Override - public @NotNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/TransferwiseUsdAccount.java b/core/src/main/java/haveno/core/payment/TransferwiseUsdAccount.java index 94491ddbf0..ca518c6912 100644 --- a/core/src/main/java/haveno/core/payment/TransferwiseUsdAccount.java +++ b/core/src/main/java/haveno/core/payment/TransferwiseUsdAccount.java @@ -24,13 +24,21 @@ import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; import haveno.core.payment.payload.TransferwiseUsdAccountPayload; import lombok.EqualsAndHashCode; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.util.List; @EqualsAndHashCode(callSuper = true) public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.EMAIL, + PaymentAccountFormField.FieldId.TRADE_CURRENCIES, + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); public TransferwiseUsdAccount() { @@ -84,12 +92,12 @@ public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount { } @Override - public @NotNull List getSupportedCurrencies() { + public @NonNull List getSupportedCurrencies() { return SUPPORTED_CURRENCIES; } @Override - public @NotNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + public @NonNull List getInputFieldIds() { + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/USPostalMoneyOrderAccount.java b/core/src/main/java/haveno/core/payment/USPostalMoneyOrderAccount.java index 41667563cf..02728f80dd 100644 --- a/core/src/main/java/haveno/core/payment/USPostalMoneyOrderAccount.java +++ b/core/src/main/java/haveno/core/payment/USPostalMoneyOrderAccount.java @@ -31,6 +31,13 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class USPostalMoneyOrderAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.POSTAL_ADDRESS, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD")); public USPostalMoneyOrderAccount() { @@ -50,7 +57,7 @@ public final class USPostalMoneyOrderAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setPostalAddress(String postalAddress) { diff --git a/core/src/main/java/haveno/core/payment/UpiAccount.java b/core/src/main/java/haveno/core/payment/UpiAccount.java index 1042e9d0e3..84e647988e 100644 --- a/core/src/main/java/haveno/core/payment/UpiAccount.java +++ b/core/src/main/java/haveno/core/payment/UpiAccount.java @@ -17,13 +17,24 @@ package haveno.core.payment; +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; + +import java.util.List; @EqualsAndHashCode(callSuper = true) public final class UpiAccount extends IfscBasedAccount { + + private static final List 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 getInputFieldIds() { + return INPUT_FIELD_IDS; + } + public void setVirtualPaymentAddress(String virtualPaymentAddress) { ((UpiAccountPayload) paymentAccountPayload).setVirtualPaymentAddress(virtualPaymentAddress); } diff --git a/core/src/main/java/haveno/core/payment/VerseAccount.java b/core/src/main/java/haveno/core/payment/VerseAccount.java index f45015a77a..71a9123cdc 100644 --- a/core/src/main/java/haveno/core/payment/VerseAccount.java +++ b/core/src/main/java/haveno/core/payment/VerseAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class VerseAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.HOLDER_NAME, + PaymentAccountFormField.FieldId.SALT + ); + // https://github.com/bisq-network/growth/issues/223 public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("DKK"), @@ -79,6 +85,6 @@ public final class VerseAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } } diff --git a/core/src/main/java/haveno/core/payment/WeChatPayAccount.java b/core/src/main/java/haveno/core/payment/WeChatPayAccount.java index 297968ef0c..dc78823111 100644 --- a/core/src/main/java/haveno/core/payment/WeChatPayAccount.java +++ b/core/src/main/java/haveno/core/payment/WeChatPayAccount.java @@ -31,6 +31,12 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class WeChatPayAccount extends PaymentAccount { + private static final List INPUT_FIELD_IDS = List.of( + PaymentAccountFormField.FieldId.ACCOUNT_NAME, + PaymentAccountFormField.FieldId.ACCOUNT_NR, + PaymentAccountFormField.FieldId.SALT + ); + public static final List SUPPORTED_CURRENCIES = List.of( new TraditionalCurrency("CNY"), new TraditionalCurrency("USD"), @@ -54,7 +60,7 @@ public final class WeChatPayAccount extends PaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public void setAccountNr(String accountNr) { diff --git a/core/src/main/java/haveno/core/payment/WesternUnionAccount.java b/core/src/main/java/haveno/core/payment/WesternUnionAccount.java index 64f18c205b..68f61af67c 100644 --- a/core/src/main/java/haveno/core/payment/WesternUnionAccount.java +++ b/core/src/main/java/haveno/core/payment/WesternUnionAccount.java @@ -29,6 +29,15 @@ import java.util.List; public final class WesternUnionAccount extends CountryBasedPaymentAccount { + private static final List 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 static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public WesternUnionAccount() { @@ -47,7 +56,7 @@ public final class WesternUnionAccount extends CountryBasedPaymentAccount { @Override public @NonNull List getInputFieldIds() { - throw new RuntimeException("Not implemented"); + return INPUT_FIELD_IDS; } public String getEmail() { diff --git a/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java b/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java index 4a8246fe78..56f57d49ef 100644 --- a/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java +++ b/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java @@ -101,7 +101,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import java.math.BigInteger; import java.util.ArrayList; @@ -342,7 +342,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList()); } @@ -530,7 +565,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable