mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-28 17:34:11 -04:00
support wise usd payment account over grpc api
This commit is contained in:
parent
cf4956f458
commit
425dc1dd4d
7 changed files with 40 additions and 17 deletions
|
@ -81,7 +81,8 @@ public final class PaymentAccountForm implements PersistablePayload {
|
||||||
PAYSAFE,
|
PAYSAFE,
|
||||||
WECHAT_PAY,
|
WECHAT_PAY,
|
||||||
ALI_PAY,
|
ALI_PAY,
|
||||||
SWISH;
|
SWISH,
|
||||||
|
TRANSFERWISE_USD;
|
||||||
|
|
||||||
public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) {
|
public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) {
|
||||||
return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name());
|
return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name());
|
||||||
|
|
|
@ -518,7 +518,8 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||||
case EXTRA_INFO:
|
case EXTRA_INFO:
|
||||||
break;
|
break;
|
||||||
case HOLDER_ADDRESS:
|
case HOLDER_ADDRESS:
|
||||||
throw new IllegalArgumentException("Not implemented");
|
processValidationResult(new LengthValidator(0, 100).validate(value));
|
||||||
|
break;
|
||||||
case HOLDER_EMAIL:
|
case HOLDER_EMAIL:
|
||||||
throw new IllegalArgumentException("Not implemented");
|
throw new IllegalArgumentException("Not implemented");
|
||||||
case HOLDER_NAME:
|
case HOLDER_NAME:
|
||||||
|
@ -668,11 +669,11 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||||
break;
|
break;
|
||||||
case BENEFICIARY_ACCOUNT_NR:
|
case BENEFICIARY_ACCOUNT_NR:
|
||||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
field.setLabel(Res.get("payment.swift.account"));
|
field.setLabel(Res.get("payment.swift.account")); // TODO: this is specific to swift
|
||||||
break;
|
break;
|
||||||
case BENEFICIARY_ADDRESS:
|
case BENEFICIARY_ADDRESS:
|
||||||
field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
|
field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
|
||||||
field.setLabel(Res.get("payment.swift.address.beneficiary"));
|
field.setLabel(Res.get("payment.swift.address.beneficiary")); // TODO: this is specific to swift
|
||||||
break;
|
break;
|
||||||
case BENEFICIARY_CITY:
|
case BENEFICIARY_CITY:
|
||||||
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
@ -717,7 +718,9 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||||
field.setLabel(Res.get("payment.shared.optionalExtra"));
|
field.setLabel(Res.get("payment.shared.optionalExtra"));
|
||||||
break;
|
break;
|
||||||
case HOLDER_ADDRESS:
|
case HOLDER_ADDRESS:
|
||||||
throw new IllegalArgumentException("Not implemented");
|
field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
|
||||||
|
field.setLabel(Res.get("payment.account.owner.address"));
|
||||||
|
break;
|
||||||
case HOLDER_EMAIL:
|
case HOLDER_EMAIL:
|
||||||
throw new IllegalArgumentException("Not implemented");
|
throw new IllegalArgumentException("Not implemented");
|
||||||
case HOLDER_NAME:
|
case HOLDER_NAME:
|
||||||
|
|
|
@ -19,6 +19,7 @@ package haveno.core.payment;
|
||||||
|
|
||||||
import haveno.core.api.model.PaymentAccountFormField;
|
import haveno.core.api.model.PaymentAccountFormField;
|
||||||
import haveno.core.locale.TraditionalCurrency;
|
import haveno.core.locale.TraditionalCurrency;
|
||||||
|
import haveno.core.locale.Res;
|
||||||
import haveno.core.locale.TradeCurrency;
|
import haveno.core.locale.TradeCurrency;
|
||||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||||
import haveno.core.payment.payload.PaymentMethod;
|
import haveno.core.payment.payload.PaymentMethod;
|
||||||
|
@ -33,6 +34,15 @@ public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount {
|
||||||
|
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new TraditionalCurrency("USD"));
|
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.EMAIL,
|
||||||
|
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.HOLDER_ADDRESS,
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.COUNTRY,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
public TransferwiseUsdAccount() {
|
public TransferwiseUsdAccount() {
|
||||||
super(PaymentMethod.TRANSFERWISE_USD);
|
super(PaymentMethod.TRANSFERWISE_USD);
|
||||||
// this payment method is currently restricted to United States/USD
|
// this payment method is currently restricted to United States/USD
|
||||||
|
@ -61,11 +71,11 @@ public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBeneficiaryAddress(String address) {
|
public void setBeneficiaryAddress(String address) {
|
||||||
((TransferwiseUsdAccountPayload) paymentAccountPayload).setBeneficiaryAddress(address);
|
((TransferwiseUsdAccountPayload) paymentAccountPayload).setHolderAddress(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBeneficiaryAddress() {
|
public String getBeneficiaryAddress() {
|
||||||
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getBeneficiaryAddress();
|
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getHolderAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,6 +100,13 @@ public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
throw new RuntimeException("Not implemented");
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
|
||||||
|
var field = super.getEmptyFormField(fieldId);
|
||||||
|
if (field.getId() == PaymentAccountFormField.FieldId.HOLDER_ADDRESS) field.setLabel(field.getLabel() + " " + Res.get("payment.transferwiseUsd.address"));
|
||||||
|
return field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||||
PAYSAFE_ID,
|
PAYSAFE_ID,
|
||||||
WECHAT_PAY_ID,
|
WECHAT_PAY_ID,
|
||||||
ALI_PAY_ID,
|
ALI_PAY_ID,
|
||||||
SWISH_ID);
|
SWISH_ID,
|
||||||
|
TRANSFERWISE_USD_ID);
|
||||||
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
|
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.Map;
|
||||||
public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAccountPayload {
|
public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
private String email = "";
|
private String email = "";
|
||||||
private String holderName = "";
|
private String holderName = "";
|
||||||
private String beneficiaryAddress = "";
|
private String holderAddress = "";
|
||||||
|
|
||||||
public TransferwiseUsdAccountPayload(String paymentMethod, String id) {
|
public TransferwiseUsdAccountPayload(String paymentMethod, String id) {
|
||||||
super(paymentMethod, id);
|
super(paymentMethod, id);
|
||||||
|
@ -51,7 +51,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
List<String> acceptedCountryCodes,
|
List<String> acceptedCountryCodes,
|
||||||
String email,
|
String email,
|
||||||
String holderName,
|
String holderName,
|
||||||
String beneficiaryAddress,
|
String holderAddress,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
|
@ -63,7 +63,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
|
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.holderName = holderName;
|
this.holderName = holderName;
|
||||||
this.beneficiaryAddress = beneficiaryAddress;
|
this.holderAddress = holderAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,7 +71,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
protobuf.TransferwiseUsdAccountPayload.Builder builder = protobuf.TransferwiseUsdAccountPayload.newBuilder()
|
protobuf.TransferwiseUsdAccountPayload.Builder builder = protobuf.TransferwiseUsdAccountPayload.newBuilder()
|
||||||
.setEmail(email)
|
.setEmail(email)
|
||||||
.setHolderName(holderName)
|
.setHolderName(holderName)
|
||||||
.setBeneficiaryAddress(beneficiaryAddress);
|
.setHolderAddress(holderAddress);
|
||||||
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
||||||
.getCountryBasedPaymentAccountPayloadBuilder()
|
.getCountryBasedPaymentAccountPayloadBuilder()
|
||||||
.setTransferwiseUsdAccountPayload(builder);
|
.setTransferwiseUsdAccountPayload(builder);
|
||||||
|
@ -89,7 +89,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
accountPayloadPB.getEmail(),
|
accountPayloadPB.getEmail(),
|
||||||
accountPayloadPB.getHolderName(),
|
accountPayloadPB.getHolderName(),
|
||||||
accountPayloadPB.getBeneficiaryAddress(),
|
accountPayloadPB.getHolderAddress(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class TransferwiseUsdForm extends PaymentMethodForm {
|
||||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, 1, Res.get("payment.email"),
|
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, 1, Res.get("payment.email"),
|
||||||
((TransferwiseUsdAccountPayload) paymentAccountPayload).getEmail());
|
((TransferwiseUsdAccountPayload) paymentAccountPayload).getEmail());
|
||||||
|
|
||||||
String address = ((TransferwiseUsdAccountPayload) paymentAccountPayload).getBeneficiaryAddress();
|
String address = ((TransferwiseUsdAccountPayload) paymentAccountPayload).getHolderAddress();
|
||||||
if (address.length() > 0) {
|
if (address.length() > 0) {
|
||||||
TextArea textAddress = addCompactTopLabelTextArea(gridPane, gridRow, 0, Res.get("payment.account.address"), "").second;
|
TextArea textAddress = addCompactTopLabelTextArea(gridPane, gridRow, 0, Res.get("payment.account.address"), "").second;
|
||||||
textAddress.setMinHeight(70);
|
textAddress.setMinHeight(70);
|
||||||
|
@ -96,7 +96,7 @@ public class TransferwiseUsdForm extends PaymentMethodForm {
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
});
|
});
|
||||||
|
|
||||||
String addressLabel = Res.get("payment.account.owner.address") + Res.get("payment.transferwiseUsd.address");
|
String addressLabel = Res.get("payment.account.owner.address") + " " + Res.get("payment.transferwiseUsd.address");
|
||||||
TextArea addressTextArea = addTopLabelTextArea(gridPane, ++gridRow, addressLabel, addressLabel).second;
|
TextArea addressTextArea = addTopLabelTextArea(gridPane, ++gridRow, addressLabel, addressLabel).second;
|
||||||
addressTextArea.setMinHeight(70);
|
addressTextArea.setMinHeight(70);
|
||||||
addressTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
|
addressTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||||
|
|
|
@ -1163,7 +1163,7 @@ message TransferwiseAccountPayload {
|
||||||
message TransferwiseUsdAccountPayload {
|
message TransferwiseUsdAccountPayload {
|
||||||
string email = 1;
|
string email = 1;
|
||||||
string holder_name = 2;
|
string holder_name = 2;
|
||||||
string beneficiary_address = 3;
|
string holder_address = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PayseraAccountPayload {
|
message PayseraAccountPayload {
|
||||||
|
@ -1906,6 +1906,7 @@ message PaymentAccountForm {
|
||||||
WECHAT_PAY = 20;
|
WECHAT_PAY = 20;
|
||||||
ALI_PAY = 21;
|
ALI_PAY = 21;
|
||||||
SWISH = 22;
|
SWISH = 22;
|
||||||
|
TRANSFERWISE_USD = 23;
|
||||||
}
|
}
|
||||||
FormId id = 1;
|
FormId id = 1;
|
||||||
repeated PaymentAccountFormField fields = 2;
|
repeated PaymentAccountFormField fields = 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue