support cash at atm over grpc

This commit is contained in:
woodser 2023-09-09 07:29:36 -04:00
parent 33eb98e3c4
commit 4017fa108a
4 changed files with 24 additions and 9 deletions

View file

@ -60,6 +60,7 @@ public final class PaymentAccountForm implements PersistablePayload {
public enum FormId {
BLOCK_CHAINS,
CASH_AT_ATM,
FASTER_PAYMENTS,
F2F,
MONEY_GRAM,

View file

@ -19,6 +19,7 @@ package haveno.core.payment;
import haveno.core.api.model.PaymentAccountFormField;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.payment.payload.CashAtAtmAccountPayload;
import haveno.core.payment.payload.PaymentAccountPayload;
@ -32,7 +33,10 @@ public final class CashAtAtmAccount extends PaymentAccount {
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
PaymentAccountFormField.FieldId.EXTRA_INFO
PaymentAccountFormField.FieldId.TRADE_CURRENCIES,
PaymentAccountFormField.FieldId.EXTRA_INFO,
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
PaymentAccountFormField.FieldId.SALT
);
public CashAtAtmAccount() {
@ -61,4 +65,12 @@ public final class CashAtAtmAccount extends PaymentAccount {
public String getExtraInfo() {
return ((CashAtAtmAccountPayload) paymentAccountPayload).getExtraInfo();
}
@Override
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
var field = super.getEmptyFormField(fieldId);
if (field.getId() == PaymentAccountFormField.FieldId.TRADE_CURRENCIES) field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
if (field.getId() == PaymentAccountFormField.FieldId.EXTRA_INFO) field.setLabel(Res.get("payment.cashAtAtm.extraInfo.prompt"));
return field;
}
}

View file

@ -334,19 +334,20 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
public static List<PaymentMethod> getPaymentMethods() {
List<String> paymentMethodIds = List.of(
BLOCK_CHAINS_ID,
CASH_AT_ATM_ID,
FASTER_PAYMENTS_ID,
F2F_ID,
MONEY_GRAM_ID,
PAXUM_ID,
PAY_BY_MAIL_ID,
REVOLUT_ID,
SEPA_ID,
SEPA_INSTANT_ID,
TRANSFERWISE_ID,
ZELLE_ID,
SWIFT_ID,
F2F_ID,
STRIKE_ID,
MONEY_GRAM_ID,
FASTER_PAYMENTS_ID,
SWIFT_ID,
TRANSFERWISE_ID,
UPHOLD_ID,
PAXUM_ID,
PAY_BY_MAIL_ID);
ZELLE_ID);
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
}

View file

@ -1839,6 +1839,7 @@ message PaymentAccountForm {
UPHOLD = 11;
PAXUM = 12;
PAY_BY_MAIL = 13;
CASH_AT_ATM = 14;
}
FormId id = 1;
repeated PaymentAccountFormField fields = 2;