support US postal money order accounts over grpc api

This commit is contained in:
woodser 2025-06-21 14:48:56 -04:00
parent 5fb92848c2
commit bb1173cc96
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF
4 changed files with 13 additions and 3 deletions

View file

@ -85,7 +85,8 @@ public final class PaymentAccountForm implements PersistablePayload {
TRANSFERWISE_USD,
AMAZON_GIFT_CARD,
ACH_TRANSFER,
INTERAC_E_TRANSFER;
INTERAC_E_TRANSFER,
US_POSTAL_MONEY_ORDER;
public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) {
return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name());

View file

@ -33,6 +33,13 @@ public final class USPostalMoneyOrderAccount 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.HOLDER_NAME,
PaymentAccountFormField.FieldId.POSTAL_ADDRESS,
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
PaymentAccountFormField.FieldId.SALT
);
public USPostalMoneyOrderAccount() {
super(PaymentMethod.US_POSTAL_MONEY_ORDER);
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
@ -50,7 +57,7 @@ public final class USPostalMoneyOrderAccount extends PaymentAccount {
@Override
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
throw new RuntimeException("Not implemented");
return INPUT_FIELD_IDS;
}
public void setPostalAddress(String postalAddress) {

View file

@ -376,7 +376,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
TRANSFERWISE_USD_ID,
AMAZON_GIFT_CARD_ID,
ACH_TRANSFER_ID,
INTERAC_E_TRANSFER_ID);
INTERAC_E_TRANSFER_ID,
US_POSTAL_MONEY_ORDER_ID);
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
}

View file

@ -1910,6 +1910,7 @@ message PaymentAccountForm {
AMAZON_GIFT_CARD = 24;
ACH_TRANSFER = 25;
INTERAC_E_TRANSFER = 26;
US_POSTAL_MONEY_ORDER = 27;
}
FormId id = 1;
repeated PaymentAccountFormField fields = 2;