mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
support sepa instant
This commit is contained in:
parent
c40938f438
commit
d0c02acba1
5 changed files with 48 additions and 12 deletions
|
@ -67,6 +67,7 @@ public final class PaymentAccountForm implements PersistablePayload {
|
|||
public enum FormId {
|
||||
REVOLUT,
|
||||
SEPA,
|
||||
SEPA_INSTANT,
|
||||
TRANSFERWISE,
|
||||
CLEAR_X_CHANGE,
|
||||
SWIFT,
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class SepaAccount extends CountryBasedPaymentAccount implements BankAccount {
|
||||
|
||||
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
protected static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||
PaymentAccountFormField.FieldId.IBAN,
|
||||
|
@ -142,7 +142,7 @@ public final class SepaAccount extends CountryBasedPaymentAccount implements Ban
|
|||
super.validateFormField(form, fieldId, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
|
||||
var field = super.getEmptyFormField(fieldId);
|
||||
|
|
|
@ -17,16 +17,18 @@
|
|||
|
||||
package bisq.core.payment;
|
||||
|
||||
import bisq.core.api.model.PaymentAccountForm;
|
||||
import bisq.core.api.model.PaymentAccountFormField;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.payload.SepaInstantAccountPayload;
|
||||
|
||||
import bisq.core.payment.validation.SepaIBANValidator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -100,13 +102,44 @@ public final class SepaInstantAccount extends CountryBasedPaymentAccount impleme
|
|||
((SepaInstantAccountPayload) paymentAccountPayload).revertChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
return SepaAccount.INPUT_FIELD_IDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||
return SUPPORTED_CURRENCIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||
throw new RuntimeException("Not implemented");
|
||||
@Nullable
|
||||
public List<Country> getSupportedCountries() {
|
||||
return CountryUtil.getAllSepaCountries();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateFormField(PaymentAccountForm form, PaymentAccountFormField.FieldId fieldId, String value) {
|
||||
switch (fieldId) {
|
||||
case IBAN:
|
||||
processValidationResult(new SepaIBANValidator().validate(value));
|
||||
break;
|
||||
default:
|
||||
super.validateFormField(form, fieldId, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
|
||||
var field = super.getEmptyFormField(fieldId);
|
||||
switch (fieldId) {
|
||||
case ACCEPTED_COUNTRY_CODES:
|
||||
field.setSupportedSepaEuroCountries(CountryUtil.getAllSepaEuroCountries());
|
||||
field.setSupportedSepaNonEuroCountries(CountryUtil.getAllSepaNonEuroCountries());
|
||||
break;
|
||||
default:
|
||||
// no action
|
||||
}
|
||||
return field;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,6 +330,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
|||
List<String> paymentMethodIds = List.of(
|
||||
REVOLUT_ID,
|
||||
SEPA_ID,
|
||||
SEPA_INSTANT_ID,
|
||||
TRANSFERWISE_ID,
|
||||
CLEAR_X_CHANGE_ID,
|
||||
SWIFT_ID,
|
||||
|
|
|
@ -2076,12 +2076,13 @@ message PaymentAccountForm {
|
|||
enum FormId {
|
||||
REVOLUT = 0;
|
||||
SEPA = 1;
|
||||
TRANSFERWISE = 2;
|
||||
CLEAR_X_CHANGE = 3;
|
||||
SWIFT = 4;
|
||||
F2F = 5;
|
||||
STRIKE = 6;
|
||||
MONEY_GRAM = 7;
|
||||
SEPA_INSTANT = 2;
|
||||
TRANSFERWISE = 3;
|
||||
CLEAR_X_CHANGE = 4;
|
||||
SWIFT = 5;
|
||||
F2F = 6;
|
||||
STRIKE = 7;
|
||||
MONEY_GRAM = 8;
|
||||
}
|
||||
FormId id = 1;
|
||||
repeated PaymentAccountFormField fields = 2;
|
||||
|
|
Loading…
Reference in a new issue