support paxum

This commit is contained in:
woodser 2022-06-23 11:16:13 -04:00
parent 27f4b18330
commit 7ad2e20d95
6 changed files with 22 additions and 11 deletions

View file

@ -75,7 +75,8 @@ public final class PaymentAccountForm implements PersistablePayload {
STRIKE,
MONEY_GRAM,
FASTER_PAYMENTS,
UPHOLD;
UPHOLD,
PAXUM;
public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) {
return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name());

View file

@ -25,7 +25,7 @@ import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.payment.payload.PaymentMethod;
import java.util.List;
import java.util.stream.Collectors;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.NotNull;
@ -33,6 +33,13 @@ import org.jetbrains.annotations.NotNull;
@EqualsAndHashCode(callSuper = true)
public final class PaxumAccount extends PaymentAccount {
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
PaymentAccountFormField.FieldId.EMAIL,
PaymentAccountFormField.FieldId.TRADE_CURRENCIES,
PaymentAccountFormField.FieldId.SALT
);
// https://github.com/bisq-network/growth/issues/235
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(
new FiatCurrency("AUD"),
@ -71,7 +78,7 @@ public final class PaxumAccount extends PaymentAccount {
@Override
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
throw new RuntimeException("Not implemented");
return INPUT_FIELD_IDS;
}
public void setEmail(String accountId) {
@ -81,4 +88,11 @@ public final class PaxumAccount extends PaymentAccount {
public String getEmail() {
return ((PaxumAccountPayload) paymentAccountPayload).getEmail();
}
@Override
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
var field = super.getEmptyFormField(fieldId);
if (field.getId() == PaymentAccountFormField.FieldId.TRADE_CURRENCIES) field.setValue("");
return field;
}
}

View file

@ -665,6 +665,7 @@ public abstract class PaymentAccount implements PersistablePayload {
field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE);
field.setLabel("Supported currencies");
field.setSupportedCurrencies(getSupportedCurrencies());
field.setValue(String.join(",", getSupportedCurrencies().stream().map(TradeCurrency::getCode).collect(Collectors.toList())));
break;
case USER_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT);

View file

@ -124,11 +124,4 @@ public final class RevolutAccount extends PaymentAccount {
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
return SUPPORTED_CURRENCIES;
}
@Override
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
var field = super.getEmptyFormField(fieldId);
if (field.getId() == PaymentAccountFormField.FieldId.TRADE_CURRENCIES) field.setValue(String.join(",", getSupportedCurrencies().stream().map(TradeCurrency::getCode).collect(Collectors.toList())));
return field;
}
}

View file

@ -338,7 +338,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
STRIKE_ID,
MONEY_GRAM_ID,
FASTER_PAYMENTS_ID,
UPHOLD_ID);
UPHOLD_ID,
PAXUM_ID);
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
}

View file

@ -2085,6 +2085,7 @@ message PaymentAccountForm {
MONEY_GRAM = 8;
FASTER_PAYMENTS = 9;
UPHOLD = 10;
PAXUM = 11;
}
FormId id = 1;
repeated PaymentAccountFormField fields = 2;