mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
refactor payment account form api to support structured, dynamic forms
This commit is contained in:
parent
341ae2bef0
commit
faeb9ca8db
203 changed files with 1844 additions and 509 deletions
|
@ -115,9 +115,6 @@ public class AbstractPaymentAccountTest extends MethodTest {
|
||||||
|
|
||||||
static final Map<String, Object> COMPLETED_FORM_MAP = new HashMap<>();
|
static final Map<String, Object> COMPLETED_FORM_MAP = new HashMap<>();
|
||||||
|
|
||||||
// A payment account serializer / deserializer.
|
|
||||||
static final PaymentAccountForm PAYMENT_ACCOUNT_FORM = new PaymentAccountForm();
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Res.setup();
|
Res.setup();
|
||||||
|
@ -134,7 +131,7 @@ public class AbstractPaymentAccountTest extends MethodTest {
|
||||||
// File emptyForm = PAYMENT_ACCOUNT_FORM.getPaymentAccountForm(paymentMethodId);
|
// File emptyForm = PAYMENT_ACCOUNT_FORM.getPaymentAccountForm(paymentMethodId);
|
||||||
log.debug("{} Empty form saved to {}",
|
log.debug("{} Empty form saved to {}",
|
||||||
testName(testInfo),
|
testName(testInfo),
|
||||||
PAYMENT_ACCOUNT_FORM.getClickableURI(emptyForm));
|
PaymentAccountForm.getClickableURI(emptyForm));
|
||||||
emptyForm.deleteOnExit();
|
emptyForm.deleteOnExit();
|
||||||
return emptyForm;
|
return emptyForm;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +139,7 @@ public class AbstractPaymentAccountTest extends MethodTest {
|
||||||
protected final void verifyEmptyForm(File jsonForm, String paymentMethodId, String... fields) {
|
protected final void verifyEmptyForm(File jsonForm, String paymentMethodId, String... fields) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Map<String, Object> emptyForm = (Map<String, Object>) GSON.fromJson(
|
Map<String, Object> emptyForm = (Map<String, Object>) GSON.fromJson(
|
||||||
PAYMENT_ACCOUNT_FORM.toJsonString(jsonForm),
|
PaymentAccountForm.toJsonString(jsonForm),
|
||||||
Object.class);
|
Object.class);
|
||||||
assertNotNull(emptyForm);
|
assertNotNull(emptyForm);
|
||||||
|
|
||||||
|
@ -201,14 +198,14 @@ public class AbstractPaymentAccountTest extends MethodTest {
|
||||||
|
|
||||||
protected final String getCompletedFormAsJsonString(List<String> comments) {
|
protected final String getCompletedFormAsJsonString(List<String> comments) {
|
||||||
File completedForm = fillPaymentAccountForm(comments);
|
File completedForm = fillPaymentAccountForm(comments);
|
||||||
String jsonString = PAYMENT_ACCOUNT_FORM.toJsonString(completedForm);
|
String jsonString = PaymentAccountForm.toJsonString(completedForm);
|
||||||
log.debug("Completed form: {}", jsonString);
|
log.debug("Completed form: {}", jsonString);
|
||||||
return jsonString;
|
return jsonString;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final String getCompletedFormAsJsonString() {
|
protected final String getCompletedFormAsJsonString() {
|
||||||
File completedForm = fillPaymentAccountForm(PROPERTY_VALUE_JSON_COMMENTS);
|
File completedForm = fillPaymentAccountForm(PROPERTY_VALUE_JSON_COMMENTS);
|
||||||
String jsonString = PAYMENT_ACCOUNT_FORM.toJsonString(completedForm);
|
String jsonString = PaymentAccountForm.toJsonString(completedForm);
|
||||||
log.debug("Completed form: {}", jsonString);
|
log.debug("Completed form: {}", jsonString);
|
||||||
return jsonString;
|
return jsonString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,12 @@ import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||||
|
|
||||||
|
|
||||||
import bisq.cli.GrpcClient;
|
import bisq.cli.GrpcClient;
|
||||||
|
import bisq.core.api.model.PaymentAccountForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience GrpcClient wrapper for bots using gRPC services.
|
* Convenience GrpcClient wrapper for bots using gRPC services.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"JavaDoc", "unused"})
|
@SuppressWarnings({"unused"})
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BotClient {
|
public class BotClient {
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,9 @@ public class BotPaymentAccountGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getPaymentAccountFormMap(String paymentMethodId) {
|
private Map<String, Object> getPaymentAccountFormMap(String paymentMethodId) {
|
||||||
PaymentAccountForm paymentAccountForm = new PaymentAccountForm();
|
File jsonFormTemplate = PaymentAccountForm.getPaymentAccountForm(paymentMethodId);
|
||||||
File jsonFormTemplate = paymentAccountForm.getPaymentAccountForm(paymentMethodId);
|
|
||||||
jsonFormTemplate.deleteOnExit();
|
jsonFormTemplate.deleteOnExit();
|
||||||
String jsonString = paymentAccountForm.toJsonString(jsonFormTemplate);
|
String jsonString = PaymentAccountForm.toJsonString(jsonFormTemplate);
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return (Map<String, Object>) gson.fromJson(jsonString, Object.class);
|
return (Map<String, Object>) gson.fromJson(jsonString, Object.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import bisq.proto.grpc.TxFeeRateInfo;
|
||||||
import bisq.proto.grpc.TxInfo;
|
import bisq.proto.grpc.TxInfo;
|
||||||
|
|
||||||
import protobuf.PaymentAccount;
|
import protobuf.PaymentAccount;
|
||||||
|
import protobuf.PaymentAccountForm;
|
||||||
import protobuf.PaymentMethod;
|
import protobuf.PaymentMethod;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -20,11 +20,13 @@ package bisq.cli.request;
|
||||||
import bisq.proto.grpc.CreateCryptoCurrencyPaymentAccountRequest;
|
import bisq.proto.grpc.CreateCryptoCurrencyPaymentAccountRequest;
|
||||||
import bisq.proto.grpc.CreatePaymentAccountRequest;
|
import bisq.proto.grpc.CreatePaymentAccountRequest;
|
||||||
import bisq.proto.grpc.GetCryptoCurrencyPaymentMethodsRequest;
|
import bisq.proto.grpc.GetCryptoCurrencyPaymentMethodsRequest;
|
||||||
|
import bisq.proto.grpc.GetPaymentAccountFormAsJsonRequest;
|
||||||
import bisq.proto.grpc.GetPaymentAccountFormRequest;
|
import bisq.proto.grpc.GetPaymentAccountFormRequest;
|
||||||
import bisq.proto.grpc.GetPaymentAccountsRequest;
|
import bisq.proto.grpc.GetPaymentAccountsRequest;
|
||||||
import bisq.proto.grpc.GetPaymentMethodsRequest;
|
import bisq.proto.grpc.GetPaymentMethodsRequest;
|
||||||
|
|
||||||
import protobuf.PaymentAccount;
|
import protobuf.PaymentAccount;
|
||||||
|
import protobuf.PaymentAccountForm;
|
||||||
import protobuf.PaymentMethod;
|
import protobuf.PaymentMethod;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -49,15 +51,15 @@ public class PaymentAccountsServiceRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPaymentAcctFormAsJson(String paymentMethodId) {
|
public String getPaymentAcctFormAsJson(String paymentMethodId) {
|
||||||
var request = GetPaymentAccountFormRequest.newBuilder()
|
var request = GetPaymentAccountFormAsJsonRequest.newBuilder()
|
||||||
.setPaymentMethodId(paymentMethodId)
|
.setPaymentMethodId(paymentMethodId)
|
||||||
.build();
|
.build();
|
||||||
return grpcStubs.paymentAccountsService.getPaymentAccountForm(request).getPaymentAccountFormJson();
|
return grpcStubs.paymentAccountsService.getPaymentAccountFormAsJson(request).getPaymentAccountFormAsJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaymentAccount createPaymentAccount(String json) {
|
public PaymentAccount createPaymentAccount(String json) {
|
||||||
var request = CreatePaymentAccountRequest.newBuilder()
|
var request = CreatePaymentAccountRequest.newBuilder()
|
||||||
.setPaymentAccountForm(json)
|
.setPaymentAccountFormAsJson(json)
|
||||||
.build();
|
.build();
|
||||||
return grpcStubs.paymentAccountsService.createPaymentAccount(request).getPaymentAccount();
|
return grpcStubs.paymentAccountsService.createPaymentAccount(request).getPaymentAccount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ import bisq.core.api.model.AddressBalanceInfo;
|
||||||
import bisq.core.api.model.BalancesInfo;
|
import bisq.core.api.model.BalancesInfo;
|
||||||
import bisq.core.api.model.MarketDepthInfo;
|
import bisq.core.api.model.MarketDepthInfo;
|
||||||
import bisq.core.api.model.MarketPriceInfo;
|
import bisq.core.api.model.MarketPriceInfo;
|
||||||
|
import bisq.core.api.model.PaymentAccountForm;
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.api.model.TxFeeRateInfo;
|
import bisq.core.api.model.TxFeeRateInfo;
|
||||||
import bisq.core.app.AppStartupState;
|
import bisq.core.app.AppStartupState;
|
||||||
import bisq.core.monetary.Price;
|
import bisq.core.monetary.Price;
|
||||||
|
@ -488,8 +490,8 @@ public class CoreApi {
|
||||||
// PaymentAccounts
|
// PaymentAccounts
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public PaymentAccount createPaymentAccount(String jsonString) {
|
public PaymentAccount createPaymentAccount(PaymentAccountForm form) {
|
||||||
return paymentAccountsService.createPaymentAccount(jsonString);
|
return paymentAccountsService.createPaymentAccount(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PaymentAccount> getPaymentAccounts() {
|
public Set<PaymentAccount> getPaymentAccounts() {
|
||||||
|
@ -500,8 +502,8 @@ public class CoreApi {
|
||||||
return paymentAccountsService.getFiatPaymentMethods();
|
return paymentAccountsService.getFiatPaymentMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPaymentAccountForm(String paymentMethodId) {
|
public PaymentAccountForm getPaymentAccountForm(String paymentMethodId) {
|
||||||
return paymentAccountsService.getPaymentAccountFormAsString(paymentMethodId);
|
return paymentAccountsService.getPaymentAccountForm(paymentMethodId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaymentAccount createCryptoCurrencyPaymentAccount(String accountName,
|
public PaymentAccount createCryptoCurrencyPaymentAccount(String accountName,
|
||||||
|
@ -518,6 +520,10 @@ public class CoreApi {
|
||||||
return paymentAccountsService.getCryptoCurrencyPaymentMethods();
|
return paymentAccountsService.getCryptoCurrencyPaymentMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void validateFormField(PaymentAccountForm form, PaymentAccountFormField.FieldId fieldId, String value) {
|
||||||
|
paymentAccountsService.validateFormField(form, fieldId, value);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Prices
|
// Prices
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -19,7 +19,11 @@ package bisq.core.api;
|
||||||
|
|
||||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||||
import bisq.core.api.model.PaymentAccountForm;
|
import bisq.core.api.model.PaymentAccountForm;
|
||||||
|
import bisq.core.api.model.PaymentAccountForm;
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CryptoCurrency;
|
import bisq.core.locale.CryptoCurrency;
|
||||||
|
import bisq.core.locale.CurrencyUtil;
|
||||||
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.AssetAccount;
|
import bisq.core.payment.AssetAccount;
|
||||||
import bisq.core.payment.CryptoCurrencyAccount;
|
import bisq.core.payment.CryptoCurrencyAccount;
|
||||||
import bisq.core.payment.InstantCryptoCurrencyAccount;
|
import bisq.core.payment.InstantCryptoCurrencyAccount;
|
||||||
|
@ -27,7 +31,6 @@ import bisq.core.payment.PaymentAccount;
|
||||||
import bisq.core.payment.PaymentAccountFactory;
|
import bisq.core.payment.PaymentAccountFactory;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
import bisq.core.user.User;
|
import bisq.core.user.User;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
@ -50,24 +53,22 @@ class CorePaymentAccountsService {
|
||||||
|
|
||||||
private final CoreAccountService accountService;
|
private final CoreAccountService accountService;
|
||||||
private final AccountAgeWitnessService accountAgeWitnessService;
|
private final AccountAgeWitnessService accountAgeWitnessService;
|
||||||
private final PaymentAccountForm paymentAccountForm;
|
|
||||||
private final User user;
|
private final User user;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CorePaymentAccountsService(CoreAccountService accountService,
|
public CorePaymentAccountsService(CoreAccountService accountService,
|
||||||
AccountAgeWitnessService accountAgeWitnessService,
|
AccountAgeWitnessService accountAgeWitnessService,
|
||||||
PaymentAccountForm paymentAccountForm,
|
|
||||||
User user) {
|
User user) {
|
||||||
this.accountService = accountService;
|
this.accountService = accountService;
|
||||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||||
this.paymentAccountForm = paymentAccountForm;
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fiat Currency Accounts
|
// Fiat Currency Accounts
|
||||||
|
|
||||||
PaymentAccount createPaymentAccount(String jsonString) {
|
PaymentAccount createPaymentAccount(PaymentAccountForm form) {
|
||||||
PaymentAccount paymentAccount = paymentAccountForm.toPaymentAccount(jsonString);
|
PaymentAccount paymentAccount = form.toPaymentAccount();
|
||||||
|
setSelectedTradeCurrency(paymentAccount); // TODO: selected trade currency is function of offer, not payment account payload
|
||||||
verifyPaymentAccountHasRequiredFields(paymentAccount);
|
verifyPaymentAccountHasRequiredFields(paymentAccount);
|
||||||
user.addPaymentAccountIfNotExists(paymentAccount);
|
user.addPaymentAccountIfNotExists(paymentAccount);
|
||||||
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
|
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
|
||||||
|
@ -77,6 +78,18 @@ class CorePaymentAccountsService {
|
||||||
return paymentAccount;
|
return paymentAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void setSelectedTradeCurrency(PaymentAccount paymentAccount) {
|
||||||
|
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
|
||||||
|
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
|
||||||
|
if (singleTradeCurrency != null) return;
|
||||||
|
else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
|
||||||
|
if (tradeCurrencies.contains(CurrencyUtil.getDefaultTradeCurrency()))
|
||||||
|
paymentAccount.setSelectedTradeCurrency(CurrencyUtil.getDefaultTradeCurrency());
|
||||||
|
else
|
||||||
|
paymentAccount.setSelectedTradeCurrency(tradeCurrencies.get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Set<PaymentAccount> getPaymentAccounts() {
|
Set<PaymentAccount> getPaymentAccounts() {
|
||||||
return user.getPaymentAccounts();
|
return user.getPaymentAccounts();
|
||||||
}
|
}
|
||||||
|
@ -88,14 +101,18 @@ class CorePaymentAccountsService {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
String getPaymentAccountFormAsString(String paymentMethodId) {
|
PaymentAccountForm getPaymentAccountForm(String paymentMethodId) {
|
||||||
File jsonForm = getPaymentAccountForm(paymentMethodId);
|
return PaymentAccountForm.getForm(paymentMethodId);
|
||||||
jsonForm.deleteOnExit(); // If just asking for a string, delete the form file.
|
|
||||||
return paymentAccountForm.toJsonString(jsonForm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
File getPaymentAccountForm(String paymentMethodId) {
|
String getPaymentAccountFormAsString(String paymentMethodId) {
|
||||||
return paymentAccountForm.getPaymentAccountForm(paymentMethodId);
|
File jsonForm = getPaymentAccountFormFile(paymentMethodId);
|
||||||
|
jsonForm.deleteOnExit(); // If just asking for a string, delete the form file.
|
||||||
|
return PaymentAccountForm.toJsonString(jsonForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
File getPaymentAccountFormFile(String paymentMethodId) {
|
||||||
|
return PaymentAccountForm.getPaymentAccountForm(paymentMethodId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crypto Currency Accounts
|
// Crypto Currency Accounts
|
||||||
|
@ -134,6 +151,16 @@ class CorePaymentAccountsService {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void validateFormField(PaymentAccountForm form, PaymentAccountFormField.FieldId fieldId, String value) {
|
||||||
|
|
||||||
|
// get payment method id
|
||||||
|
PaymentAccountForm.FormId formId = form.getId();
|
||||||
|
|
||||||
|
// validate field with empty payment account
|
||||||
|
PaymentAccount paymentAccount = PaymentAccountFactory.getPaymentAccount(PaymentMethod.getPaymentMethod(formId.toString()));
|
||||||
|
paymentAccount.validateFormField(form, fieldId, value);
|
||||||
|
}
|
||||||
|
|
||||||
private void verifyPaymentAccountHasRequiredFields(PaymentAccount paymentAccount) {
|
private void verifyPaymentAccountHasRequiredFields(PaymentAccount paymentAccount) {
|
||||||
if (!paymentAccount.hasMultipleCurrencies() && paymentAccount.getSingleTradeCurrency() == null)
|
if (!paymentAccount.hasMultipleCurrencies() && paymentAccount.getSingleTradeCurrency() == null)
|
||||||
throw new IllegalArgumentException(format("no trade currency defined for %s payment account",
|
throw new IllegalArgumentException(format("no trade currency defined for %s payment account",
|
||||||
|
|
|
@ -17,130 +17,137 @@
|
||||||
|
|
||||||
package bisq.core.api.model;
|
package bisq.core.api.model;
|
||||||
|
|
||||||
import bisq.core.payment.PaymentAccount;
|
|
||||||
import bisq.core.payment.PaymentAccountFactory;
|
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethod;
|
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethod;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static java.lang.String.format;
|
import static java.lang.String.format;
|
||||||
import static java.lang.System.getProperty;
|
import static java.lang.System.getProperty;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
|
import bisq.common.proto.ProtoUtil;
|
||||||
|
import bisq.common.proto.persistable.PersistablePayload;
|
||||||
|
import bisq.core.payment.PaymentAccount;
|
||||||
|
import bisq.core.payment.PaymentAccountFactory;
|
||||||
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
@Getter
|
||||||
* <p>
|
@Immutable
|
||||||
* An instance of this class can write new payment account forms (editable json files),
|
@EqualsAndHashCode
|
||||||
* and de-serialize edited json files into {@link PaymentAccount}
|
@ToString
|
||||||
* instances.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* Example use case: (1) ask for a blank Hal Cash account form, (2) edit it, (3) derive a
|
|
||||||
* {@link bisq.core.payment.HalCashAccount} instance from the edited json file.
|
|
||||||
* </p>
|
|
||||||
* <br>
|
|
||||||
* <p>
|
|
||||||
* (1) Ask for a hal cash account form: Pass a {@link PaymentMethod#HAL_CASH_ID}
|
|
||||||
* to {@link PaymentAccountForm#getPaymentAccountForm(String)} to
|
|
||||||
* get the json Hal Cash payment account form:
|
|
||||||
* <pre>
|
|
||||||
* {
|
|
||||||
* "_COMMENTS_": [
|
|
||||||
* "Do not manually edit the paymentMethodId field.",
|
|
||||||
* "Edit the salt field only if you are recreating a payment account on a new installation and wish to preserve the account age."
|
|
||||||
* ],
|
|
||||||
* "paymentMethodId": "HAL_CASH",
|
|
||||||
* "accountName": "Your accountname",
|
|
||||||
* "mobileNr": "Your mobilenr"
|
|
||||||
* "salt": ""
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* (2) Save the Hal Cash payment account form to disk, and edit it:
|
|
||||||
* <pre>
|
|
||||||
* {
|
|
||||||
* "_COMMENTS_": [
|
|
||||||
* "Do not manually edit the paymentMethodId field.",
|
|
||||||
* "Edit the salt field only if you are recreating a payment account on a new installation and wish to preserve the account age."
|
|
||||||
* ],
|
|
||||||
* "paymentMethodId": "HAL_CASH",
|
|
||||||
* "accountName": "Hal Cash Acct",
|
|
||||||
* "mobileNr": "798 123 456"
|
|
||||||
* "salt": ""
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
* </p>
|
|
||||||
* (3) De-serialize the edited json account form: Pass the edited json file to
|
|
||||||
* {@link PaymentAccountForm#toPaymentAccount(File)}, or
|
|
||||||
* a json string to {@link PaymentAccountForm#toPaymentAccount(String)}
|
|
||||||
* and get a {@link bisq.core.payment.HalCashAccount} instance.
|
|
||||||
* <pre>
|
|
||||||
* PaymentAccount(
|
|
||||||
* paymentMethod=PaymentMethod(id=HAL_CASH,
|
|
||||||
* maxTradePeriod=86400000,
|
|
||||||
* maxTradeLimit=50000000),
|
|
||||||
* id=e33c9d94-1a1a-43fd-aa11-fcaacbb46100,
|
|
||||||
* creationDate=Mon Nov 16 12:26:43 BRST 2020,
|
|
||||||
* paymentAccountPayload=HalCashAccountPayload(mobileNr=798 123 456),
|
|
||||||
* accountName=Hal Cash Acct,
|
|
||||||
* tradeCurrencies=[FiatCurrency(currency=EUR)],
|
|
||||||
* selectedTradeCurrency=FiatCurrency(currency=EUR)
|
|
||||||
* )
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class PaymentAccountForm {
|
public final class PaymentAccountForm implements PersistablePayload {
|
||||||
|
|
||||||
private final GsonBuilder gsonBuilder = new GsonBuilder()
|
private static final GsonBuilder gsonBuilder = new GsonBuilder()
|
||||||
.setPrettyPrinting()
|
.setPrettyPrinting()
|
||||||
.serializeNulls();
|
.serializeNulls();
|
||||||
|
|
||||||
// A list of PaymentAccount fields to exclude from json forms.
|
public enum FormId {
|
||||||
private final String[] excludedFields = new String[]{
|
REVOLUT,
|
||||||
"log",
|
SEPA,
|
||||||
"id",
|
TRANSFERWISE,
|
||||||
"acceptedCountryCodes",
|
CLEAR_X_CHANGE,
|
||||||
"countryCode",
|
SWIFT,
|
||||||
"creationDate",
|
F2F,
|
||||||
"excludeFromJsonDataMap",
|
STRIKE;
|
||||||
"maxTradePeriod",
|
|
||||||
"paymentAccountPayload",
|
public static PaymentAccountForm.FormId fromProto(protobuf.PaymentAccountForm.FormId formId) {
|
||||||
"paymentMethod",
|
return ProtoUtil.enumFromProto(PaymentAccountForm.FormId.class, formId.name());
|
||||||
"paymentMethodId", // Will be included, but handled differently.
|
}
|
||||||
"persistedAccountName", // Automatically set in PaymentAccount.onPersistChanges().
|
|
||||||
"selectedTradeCurrency", // May be included, but handled differently.
|
public static protobuf.PaymentAccountForm.FormId toProtoMessage(PaymentAccountForm.FormId formId) {
|
||||||
"tradeCurrencies", // May be included, but handled differently.
|
return protobuf.PaymentAccountForm.FormId.valueOf(formId.name());
|
||||||
"HOLDER_NAME",
|
}
|
||||||
"SALT" // Will be included, but handled differently.
|
}
|
||||||
};
|
|
||||||
|
private final FormId id;
|
||||||
|
private final List<PaymentAccountFormField> fields;
|
||||||
|
|
||||||
|
public PaymentAccountForm(FormId id) {
|
||||||
|
this.id = id;
|
||||||
|
this.fields = new ArrayList<PaymentAccountFormField>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PaymentAccountForm(FormId id, List<PaymentAccountFormField> fields) {
|
||||||
|
this.id = id;
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public protobuf.PaymentAccountForm toProtoMessage() {
|
||||||
|
return protobuf.PaymentAccountForm.newBuilder()
|
||||||
|
.setId(PaymentAccountForm.FormId.toProtoMessage(id))
|
||||||
|
.addAllFields(fields.stream().map(field -> field.toProtoMessage()).collect(Collectors.toList()))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaymentAccountForm fromProto(protobuf.PaymentAccountForm proto) {
|
||||||
|
List<PaymentAccountFormField> fields = proto.getFieldsList().isEmpty() ? null : proto.getFieldsList().stream().map(PaymentAccountFormField::fromProto).collect(Collectors.toList());
|
||||||
|
return new PaymentAccountForm(FormId.fromProto(proto.getId()), fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a structured form for the given payment method.
|
||||||
|
*/
|
||||||
|
public static PaymentAccountForm getForm(String paymentMethodId) {
|
||||||
|
PaymentAccount paymentAccount = PaymentAccountFactory.getPaymentAccount(PaymentMethod.getPaymentMethod(paymentMethodId));
|
||||||
|
return paymentAccount.toForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert this form to a PaymentAccount json string.
|
||||||
|
*/
|
||||||
|
public String toPaymentAccountJsonString() {
|
||||||
|
Map<String, Object> formMap = new HashMap<String, Object>();
|
||||||
|
formMap.put("paymentMethodId", getId().toString());
|
||||||
|
for (PaymentAccountFormField field : getFields()) {
|
||||||
|
formMap.put(toCamelCase(field.getId().toString()), field.getValue());
|
||||||
|
}
|
||||||
|
return new Gson().toJson(formMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert this form to a PaymentAccount.
|
||||||
|
*/
|
||||||
|
public PaymentAccount toPaymentAccount() {
|
||||||
|
return toPaymentAccount(toPaymentAccountJsonString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize a PaymentAccount json string into a new PaymentAccount instance.
|
||||||
|
*
|
||||||
|
* @param paymentAccountJsonString The json data representing a new payment account form.
|
||||||
|
* @return A populated PaymentAccount subclass instance.
|
||||||
|
*/
|
||||||
|
public static PaymentAccount toPaymentAccount(String paymentAccountJsonString) {
|
||||||
|
Class<? extends PaymentAccount> clazz = getPaymentAccountClassFromJson(paymentAccountJsonString);
|
||||||
|
Gson gson = gsonBuilder.registerTypeAdapter(clazz, new PaymentAccountTypeAdapter(clazz)).create();
|
||||||
|
return gson.fromJson(paymentAccountJsonString, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------- OLD FORM API -----------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a blank payment account form (json) for the given paymentMethodId.
|
* Returns a blank payment account form (json) for the given paymentMethodId.
|
||||||
|
@ -148,14 +155,12 @@ public class PaymentAccountForm {
|
||||||
* @param paymentMethodId Determines what kind of json form to return.
|
* @param paymentMethodId Determines what kind of json form to return.
|
||||||
* @return A uniquely named tmp file used to define new payment account details.
|
* @return A uniquely named tmp file used to define new payment account details.
|
||||||
*/
|
*/
|
||||||
public File getPaymentAccountForm(String paymentMethodId) {
|
public static File getPaymentAccountForm(String paymentMethodId) {
|
||||||
PaymentMethod paymentMethod = getPaymentMethod(paymentMethodId);
|
PaymentMethod paymentMethod = getPaymentMethod(paymentMethodId);
|
||||||
File file = getTmpJsonFile(paymentMethodId);
|
File file = getTmpJsonFile(paymentMethodId);
|
||||||
try (OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(checkNotNull(file), false), UTF_8)) {
|
try (OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(checkNotNull(file), false), UTF_8)) {
|
||||||
PaymentAccount paymentAccount = PaymentAccountFactory.getPaymentAccount(paymentMethod);
|
PaymentAccount paymentAccount = PaymentAccountFactory.getPaymentAccount(paymentMethod);
|
||||||
Class<? extends PaymentAccount> clazz = paymentAccount.getClass();
|
String json = paymentAccount.toForm().toPaymentAccountJsonString();
|
||||||
Gson gson = gsonBuilder.registerTypeAdapter(clazz, new PaymentAccountTypeAdapter(clazz, excludedFields)).create();
|
|
||||||
String json = gson.toJson(paymentAccount); // serializes target to json
|
|
||||||
outputStreamWriter.write(json);
|
outputStreamWriter.write(json);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String errMsg = format("cannot create a payment account form for a %s payment method", paymentMethodId);
|
String errMsg = format("cannot create a payment account form for a %s payment method", paymentMethodId);
|
||||||
|
@ -173,24 +178,12 @@ public class PaymentAccountForm {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public PaymentAccount toPaymentAccount(File jsonForm) {
|
public static PaymentAccount toPaymentAccount(File jsonForm) {
|
||||||
String jsonString = toJsonString(jsonForm);
|
String jsonString = toJsonString(jsonForm);
|
||||||
return toPaymentAccount(jsonString);
|
return toPaymentAccount(jsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static String toJsonString(File jsonFile) {
|
||||||
* De-serialize a PaymentAccount json string into a new PaymentAccount instance.
|
|
||||||
*
|
|
||||||
* @param jsonString The json data representing a new payment account form.
|
|
||||||
* @return A populated PaymentAccount subclass instance.
|
|
||||||
*/
|
|
||||||
public PaymentAccount toPaymentAccount(String jsonString) {
|
|
||||||
Class<? extends PaymentAccount> clazz = getPaymentAccountClassFromJson(jsonString);
|
|
||||||
Gson gson = gsonBuilder.registerTypeAdapter(clazz, new PaymentAccountTypeAdapter(clazz)).create();
|
|
||||||
return gson.fromJson(jsonString, clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toJsonString(File jsonFile) {
|
|
||||||
try {
|
try {
|
||||||
checkNotNull(jsonFile, "json file cannot be null");
|
checkNotNull(jsonFile, "json file cannot be null");
|
||||||
return new String(Files.readAllBytes(Paths.get(jsonFile.getAbsolutePath())));
|
return new String(Files.readAllBytes(Paths.get(jsonFile.getAbsolutePath())));
|
||||||
|
@ -203,7 +196,7 @@ public class PaymentAccountForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public URI getClickableURI(File jsonFile) {
|
public static URI getClickableURI(File jsonFile) {
|
||||||
try {
|
try {
|
||||||
return new URI("file",
|
return new URI("file",
|
||||||
"",
|
"",
|
||||||
|
@ -237,14 +230,20 @@ public class PaymentAccountForm {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Class<? extends PaymentAccount> getPaymentAccountClassFromJson(String json) {
|
// -------------------------------- HELPERS -------------------------------
|
||||||
|
|
||||||
|
private static String toCamelCase(String underscore) {
|
||||||
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, underscore);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Class<? extends PaymentAccount> getPaymentAccountClassFromJson(String json) {
|
||||||
Map<String, Object> jsonMap = gsonBuilder.create().fromJson(json, (Type) Object.class);
|
Map<String, Object> jsonMap = gsonBuilder.create().fromJson(json, (Type) Object.class);
|
||||||
String paymentMethodId = checkNotNull((String) jsonMap.get("paymentMethodId"),
|
String paymentMethodId = checkNotNull((String) jsonMap.get("paymentMethodId"),
|
||||||
format("cannot not find a paymentMethodId in json string: %s", json));
|
format("cannot not find a paymentMethodId in json string: %s", json));
|
||||||
return getPaymentAccountClass(paymentMethodId);
|
return getPaymentAccountClass(paymentMethodId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Class<? extends PaymentAccount> getPaymentAccountClass(String paymentMethodId) {
|
private static Class<? extends PaymentAccount> getPaymentAccountClass(String paymentMethodId) {
|
||||||
PaymentMethod paymentMethod = getPaymentMethod(paymentMethodId);
|
PaymentMethod paymentMethod = getPaymentMethod(paymentMethodId);
|
||||||
return PaymentAccountFactory.getPaymentAccount(paymentMethod).getClass();
|
return PaymentAccountFactory.getPaymentAccount(paymentMethod).getClass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Haveno.
|
||||||
|
*
|
||||||
|
* Haveno is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package bisq.core.api.model;
|
||||||
|
|
||||||
|
import bisq.common.proto.ProtoUtil;
|
||||||
|
import bisq.common.proto.persistable.PersistablePayload;
|
||||||
|
import bisq.core.locale.Country;
|
||||||
|
import bisq.core.locale.TradeCurrency;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Immutable
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
|
public final class PaymentAccountFormField implements PersistablePayload {
|
||||||
|
|
||||||
|
public enum FieldId {
|
||||||
|
ACCEPTED_COUNTRY_CODES,
|
||||||
|
ACCOUNT_ID,
|
||||||
|
ACCOUNT_NAME,
|
||||||
|
ACCOUNT_NR,
|
||||||
|
ACCOUNT_OWNER,
|
||||||
|
ACCOUNT_TYPE,
|
||||||
|
ANSWER,
|
||||||
|
BANK_ACCOUNT_NAME,
|
||||||
|
BANK_ACCOUNT_NUMBER,
|
||||||
|
BANK_ACCOUNT_TYPE,
|
||||||
|
BANK_ADDRESS,
|
||||||
|
BANK_BRANCH,
|
||||||
|
BANK_BRANCH_CODE,
|
||||||
|
BANK_BRANCH_NAME,
|
||||||
|
BANK_CODE,
|
||||||
|
BANK_COUNTRY_CODE,
|
||||||
|
BANK_ID,
|
||||||
|
BANK_NAME,
|
||||||
|
BANK_SWIFT_CODE,
|
||||||
|
BENEFICIARY_ACCOUNT_NR,
|
||||||
|
BENEFICIARY_ADDRESS,
|
||||||
|
BENEFICIARY_CITY,
|
||||||
|
BENEFICIARY_NAME,
|
||||||
|
BENEFICIARY_PHONE,
|
||||||
|
BIC,
|
||||||
|
BRANCH_ID,
|
||||||
|
CITY,
|
||||||
|
CONTACT,
|
||||||
|
COUNTRY,
|
||||||
|
EMAIL,
|
||||||
|
EMAIL_OR_MOBILE_NR,
|
||||||
|
EXTRA_INFO,
|
||||||
|
HOLDER_ADDRESS,
|
||||||
|
HOLDER_EMAIL,
|
||||||
|
HOLDER_NAME,
|
||||||
|
HOLDER_TAX_ID,
|
||||||
|
IBAN,
|
||||||
|
IFSC,
|
||||||
|
INTERMEDIARY_ADDRESS,
|
||||||
|
INTERMEDIARY_BRANCH,
|
||||||
|
INTERMEDIARY_COUNTRY_CODE,
|
||||||
|
INTERMEDIARY_NAME,
|
||||||
|
INTERMEDIARY_SWIFT_CODE,
|
||||||
|
MOBILE_NR,
|
||||||
|
NATIONAL_ACCOUNT_ID,
|
||||||
|
PAYID,
|
||||||
|
PIX_KEY,
|
||||||
|
POSTAL_ADDRESS,
|
||||||
|
PROMPT_PAY_ID,
|
||||||
|
QUESTION,
|
||||||
|
REQUIREMENTS,
|
||||||
|
SALT,
|
||||||
|
SORT_CODE,
|
||||||
|
SPECIAL_INSTRUCTIONS,
|
||||||
|
STATE,
|
||||||
|
TRADE_CURRENCIES,
|
||||||
|
USER_NAME,
|
||||||
|
VIRTUAL_PAYMENT_ADDRESS;
|
||||||
|
|
||||||
|
public static PaymentAccountFormField.FieldId fromProto(protobuf.PaymentAccountFormField.FieldId fieldId) {
|
||||||
|
return ProtoUtil.enumFromProto(PaymentAccountFormField.FieldId.class, fieldId.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static protobuf.PaymentAccountFormField.FieldId toProtoMessage(PaymentAccountFormField.FieldId fieldId) {
|
||||||
|
return protobuf.PaymentAccountFormField.FieldId.valueOf(fieldId.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Component {
|
||||||
|
TEXT,
|
||||||
|
SELECT_ONE,
|
||||||
|
SELECT_MULTIPLE;
|
||||||
|
|
||||||
|
public static PaymentAccountFormField.Component fromProto(protobuf.PaymentAccountFormField.Component component) {
|
||||||
|
return ProtoUtil.enumFromProto(PaymentAccountFormField.Component.class, component.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static protobuf.PaymentAccountFormField.Component toProtoMessage(PaymentAccountFormField.Component component) {
|
||||||
|
return protobuf.PaymentAccountFormField.Component.valueOf(component.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FieldId id;
|
||||||
|
private Component component;
|
||||||
|
@Nullable
|
||||||
|
private String type;
|
||||||
|
private String label;
|
||||||
|
private String value;
|
||||||
|
private int minLength;
|
||||||
|
private int maxLength;
|
||||||
|
private List<TradeCurrency> supportedCurrencies;
|
||||||
|
private List<Country> supportedCountries;
|
||||||
|
private List<Country> supportedSepaEuroCountries;
|
||||||
|
private List<Country> supportedSepaNonEuroCountries;
|
||||||
|
|
||||||
|
public PaymentAccountFormField(FieldId id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public protobuf.PaymentAccountFormField toProtoMessage() {
|
||||||
|
protobuf.PaymentAccountFormField.Builder builder = protobuf.PaymentAccountFormField.newBuilder()
|
||||||
|
.setId(PaymentAccountFormField.FieldId.toProtoMessage(id))
|
||||||
|
.setComponent(PaymentAccountFormField.Component.toProtoMessage(component))
|
||||||
|
.setMinLength(minLength)
|
||||||
|
.setMaxLength(maxLength);
|
||||||
|
Optional.ofNullable(type).ifPresent(builder::setType);
|
||||||
|
Optional.ofNullable(label).ifPresent(builder::setLabel);
|
||||||
|
Optional.ofNullable(value).ifPresent(builder::setValue);
|
||||||
|
Optional.ofNullable(supportedCurrencies).ifPresent(e -> builder.addAllSupportedCurrencies(ProtoUtil.collectionToProto(supportedCurrencies, protobuf.TradeCurrency.class)));
|
||||||
|
Optional.ofNullable(supportedCountries).ifPresent(e -> builder.addAllSupportedCountries(ProtoUtil.collectionToProto(supportedCountries, protobuf.Country.class)));
|
||||||
|
Optional.ofNullable(supportedSepaEuroCountries).ifPresent(e -> builder.addAllSupportedSepaEuroCountries(ProtoUtil.collectionToProto(supportedSepaEuroCountries, protobuf.Country.class)));
|
||||||
|
Optional.ofNullable(supportedSepaNonEuroCountries).ifPresent(e -> builder.addAllSupportedSepaNonEuroCountries(ProtoUtil.collectionToProto(supportedSepaNonEuroCountries, protobuf.Country.class)));
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaymentAccountFormField fromProto(protobuf.PaymentAccountFormField proto) {
|
||||||
|
PaymentAccountFormField formField = new PaymentAccountFormField(FieldId.fromProto(proto.getId()));
|
||||||
|
formField.type = proto.getType();
|
||||||
|
formField.label = proto.getLabel();
|
||||||
|
formField.value = proto.getValue();
|
||||||
|
formField.minLength = proto.getMinLength();
|
||||||
|
formField.maxLength = proto.getMaxLength();
|
||||||
|
formField.supportedCountries = proto.getSupportedCountriesList().isEmpty() ? null : proto.getSupportedCountriesList().stream().map(Country::fromProto).collect(Collectors.toList());
|
||||||
|
formField.supportedSepaEuroCountries = proto.getSupportedSepaEuroCountriesList().isEmpty() ? null : proto.getSupportedSepaEuroCountriesList().stream().map(Country::fromProto).collect(Collectors.toList());
|
||||||
|
formField.supportedSepaNonEuroCountries = proto.getSupportedSepaNonEuroCountriesList().isEmpty() ? null : proto.getSupportedSepaNonEuroCountriesList().stream().map(Country::fromProto).collect(Collectors.toList());
|
||||||
|
return formField;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ package bisq.core.api.model;
|
||||||
|
|
||||||
|
|
||||||
import bisq.core.locale.Country;
|
import bisq.core.locale.Country;
|
||||||
|
import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
|
@ -39,7 +40,6 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
@ -59,10 +59,8 @@ import static bisq.core.payment.payload.PaymentMethod.MONEY_GRAM_ID;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static java.lang.String.format;
|
import static java.lang.String.format;
|
||||||
import static java.util.Arrays.stream;
|
import static java.util.Arrays.stream;
|
||||||
import static java.util.Collections.singletonList;
|
|
||||||
import static java.util.Collections.unmodifiableMap;
|
import static java.util.Collections.unmodifiableMap;
|
||||||
import static java.util.Comparator.comparing;
|
import static java.util.Comparator.comparing;
|
||||||
import static java.util.stream.Collectors.toList;
|
|
||||||
import static org.apache.commons.lang3.StringUtils.capitalize;
|
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -222,6 +220,10 @@ class PaymentAccountTypeAdapter extends TypeAdapter<PaymentAccount> {
|
||||||
if (didReadTradeCurrenciesField(in, account, currentFieldName))
|
if (didReadTradeCurrenciesField(in, account, currentFieldName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// The acceptedCountryCodes field has no setter.
|
||||||
|
if (didReadAcceptedCountryCodes(in, account, currentFieldName))
|
||||||
|
continue;
|
||||||
|
|
||||||
// The selectedTradeCurrency field is common to all payment account types,
|
// The selectedTradeCurrency field is common to all payment account types,
|
||||||
// but is @Nullable, and may not need to be explicitly defined by user.
|
// but is @Nullable, and may not need to be explicitly defined by user.
|
||||||
if (didReadSelectedTradeCurrencyField(in, account, currentFieldName))
|
if (didReadSelectedTradeCurrencyField(in, account, currentFieldName))
|
||||||
|
@ -339,15 +341,15 @@ class PaymentAccountTypeAdapter extends TypeAdapter<PaymentAccount> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Predicate<String> isCommaDelimitedCurrencyList = (s) -> s != null && s.contains(",");
|
private boolean didReadAcceptedCountryCodes(JsonReader in,
|
||||||
private final Function<String, List<String>> commaDelimitedCodesToList = (s) -> {
|
PaymentAccount account,
|
||||||
if (isCommaDelimitedCurrencyList.test(s))
|
String fieldName) {
|
||||||
return stream(s.split(",")).map(a -> a.trim().toUpperCase()).collect(toList());
|
if (!fieldName.equals("acceptedCountryCodes")) return false;
|
||||||
else if (s != null && !s.isEmpty())
|
String fieldValue = nextStringOrNull(in);
|
||||||
return singletonList(s.trim().toUpperCase());
|
List<String> countryCodes = PaymentAccount.commaDelimitedCodesToList.apply(fieldValue);
|
||||||
else
|
((CountryBasedPaymentAccount) account).setAcceptedCountries(CountryUtil.getCountries(countryCodes));
|
||||||
return new ArrayList<>();
|
return true;
|
||||||
};
|
}
|
||||||
|
|
||||||
private boolean didReadTradeCurrenciesField(JsonReader in,
|
private boolean didReadTradeCurrenciesField(JsonReader in,
|
||||||
PaymentAccount account,
|
PaymentAccount account,
|
||||||
|
@ -359,7 +361,7 @@ class PaymentAccountTypeAdapter extends TypeAdapter<PaymentAccount> {
|
||||||
// no setter, so we add currencies to the List here if the payment account
|
// no setter, so we add currencies to the List here if the payment account
|
||||||
// supports multiple trade currencies.
|
// supports multiple trade currencies.
|
||||||
String fieldValue = nextStringOrNull(in);
|
String fieldValue = nextStringOrNull(in);
|
||||||
List<String> currencyCodes = commaDelimitedCodesToList.apply(fieldValue);
|
List<String> currencyCodes = PaymentAccount.commaDelimitedCodesToList.apply(fieldValue);
|
||||||
Optional<List<TradeCurrency>> tradeCurrencies = getReconciledTradeCurrencies(currencyCodes, account);
|
Optional<List<TradeCurrency>> tradeCurrencies = getReconciledTradeCurrencies(currencyCodes, account);
|
||||||
if (tradeCurrencies.isPresent()) {
|
if (tradeCurrencies.isPresent()) {
|
||||||
for (TradeCurrency tradeCurrency : tradeCurrencies.get()) {
|
for (TradeCurrency tradeCurrency : tradeCurrencies.get()) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.google.common.collect.Collections2;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -35,6 +36,26 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CountryUtil {
|
public class CountryUtil {
|
||||||
|
|
||||||
|
public static List<String> getCountryCodes(List<Country> countries) {
|
||||||
|
return countries.stream().map(country -> country.code).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Country> getCountries(List<String> codes) {
|
||||||
|
List<Country> countries = new ArrayList<Country>();
|
||||||
|
for (String code : codes) {
|
||||||
|
Locale locale = new Locale(LanguageUtil.getDefaultLanguage(), code, "");
|
||||||
|
final String countryCode = locale.getCountry();
|
||||||
|
String regionCode = getRegionCode(countryCode);
|
||||||
|
final Region region = new Region(regionCode, getRegionName(regionCode));
|
||||||
|
Country country = new Country(countryCode, locale.getDisplayCountry(), region);
|
||||||
|
if (countryCode.equals("XK"))
|
||||||
|
country = new Country(countryCode, getNameByCode(countryCode), region);
|
||||||
|
countries.add(country);
|
||||||
|
}
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<Country> getAllSepaEuroCountries() {
|
public static List<Country> getAllSepaEuroCountries() {
|
||||||
List<Country> list = new ArrayList<>();
|
List<Country> list = new ArrayList<>();
|
||||||
String[] codes = {"AT", "BE", "CY", "DE", "EE", "FI", "FR", "GR", "IE",
|
String[] codes = {"AT", "BE", "CY", "DE", "EE", "FI", "FR", "GR", "IE",
|
||||||
|
@ -72,16 +93,7 @@ public class CountryUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void populateCountryListByCodes(List<Country> list, String[] codes) {
|
private static void populateCountryListByCodes(List<Country> list, String[] codes) {
|
||||||
for (String code : codes) {
|
list.addAll(getCountries(Arrays.asList(codes)));
|
||||||
Locale locale = new Locale(LanguageUtil.getDefaultLanguage(), code, "");
|
|
||||||
final String countryCode = locale.getCountry();
|
|
||||||
String regionCode = getRegionCode(countryCode);
|
|
||||||
final Region region = new Region(regionCode, getRegionName(regionCode));
|
|
||||||
Country country = new Country(countryCode, locale.getDisplayCountry(), region);
|
|
||||||
if (countryCode.equals("XK"))
|
|
||||||
country = new Country(countryCode, getNameByCode(countryCode), region);
|
|
||||||
list.add(country);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean containsAllSepaEuroCountries(List<String> countryCodesToCompare) {
|
public static boolean containsAllSepaEuroCountries(List<String> countryCodesToCompare) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.AchTransferAccountPayload;
|
import bisq.core.payment.payload.AchTransferAccountPayload;
|
||||||
|
@ -57,14 +58,17 @@ public final class AchTransferAccount extends CountryBasedPaymentAccount impleme
|
||||||
return (AchTransferAccountPayload) paymentAccountPayload;
|
return (AchTransferAccountPayload) paymentAccountPayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.achTransfer.info.buyer";
|
return "payment.achTransfer.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.achTransfer.info.seller";
|
return "payment.achTransfer.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.achTransfer.info.account";
|
return "payment.achTransfer.info.account";
|
||||||
}
|
}
|
||||||
|
@ -73,4 +77,9 @@ public final class AchTransferAccount extends CountryBasedPaymentAccount impleme
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.AdvancedCashAccountPayload;
|
import bisq.core.payment.payload.AdvancedCashAccountPayload;
|
||||||
|
@ -57,6 +58,12 @@ public final class AdvancedCashAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountNr(String accountNr) {
|
public void setAccountNr(String accountNr) {
|
||||||
((AdvancedCashAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
((AdvancedCashAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.AliPayAccountPayload;
|
import bisq.core.payment.payload.AliPayAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class AliPayAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountNr(String accountNr) {
|
public void setAccountNr(String accountNr) {
|
||||||
((AliPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
((AliPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.Country;
|
import bisq.core.locale.Country;
|
||||||
import bisq.core.locale.CountryUtil;
|
import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
|
@ -59,12 +60,16 @@ public final class AmazonGiftCardAccount extends PaymentAccount {
|
||||||
return new AmazonGiftCardAccountPayload(paymentMethod.getId(), id);
|
return new AmazonGiftCardAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public String getEmailOrMobileNr() {
|
public String getEmailOrMobileNr() {
|
||||||
return getAmazonGiftCardAccountPayload().getEmailOrMobileNr();
|
return getAmazonGiftCardAccountPayload().getEmailOrMobileNr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.AustraliaPayidAccountPayload;
|
import bisq.core.payment.payload.AustraliaPayidAccountPayload;
|
||||||
|
@ -46,6 +47,11 @@ public final class AustraliaPayidAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public String getPayid() {
|
public String getPayid() {
|
||||||
return ((AustraliaPayidAccountPayload) paymentAccountPayload).getPayid();
|
return ((AustraliaPayidAccountPayload) paymentAccountPayload).getPayid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.BizumAccountPayload;
|
import bisq.core.payment.payload.BizumAccountPayload;
|
||||||
|
@ -50,14 +51,17 @@ public final class BizumAccount extends CountryBasedPaymentAccount {
|
||||||
return ((BizumAccountPayload) paymentAccountPayload).getMobileNr();
|
return ((BizumAccountPayload) paymentAccountPayload).getMobileNr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.bizum.info.buyer";
|
return "payment.bizum.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.bizum.info.seller";
|
return "payment.bizum.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.bizum.info.account";
|
return "payment.bizum.info.account";
|
||||||
}
|
}
|
||||||
|
@ -66,4 +70,9 @@ public final class BizumAccount extends CountryBasedPaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.CapitualAccountPayload;
|
import bisq.core.payment.payload.CapitualAccountPayload;
|
||||||
|
@ -55,6 +56,12 @@ public final class CapitualAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountNr(String accountNr) {
|
public void setAccountNr(String accountNr) {
|
||||||
((CapitualAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
((CapitualAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.CashAppAccountPayload;
|
import bisq.core.payment.payload.CashAppAccountPayload;
|
||||||
|
@ -51,6 +52,11 @@ public final class CashAppAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setCashTag(String cashTag) {
|
public void setCashTag(String cashTag) {
|
||||||
((CashAppAccountPayload) paymentAccountPayload).setCashTag(cashTag);
|
((CashAppAccountPayload) paymentAccountPayload).setCashTag(cashTag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.CashByMailAccountPayload;
|
import bisq.core.payment.payload.CashByMailAccountPayload;
|
||||||
|
@ -45,6 +46,11 @@ public final class CashByMailAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setPostalAddress(String postalAddress) {
|
public void setPostalAddress(String postalAddress) {
|
||||||
((CashByMailAccountPayload) paymentAccountPayload).setPostalAddress(postalAddress);
|
((CashByMailAccountPayload) paymentAccountPayload).setPostalAddress(postalAddress);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.CashDepositAccountPayload;
|
import bisq.core.payment.payload.CashDepositAccountPayload;
|
||||||
|
@ -47,6 +48,11 @@ public final class CashDepositAccount extends CountryBasedPaymentAccount impleme
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBankId() {
|
public String getBankId() {
|
||||||
return ((CashDepositAccountPayload) paymentAccountPayload).getBankId();
|
return ((CashDepositAccountPayload) paymentAccountPayload).getBankId();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.CelPayAccountPayload;
|
import bisq.core.payment.payload.CelPayAccountPayload;
|
||||||
|
@ -58,21 +59,28 @@ public final class CelPayAccount extends PaymentAccount {
|
||||||
return ((CelPayAccountPayload) paymentAccountPayload).getEmail();
|
return ((CelPayAccountPayload) paymentAccountPayload).getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.celpay.info.buyer";
|
return "payment.celpay.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.celpay.info.seller";
|
return "payment.celpay.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.celpay.info.account";
|
return "payment.celpay.info.account";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.ChaseQuickPayAccountPayload;
|
import bisq.core.payment.payload.ChaseQuickPayAccountPayload;
|
||||||
|
@ -51,6 +52,11 @@ public final class ChaseQuickPayAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
((ChaseQuickPayAccountPayload) paymentAccountPayload).setEmail(email);
|
((ChaseQuickPayAccountPayload) paymentAccountPayload).setEmail(email);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.ClearXchangeAccountPayload;
|
import bisq.core.payment.payload.ClearXchangeAccountPayload;
|
||||||
|
@ -38,6 +39,13 @@ public final class ClearXchangeAccount extends PaymentAccount {
|
||||||
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.EMAIL_OR_MOBILE_NR,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PaymentAccountPayload createPayload() {
|
protected PaymentAccountPayload createPayload() {
|
||||||
return new ClearXchangeAccountPayload(paymentMethod.getId(), id);
|
return new ClearXchangeAccountPayload(paymentMethod.getId(), id);
|
||||||
|
@ -48,6 +56,11 @@ public final class ClearXchangeAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
public void setEmailOrMobileNr(String mobileNr) {
|
public void setEmailOrMobileNr(String mobileNr) {
|
||||||
((ClearXchangeAccountPayload) paymentAccountPayload).setEmailOrMobileNr(mobileNr);
|
((ClearXchangeAccountPayload) paymentAccountPayload).setEmailOrMobileNr(mobileNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ import bisq.core.locale.Country;
|
||||||
import bisq.core.locale.CountryUtil;
|
import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.payment.payload.CountryBasedPaymentAccountPayload;
|
import bisq.core.payment.payload.CountryBasedPaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
import java.util.List;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NonNull;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -32,6 +32,8 @@ import javax.annotation.Nullable;
|
||||||
public abstract class CountryBasedPaymentAccount extends PaymentAccount {
|
public abstract class CountryBasedPaymentAccount extends PaymentAccount {
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Country country;
|
protected Country country;
|
||||||
|
@Nullable
|
||||||
|
protected List<Country> acceptedCountries;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -61,4 +63,23 @@ public abstract class CountryBasedPaymentAccount extends PaymentAccount {
|
||||||
this.country = country;
|
this.country = country;
|
||||||
((CountryBasedPaymentAccountPayload) paymentAccountPayload).setCountryCode(country.code);
|
((CountryBasedPaymentAccountPayload) paymentAccountPayload).setCountryCode(country.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public List<Country> getAcceptedCountries() {
|
||||||
|
if (acceptedCountries == null) {
|
||||||
|
final List<String> acceptedCountryCodes = ((CountryBasedPaymentAccountPayload) paymentAccountPayload).getAcceptedCountryCodes();
|
||||||
|
acceptedCountries = CountryUtil.getCountries(acceptedCountryCodes);
|
||||||
|
}
|
||||||
|
return acceptedCountries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcceptedCountries(List<Country> acceptedCountries) {
|
||||||
|
this.acceptedCountries = acceptedCountries;
|
||||||
|
((CountryBasedPaymentAccountPayload) paymentAccountPayload).setAcceptedCountryCodes(CountryUtil.getCountryCodes(acceptedCountries));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public List<Country> getSupportedCountries() {
|
||||||
|
return null; // support all countries by default
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.CryptoCurrencyAccountPayload;
|
import bisq.core.payment.payload.CryptoCurrencyAccountPayload;
|
||||||
|
@ -47,4 +48,9 @@ public final class CryptoCurrencyAccount extends AssetAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.BankAccountPayload;
|
import bisq.core.payment.payload.BankAccountPayload;
|
||||||
|
@ -57,14 +58,17 @@ public final class DomesticWireTransferAccount extends CountryBasedPaymentAccoun
|
||||||
return (DomesticWireTransferAccountPayload) paymentAccountPayload;
|
return (DomesticWireTransferAccountPayload) paymentAccountPayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.domesticWire.info.buyer";
|
return "payment.domesticWire.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.domesticWire.info.seller";
|
return "payment.domesticWire.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.domesticWire.info.account";
|
return "payment.domesticWire.info.account";
|
||||||
}
|
}
|
||||||
|
@ -73,4 +77,9 @@ public final class DomesticWireTransferAccount extends CountryBasedPaymentAccoun
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.F2FAccountPayload;
|
import bisq.core.payment.payload.F2FAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
|
@ -33,6 +33,15 @@ public final class F2FAccount extends CountryBasedPaymentAccount {
|
||||||
|
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
|
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies();
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.COUNTRY,
|
||||||
|
PaymentAccountFormField.FieldId.CONTACT, // TODO: contact is not used anywhere?
|
||||||
|
PaymentAccountFormField.FieldId.CITY,
|
||||||
|
PaymentAccountFormField.FieldId.EXTRA_INFO,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
public F2FAccount() {
|
public F2FAccount() {
|
||||||
super(PaymentMethod.F2F);
|
super(PaymentMethod.F2F);
|
||||||
}
|
}
|
||||||
|
@ -47,6 +56,11 @@ public final class F2FAccount extends CountryBasedPaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
public void setContact(String contact) {
|
public void setContact(String contact) {
|
||||||
((F2FAccountPayload) paymentAccountPayload).setContact(contact);
|
((F2FAccountPayload) paymentAccountPayload).setContact(contact);
|
||||||
}
|
}
|
||||||
|
@ -70,4 +84,13 @@ public final class F2FAccount extends CountryBasedPaymentAccount {
|
||||||
public String getExtraInfo() {
|
public String getExtraInfo() {
|
||||||
return ((F2FAccountPayload) paymentAccountPayload).getExtraInfo();
|
return ((F2FAccountPayload) paymentAccountPayload).getExtraInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
|
||||||
|
var field = super.getEmptyFormField(fieldId);
|
||||||
|
if (field.getId() == PaymentAccountFormField.FieldId.CITY) field.setLabel(Res.get("payment.f2f.city"));
|
||||||
|
if (field.getId() == PaymentAccountFormField.FieldId.CONTACT) field.setLabel(Res.get("payment.f2f.contact"));
|
||||||
|
if (field.getId() == PaymentAccountFormField.FieldId.EXTRA_INFO) field.setLabel(Res.get("payment.shared.extraInfo.prompt"));
|
||||||
|
return field;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.FasterPaymentsAccountPayload;
|
import bisq.core.payment.payload.FasterPaymentsAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class FasterPaymentsAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setHolderName(String value) {
|
public void setHolderName(String value) {
|
||||||
((FasterPaymentsAccountPayload) paymentAccountPayload).setHolderName(value);
|
((FasterPaymentsAccountPayload) paymentAccountPayload).setHolderName(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.HalCashAccountPayload;
|
import bisq.core.payment.payload.HalCashAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class HalCashAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setMobileNr(String mobileNr) {
|
public void setMobileNr(String mobileNr) {
|
||||||
((HalCashAccountPayload) paymentAccountPayload).setMobileNr(mobileNr);
|
((HalCashAccountPayload) paymentAccountPayload).setMobileNr(mobileNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
@ -37,4 +38,9 @@ abstract public class IfscBasedAccount extends CountryBasedPaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.ImpsAccountPayload;
|
import bisq.core.payment.payload.ImpsAccountPayload;
|
||||||
|
@ -42,14 +43,17 @@ public final class ImpsAccount extends CountryBasedPaymentAccount {
|
||||||
return new ImpsAccountPayload(paymentMethod.getId(), id);
|
return new ImpsAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.imps.info.buyer";
|
return "payment.imps.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.imps.info.seller";
|
return "payment.imps.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.imps.info.account";
|
return "payment.imps.info.account";
|
||||||
}
|
}
|
||||||
|
@ -58,4 +62,9 @@ public final class ImpsAccount extends CountryBasedPaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.InstantCryptoCurrencyPayload;
|
import bisq.core.payment.payload.InstantCryptoCurrencyPayload;
|
||||||
|
@ -47,4 +48,9 @@ public final class InstantCryptoCurrencyAccount extends AssetAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.InteracETransferAccountPayload;
|
import bisq.core.payment.payload.InteracETransferAccountPayload;
|
||||||
|
@ -44,12 +45,16 @@ public final class InteracETransferAccount extends PaymentAccount {
|
||||||
return new InteracETransferAccountPayload(paymentMethod.getId(), id);
|
return new InteracETransferAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
((InteracETransferAccountPayload) paymentAccountPayload).setEmail(email);
|
((InteracETransferAccountPayload) paymentAccountPayload).setEmail(email);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.JapanBankAccountPayload;
|
import bisq.core.payment.payload.JapanBankAccountPayload;
|
||||||
|
@ -46,6 +47,11 @@ public final class JapanBankAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
// bank code
|
// bank code
|
||||||
public String getBankCode() {
|
public String getBankCode() {
|
||||||
return ((JapanBankAccountPayload) paymentAccountPayload).getBankCode();
|
return ((JapanBankAccountPayload) paymentAccountPayload).getBankCode();
|
||||||
|
|
|
@ -15,12 +15,11 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.components.paymentmethods.data;
|
package bisq.core.payment;
|
||||||
|
|
||||||
import bisq.desktop.util.GUIUtil;
|
|
||||||
|
|
||||||
|
import bisq.core.user.Preferences;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.inject.Inject;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -46,6 +45,14 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class JapanBankData {
|
public class JapanBankData {
|
||||||
|
|
||||||
|
private static String userLanguage;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
JapanBankData(Preferences preferences) {
|
||||||
|
userLanguage = preferences.getUserLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns the main list of ~500 banks in Japan with bank codes,
|
Returns the main list of ~500 banks in Japan with bank codes,
|
||||||
but since 90%+ of people will be using one of ~30 major banks,
|
but since 90%+ of people will be using one of ~30 major banks,
|
||||||
|
@ -785,7 +792,7 @@ public class JapanBankData {
|
||||||
// don't localize these strings into all languages,
|
// don't localize these strings into all languages,
|
||||||
// all we want is either Japanese or English here.
|
// all we want is either Japanese or English here.
|
||||||
public static String getString(String id) {
|
public static String getString(String id) {
|
||||||
boolean ja = GUIUtil.getUserLanguage().equals("ja");
|
boolean ja = userLanguage.equals("ja");
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case "bank":
|
case "bank":
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.MoneseAccountPayload;
|
import bisq.core.payment.payload.MoneseAccountPayload;
|
||||||
|
@ -63,14 +64,17 @@ public final class MoneseAccount extends PaymentAccount {
|
||||||
return ((MoneseAccountPayload) paymentAccountPayload).getMobileNr();
|
return ((MoneseAccountPayload) paymentAccountPayload).getMobileNr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.monese.info.buyer";
|
return "payment.monese.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.monese.info.seller";
|
return "payment.monese.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.monese.info.account";
|
return "payment.monese.info.account";
|
||||||
}
|
}
|
||||||
|
@ -79,4 +83,9 @@ public final class MoneseAccount extends PaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.MoneyBeamAccountPayload;
|
import bisq.core.payment.payload.MoneyBeamAccountPayload;
|
||||||
|
@ -49,6 +50,11 @@ public final class MoneyBeamAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountId(String accountId) {
|
public void setAccountId(String accountId) {
|
||||||
((MoneyBeamAccountPayload) paymentAccountPayload).setAccountId(accountId);
|
((MoneyBeamAccountPayload) paymentAccountPayload).setAccountId(accountId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.Country;
|
import bisq.core.locale.Country;
|
||||||
import bisq.core.locale.CountryUtil;
|
import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
|
@ -100,12 +101,16 @@ public final class MoneyGramAccount extends PaymentAccount {
|
||||||
return new MoneyGramAccountPayload(paymentMethod.getId(), id);
|
return new MoneyGramAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Country getCountry() {
|
public Country getCountry() {
|
||||||
if (country == null) {
|
if (country == null) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.BankAccountPayload;
|
import bisq.core.payment.payload.BankAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class NationalBankAccount extends CountryBasedPaymentAccount implem
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBankId() {
|
public String getBankId() {
|
||||||
return ((BankAccountPayload) paymentAccountPayload).getBankId();
|
return ((BankAccountPayload) paymentAccountPayload).getBankId();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.NequiAccountPayload;
|
import bisq.core.payment.payload.NequiAccountPayload;
|
||||||
|
@ -50,14 +51,17 @@ public final class NequiAccount extends CountryBasedPaymentAccount {
|
||||||
return ((NequiAccountPayload) paymentAccountPayload).getMobileNr();
|
return ((NequiAccountPayload) paymentAccountPayload).getMobileNr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.nequi.info.buyer";
|
return "payment.nequi.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.nequi.info.seller";
|
return "payment.nequi.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.nequi.info.account";
|
return "payment.nequi.info.account";
|
||||||
}
|
}
|
||||||
|
@ -66,4 +70,9 @@ public final class NequiAccount extends CountryBasedPaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.OKPayAccountPayload;
|
import bisq.core.payment.payload.OKPayAccountPayload;
|
||||||
|
@ -71,12 +72,16 @@ public final class OKPayAccount extends PaymentAccount {
|
||||||
return new OKPayAccountPayload(paymentMethod.getId(), id);
|
return new OKPayAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountNr(String accountNr) {
|
public void setAccountNr(String accountNr) {
|
||||||
((OKPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
((OKPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaxumAccountPayload;
|
import bisq.core.payment.payload.PaxumAccountPayload;
|
||||||
|
@ -63,12 +64,16 @@ public final class PaxumAccount extends PaymentAccount {
|
||||||
return new PaxumAccountPayload(paymentMethod.getId(), id);
|
return new PaxumAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEmail(String accountId) {
|
public void setEmail(String accountId) {
|
||||||
((PaxumAccountPayload) paymentAccountPayload).setEmail(accountId);
|
((PaxumAccountPayload) paymentAccountPayload).setEmail(accountId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,22 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
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.CurrencyUtil;
|
||||||
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
import bisq.core.payment.validation.BICValidator;
|
||||||
|
import bisq.core.payment.validation.EmailOrMobileNrValidator;
|
||||||
|
import bisq.core.payment.validation.EmailValidator;
|
||||||
|
import bisq.core.payment.validation.IBANValidator;
|
||||||
|
import bisq.core.payment.validation.LengthValidator;
|
||||||
import bisq.core.proto.CoreProtoResolver;
|
import bisq.core.proto.CoreProtoResolver;
|
||||||
|
import bisq.core.util.validation.InputValidator.ValidationResult;
|
||||||
import bisq.common.proto.ProtoUtil;
|
import bisq.common.proto.ProtoUtil;
|
||||||
import bisq.common.proto.persistable.PersistablePayload;
|
import bisq.common.proto.persistable.PersistablePayload;
|
||||||
import bisq.common.util.Utilities;
|
import bisq.common.util.Utilities;
|
||||||
|
@ -31,6 +42,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -44,6 +57,9 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static bisq.core.payment.payload.PaymentMethod.TRANSFERWISE_ID;
|
import static bisq.core.payment.payload.PaymentMethod.TRANSFERWISE_ID;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static java.util.Arrays.stream;
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
|
import static java.util.stream.Collectors.toList;
|
||||||
|
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
@ToString
|
@ToString
|
||||||
|
@ -265,4 +281,394 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public abstract List<TradeCurrency> getSupportedCurrencies();
|
public abstract List<TradeCurrency> getSupportedCurrencies();
|
||||||
|
|
||||||
|
// ------------------------- PAYMENT ACCOUNT FORM -------------------------
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public abstract List<PaymentAccountFormField.FieldId> getInputFieldIds();
|
||||||
|
|
||||||
|
public PaymentAccountForm toForm() {
|
||||||
|
PaymentAccountForm form = new PaymentAccountForm(PaymentAccountForm.FormId.valueOf(paymentMethod.getId()));
|
||||||
|
for (PaymentAccountFormField.FieldId fieldId : getInputFieldIds()) {
|
||||||
|
PaymentAccountFormField field = getEmptyFormField(fieldId);
|
||||||
|
form.getFields().add(field);
|
||||||
|
}
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validateFormField(PaymentAccountForm form, PaymentAccountFormField.FieldId fieldId, String value) {
|
||||||
|
switch (fieldId) {
|
||||||
|
case ACCEPTED_COUNTRY_CODES: {
|
||||||
|
List<String> countryCodes = PaymentAccount.commaDelimitedCodesToList.apply(value);
|
||||||
|
List<String> supportedCountryCodes = CountryUtil.getCountryCodes(((CountryBasedPaymentAccount) this).getSupportedCountries());
|
||||||
|
for (String countryCode : countryCodes) {
|
||||||
|
if (!supportedCountryCodes.contains(countryCode)) throw new IllegalArgumentException("Country is not supported by " + getPaymentMethod().getId() + ": " + value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ACCOUNT_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ACCOUNT_NAME:
|
||||||
|
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||||
|
break;
|
||||||
|
case ACCOUNT_NR:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ACCOUNT_OWNER:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ACCOUNT_TYPE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ANSWER:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ACCOUNT_NAME:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ACCOUNT_NUMBER:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ACCOUNT_TYPE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ADDRESS:
|
||||||
|
case INTERMEDIARY_ADDRESS:
|
||||||
|
processValidationResult(new LengthValidator(1, 100).validate(value));
|
||||||
|
break;
|
||||||
|
case BANK_BRANCH:
|
||||||
|
case INTERMEDIARY_BRANCH:
|
||||||
|
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||||
|
break;
|
||||||
|
case BANK_BRANCH_CODE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_BRANCH_NAME:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_CODE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_COUNTRY_CODE:
|
||||||
|
if (!CountryUtil.findCountryByCode(value).isPresent()) throw new IllegalArgumentException("Invalid country code: " + value);
|
||||||
|
break;
|
||||||
|
case BANK_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_NAME:
|
||||||
|
case INTERMEDIARY_NAME:
|
||||||
|
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||||
|
break;
|
||||||
|
case BANK_SWIFT_CODE:
|
||||||
|
case INTERMEDIARY_SWIFT_CODE:
|
||||||
|
processValidationResult(new LengthValidator(11, 11).validate(value));
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_ACCOUNT_NR:
|
||||||
|
processValidationResult(new LengthValidator(2, 40).validate(value));
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_ADDRESS:
|
||||||
|
processValidationResult(new LengthValidator(1, 100).validate(value));
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_CITY:
|
||||||
|
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_NAME:
|
||||||
|
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_PHONE:
|
||||||
|
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||||
|
break;
|
||||||
|
case BIC:
|
||||||
|
processValidationResult(new BICValidator().validate(value));
|
||||||
|
break;
|
||||||
|
case BRANCH_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case CITY:
|
||||||
|
processValidationResult(new LengthValidator(2, 34).validate(value));
|
||||||
|
break;
|
||||||
|
case CONTACT:
|
||||||
|
checkNotEmpty(value);
|
||||||
|
break;
|
||||||
|
case COUNTRY:
|
||||||
|
List<Country> supportedCountries = ((CountryBasedPaymentAccount) this).getSupportedCountries();
|
||||||
|
if (supportedCountries == null || supportedCountries.isEmpty()) {
|
||||||
|
if (!CountryUtil.findCountryByCode(value).isPresent()) throw new IllegalArgumentException("Invalid country code: " + value);
|
||||||
|
} else {
|
||||||
|
System.out.println("BUT WE SUPPORT THESE COUNTRIES!");
|
||||||
|
System.out.println(supportedCountries);
|
||||||
|
List<String> supportedCountryCodes = CountryUtil.getCountryCodes(supportedCountries);
|
||||||
|
if (!supportedCountryCodes.contains(value)) throw new IllegalArgumentException("Country is not supported by " + getPaymentMethod().getId() + ": " + value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EMAIL:
|
||||||
|
checkNotEmpty(value);
|
||||||
|
processValidationResult(new EmailValidator().validate(value));
|
||||||
|
break;
|
||||||
|
case EMAIL_OR_MOBILE_NR:
|
||||||
|
checkNotEmpty(value);
|
||||||
|
processValidationResult(new EmailOrMobileNrValidator().validate(value));
|
||||||
|
break;
|
||||||
|
case EXTRA_INFO:
|
||||||
|
break;
|
||||||
|
case HOLDER_ADDRESS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case HOLDER_EMAIL:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case HOLDER_NAME:
|
||||||
|
processValidationResult(new LengthValidator(2, 100).validate(value));
|
||||||
|
break;
|
||||||
|
case HOLDER_TAX_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case IBAN:
|
||||||
|
processValidationResult(new IBANValidator().validate(value));
|
||||||
|
break;
|
||||||
|
case IFSC:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case INTERMEDIARY_COUNTRY_CODE:
|
||||||
|
if (!CountryUtil.findCountryByCode(value).isPresent()) throw new IllegalArgumentException("Invalid country code: " + value); // TODO: value must be within supported countries unless all countries supported
|
||||||
|
break;
|
||||||
|
case MOBILE_NR:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case NATIONAL_ACCOUNT_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case PAYID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case PIX_KEY:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case POSTAL_ADDRESS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case PROMPT_PAY_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case QUESTION:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case REQUIREMENTS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case SALT:
|
||||||
|
if (!value.equals("")) throw new IllegalArgumentException("Salt must be empty");
|
||||||
|
break;
|
||||||
|
case SORT_CODE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case SPECIAL_INSTRUCTIONS:
|
||||||
|
break;
|
||||||
|
case STATE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case TRADE_CURRENCIES:
|
||||||
|
checkNotEmpty(value);
|
||||||
|
List<String> currencyCodes = commaDelimitedCodesToList.apply(value);
|
||||||
|
Optional<List<TradeCurrency>> tradeCurrencies = CurrencyUtil.getTradeCurrenciesInList(currencyCodes, getSupportedCurrencies());
|
||||||
|
if (!tradeCurrencies.isPresent()) throw new IllegalArgumentException("No trade currencies were found in the " + getPaymentMethod().getDisplayString() + " account form");
|
||||||
|
break;
|
||||||
|
case USER_NAME:
|
||||||
|
checkNotEmpty(value);
|
||||||
|
processValidationResult(new LengthValidator(3, 100).validate(value));
|
||||||
|
break;
|
||||||
|
case VIRTUAL_PAYMENT_ADDRESS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unhandled form field: " + fieldId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkNotEmpty(String input) {
|
||||||
|
if (input == null || "".equals(input)) throw new IllegalArgumentException("Field must not be empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void processValidationResult(ValidationResult result) {
|
||||||
|
if (!result.isValid) throw new IllegalArgumentException(result.errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
|
||||||
|
PaymentAccountFormField field = new PaymentAccountFormField(fieldId);
|
||||||
|
switch (fieldId) {
|
||||||
|
case ACCEPTED_COUNTRY_CODES:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE);
|
||||||
|
field.setLabel("Accepted country codes");
|
||||||
|
field.setSupportedCountries(((CountryBasedPaymentAccount) this).getSupportedCountries());
|
||||||
|
break;
|
||||||
|
case ACCOUNT_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ACCOUNT_NAME:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Account name"); // TODO: pull all labels from language file
|
||||||
|
field.setMinLength(3);
|
||||||
|
field.setMaxLength(100);
|
||||||
|
break;
|
||||||
|
case ACCOUNT_NR:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ACCOUNT_OWNER:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ACCOUNT_TYPE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case ANSWER:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ACCOUNT_NAME:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ACCOUNT_NUMBER:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ACCOUNT_TYPE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_ADDRESS:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Receiving Bank address");
|
||||||
|
break;
|
||||||
|
case BANK_BRANCH:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Receiving Bank branch");
|
||||||
|
break;
|
||||||
|
case BANK_BRANCH_CODE:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Receiving Bank SWIFT code"); // TODO: only used for swift?
|
||||||
|
break;
|
||||||
|
case BANK_BRANCH_NAME:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_CODE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_COUNTRY_CODE:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
|
||||||
|
field.setLabel("Country of bank");
|
||||||
|
break;
|
||||||
|
case BANK_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case BANK_NAME:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Receiving Bank name");
|
||||||
|
break;
|
||||||
|
case BANK_SWIFT_CODE:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Receiving Bank SWIFT Code");
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_ACCOUNT_NR:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Account No. (or IBAN)");
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_ADDRESS:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Beneficiary address");
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_CITY:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Beneficiary city");
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_NAME:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Account owner full name");
|
||||||
|
break;
|
||||||
|
case BENEFICIARY_PHONE:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Beneficiary phone number");
|
||||||
|
break;
|
||||||
|
case BIC:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("BIC");
|
||||||
|
break;
|
||||||
|
case BRANCH_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case CITY:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel(Res.get("Contact"));
|
||||||
|
case CONTACT:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("City");
|
||||||
|
case COUNTRY:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
|
||||||
|
field.setLabel("Country");
|
||||||
|
field.setSupportedCountries(((CountryBasedPaymentAccount) this).getSupportedCountries());
|
||||||
|
break;
|
||||||
|
case EMAIL:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setType("email");
|
||||||
|
field.setLabel("Email");
|
||||||
|
break;
|
||||||
|
case EMAIL_OR_MOBILE_NR:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Email or mobile number");
|
||||||
|
break;
|
||||||
|
case EXTRA_INFO:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Optional additional information");
|
||||||
|
break;
|
||||||
|
case HOLDER_ADDRESS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case HOLDER_EMAIL:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case HOLDER_NAME:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Account owner full name");
|
||||||
|
field.setMinLength(2);
|
||||||
|
field.setMaxLength(100);
|
||||||
|
break;
|
||||||
|
case HOLDER_TAX_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case IBAN:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("IBAN");
|
||||||
|
break;
|
||||||
|
case IFSC:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case INTERMEDIARY_ADDRESS:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Intermediary Bank address");
|
||||||
|
break;
|
||||||
|
case INTERMEDIARY_BRANCH:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Intermediary Bank branch");
|
||||||
|
break;
|
||||||
|
case INTERMEDIARY_COUNTRY_CODE:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
|
||||||
|
field.setLabel("Intermediary Bank country");
|
||||||
|
break;
|
||||||
|
case INTERMEDIARY_NAME:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Intermediary Bank name");
|
||||||
|
break;
|
||||||
|
case INTERMEDIARY_SWIFT_CODE:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Intermediary Bank SWIFT Code"); // TODO: swift only?
|
||||||
|
break;
|
||||||
|
case MOBILE_NR:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case NATIONAL_ACCOUNT_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case PAYID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case PIX_KEY:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case POSTAL_ADDRESS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case PROMPT_PAY_ID:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case QUESTION:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case REQUIREMENTS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case SALT:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Salt");
|
||||||
|
break;
|
||||||
|
case SORT_CODE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case SPECIAL_INSTRUCTIONS:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("Special instructions");
|
||||||
|
break;
|
||||||
|
case STATE:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
case TRADE_CURRENCIES:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE);
|
||||||
|
field.setLabel("Supported currencies");
|
||||||
|
field.setSupportedCurrencies(getSupportedCurrencies());
|
||||||
|
break;
|
||||||
|
case USER_NAME:
|
||||||
|
field.setComponent(PaymentAccountFormField.Component.TEXT);
|
||||||
|
field.setLabel("User name");
|
||||||
|
field.setMinLength(3);
|
||||||
|
field.setMaxLength(100);
|
||||||
|
break;
|
||||||
|
case VIRTUAL_PAYMENT_ADDRESS:
|
||||||
|
throw new IllegalArgumentException("Not implemented");
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unhandled form field: " + field);
|
||||||
|
}
|
||||||
|
if ("".equals(field.getValue())) field.setValue("");
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Predicate<String> isCommaDelimitedCurrencyList = (s) -> s != null && s.contains(",");
|
||||||
|
public static final Function<String, List<String>> commaDelimitedCodesToList = (s) -> {
|
||||||
|
if (isCommaDelimitedCurrencyList.test(s))
|
||||||
|
return stream(s.split(",")).map(a -> a.trim().toUpperCase()).collect(toList());
|
||||||
|
else if (s != null && !s.isEmpty())
|
||||||
|
return singletonList(s.trim().toUpperCase());
|
||||||
|
else
|
||||||
|
return new ArrayList<>();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -77,12 +78,16 @@ public final class PayseraAccount extends PaymentAccount {
|
||||||
return new PayseraAccountPayload(paymentMethod.getId(), id);
|
return new PayseraAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEmail(String accountId) {
|
public void setEmail(String accountId) {
|
||||||
((PayseraAccountPayload) paymentAccountPayload).setEmail(accountId);
|
((PayseraAccountPayload) paymentAccountPayload).setEmail(accountId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class PerfectMoneyAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountNr(String accountNr) {
|
public void setAccountNr(String accountNr) {
|
||||||
((PerfectMoneyAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
((PerfectMoneyAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -50,14 +51,17 @@ public final class PixAccount extends CountryBasedPaymentAccount {
|
||||||
return ((PixAccountPayload) paymentAccountPayload).getPixKey();
|
return ((PixAccountPayload) paymentAccountPayload).getPixKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.pix.info.buyer";
|
return "payment.pix.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.pix.info.seller";
|
return "payment.pix.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.pix.info.account";
|
return "payment.pix.info.account";
|
||||||
}
|
}
|
||||||
|
@ -66,4 +70,9 @@ public final class PixAccount extends CountryBasedPaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -49,6 +50,11 @@ public final class PopmoneyAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountId(String accountId) {
|
public void setAccountId(String accountId) {
|
||||||
((PopmoneyAccountPayload) paymentAccountPayload).setAccountId(accountId);
|
((PopmoneyAccountPayload) paymentAccountPayload).setAccountId(accountId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class PromptPayAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setPromptPayId(String promptPayId) {
|
public void setPromptPayId(String promptPayId) {
|
||||||
((PromptPayAccountPayload) paymentAccountPayload).setPromptPayId(promptPayId);
|
((PromptPayAccountPayload) paymentAccountPayload).setPromptPayId(promptPayId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,20 +17,27 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
import bisq.core.payment.payload.RevolutAccountPayload;
|
import bisq.core.payment.payload.RevolutAccountPayload;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public final class RevolutAccount extends PaymentAccount {
|
public final class RevolutAccount extends PaymentAccount {
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.USER_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.TRADE_CURRENCIES,
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
// https://www.revolut.com/help/getting-started/exchanging-currencies/what-fiat-currencies-are-supported-for-holding-and-exchange
|
// https://www.revolut.com/help/getting-started/exchanging-currencies/what-fiat-currencies-are-supported-for-holding-and-exchange
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(
|
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(
|
||||||
new FiatCurrency("AED"),
|
new FiatCurrency("AED"),
|
||||||
|
@ -108,8 +115,20 @@ public final class RevolutAccount extends PaymentAccount {
|
||||||
revolutAccountPayload().maybeApplyUserNameToAccountId();
|
revolutAccountPayload().maybeApplyUserNameToAccountId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.BankAccountPayload;
|
import bisq.core.payment.payload.BankAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class SameBankAccount extends CountryBasedPaymentAccount implements
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBankId() {
|
public String getBankId() {
|
||||||
return ((BankAccountPayload) paymentAccountPayload).getBankId();
|
return ((BankAccountPayload) paymentAccountPayload).getBankId();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -58,14 +59,17 @@ public final class SatispayAccount extends CountryBasedPaymentAccount {
|
||||||
return ((SatispayAccountPayload) paymentAccountPayload).getMobileNr();
|
return ((SatispayAccountPayload) paymentAccountPayload).getMobileNr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.satispay.info.buyer";
|
return "payment.satispay.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.satispay.info.seller";
|
return "payment.satispay.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.satispay.info.account";
|
return "payment.satispay.info.account";
|
||||||
}
|
}
|
||||||
|
@ -74,4 +78,9 @@ public final class SatispayAccount extends CountryBasedPaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,18 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
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.CountryUtil;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
import bisq.core.payment.payload.SepaAccountPayload;
|
import bisq.core.payment.payload.SepaAccountPayload;
|
||||||
|
import bisq.core.payment.validation.SepaIBANValidator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -33,6 +36,16 @@ import org.jetbrains.annotations.NotNull;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public final class SepaAccount extends CountryBasedPaymentAccount implements BankAccount {
|
public final class SepaAccount extends CountryBasedPaymentAccount implements BankAccount {
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.IBAN,
|
||||||
|
PaymentAccountFormField.FieldId.BIC,
|
||||||
|
PaymentAccountFormField.FieldId.COUNTRY,
|
||||||
|
PaymentAccountFormField.FieldId.ACCEPTED_COUNTRY_CODES,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new FiatCurrency("EUR"));
|
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new FiatCurrency("EUR"));
|
||||||
|
|
||||||
public SepaAccount() {
|
public SepaAccount() {
|
||||||
|
@ -79,6 +92,10 @@ public final class SepaAccount extends CountryBasedPaymentAccount implements Ban
|
||||||
return ((SepaAccountPayload) paymentAccountPayload).getAcceptedCountryCodes();
|
return ((SepaAccountPayload) paymentAccountPayload).getAcceptedCountryCodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAcceptedCountryCodes(List<String> acceptedCountryCodes) {
|
||||||
|
((SepaAccountPayload) paymentAccountPayload).setAcceptedCountryCodes(acceptedCountryCodes);
|
||||||
|
}
|
||||||
|
|
||||||
public void addAcceptedCountry(String countryCode) {
|
public void addAcceptedCountry(String countryCode) {
|
||||||
((SepaAccountPayload) paymentAccountPayload).addAcceptedCountry(countryCode);
|
((SepaAccountPayload) paymentAccountPayload).addAcceptedCountry(countryCode);
|
||||||
}
|
}
|
||||||
|
@ -99,9 +116,44 @@ public final class SepaAccount extends CountryBasedPaymentAccount implements Ban
|
||||||
((SepaAccountPayload) paymentAccountPayload).revertChanges();
|
((SepaAccountPayload) paymentAccountPayload).revertChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CountryUtil;
|
import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
|
@ -99,9 +100,13 @@ public final class SepaInstantAccount extends CountryBasedPaymentAccount impleme
|
||||||
((SepaInstantAccountPayload) paymentAccountPayload).revertChanges();
|
((SepaInstantAccountPayload) paymentAccountPayload).revertChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class SpecificBanksAccount extends CountryBasedPaymentAccount imple
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
// TODO change to List
|
// TODO change to List
|
||||||
public ArrayList<String> getAcceptedBanks() {
|
public ArrayList<String> getAcceptedBanks() {
|
||||||
return ((SpecificBanksAccountPayload) paymentAccountPayload).getAcceptedBanks();
|
return ((SpecificBanksAccountPayload) paymentAccountPayload).getAcceptedBanks();
|
||||||
|
|
|
@ -17,14 +17,16 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
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.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
import bisq.core.payment.payload.StrikeAccountPayload;
|
import bisq.core.payment.payload.StrikeAccountPayload;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -33,6 +35,14 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public final class StrikeAccount extends CountryBasedPaymentAccount {
|
public final class StrikeAccount extends CountryBasedPaymentAccount {
|
||||||
|
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new FiatCurrency("USD"));
|
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new FiatCurrency("USD"));
|
||||||
|
public static final List<Country> SUPPORTED_COUNTRIES = CountryUtil.getCountries(List.of("US"));
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.COUNTRY,
|
||||||
|
PaymentAccountFormField.FieldId.HOLDER_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
public StrikeAccount() {
|
public StrikeAccount() {
|
||||||
super(PaymentMethod.STRIKE);
|
super(PaymentMethod.STRIKE);
|
||||||
|
@ -53,21 +63,35 @@ public final class StrikeAccount extends CountryBasedPaymentAccount {
|
||||||
return ((StrikeAccountPayload) paymentAccountPayload).getHolderName();
|
return ((StrikeAccountPayload) paymentAccountPayload).getHolderName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.strike.info.buyer";
|
return "payment.strike.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.strike.info.seller";
|
return "payment.strike.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.strike.info.account";
|
return "payment.strike.info.account";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public @NotNull List<Country> getSupportedCountries() {
|
||||||
|
System.out.println("STIKE RETURNING SUPPORTED COUNTRIES: " + SUPPORTED_COUNTRIES);
|
||||||
|
return SUPPORTED_COUNTRIES;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
@ -36,6 +37,27 @@ public final class SwiftAccount extends PaymentAccount {
|
||||||
|
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = new ArrayList<>(getAllSortedFiatCurrencies(comparing(TradeCurrency::getCode)));
|
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = new ArrayList<>(getAllSortedFiatCurrencies(comparing(TradeCurrency::getCode)));
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.BANK_SWIFT_CODE,
|
||||||
|
PaymentAccountFormField.FieldId.BANK_COUNTRY_CODE,
|
||||||
|
PaymentAccountFormField.FieldId.BANK_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.BANK_BRANCH,
|
||||||
|
PaymentAccountFormField.FieldId.BANK_ADDRESS,
|
||||||
|
PaymentAccountFormField.FieldId.INTERMEDIARY_SWIFT_CODE,
|
||||||
|
PaymentAccountFormField.FieldId.INTERMEDIARY_COUNTRY_CODE,
|
||||||
|
PaymentAccountFormField.FieldId.INTERMEDIARY_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.INTERMEDIARY_BRANCH,
|
||||||
|
PaymentAccountFormField.FieldId.INTERMEDIARY_ADDRESS,
|
||||||
|
PaymentAccountFormField.FieldId.BENEFICIARY_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.BENEFICIARY_ACCOUNT_NR,
|
||||||
|
PaymentAccountFormField.FieldId.BENEFICIARY_ADDRESS,
|
||||||
|
PaymentAccountFormField.FieldId.BENEFICIARY_CITY,
|
||||||
|
PaymentAccountFormField.FieldId.BENEFICIARY_PHONE,
|
||||||
|
PaymentAccountFormField.FieldId.SPECIAL_INSTRUCTIONS,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
public SwiftAccount() {
|
public SwiftAccount() {
|
||||||
super(PaymentMethod.SWIFT);
|
super(PaymentMethod.SWIFT);
|
||||||
tradeCurrencies.addAll(SUPPORTED_CURRENCIES);
|
tradeCurrencies.addAll(SUPPORTED_CURRENCIES);
|
||||||
|
@ -50,14 +72,17 @@ public final class SwiftAccount extends PaymentAccount {
|
||||||
return ((SwiftAccountPayload) this.paymentAccountPayload);
|
return ((SwiftAccountPayload) this.paymentAccountPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.swift.info.buyer";
|
return "payment.swift.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.swift.info.seller";
|
return "payment.swift.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.swift.info.account";
|
return "payment.swift.info.account";
|
||||||
}
|
}
|
||||||
|
@ -66,4 +91,9 @@ public final class SwiftAccount extends PaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class SwishAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setMobileNr(String mobileNr) {
|
public void setMobileNr(String mobileNr) {
|
||||||
((SwishAccountPayload) paymentAccountPayload).setMobileNr(mobileNr);
|
((SwishAccountPayload) paymentAccountPayload).setMobileNr(mobileNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -53,21 +54,28 @@ public final class TikkieAccount extends CountryBasedPaymentAccount {
|
||||||
return ((TikkieAccountPayload) paymentAccountPayload).getIban();
|
return ((TikkieAccountPayload) paymentAccountPayload).getIban();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.tikkie.info.buyer";
|
return "payment.tikkie.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.tikkie.info.seller";
|
return "payment.tikkie.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.tikkie.info.account";
|
return "payment.tikkie.info.account";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -24,14 +25,20 @@ import bisq.core.payment.payload.PaymentMethod;
|
||||||
import bisq.core.payment.payload.TransferwiseAccountPayload;
|
import bisq.core.payment.payload.TransferwiseAccountPayload;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NonNull;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public final class TransferwiseAccount extends PaymentAccount {
|
public final class TransferwiseAccount extends PaymentAccount {
|
||||||
|
|
||||||
|
private static final List<PaymentAccountFormField.FieldId> INPUT_FIELD_IDS = List.of(
|
||||||
|
PaymentAccountFormField.FieldId.EMAIL,
|
||||||
|
PaymentAccountFormField.FieldId.TRADE_CURRENCIES,
|
||||||
|
PaymentAccountFormField.FieldId.ACCOUNT_NAME,
|
||||||
|
PaymentAccountFormField.FieldId.SALT
|
||||||
|
);
|
||||||
|
|
||||||
// https://github.com/bisq-network/proposals/issues/243
|
// https://github.com/bisq-network/proposals/issues/243
|
||||||
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(
|
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(
|
||||||
new FiatCurrency("AED"),
|
new FiatCurrency("AED"),
|
||||||
|
@ -87,9 +94,13 @@ public final class TransferwiseAccount extends PaymentAccount {
|
||||||
return new TransferwiseAccountPayload(paymentMethod.getId(), id);
|
return new TransferwiseAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
return INPUT_FIELD_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,4 +111,11 @@ public final class TransferwiseAccount extends PaymentAccount {
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return ((TransferwiseAccountPayload) paymentAccountPayload).getEmail();
|
return ((TransferwiseAccountPayload) paymentAccountPayload).getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PaymentAccountFormField getEmptyFormField(PaymentAccountFormField.FieldId fieldId) {
|
||||||
|
var field = super.getEmptyFormField(fieldId);
|
||||||
|
if (field.getId() == PaymentAccountFormField.FieldId.TRADE_CURRENCIES) field.setLabel("Currencies for receiving funds");
|
||||||
|
return field;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -69,21 +70,28 @@ public final class TransferwiseUsdAccount extends CountryBasedPaymentAccount {
|
||||||
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getBeneficiaryAddress();
|
return ((TransferwiseUsdAccountPayload) paymentAccountPayload).getBeneficiaryAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.transferwiseUsd.info.buyer";
|
return "payment.transferwiseUsd.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.transferwiseUsd.info.seller";
|
return "payment.transferwiseUsd.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.transferwiseUsd.info.account";
|
return "payment.transferwiseUsd.info.account";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class USPostalMoneyOrderAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setPostalAddress(String postalAddress) {
|
public void setPostalAddress(String postalAddress) {
|
||||||
((USPostalMoneyOrderAccountPayload) paymentAccountPayload).setPostalAddress(postalAddress);
|
((USPostalMoneyOrderAccountPayload) paymentAccountPayload).setPostalAddress(postalAddress);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -70,12 +71,16 @@ public final class UpholdAccount extends PaymentAccount {
|
||||||
return new UpholdAccountPayload(paymentMethod.getId(), id);
|
return new UpholdAccountPayload(paymentMethod.getId(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public List<TradeCurrency> getSupportedCurrencies() {
|
public @NotNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountId(String accountId) {
|
public void setAccountId(String accountId) {
|
||||||
((UpholdAccountPayload) paymentAccountPayload).setAccountId(accountId);
|
((UpholdAccountPayload) paymentAccountPayload).setAccountId(accountId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -51,6 +52,11 @@ public final class VenmoAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setVenmoUserName(String venmoUserName) {
|
public void setVenmoUserName(String venmoUserName) {
|
||||||
((VenmoAccountPayload) paymentAccountPayload).setVenmoUserName(venmoUserName);
|
((VenmoAccountPayload) paymentAccountPayload).setVenmoUserName(venmoUserName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -57,14 +58,17 @@ public final class VerseAccount extends PaymentAccount {
|
||||||
return ((VerseAccountPayload) paymentAccountPayload).getHolderName();
|
return ((VerseAccountPayload) paymentAccountPayload).getHolderName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForBuyer() {
|
public String getMessageForBuyer() {
|
||||||
return "payment.verse.info.buyer";
|
return "payment.verse.info.buyer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForSeller() {
|
public String getMessageForSeller() {
|
||||||
return "payment.verse.info.seller";
|
return "payment.verse.info.seller";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMessageForAccountCreation() {
|
public String getMessageForAccountCreation() {
|
||||||
return "payment.verse.info.account";
|
return "payment.verse.info.account";
|
||||||
}
|
}
|
||||||
|
@ -73,4 +77,9 @@ public final class VerseAccount extends PaymentAccount {
|
||||||
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.FiatCurrency;
|
import bisq.core.locale.FiatCurrency;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -48,6 +49,11 @@ public final class WeChatPayAccount extends PaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public void setAccountNr(String accountNr) {
|
public void setAccountNr(String accountNr) {
|
||||||
((WeChatPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
((WeChatPayAccountPayload) paymentAccountPayload).setAccountNr(accountNr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.payment;
|
package bisq.core.payment;
|
||||||
|
|
||||||
|
import bisq.core.api.model.PaymentAccountFormField;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||||
|
@ -45,6 +46,11 @@ public final class WesternUnionAccount extends CountryBasedPaymentAccount {
|
||||||
return SUPPORTED_CURRENCIES;
|
return SUPPORTED_CURRENCIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull List<PaymentAccountFormField.FieldId> getInputFieldIds() {
|
||||||
|
throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return ((WesternUnionAccountPayload) paymentAccountPayload).getEmail();
|
return ((WesternUnionAccountPayload) paymentAccountPayload).getEmail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,9 @@ package bisq.core.payment.payload;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -50,6 +51,7 @@ public final class AchTransferAccountPayload extends BankAccountPayload {
|
||||||
private AchTransferAccountPayload(String paymentMethodName,
|
private AchTransferAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String bankName,
|
String bankName,
|
||||||
String branchId,
|
String branchId,
|
||||||
|
@ -61,6 +63,7 @@ public final class AchTransferAccountPayload extends BankAccountPayload {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
bankName,
|
bankName,
|
||||||
branchId,
|
branchId,
|
||||||
|
@ -98,6 +101,7 @@ public final class AchTransferAccountPayload extends BankAccountPayload {
|
||||||
return new AchTransferAccountPayload(proto.getPaymentMethodId(),
|
return new AchTransferAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
bankAccountPayloadPB.getHolderName(),
|
bankAccountPayloadPB.getHolderName(),
|
||||||
bankAccountPayloadPB.getBankName().isEmpty() ? null : bankAccountPayloadPB.getBankName(),
|
bankAccountPayloadPB.getBankName().isEmpty() ? null : bankAccountPayloadPB.getBankName(),
|
||||||
bankAccountPayloadPB.getBranchId().isEmpty() ? null : bankAccountPayloadPB.getBranchId(),
|
bankAccountPayloadPB.getBranchId().isEmpty() ? null : bankAccountPayloadPB.getBranchId(),
|
||||||
|
|
|
@ -22,7 +22,7 @@ import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
|
||||||
protected BankAccountPayload(String paymentMethodName,
|
protected BankAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
@Nullable String bankName,
|
@Nullable String bankName,
|
||||||
@Nullable String branchId,
|
@Nullable String branchId,
|
||||||
|
@ -76,6 +77,7 @@ public abstract class BankAccountPayload extends CountryBasedPaymentAccountPaylo
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +48,14 @@ public final class BizumAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
private BizumAccountPayload(String paymentMethod,
|
private BizumAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String mobileNr,
|
String mobileNr,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public final class BizumAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
return new BizumAccountPayload(proto.getPaymentMethodId(),
|
return new BizumAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
paytmAccountPayloadPB.getMobileNr(),
|
paytmAccountPayloadPB.getMobileNr(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ public class CashDepositAccountPayload extends BankAccountPayload {
|
||||||
private CashDepositAccountPayload(String paymentMethodName,
|
private CashDepositAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
@Nullable String holderEmail,
|
@Nullable String holderEmail,
|
||||||
@Nullable String bankName,
|
@Nullable String bankName,
|
||||||
|
@ -73,6 +75,7 @@ public class CashDepositAccountPayload extends BankAccountPayload {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
bankName,
|
bankName,
|
||||||
branchId,
|
branchId,
|
||||||
|
@ -117,6 +120,7 @@ public class CashDepositAccountPayload extends BankAccountPayload {
|
||||||
return new CashDepositAccountPayload(proto.getPaymentMethodId(),
|
return new CashDepositAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
cashDepositAccountPayload.getHolderName(),
|
cashDepositAccountPayload.getHolderName(),
|
||||||
cashDepositAccountPayload.getHolderEmail().isEmpty() ? null : cashDepositAccountPayload.getHolderEmail(),
|
cashDepositAccountPayload.getHolderEmail().isEmpty() ? null : cashDepositAccountPayload.getHolderEmail(),
|
||||||
cashDepositAccountPayload.getBankName().isEmpty() ? null : cashDepositAccountPayload.getBankName(),
|
cashDepositAccountPayload.getBankName().isEmpty() ? null : cashDepositAccountPayload.getBankName(),
|
||||||
|
|
|
@ -20,7 +20,8 @@ package bisq.core.payment.payload;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -36,6 +37,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class CountryBasedPaymentAccountPayload extends PaymentAccountPayload {
|
public abstract class CountryBasedPaymentAccountPayload extends PaymentAccountPayload {
|
||||||
protected String countryCode = "";
|
protected String countryCode = "";
|
||||||
|
protected List<String> acceptedCountryCodes = new ArrayList<String>();
|
||||||
|
|
||||||
CountryBasedPaymentAccountPayload(String paymentMethodName, String id) {
|
CountryBasedPaymentAccountPayload(String paymentMethodName, String id) {
|
||||||
super(paymentMethodName, id);
|
super(paymentMethodName, id);
|
||||||
|
@ -44,6 +46,7 @@ public abstract class CountryBasedPaymentAccountPayload extends PaymentAccountPa
|
||||||
protected CountryBasedPaymentAccountPayload(String paymentMethodName,
|
protected CountryBasedPaymentAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
|
@ -52,18 +55,22 @@ public abstract class CountryBasedPaymentAccountPayload extends PaymentAccountPa
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
this.countryCode = countryCode;
|
this.countryCode = countryCode;
|
||||||
|
this.acceptedCountryCodes = acceptedCountryCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected protobuf.PaymentAccountPayload.Builder getPaymentAccountPayloadBuilder() {
|
protected protobuf.PaymentAccountPayload.Builder getPaymentAccountPayloadBuilder() {
|
||||||
protobuf.CountryBasedPaymentAccountPayload.Builder builder = protobuf.CountryBasedPaymentAccountPayload.newBuilder()
|
protobuf.CountryBasedPaymentAccountPayload.Builder builder = protobuf.CountryBasedPaymentAccountPayload.newBuilder()
|
||||||
.setCountryCode(countryCode);
|
.setCountryCode(countryCode)
|
||||||
|
.addAllAcceptedCountryCodes(acceptedCountryCodes);
|
||||||
return super.getPaymentAccountPayloadBuilder()
|
return super.getPaymentAccountPayloadBuilder()
|
||||||
.setCountryBasedPaymentAccountPayload(builder);
|
.setCountryBasedPaymentAccountPayload(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract String getPaymentDetails();
|
public abstract String getPaymentDetails();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract String getPaymentDetailsForTradePopup();
|
public abstract String getPaymentDetailsForTradePopup();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
package bisq.core.payment.payload;
|
package bisq.core.payment.payload;
|
||||||
|
|
||||||
import bisq.core.locale.BankUtil;
|
import bisq.core.locale.BankUtil;
|
||||||
|
import bisq.core.locale.Country;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -51,6 +53,7 @@ public final class DomesticWireTransferAccountPayload extends BankAccountPayload
|
||||||
private DomesticWireTransferAccountPayload(String paymentMethodName,
|
private DomesticWireTransferAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String bankName,
|
String bankName,
|
||||||
String branchId,
|
String branchId,
|
||||||
|
@ -61,6 +64,7 @@ public final class DomesticWireTransferAccountPayload extends BankAccountPayload
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
bankName,
|
bankName,
|
||||||
branchId,
|
branchId,
|
||||||
|
@ -98,6 +102,7 @@ public final class DomesticWireTransferAccountPayload extends BankAccountPayload
|
||||||
return new DomesticWireTransferAccountPayload(proto.getPaymentMethodId(),
|
return new DomesticWireTransferAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
bankAccountPayloadPB.getHolderName(),
|
bankAccountPayloadPB.getHolderName(),
|
||||||
bankAccountPayloadPB.getBankName().isEmpty() ? null : bankAccountPayloadPB.getBankName(),
|
bankAccountPayloadPB.getBankName().isEmpty() ? null : bankAccountPayloadPB.getBankName(),
|
||||||
bankAccountPayloadPB.getBranchId().isEmpty() ? null : bankAccountPayloadPB.getBranchId(),
|
bankAccountPayloadPB.getBranchId().isEmpty() ? null : bankAccountPayloadPB.getBranchId(),
|
||||||
|
|
|
@ -24,8 +24,9 @@ import com.google.protobuf.Message;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -56,6 +57,7 @@ public final class F2FAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
private F2FAccountPayload(String paymentMethodName,
|
private F2FAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String contact,
|
String contact,
|
||||||
String city,
|
String city,
|
||||||
String extraInfo,
|
String extraInfo,
|
||||||
|
@ -64,6 +66,7 @@ public final class F2FAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
this.contact = contact;
|
this.contact = contact;
|
||||||
|
@ -91,6 +94,7 @@ public final class F2FAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
return new F2FAccountPayload(proto.getPaymentMethodId(),
|
return new F2FAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
f2fAccountPayloadPB.getContact(),
|
f2fAccountPayloadPB.getContact(),
|
||||||
f2fAccountPayloadPB.getCity(),
|
f2fAccountPayloadPB.getCity(),
|
||||||
f2fAccountPayloadPB.getExtraInfo(),
|
f2fAccountPayloadPB.getExtraInfo(),
|
||||||
|
|
|
@ -6,7 +6,7 @@ import bisq.core.locale.CountryUtil;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ public abstract class IfscBasedAccountPayload extends CountryBasedPaymentAccount
|
||||||
protected IfscBasedAccountPayload(String paymentMethodName,
|
protected IfscBasedAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String accountNr,
|
String accountNr,
|
||||||
String ifsc,
|
String ifsc,
|
||||||
|
@ -45,6 +46,7 @@ public abstract class IfscBasedAccountPayload extends CountryBasedPaymentAccount
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -46,6 +47,7 @@ public final class ImpsAccountPayload extends IfscBasedAccountPayload {
|
||||||
private ImpsAccountPayload(String paymentMethod,
|
private ImpsAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String accountNr,
|
String accountNr,
|
||||||
String ifsc,
|
String ifsc,
|
||||||
|
@ -54,6 +56,7 @@ public final class ImpsAccountPayload extends IfscBasedAccountPayload {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
accountNr,
|
accountNr,
|
||||||
ifsc,
|
ifsc,
|
||||||
|
@ -83,6 +86,7 @@ public final class ImpsAccountPayload extends IfscBasedAccountPayload {
|
||||||
return new ImpsAccountPayload(proto.getPaymentMethodId(),
|
return new ImpsAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
ifscBasedAccountPayloadPB.getHolderName(),
|
ifscBasedAccountPayloadPB.getHolderName(),
|
||||||
ifscBasedAccountPayloadPB.getAccountNr(),
|
ifscBasedAccountPayloadPB.getAccountNr(),
|
||||||
ifscBasedAccountPayloadPB.getIfsc(),
|
ifscBasedAccountPayloadPB.getIfsc(),
|
||||||
|
|
|
@ -20,8 +20,9 @@ package bisq.core.payment.payload;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -45,6 +46,7 @@ public final class NationalBankAccountPayload extends BankAccountPayload {
|
||||||
private NationalBankAccountPayload(String paymentMethodName,
|
private NationalBankAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String bankName,
|
String bankName,
|
||||||
String branchId,
|
String branchId,
|
||||||
|
@ -58,6 +60,7 @@ public final class NationalBankAccountPayload extends BankAccountPayload {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
bankName,
|
bankName,
|
||||||
branchId,
|
branchId,
|
||||||
|
@ -92,6 +95,7 @@ public final class NationalBankAccountPayload extends BankAccountPayload {
|
||||||
return new NationalBankAccountPayload(proto.getPaymentMethodId(),
|
return new NationalBankAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
bankAccountPayloadPB.getHolderName(),
|
bankAccountPayloadPB.getHolderName(),
|
||||||
bankAccountPayloadPB.getBankName().isEmpty() ? null : bankAccountPayloadPB.getBankName(),
|
bankAccountPayloadPB.getBankName().isEmpty() ? null : bankAccountPayloadPB.getBankName(),
|
||||||
bankAccountPayloadPB.getBranchId().isEmpty() ? null : bankAccountPayloadPB.getBranchId(),
|
bankAccountPayloadPB.getBranchId().isEmpty() ? null : bankAccountPayloadPB.getBranchId(),
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -46,6 +47,7 @@ public final class NeftAccountPayload extends IfscBasedAccountPayload {
|
||||||
private NeftAccountPayload(String paymentMethod,
|
private NeftAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String accountNr,
|
String accountNr,
|
||||||
String ifsc,
|
String ifsc,
|
||||||
|
@ -54,6 +56,7 @@ public final class NeftAccountPayload extends IfscBasedAccountPayload {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
accountNr,
|
accountNr,
|
||||||
ifsc,
|
ifsc,
|
||||||
|
@ -83,6 +86,7 @@ public final class NeftAccountPayload extends IfscBasedAccountPayload {
|
||||||
return new NeftAccountPayload(proto.getPaymentMethodId(),
|
return new NeftAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
ifscBasedAccountPayloadPB.getHolderName(),
|
ifscBasedAccountPayloadPB.getHolderName(),
|
||||||
ifscBasedAccountPayloadPB.getAccountNr(),
|
ifscBasedAccountPayloadPB.getAccountNr(),
|
||||||
ifscBasedAccountPayloadPB.getIfsc(),
|
ifscBasedAccountPayloadPB.getIfsc(),
|
||||||
|
|
|
@ -17,13 +17,15 @@
|
||||||
|
|
||||||
package bisq.core.payment.payload;
|
package bisq.core.payment.payload;
|
||||||
|
|
||||||
|
import bisq.core.locale.Country;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +49,14 @@ public final class NequiAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
private NequiAccountPayload(String paymentMethod,
|
private NequiAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String mobileNr,
|
String mobileNr,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +81,7 @@ public final class NequiAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
return new NequiAccountPayload(proto.getPaymentMethodId(),
|
return new NequiAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
paytmAccountPayloadPB.getMobileNr(),
|
paytmAccountPayloadPB.getMobileNr(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -245,7 +245,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||||
// The limit and duration assignment must not be changed as that could break old offers (if amount would be higher
|
// The limit and duration assignment must not be changed as that could break old offers (if amount would be higher
|
||||||
// than new trade limit) and violate the maker expectation when he created the offer (duration).
|
// than new trade limit) and violate the maker expectation when he created the offer (duration).
|
||||||
@Getter
|
@Getter
|
||||||
private final static List<PaymentMethod> paymentMethods = new ArrayList<>(Arrays.asList(
|
public final static List<PaymentMethod> paymentMethods = new ArrayList<>(Arrays.asList(
|
||||||
// EUR
|
// EUR
|
||||||
HAL_CASH = new PaymentMethod(HAL_CASH_ID, DAY, DEFAULT_TRADE_LIMIT_LOW_RISK, getAssetCodes(HalCashAccount.SUPPORTED_CURRENCIES)),
|
HAL_CASH = new PaymentMethod(HAL_CASH_ID, DAY, DEFAULT_TRADE_LIMIT_LOW_RISK, getAssetCodes(HalCashAccount.SUPPORTED_CURRENCIES)),
|
||||||
SEPA = new PaymentMethod(SEPA_ID, 6 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(SepaAccount.SUPPORTED_CURRENCIES)),
|
SEPA = new PaymentMethod(SEPA_ID, 6 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK, getAssetCodes(SepaAccount.SUPPORTED_CURRENCIES)),
|
||||||
|
@ -325,6 +325,19 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||||
BLOCK_CHAINS_INSTANT = new PaymentMethod(BLOCK_CHAINS_INSTANT_ID, TimeUnit.HOURS.toMillis(1), DEFAULT_TRADE_LIMIT_VERY_LOW_RISK, Arrays.asList())
|
BLOCK_CHAINS_INSTANT = new PaymentMethod(BLOCK_CHAINS_INSTANT_ID, TimeUnit.HOURS.toMillis(1), DEFAULT_TRADE_LIMIT_VERY_LOW_RISK, Arrays.asList())
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// TODO: delete this override method, which overrides the paymentMethods variable, when all payment methods supported using structured form api, and make paymentMethods private
|
||||||
|
public static final List<PaymentMethod> getPaymentMethods() {
|
||||||
|
List<String> paymentMethodIds = List.of(
|
||||||
|
REVOLUT_ID,
|
||||||
|
SEPA_ID,
|
||||||
|
TRANSFERWISE_ID,
|
||||||
|
CLEAR_X_CHANGE_ID,
|
||||||
|
SWIFT_ID,
|
||||||
|
F2F_ID,
|
||||||
|
STRIKE_ID);
|
||||||
|
return paymentMethods.stream().filter(paymentMethod -> paymentMethodIds.contains(paymentMethod.getId())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
private static List<String> getAssetCodes(List<TradeCurrency> tradeCurrencies) {
|
private static List<String> getAssetCodes(List<TradeCurrency> tradeCurrencies) {
|
||||||
return tradeCurrencies.stream().map(TradeCurrency::getCode).collect(Collectors.toList());
|
return tradeCurrencies.stream().map(TradeCurrency::getCode).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +48,14 @@ public final class PaytmAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
private PaytmAccountPayload(String paymentMethod,
|
private PaytmAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String emailOrMobileNr,
|
String emailOrMobileNr,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public final class PaytmAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
return new PaytmAccountPayload(proto.getPaymentMethodId(),
|
return new PaytmAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
paytmAccountPayloadPB.getEmailOrMobileNr(),
|
paytmAccountPayloadPB.getEmailOrMobileNr(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +48,14 @@ public final class PixAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
private PixAccountPayload(String paymentMethod,
|
private PixAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String pixKey,
|
String pixKey,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public final class PixAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
return new PixAccountPayload(proto.getPaymentMethodId(),
|
return new PixAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
paytmAccountPayloadPB.getPixKey(),
|
paytmAccountPayloadPB.getPixKey(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -46,6 +47,7 @@ public final class RtgsAccountPayload extends IfscBasedAccountPayload {
|
||||||
private RtgsAccountPayload(String paymentMethod,
|
private RtgsAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String accountNr,
|
String accountNr,
|
||||||
String ifsc,
|
String ifsc,
|
||||||
|
@ -54,6 +56,7 @@ public final class RtgsAccountPayload extends IfscBasedAccountPayload {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
accountNr,
|
accountNr,
|
||||||
ifsc,
|
ifsc,
|
||||||
|
@ -83,6 +86,7 @@ public final class RtgsAccountPayload extends IfscBasedAccountPayload {
|
||||||
return new RtgsAccountPayload(proto.getPaymentMethodId(),
|
return new RtgsAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
ifscBasedAccountPayloadPB.getHolderName(),
|
ifscBasedAccountPayloadPB.getHolderName(),
|
||||||
ifscBasedAccountPayloadPB.getAccountNr(),
|
ifscBasedAccountPayloadPB.getAccountNr(),
|
||||||
ifscBasedAccountPayloadPB.getIfsc(),
|
ifscBasedAccountPayloadPB.getIfsc(),
|
||||||
|
|
|
@ -20,8 +20,9 @@ package bisq.core.payment.payload;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -45,6 +46,7 @@ public final class SameBankAccountPayload extends BankAccountPayload {
|
||||||
private SameBankAccountPayload(String paymentMethodName,
|
private SameBankAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String bankName,
|
String bankName,
|
||||||
String branchId,
|
String branchId,
|
||||||
|
@ -58,6 +60,7 @@ public final class SameBankAccountPayload extends BankAccountPayload {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
bankName,
|
bankName,
|
||||||
branchId,
|
branchId,
|
||||||
|
@ -92,6 +95,7 @@ public final class SameBankAccountPayload extends BankAccountPayload {
|
||||||
return new SameBankAccountPayload(proto.getPaymentMethodId(),
|
return new SameBankAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
bankAccountPayload.getHolderName(),
|
bankAccountPayload.getHolderName(),
|
||||||
bankAccountPayload.getBankName().isEmpty() ? null : bankAccountPayload.getBankName(),
|
bankAccountPayload.getBankName().isEmpty() ? null : bankAccountPayload.getBankName(),
|
||||||
bankAccountPayload.getBranchId().isEmpty() ? null : bankAccountPayload.getBranchId(),
|
bankAccountPayload.getBranchId().isEmpty() ? null : bankAccountPayload.getBranchId(),
|
||||||
|
|
|
@ -17,13 +17,15 @@
|
||||||
|
|
||||||
package bisq.core.payment.payload;
|
package bisq.core.payment.payload;
|
||||||
|
|
||||||
|
import bisq.core.locale.Country;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -48,6 +50,7 @@ public final class SatispayAccountPayload extends CountryBasedPaymentAccountPayl
|
||||||
private SatispayAccountPayload(String paymentMethod,
|
private SatispayAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String mobileNr,
|
String mobileNr,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
|
@ -55,6 +58,7 @@ public final class SatispayAccountPayload extends CountryBasedPaymentAccountPayl
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -81,6 +85,7 @@ public final class SatispayAccountPayload extends CountryBasedPaymentAccountPayl
|
||||||
return new SatispayAccountPayload(proto.getPaymentMethodId(),
|
return new SatispayAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
accountPayloadPB.getHolderName(),
|
accountPayloadPB.getHolderName(),
|
||||||
accountPayloadPB.getMobileNr(),
|
accountPayloadPB.getMobileNr(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
|
|
|
@ -53,7 +53,6 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
private String email = ""; // not used anymore but need to keep it for backward compatibility, must not be null but empty string, otherwise hash check fails for contract
|
private String email = ""; // not used anymore but need to keep it for backward compatibility, must not be null but empty string, otherwise hash check fails for contract
|
||||||
|
|
||||||
// Don't use a set here as we need a deterministic ordering, otherwise the contract hash does not match
|
// Don't use a set here as we need a deterministic ordering, otherwise the contract hash does not match
|
||||||
private final List<String> acceptedCountryCodes;
|
|
||||||
private final List<String> persistedAcceptedCountryCodes = new ArrayList<>();
|
private final List<String> persistedAcceptedCountryCodes = new ArrayList<>();
|
||||||
|
|
||||||
public SepaAccountPayload(String paymentMethod, String id, List<Country> acceptedCountries) {
|
public SepaAccountPayload(String paymentMethod, String id, List<Country> acceptedCountries) {
|
||||||
|
@ -73,16 +72,17 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
private SepaAccountPayload(String paymentMethodName,
|
private SepaAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String iban,
|
String iban,
|
||||||
String bic,
|
String bic,
|
||||||
String email,
|
String email,
|
||||||
List<String> acceptedCountryCodes,
|
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -101,8 +101,7 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
.setHolderName(holderName)
|
.setHolderName(holderName)
|
||||||
.setIban(iban)
|
.setIban(iban)
|
||||||
.setBic(bic)
|
.setBic(bic)
|
||||||
.setEmail(email)
|
.setEmail(email);
|
||||||
.addAllAcceptedCountryCodes(acceptedCountryCodes);
|
|
||||||
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
||||||
.getCountryBasedPaymentAccountPayloadBuilder()
|
.getCountryBasedPaymentAccountPayloadBuilder()
|
||||||
.setSepaAccountPayload(builder);
|
.setSepaAccountPayload(builder);
|
||||||
|
@ -117,11 +116,11 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
return new SepaAccountPayload(proto.getPaymentMethodId(),
|
return new SepaAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
sepaAccountPayloadPB.getHolderName(),
|
sepaAccountPayloadPB.getHolderName(),
|
||||||
sepaAccountPayloadPB.getIban(),
|
sepaAccountPayloadPB.getIban(),
|
||||||
sepaAccountPayloadPB.getBic(),
|
sepaAccountPayloadPB.getBic(),
|
||||||
sepaAccountPayloadPB.getEmail(),
|
sepaAccountPayloadPB.getEmail(),
|
||||||
new ArrayList<>(sepaAccountPayloadPB.getAcceptedCountryCodesList()),
|
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
}
|
}
|
||||||
|
@ -131,6 +130,12 @@ public final class SepaAccountPayload extends CountryBasedPaymentAccountPayload
|
||||||
// API
|
// API
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAcceptedCountryCodes(List<String> acceptedCountryCodes) {
|
||||||
|
this.acceptedCountryCodes.clear();
|
||||||
|
for (String countryCode : acceptedCountryCodes) this.acceptedCountryCodes.add(countryCode);
|
||||||
|
}
|
||||||
|
|
||||||
public void addAcceptedCountry(String countryCode) {
|
public void addAcceptedCountry(String countryCode) {
|
||||||
if (!acceptedCountryCodes.contains(countryCode))
|
if (!acceptedCountryCodes.contains(countryCode))
|
||||||
acceptedCountryCodes.add(countryCode);
|
acceptedCountryCodes.add(countryCode);
|
||||||
|
|
|
@ -52,7 +52,6 @@ public final class SepaInstantAccountPayload extends CountryBasedPaymentAccountP
|
||||||
private String bic = "";
|
private String bic = "";
|
||||||
|
|
||||||
// Don't use a set here as we need a deterministic ordering, otherwise the contract hash does not match
|
// Don't use a set here as we need a deterministic ordering, otherwise the contract hash does not match
|
||||||
private final List<String> acceptedCountryCodes;
|
|
||||||
private final List<String> persistedAcceptedCountryCodes = new ArrayList<>();
|
private final List<String> persistedAcceptedCountryCodes = new ArrayList<>();
|
||||||
|
|
||||||
public SepaInstantAccountPayload(String paymentMethod, String id, List<Country> acceptedCountries) {
|
public SepaInstantAccountPayload(String paymentMethod, String id, List<Country> acceptedCountries) {
|
||||||
|
@ -72,22 +71,22 @@ public final class SepaInstantAccountPayload extends CountryBasedPaymentAccountP
|
||||||
private SepaInstantAccountPayload(String paymentMethodName,
|
private SepaInstantAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String iban,
|
String iban,
|
||||||
String bic,
|
String bic,
|
||||||
List<String> acceptedCountryCodes,
|
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
this.holderName = holderName;
|
this.holderName = holderName;
|
||||||
this.iban = iban;
|
this.iban = iban;
|
||||||
this.bic = bic;
|
this.bic = bic;
|
||||||
this.acceptedCountryCodes = acceptedCountryCodes;
|
|
||||||
persistedAcceptedCountryCodes.addAll(acceptedCountryCodes);
|
persistedAcceptedCountryCodes.addAll(acceptedCountryCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +96,7 @@ public final class SepaInstantAccountPayload extends CountryBasedPaymentAccountP
|
||||||
protobuf.SepaInstantAccountPayload.newBuilder()
|
protobuf.SepaInstantAccountPayload.newBuilder()
|
||||||
.setHolderName(holderName)
|
.setHolderName(holderName)
|
||||||
.setIban(iban)
|
.setIban(iban)
|
||||||
.setBic(bic)
|
.setBic(bic);
|
||||||
.addAllAcceptedCountryCodes(acceptedCountryCodes);
|
|
||||||
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
final protobuf.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
||||||
.getCountryBasedPaymentAccountPayloadBuilder()
|
.getCountryBasedPaymentAccountPayloadBuilder()
|
||||||
.setSepaInstantAccountPayload(builder);
|
.setSepaInstantAccountPayload(builder);
|
||||||
|
@ -113,10 +111,10 @@ public final class SepaInstantAccountPayload extends CountryBasedPaymentAccountP
|
||||||
return new SepaInstantAccountPayload(proto.getPaymentMethodId(),
|
return new SepaInstantAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
sepaInstantAccountPayloadPB.getHolderName(),
|
sepaInstantAccountPayloadPB.getHolderName(),
|
||||||
sepaInstantAccountPayloadPB.getIban(),
|
sepaInstantAccountPayloadPB.getIban(),
|
||||||
sepaInstantAccountPayloadPB.getBic(),
|
sepaInstantAccountPayloadPB.getBic(),
|
||||||
new ArrayList<>(sepaInstantAccountPayloadPB.getAcceptedCountryCodesList()),
|
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -52,6 +53,7 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
|
||||||
private SpecificBanksAccountPayload(String paymentMethodName,
|
private SpecificBanksAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String bankName,
|
String bankName,
|
||||||
String branchId,
|
String branchId,
|
||||||
|
@ -66,6 +68,7 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
holderName,
|
holderName,
|
||||||
bankName,
|
bankName,
|
||||||
branchId,
|
branchId,
|
||||||
|
@ -106,6 +109,7 @@ public final class SpecificBanksAccountPayload extends BankAccountPayload {
|
||||||
return new SpecificBanksAccountPayload(proto.getPaymentMethodId(),
|
return new SpecificBanksAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
bankAccountPayload.getHolderName(),
|
bankAccountPayload.getHolderName(),
|
||||||
bankAccountPayload.getBankName().isEmpty() ? null : bankAccountPayload.getBankName(),
|
bankAccountPayload.getBankName().isEmpty() ? null : bankAccountPayload.getBankName(),
|
||||||
bankAccountPayload.getBranchId().isEmpty() ? null : bankAccountPayload.getBranchId(),
|
bankAccountPayload.getBranchId().isEmpty() ? null : bankAccountPayload.getBranchId(),
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +48,14 @@ public final class StrikeAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
private StrikeAccountPayload(String paymentMethod,
|
private StrikeAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public final class StrikeAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
return new StrikeAccountPayload(proto.getPaymentMethodId(),
|
return new StrikeAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
accountPayloadPB.getHolderName(),
|
accountPayloadPB.getHolderName(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +48,14 @@ public final class TikkieAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
private TikkieAccountPayload(String paymentMethod,
|
private TikkieAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String iban,
|
String iban,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public final class TikkieAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
return new TikkieAccountPayload(proto.getPaymentMethodId(),
|
return new TikkieAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
accountPayloadPB.getIban(),
|
accountPayloadPB.getIban(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -49,6 +50,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
private TransferwiseUsdAccountPayload(String paymentMethod,
|
private TransferwiseUsdAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String email,
|
String email,
|
||||||
String holderName,
|
String holderName,
|
||||||
String beneficiaryAddress,
|
String beneficiaryAddress,
|
||||||
|
@ -57,6 +59,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -85,6 +88,7 @@ public final class TransferwiseUsdAccountPayload extends CountryBasedPaymentAcco
|
||||||
return new TransferwiseUsdAccountPayload(proto.getPaymentMethodId(),
|
return new TransferwiseUsdAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
accountPayloadPB.getEmail(),
|
accountPayloadPB.getEmail(),
|
||||||
accountPayloadPB.getHolderName(),
|
accountPayloadPB.getHolderName(),
|
||||||
accountPayloadPB.getBeneficiaryAddress(),
|
accountPayloadPB.getBeneficiaryAddress(),
|
||||||
|
|
|
@ -22,8 +22,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -47,12 +48,14 @@ public final class UpiAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
private UpiAccountPayload(String paymentMethod,
|
private UpiAccountPayload(String paymentMethod,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String virtualPaymentAddress,
|
String virtualPaymentAddress,
|
||||||
long maxTradePeriod,
|
long maxTradePeriod,
|
||||||
Map<String, String> excludeFromJsonDataMap) {
|
Map<String, String> excludeFromJsonDataMap) {
|
||||||
super(paymentMethod,
|
super(paymentMethod,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public final class UpiAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||||
return new UpiAccountPayload(proto.getPaymentMethodId(),
|
return new UpiAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
upiAccountPayloadPB.getVirtualPaymentAddress(),
|
upiAccountPayloadPB.getVirtualPaymentAddress(),
|
||||||
proto.getMaxTradePeriod(),
|
proto.getMaxTradePeriod(),
|
||||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||||
|
|
|
@ -24,8 +24,9 @@ import bisq.core.locale.Res;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -57,6 +58,7 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
private WesternUnionAccountPayload(String paymentMethodName,
|
private WesternUnionAccountPayload(String paymentMethodName,
|
||||||
String id,
|
String id,
|
||||||
String countryCode,
|
String countryCode,
|
||||||
|
List<String> acceptedCountryCodes,
|
||||||
String holderName,
|
String holderName,
|
||||||
String city,
|
String city,
|
||||||
String state,
|
String state,
|
||||||
|
@ -66,6 +68,7 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
super(paymentMethodName,
|
super(paymentMethodName,
|
||||||
id,
|
id,
|
||||||
countryCode,
|
countryCode,
|
||||||
|
acceptedCountryCodes,
|
||||||
maxTradePeriod,
|
maxTradePeriod,
|
||||||
excludeFromJsonDataMap);
|
excludeFromJsonDataMap);
|
||||||
this.holderName = holderName;
|
this.holderName = holderName;
|
||||||
|
@ -97,6 +100,7 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
|
||||||
return new WesternUnionAccountPayload(proto.getPaymentMethodId(),
|
return new WesternUnionAccountPayload(proto.getPaymentMethodId(),
|
||||||
proto.getId(),
|
proto.getId(),
|
||||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||||
|
new ArrayList<>(countryBasedPaymentAccountPayload.getAcceptedCountryCodesList()),
|
||||||
westernUnionAccountPayload.getHolderName(),
|
westernUnionAccountPayload.getHolderName(),
|
||||||
westernUnionAccountPayload.getCity(),
|
westernUnionAccountPayload.getCity(),
|
||||||
westernUnionAccountPayload.getState(),
|
westernUnionAccountPayload.getState(),
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.locale.BankUtil;
|
import bisq.core.locale.BankUtil;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
|
@ -1,4 +1,4 @@
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
||||||
import bisq.core.util.validation.RegexValidator;
|
import bisq.core.util.validation.RegexValidator;
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
|
@ -15,7 +15,7 @@
|
||||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bisq.desktop.util.validation;
|
package bisq.core.payment.validation;
|
||||||
|
|
||||||
import bisq.core.locale.BankUtil;
|
import bisq.core.locale.BankUtil;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue