mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-01 19:26:09 -04: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
|
@ -18,11 +18,9 @@
|
|||
package bisq.desktop.components;
|
||||
|
||||
|
||||
import bisq.desktop.util.validation.JFXInputValidator;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.desktop.util.validation.JFXInputValidator;
|
||||
import com.jfoenix.controls.JFXTextField;
|
||||
|
||||
import javafx.scene.control.Skin;
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.AdvancedCashValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.AdvancedCashAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.AdvancedCashAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.AdvancedCashValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.util.validation.AliPayValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.AliPayAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.AliPayAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.AliPayValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.AustraliaPayidValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.AustraliaPayidAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.AustraliaPayidAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.AustraliaPayidValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.CapitualValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.CapitualAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.CapitualAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.CapitualValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Country;
|
||||
|
@ -33,6 +31,7 @@ import bisq.core.payment.CountryBasedPaymentAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.CashDepositAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.CelPayAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.CelPayAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.ChaseQuickPayValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.ChaseQuickPayAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.ChaseQuickPayAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.ChaseQuickPayValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.ClearXchangeValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.ClearXchangeAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.ClearXchangeAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.EmailOrMobileNrValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
@ -40,7 +39,7 @@ import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
|
|||
|
||||
public class ClearXchangeForm extends PaymentMethodForm {
|
||||
private final ClearXchangeAccount clearXchangeAccount;
|
||||
private final ClearXchangeValidator clearXchangeValidator;
|
||||
private final EmailOrMobileNrValidator clearXchangeValidator;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.owner"),
|
||||
|
@ -50,7 +49,7 @@ public class ClearXchangeForm extends PaymentMethodForm {
|
|||
return gridRow;
|
||||
}
|
||||
|
||||
public ClearXchangeForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, ClearXchangeValidator clearXchangeValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) {
|
||||
public ClearXchangeForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, EmailOrMobileNrValidator clearXchangeValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.clearXchangeAccount = (ClearXchangeAccount) paymentAccount;
|
||||
this.clearXchangeValidator = clearXchangeValidator;
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.F2FValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
|
@ -34,6 +32,7 @@ import bisq.core.payment.F2FAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.F2FAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.F2FValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.AccountNrValidator;
|
||||
import bisq.desktop.util.validation.BranchIdValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -29,6 +26,8 @@ import bisq.core.payment.FasterPaymentsAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.FasterPaymentsAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.AccountNrValidator;
|
||||
import bisq.core.payment.validation.BranchIdValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.validation.AccountNrValidator;
|
||||
import bisq.desktop.util.validation.BankIdValidator;
|
||||
import bisq.desktop.util.validation.BranchIdValidator;
|
||||
import bisq.desktop.util.validation.NationalAccountIdValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.BankAccountPayload;
|
||||
import bisq.core.payment.validation.AccountNrValidator;
|
||||
import bisq.core.payment.validation.BankIdValidator;
|
||||
import bisq.core.payment.validation.BranchIdValidator;
|
||||
import bisq.core.payment.validation.NationalAccountIdValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.HalCashValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.HalCashAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.HalCashAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.HalCashValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.InteracETransferValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.InteracETransferAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.InteracETransferAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.InteracETransferValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,20 +19,19 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.AutocompleteComboBox;
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.components.paymentmethods.data.JapanBankData;
|
||||
import bisq.desktop.util.validation.JapanBankAccountNameValidator;
|
||||
import bisq.desktop.util.validation.JapanBankAccountNumberValidator;
|
||||
import bisq.desktop.util.validation.JapanBankBranchCodeValidator;
|
||||
import bisq.desktop.util.validation.JapanBankBranchNameValidator;
|
||||
import bisq.desktop.util.validation.LengthValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.JapanBankAccount;
|
||||
import bisq.core.payment.JapanBankData;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.JapanBankAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.JapanBankAccountNameValidator;
|
||||
import bisq.core.payment.validation.JapanBankAccountNumberValidator;
|
||||
import bisq.core.payment.validation.JapanBankBranchCodeValidator;
|
||||
import bisq.core.payment.validation.JapanBankBranchNameValidator;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.MoneyBeamValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.MoneyBeamAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.MoneyBeamAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.MoneyBeamValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Country;
|
||||
|
@ -31,6 +29,7 @@ import bisq.core.payment.MoneyGramAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.MoneyGramAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
@ -171,7 +170,7 @@ public class MoneyGramForm extends PaymentMethodForm {
|
|||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(moneyGramAccountPayload.getHolderName());
|
||||
setAccountNameWithString(moneyGramAccountPayload.getHolderName() == null ? "" : moneyGramAccountPayload.getHolderName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaxumAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaxumAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.PayseraAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PayseraAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.util.validation.PerfectMoneyValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Res;
|
||||
|
@ -26,6 +24,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.PerfectMoneyAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PerfectMoneyAccountPayload;
|
||||
import bisq.core.payment.validation.PerfectMoneyValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.PopmoneyValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.PopmoneyAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PopmoneyAccountPayload;
|
||||
import bisq.core.payment.validation.PopmoneyValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.validation.PromptPayValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -27,6 +25,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.PromptPayAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PromptPayAccountPayload;
|
||||
import bisq.core.payment.validation.PromptPayValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -20,14 +20,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.RevolutValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.RevolutAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.RevolutAccountPayload;
|
||||
import bisq.core.payment.validation.RevolutValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -17,11 +17,8 @@
|
|||
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.normalization.IBANNormalizer;
|
||||
import bisq.desktop.util.validation.BICValidator;
|
||||
import bisq.desktop.util.validation.SepaIBANValidator;
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Country;
|
||||
|
@ -32,21 +29,20 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.SepaAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.SepaAccountPayload;
|
||||
import bisq.core.payment.validation.BICValidator;
|
||||
import bisq.core.payment.validation.SepaIBANValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.normalization.IBANNormalizer;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.TextFormatter;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
|
||||
public class SepaForm extends GeneralSepaForm {
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
|
|
|
@ -20,9 +20,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.normalization.IBANNormalizer;
|
||||
import bisq.desktop.util.validation.BICValidator;
|
||||
import bisq.desktop.util.validation.SepaIBANValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
|
@ -32,6 +29,8 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.SepaInstantAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.SepaInstantAccountPayload;
|
||||
import bisq.core.payment.validation.BICValidator;
|
||||
import bisq.core.payment.validation.SepaIBANValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@ import bisq.desktop.components.InputTextField;
|
|||
import bisq.desktop.main.overlays.windows.SwiftPaymentDetails;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.LengthValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
|
@ -33,6 +31,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.SwiftAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.SwiftAccountPayload;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.trade.Trade;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.SwishValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.SwishAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.SwishAccountPayload;
|
||||
import bisq.core.payment.validation.SwishValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.IBANValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.TikkieAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.TikkieAccountPayload;
|
||||
import bisq.core.payment.validation.IBANValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.TransferwiseValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.TransferwiseAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.TransferwiseAccountPayload;
|
||||
import bisq.core.payment.validation.TransferwiseValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
import bisq.desktop.util.validation.LengthValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
@ -29,6 +26,8 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.TransferwiseUsdAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.TransferwiseUsdAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.USPostalMoneyOrderValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -28,6 +26,7 @@ import bisq.core.payment.PaymentAccount;
|
|||
import bisq.core.payment.USPostalMoneyOrderAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.USPostalMoneyOrderAccountPayload;
|
||||
import bisq.core.payment.validation.USPostalMoneyOrderValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.components.paymentmethods;
|
|||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.validation.UpholdValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.UpholdAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.UpholdAccountPayload;
|
||||
import bisq.core.payment.validation.UpholdValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -17,14 +17,13 @@
|
|||
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.util.validation.WeChatPayValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.WeChatPayAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.WeChatPayAccountPayload;
|
||||
import bisq.core.payment.validation.WeChatPayValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ package bisq.desktop.components.paymentmethods;
|
|||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Country;
|
||||
|
@ -33,6 +31,7 @@ import bisq.core.payment.CountryBasedPaymentAccount;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.WesternUnionAccountPayload;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
|
|
|
@ -1,878 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.components.paymentmethods.data;
|
||||
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
Japan's National Banking Association assigns 4 digit codes to all
|
||||
Financial Institutions, so we use that as the primary "Bank ID",
|
||||
add the English names for the top ~30 major international banks,
|
||||
and remove local farmers agricultural cooperative associations
|
||||
to keep the list to a reasonable size. Please update annually.
|
||||
|
||||
Source: Zengin Net list of Financial Institutions
|
||||
Last Updated: July 16, 2019
|
||||
URL: https://www.zengin-net.jp/company/member/
|
||||
PDF: https://www.zengin-net.jp/company/pdf/member1.pdf
|
||||
PDF: https://www.zengin-net.jp/company/pdf/member2.pdf
|
||||
|
||||
Source: Bank of Japan list of Financial Institutions
|
||||
Last Updated: July 16, 2019
|
||||
URL: https://www5.boj.or.jp/bojnet/codenew/mokujinew.htm
|
||||
File: code1_20190716.xlsx
|
||||
Excel sheet: 金融機関等コード一覧
|
||||
*/
|
||||
|
||||
public class JapanBankData {
|
||||
/*
|
||||
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,
|
||||
we hard-code those at the top for easier pull-down selection,
|
||||
and add their English names in parenthesis for foreigners.
|
||||
*/
|
||||
public static List<String> prettyPrintBankList() // {{{
|
||||
{
|
||||
List<String> prettyList = new ArrayList<>();
|
||||
|
||||
// add mega banks at the top
|
||||
for (Map.Entry<String, String> bank : megaBanksEnglish.entrySet()) {
|
||||
String bankId = bank.getKey();
|
||||
String bankNameEn = bank.getValue();
|
||||
String bankNameJa = majorBanksJapanese.get(bankId);
|
||||
if (bankNameJa == null) bankNameJa = minorBanksJapanese.get(bankId);
|
||||
prettyList.add(prettyPrintMajorBank(bankId, bankNameJa, bankNameEn));
|
||||
}
|
||||
|
||||
// append the major banks next
|
||||
for (Map.Entry<String, String> bank : majorBanksJapanese.entrySet()) {
|
||||
String bankId = bank.getKey();
|
||||
String bankNameJa = bank.getValue();
|
||||
// avoid duplicates
|
||||
if (megaBanksEnglish.get(bankId) != null) continue;
|
||||
prettyList.add(prettyPrintBank(bankId, bankNameJa));
|
||||
}
|
||||
|
||||
// append the minor local banks last
|
||||
for (Map.Entry<String, String> bank : minorBanksJapanese.entrySet()) {
|
||||
String bankId = bank.getKey();
|
||||
String bankNameJa = bank.getValue();
|
||||
prettyList.add(prettyPrintBank(bankId, bankNameJa));
|
||||
}
|
||||
|
||||
return prettyList;
|
||||
} // }}}
|
||||
|
||||
// Pretty print major banks like this: (0001) みずほ (Mizuho Bank)
|
||||
private static String prettyPrintMajorBank(String bankId, String bankNameJa, String bankNameEn) // {{{
|
||||
{
|
||||
return ID_OPEN + bankId + ID_CLOSE + SPACE +
|
||||
JA_OPEN + bankNameJa + JA_CLOSE + SPACE +
|
||||
EN_OPEN + bankNameEn + EN_CLOSE;
|
||||
} // }}}
|
||||
|
||||
// Pretty print other banks like this: (9524) みずほ証券
|
||||
private static String prettyPrintBank(String bankId, String bankName) // {{{
|
||||
{
|
||||
return ID_OPEN + bankId + ID_CLOSE + SPACE +
|
||||
JA_OPEN + bankName + JA_CLOSE;
|
||||
} // }}}
|
||||
|
||||
// top 30 mega banks with english
|
||||
private static final Map<String, String> megaBanksEnglish = ImmutableMap.<String, String>builder()
|
||||
// {{{ japan post office
|
||||
.put("9900", "Japan Post Bank Yucho")
|
||||
// }}}
|
||||
// {{{ japan mega-banks
|
||||
.put("0001", "Mizuho Bank")
|
||||
.put("0005", "Mitsubishi UFJ Bank (MUFG)")
|
||||
.put("0009", "Sumitomo Mitsui Banking Corporation (SMBC)")
|
||||
.put("0010", "Resona Bank")
|
||||
// }}}
|
||||
// {{{ major online banks
|
||||
.put("0033", "Japan Net Bank")
|
||||
.put("0034", "Seven Bank (7-11)")
|
||||
.put("0035", "Sony Bank")
|
||||
.put("0036", "Rakuten Bank")
|
||||
.put("0038", "SBI Sumishin Net Bank")
|
||||
.put("0039", "Jibun Bank")
|
||||
.put("0040", "Aeon Bank")
|
||||
.put("0042", "Lawson Bank")
|
||||
// }}}
|
||||
// {{{ major trust banks, etc.
|
||||
.put("0150", "Suruga Bank")
|
||||
.put("0288", "Mitsubishi UFJ Trust Bank")
|
||||
.put("0289", "Mizuho Trust Bank")
|
||||
.put("0294", "Sumitomo Trust Bank")
|
||||
.put("0300", "SMBC Trust Bank (PRESTIA)")
|
||||
.put("0304", "Nomura Trust Bank")
|
||||
.put("0307", "Orix Trust Bank")
|
||||
.put("0310", "GMO Aozora Net Bank")
|
||||
.put("0321", "Japan Securities Trust Bank")
|
||||
.put("0397", "Shinsei Bank")
|
||||
.put("0398", "Aozora Bank")
|
||||
.put("0402", "JP Morgan Chase Bank")
|
||||
.put("0442", "BNY Mellon")
|
||||
.put("0458", "DBS Bank")
|
||||
.put("0472", "SBJ Shinhan Bank Japan")
|
||||
// }}}
|
||||
.build();
|
||||
|
||||
// major ~200 banks
|
||||
private static final Map<String, String> majorBanksJapanese = ImmutableMap.<String, String>builder()
|
||||
// {{{ ゆうちょ銀行 (9900)
|
||||
.put("9900", "ゆうちょ銀行")
|
||||
// }}}
|
||||
// {{{ 都市銀行 (0001 ~ 0029)
|
||||
.put("0001", "みずほ銀行")
|
||||
.put("0005", "三菱UFJ銀行")
|
||||
.put("0009", "三井住友銀行")
|
||||
.put("0010", "りそな銀行")
|
||||
.put("0017", "埼玉りそな銀行")
|
||||
// }}}
|
||||
// {{{ ネット専業銀行等 (0030 ~ 0049)
|
||||
.put("0033", "ジャパンネット銀行")
|
||||
.put("0034", "セブン銀行")
|
||||
.put("0035", "ソニー銀行")
|
||||
.put("0036", "楽天銀行")
|
||||
.put("0038", "住信SBIネット銀行")
|
||||
.put("0039", "じぶん銀行")
|
||||
.put("0040", "イオン銀行")
|
||||
.put("0041", "大和ネクスト銀行")
|
||||
.put("0042", "ローソン銀行")
|
||||
// }}}
|
||||
// {{{ 協会 (0050 ~ 0099)
|
||||
.put("0051", "全銀協")
|
||||
.put("0052", "横浜銀行協会")
|
||||
.put("0053", "釧路銀行協会")
|
||||
.put("0054", "札幌銀行協会")
|
||||
.put("0056", "函館銀行協会")
|
||||
.put("0057", "青森銀行協会")
|
||||
.put("0058", "秋田銀行協会")
|
||||
.put("0059", "宮城銀行協会")
|
||||
.put("0060", "福島銀行協会")
|
||||
.put("0061", "群馬銀行協会")
|
||||
.put("0062", "新潟銀行協会")
|
||||
.put("0063", "石川銀行協会")
|
||||
.put("0064", "山梨銀行協会")
|
||||
.put("0065", "長野銀行協会")
|
||||
.put("0066", "静岡銀行協会")
|
||||
.put("0067", "名古屋銀行協会")
|
||||
.put("0068", "京都銀行協会")
|
||||
.put("0069", "大阪銀行協会")
|
||||
.put("0070", "神戸銀行協会")
|
||||
.put("0071", "岡山銀行協会")
|
||||
.put("0072", "広島銀行協会")
|
||||
.put("0073", "島根銀行協会")
|
||||
.put("0074", "山口銀行協会")
|
||||
.put("0075", "香川銀行協会")
|
||||
.put("0076", "愛媛銀行協会")
|
||||
.put("0077", "高知銀行協会")
|
||||
.put("0078", "北九州銀行協会")
|
||||
.put("0079", "福岡銀行協会")
|
||||
.put("0080", "大分銀行協会")
|
||||
.put("0081", "長崎銀行協会")
|
||||
.put("0082", "熊本銀行協会")
|
||||
.put("0083", "鹿児島銀行協会")
|
||||
.put("0084", "沖縄銀行協会")
|
||||
.put("0090", "全銀ネット")
|
||||
.put("0095", "CLSBANK")
|
||||
// }}}
|
||||
// {{{ 地方銀行 (0116 ~ 0190)
|
||||
.put("0116", "北海道銀行")
|
||||
.put("0117", "青森銀行")
|
||||
.put("0118", "みちのく銀行")
|
||||
.put("0119", "秋田銀行")
|
||||
.put("0120", "北都銀行")
|
||||
.put("0121", "荘内銀行")
|
||||
.put("0122", "山形銀行")
|
||||
.put("0123", "岩手銀行")
|
||||
.put("0124", "東北銀行")
|
||||
.put("0125", "七十七銀行")
|
||||
.put("0126", "東邦銀行")
|
||||
.put("0128", "群馬銀行")
|
||||
.put("0129", "足利銀行")
|
||||
.put("0130", "常陽銀行")
|
||||
.put("0131", "筑波銀行")
|
||||
.put("0133", "武蔵野銀行")
|
||||
.put("0134", "千葉銀行")
|
||||
.put("0135", "千葉興業銀行")
|
||||
.put("0137", "きらぼし銀行")
|
||||
.put("0138", "横浜銀行")
|
||||
.put("0140", "第四銀行")
|
||||
.put("0141", "北越銀行")
|
||||
.put("0142", "山梨中央銀行")
|
||||
.put("0143", "八十二銀行")
|
||||
.put("0144", "北陸銀行")
|
||||
.put("0145", "富山銀行")
|
||||
.put("0146", "北國銀行")
|
||||
.put("0147", "福井銀行")
|
||||
.put("0149", "静岡銀行")
|
||||
.put("0150", "スルガ銀行")
|
||||
.put("0151", "清水銀行")
|
||||
.put("0152", "大垣共立銀行")
|
||||
.put("0153", "十六銀行")
|
||||
.put("0154", "三重銀行")
|
||||
.put("0155", "百五銀行")
|
||||
.put("0157", "滋賀銀行")
|
||||
.put("0158", "京都銀行")
|
||||
.put("0159", "関西みらい銀行")
|
||||
.put("0161", "池田泉州銀行")
|
||||
.put("0162", "南都銀行")
|
||||
.put("0163", "紀陽銀行")
|
||||
.put("0164", "但馬銀行")
|
||||
.put("0166", "鳥取銀行")
|
||||
.put("0167", "山陰合同銀行")
|
||||
.put("0168", "中国銀行")
|
||||
.put("0169", "広島銀行")
|
||||
.put("0170", "山口銀行")
|
||||
.put("0172", "阿波銀行")
|
||||
.put("0173", "百十四銀行")
|
||||
.put("0174", "伊予銀行")
|
||||
.put("0175", "四国銀行")
|
||||
.put("0177", "福岡銀行")
|
||||
.put("0178", "筑邦銀行")
|
||||
.put("0179", "佐賀銀行")
|
||||
.put("0180", "十八銀行")
|
||||
.put("0181", "親和銀行")
|
||||
.put("0182", "肥後銀行")
|
||||
.put("0183", "大分銀行")
|
||||
.put("0184", "宮崎銀行")
|
||||
.put("0185", "鹿児島銀行")
|
||||
.put("0187", "琉球銀行")
|
||||
.put("0188", "沖縄銀行")
|
||||
.put("0190", "西日本シティ銀行")
|
||||
.put("0191", "北九州銀行")
|
||||
// }}}
|
||||
// {{{ 信託銀行 (0288 ~ 0326)
|
||||
.put("0288", "三菱UFJ信託銀行")
|
||||
.put("0289", "みずほ信託銀行")
|
||||
.put("0294", "三井住友信託銀行")
|
||||
.put("0295", "BNYM信託")
|
||||
.put("0297", "日本マスタートラスト信託銀行")
|
||||
.put("0299", "ステート信託")
|
||||
.put("0300", "SMBC信託銀行 プレスティア")
|
||||
.put("0304", "野村信託銀行")
|
||||
.put("0307", "オリックス銀行")
|
||||
.put("0310", "GMOあおぞらネット銀行")
|
||||
.put("0311", "農中信託")
|
||||
.put("0320", "新生信託")
|
||||
.put("0321", "日証金信託")
|
||||
.put("0324", "日本トラスティサービス信託銀行")
|
||||
.put("0325", "資産管理サービス信託銀行")
|
||||
// }}}
|
||||
// {{{ 旧長期信用銀行 (0397 ~ 0398)
|
||||
.put("0397", "新生銀行")
|
||||
.put("0398", "あおぞら銀行")
|
||||
// }}}
|
||||
// {{{ foreign banks (0400 ~ 0497)
|
||||
.put("0401", "シティバンク、エヌ・エイ 銀行")
|
||||
.put("0402", "JPモルガン・チェース銀行")
|
||||
.put("0403", "アメリカ銀行")
|
||||
.put("0411", "香港上海銀行")
|
||||
.put("0413", "スタンチヤート")
|
||||
.put("0414", "バークレイズ")
|
||||
.put("0421", "アグリコル")
|
||||
.put("0423", "ハナ")
|
||||
.put("0424", "印度")
|
||||
.put("0425", "兆豐國際商銀")
|
||||
.put("0426", "バンコツク")
|
||||
.put("0429", "バンクネガラ")
|
||||
.put("0430", "ドイツ銀行")
|
||||
.put("0432", "ブラジル")
|
||||
.put("0438", "ユーオバシーズ")
|
||||
.put("0439", "ユービーエス")
|
||||
.put("0442", "BNYメロン")
|
||||
.put("0443", "ビー・エヌ・ピー・パリバ銀行")
|
||||
.put("0444", "チヤイニーズ")
|
||||
.put("0445", "ソシエテ")
|
||||
.put("0456", "ユバフ")
|
||||
.put("0458", "DBS")
|
||||
.put("0459", "パキスタン")
|
||||
.put("0460", "クレデイスイス")
|
||||
.put("0461", "コメルツ銀行")
|
||||
.put("0463", "ウニクレデイト")
|
||||
.put("0468", "インドステイト")
|
||||
.put("0471", "カナダロイヤル")
|
||||
.put("0472", "SBJ銀行")
|
||||
.put("0477", "ウリイ")
|
||||
.put("0482", "アイエヌジー")
|
||||
.put("0484", "ナツトオース")
|
||||
.put("0485", "アンズバンク")
|
||||
.put("0487", "コモンウエルス")
|
||||
.put("0489", "バンクチヤイナ")
|
||||
.put("0495", "ステストリート")
|
||||
.put("0498", "中小企業")
|
||||
// }}}
|
||||
// {{{ 第二地方銀行 (0501 ~ 0597)
|
||||
.put("0501", "北洋銀行")
|
||||
.put("0508", "きらやか銀行")
|
||||
.put("0509", "北日本銀行")
|
||||
.put("0512", "仙台銀行")
|
||||
.put("0513", "福島銀行")
|
||||
.put("0514", "大東銀行")
|
||||
.put("0516", "東和銀行")
|
||||
.put("0517", "栃木銀行")
|
||||
.put("0522", "京葉銀行")
|
||||
.put("0525", "東日本銀行")
|
||||
.put("0526", "東京スター銀行")
|
||||
.put("0530", "神奈川銀行")
|
||||
.put("0532", "大光銀行")
|
||||
.put("0533", "長野銀行")
|
||||
.put("0534", "富山第一銀行")
|
||||
.put("0537", "福邦銀行")
|
||||
.put("0538", "静岡中央銀行")
|
||||
.put("0542", "愛知銀行")
|
||||
.put("0543", "名古屋銀行")
|
||||
.put("0544", "中京銀行")
|
||||
.put("0546", "第三銀行")
|
||||
.put("0555", "大正銀行")
|
||||
.put("0562", "みなと銀行")
|
||||
.put("0565", "島根銀行")
|
||||
.put("0566", "トマト銀行")
|
||||
.put("0569", "もみじ銀行")
|
||||
.put("0570", "西京銀行")
|
||||
.put("0572", "徳島銀行")
|
||||
.put("0573", "香川銀行")
|
||||
.put("0576", "愛媛銀行")
|
||||
.put("0578", "高知銀行")
|
||||
.put("0582", "福岡中央銀行")
|
||||
.put("0583", "佐賀共栄銀行")
|
||||
.put("0585", "長崎銀行")
|
||||
.put("0587", "熊本銀行")
|
||||
.put("0590", "豊和銀行")
|
||||
.put("0591", "宮崎太陽銀行")
|
||||
.put("0594", "南日本銀行")
|
||||
.put("0596", "沖縄海邦銀行")
|
||||
// }}}
|
||||
// {{{ more foreign banks (0600 ~ 0999)
|
||||
.put("0603", "韓国産業")
|
||||
.put("0607", "彰化商業")
|
||||
.put("0608", "ウエルズフアゴ")
|
||||
.put("0611", "第一商業")
|
||||
.put("0612", "台湾")
|
||||
.put("0615", "交通")
|
||||
.put("0616", "メトロポリタン")
|
||||
.put("0617", "フイリピン")
|
||||
.put("0619", "中国工商")
|
||||
.put("0621", "中國信託商業")
|
||||
.put("0623", "インテーザ")
|
||||
.put("0624", "國民")
|
||||
.put("0625", "中国建設")
|
||||
.put("0626", "イタウウニ")
|
||||
.put("0627", "BBVA")
|
||||
.put("0630", "中国農業")
|
||||
.put("0631", "台新")
|
||||
.put("0632", "玉山")
|
||||
.put("0633", "台湾企銀")
|
||||
.put("0808", "ドイツ証券")
|
||||
.put("0813", "ソシエテ証券")
|
||||
.put("0821", "ビーピー証券")
|
||||
.put("0822", "バークレイ証券")
|
||||
.put("0831", "アグリコル証券")
|
||||
.put("0832", "ジエイピー証券")
|
||||
.put("0842", "ゴルドマン証券")
|
||||
.put("0845", "ナツトウエ証券")
|
||||
.put("0900", "日本相互証券")
|
||||
.put("0905", "東京金融取引所")
|
||||
.put("0909", "日本クリア機構")
|
||||
.put("0910", "ほふりクリア")
|
||||
.put("0964", "しんきん証券")
|
||||
.put("0966", "HSBC証券")
|
||||
.put("0968", "セント東短証券")
|
||||
.put("0971", "UBS証券")
|
||||
.put("0972", "メリル日本証券")
|
||||
// }}}
|
||||
.build();
|
||||
|
||||
// minor ~280 lesser known banks
|
||||
private static final Map<String, String> minorBanksJapanese = ImmutableMap.<String, String>builder()
|
||||
// {{{ 信用金庫 (1001 ~ 1996)
|
||||
.put("1000", "信金中央金庫")
|
||||
.put("1001", "北海道信金")
|
||||
.put("1003", "室蘭信金")
|
||||
.put("1004", "空知信金")
|
||||
.put("1006", "苫小牧信金")
|
||||
.put("1008", "北門信金")
|
||||
.put("1009", "伊達信金")
|
||||
.put("1010", "北空知信金")
|
||||
.put("1011", "日高信金")
|
||||
.put("1013", "渡島信金")
|
||||
.put("1014", "道南うみ街信金")
|
||||
.put("1020", "旭川信金")
|
||||
.put("1021", "稚内信金")
|
||||
.put("1022", "留萌信金")
|
||||
.put("1024", "北星信金")
|
||||
.put("1026", "帯広信金")
|
||||
.put("1027", "釧路信金")
|
||||
.put("1028", "大地みらい信金")
|
||||
.put("1030", "北見信金")
|
||||
.put("1031", "網走信金")
|
||||
.put("1033", "遠軽信金")
|
||||
.put("1104", "東奥信金")
|
||||
.put("1105", "青い森信金")
|
||||
.put("1120", "秋田信金")
|
||||
.put("1123", "羽後信金")
|
||||
.put("1140", "山形信金")
|
||||
.put("1141", "米沢信金")
|
||||
.put("1142", "鶴岡信金")
|
||||
.put("1143", "新庄信金")
|
||||
.put("1150", "盛岡信金")
|
||||
.put("1152", "宮古信金")
|
||||
.put("1153", "一関信金")
|
||||
.put("1154", "北上信金")
|
||||
.put("1155", "花巻信金")
|
||||
.put("1156", "水沢信金")
|
||||
.put("1170", "杜の都信金")
|
||||
.put("1171", "宮城第一信金")
|
||||
.put("1172", "石巻信金")
|
||||
.put("1174", "仙南信金")
|
||||
.put("1181", "会津信金")
|
||||
.put("1182", "郡山信金")
|
||||
.put("1184", "白河信金")
|
||||
.put("1185", "須賀川信金")
|
||||
.put("1186", "ひまわり信金")
|
||||
.put("1188", "あぶくま信金")
|
||||
.put("1189", "二本松信金")
|
||||
.put("1190", "福島信金")
|
||||
.put("1203", "高崎信金")
|
||||
.put("1204", "桐生信金")
|
||||
.put("1206", "アイオー信金")
|
||||
.put("1208", "利根郡信金")
|
||||
.put("1209", "館林信金")
|
||||
.put("1210", "北群馬信金")
|
||||
.put("1211", "しののめ信金")
|
||||
.put("1221", "足利小山信金")
|
||||
.put("1222", "栃木信金")
|
||||
.put("1223", "鹿沼相互信金")
|
||||
.put("1224", "佐野信金")
|
||||
.put("1225", "大田原信金")
|
||||
.put("1227", "烏山信金")
|
||||
.put("1240", "水戸信金")
|
||||
.put("1242", "結城信金")
|
||||
.put("1250", "埼玉県信金")
|
||||
.put("1251", "川口信金")
|
||||
.put("1252", "青木信金")
|
||||
.put("1253", "飯能信金")
|
||||
.put("1260", "千葉信金")
|
||||
.put("1261", "銚子信金")
|
||||
.put("1262", "東京ベイ信金")
|
||||
.put("1264", "館山信金")
|
||||
.put("1267", "佐原信金")
|
||||
.put("1280", "横浜信金")
|
||||
.put("1281", "かながわ信金")
|
||||
.put("1282", "湘南信金")
|
||||
.put("1283", "川崎信金")
|
||||
.put("1286", "平塚信金")
|
||||
.put("1288", "さがみ信金")
|
||||
.put("1289", "中栄信金")
|
||||
.put("1290", "中南信金")
|
||||
.put("1303", "朝日信金")
|
||||
.put("1305", "興産信金")
|
||||
.put("1310", "さわやか信金")
|
||||
.put("1311", "東京シテイ信金")
|
||||
.put("1319", "芝信金")
|
||||
.put("1320", "東京東信金")
|
||||
.put("1321", "東栄信金")
|
||||
.put("1323", "亀有信金")
|
||||
.put("1326", "小松川信金")
|
||||
.put("1327", "足立成和信金")
|
||||
.put("1333", "東京三協信金")
|
||||
.put("1336", "西京信金")
|
||||
.put("1341", "西武信金")
|
||||
.put("1344", "城南信金")
|
||||
.put("1345", "東京)昭和信金")
|
||||
.put("1346", "目黒信金")
|
||||
.put("1348", "世田谷信金")
|
||||
.put("1349", "東京信金")
|
||||
.put("1351", "城北信金")
|
||||
.put("1352", "滝野川信金")
|
||||
.put("1356", "巣鴨信金")
|
||||
.put("1358", "青梅信金")
|
||||
.put("1360", "多摩信金")
|
||||
.put("1370", "新潟信金")
|
||||
.put("1371", "長岡信金")
|
||||
.put("1373", "三条信金")
|
||||
.put("1374", "新発田信金")
|
||||
.put("1375", "柏崎信金")
|
||||
.put("1376", "上越信金")
|
||||
.put("1377", "新井信金")
|
||||
.put("1379", "村上信金")
|
||||
.put("1380", "加茂信金")
|
||||
.put("1385", "甲府信金")
|
||||
.put("1386", "山梨信金")
|
||||
.put("1390", "長野信金")
|
||||
.put("1391", "松本信金")
|
||||
.put("1392", "上田信金")
|
||||
.put("1393", "諏訪信金")
|
||||
.put("1394", "飯田信金")
|
||||
.put("1396", "アルプス信金")
|
||||
.put("1401", "富山信金")
|
||||
.put("1402", "高岡信金")
|
||||
.put("1405", "にいかわ信金")
|
||||
.put("1406", "氷見伏木信金")
|
||||
.put("1412", "砺波信金")
|
||||
.put("1413", "石動信金")
|
||||
.put("1440", "金沢信金")
|
||||
.put("1442", "のと共栄信金")
|
||||
.put("1444", "北陸信金")
|
||||
.put("1445", "鶴来信金")
|
||||
.put("1448", "興能信金")
|
||||
.put("1470", "福井信金")
|
||||
.put("1471", "敦賀信金")
|
||||
.put("1473", "小浜信金")
|
||||
.put("1475", "越前信金")
|
||||
.put("1501", "しず焼津信金")
|
||||
.put("1502", "静清信金")
|
||||
.put("1503", "浜松磐田信金")
|
||||
.put("1505", "沼津信金")
|
||||
.put("1506", "三島信金")
|
||||
.put("1507", "富士宮信金")
|
||||
.put("1513", "島田掛川信金")
|
||||
.put("1515", "静岡)富士信金")
|
||||
.put("1517", "遠州信金")
|
||||
.put("1530", "岐阜信金")
|
||||
.put("1531", "大垣西濃信金")
|
||||
.put("1532", "高山信金")
|
||||
.put("1533", "東濃信金")
|
||||
.put("1534", "関信金")
|
||||
.put("1538", "八幡信金")
|
||||
.put("1550", "愛知信金")
|
||||
.put("1551", "豊橋信金")
|
||||
.put("1552", "岡崎信金")
|
||||
.put("1553", "いちい信金")
|
||||
.put("1554", "瀬戸信金")
|
||||
.put("1555", "半田信金")
|
||||
.put("1556", "知多信金")
|
||||
.put("1557", "豊川信金")
|
||||
.put("1559", "豊田信金")
|
||||
.put("1560", "碧海信金")
|
||||
.put("1561", "西尾信金")
|
||||
.put("1562", "蒲郡信金")
|
||||
.put("1563", "尾西信金")
|
||||
.put("1565", "中日信金")
|
||||
.put("1566", "東春信金")
|
||||
.put("1580", "津信金")
|
||||
.put("1581", "北伊勢上野信金")
|
||||
.put("1583", "桑名三重信金")
|
||||
.put("1585", "紀北信金")
|
||||
.put("1602", "滋賀中央信金")
|
||||
.put("1603", "長浜信金")
|
||||
.put("1604", "湖東信金")
|
||||
.put("1610", "京都信金")
|
||||
.put("1611", "京都中央信金")
|
||||
.put("1620", "京都北都信金")
|
||||
.put("1630", "大阪信金")
|
||||
.put("1633", "大阪厚生信金")
|
||||
.put("1635", "大阪シテイ信金")
|
||||
.put("1636", "大阪商工信金")
|
||||
.put("1643", "永和信金")
|
||||
.put("1645", "北おおさか信金")
|
||||
.put("1656", "枚方信金")
|
||||
.put("1666", "奈良信金")
|
||||
.put("1667", "大和信金")
|
||||
.put("1668", "奈良中央信金")
|
||||
.put("1671", "新宮信金")
|
||||
.put("1674", "きのくに信金")
|
||||
.put("1680", "神戸信金")
|
||||
.put("1685", "姫路信金")
|
||||
.put("1686", "播州信金")
|
||||
.put("1687", "兵庫信金")
|
||||
.put("1688", "尼崎信金")
|
||||
.put("1689", "日新信金")
|
||||
.put("1691", "淡路信金")
|
||||
.put("1692", "但馬信金")
|
||||
.put("1694", "西兵庫信金")
|
||||
.put("1695", "中兵庫信金")
|
||||
.put("1696", "但陽信金")
|
||||
.put("1701", "鳥取信金")
|
||||
.put("1702", "米子信金")
|
||||
.put("1703", "倉吉信金")
|
||||
.put("1710", "しまね信金")
|
||||
.put("1711", "日本海信金")
|
||||
.put("1712", "島根中央信金")
|
||||
.put("1732", "おかやま信金")
|
||||
.put("1734", "水島信金")
|
||||
.put("1735", "津山信金")
|
||||
.put("1738", "玉島信金")
|
||||
.put("1740", "備北信金")
|
||||
.put("1741", "吉備信金")
|
||||
.put("1742", "日生信金")
|
||||
.put("1743", "備前信金")
|
||||
.put("1750", "広島信金")
|
||||
.put("1752", "呉信金")
|
||||
.put("1756", "しまなみ信金")
|
||||
.put("1758", "広島みどり信金")
|
||||
.put("1780", "萩山口信金")
|
||||
.put("1781", "西中国信金")
|
||||
.put("1789", "東山口信金")
|
||||
.put("1801", "徳島信金")
|
||||
.put("1803", "阿南信金")
|
||||
.put("1830", "高松信金")
|
||||
.put("1833", "観音寺信金")
|
||||
.put("1860", "愛媛信金")
|
||||
.put("1862", "宇和島信金")
|
||||
.put("1864", "東予信金")
|
||||
.put("1866", "川之江信金")
|
||||
.put("1880", "幡多信金")
|
||||
.put("1881", "高知信金")
|
||||
.put("1901", "福岡信金")
|
||||
.put("1903", "福岡ひびき信金")
|
||||
.put("1908", "大牟田柳川信金")
|
||||
.put("1909", "筑後信金")
|
||||
.put("1910", "飯塚信金")
|
||||
.put("1917", "大川信金")
|
||||
.put("1920", "遠賀信金")
|
||||
.put("1930", "唐津信金")
|
||||
.put("1931", "佐賀信金")
|
||||
.put("1933", "九州ひぜん信金")
|
||||
.put("1942", "たちばな信金")
|
||||
.put("1951", "熊本信金")
|
||||
.put("1952", "熊本第一信金")
|
||||
.put("1954", "熊本中央信金")
|
||||
.put("1960", "大分信金")
|
||||
.put("1962", "大分みらい信金")
|
||||
.put("1980", "宮崎都城信金")
|
||||
.put("1985", "高鍋信金")
|
||||
.put("1990", "鹿児島信金")
|
||||
.put("1991", "鹿児島相互信金")
|
||||
.put("1993", "奄美大島信金")
|
||||
.put("1996", "コザ信金")
|
||||
// }}}
|
||||
// {{{ 信用組合 (2011 ~ 2895)
|
||||
.put("2004", "商工組合中央金庫")
|
||||
.put("2010", "全国信用協同組合連合会")
|
||||
.put("2213", "整理回収機構")
|
||||
// }}}
|
||||
// {{{ 労働金庫 (2951 ~ 2997)
|
||||
.put("2950", "労働金庫連合会")
|
||||
// }}}
|
||||
// {{{ 農林中央金庫 (3000)
|
||||
.put("3000", "農林中央金庫")
|
||||
// }}}
|
||||
// {{{ 信用農業協同組合連合会 (3001 ~ 3046)
|
||||
.put("3001", "北海道信用農業協同組合連合会")
|
||||
.put("3003", "岩手県信用農業協同組合連合会")
|
||||
.put("3008", "茨城県信用農業協同組合連合会")
|
||||
.put("3011", "埼玉県信用農業協同組合連合会")
|
||||
.put("3013", "東京都信用農業協同組合連合会")
|
||||
.put("3014", "神奈川県信用農業協同組合連合会")
|
||||
.put("3015", "山梨県信用農業協同組合連合会")
|
||||
.put("3016", "長野県信用農業協同組合連合会")
|
||||
.put("3017", "新潟県信用農業協同組合連合会")
|
||||
.put("3019", "石川県信用農業協同組合連合会")
|
||||
.put("3020", "岐阜県信用農業協同組合連合会")
|
||||
.put("3021", "静岡県信用農業協同組合連合会")
|
||||
.put("3022", "愛知県信用農業協同組合連合会")
|
||||
.put("3023", "三重県信用農業協同組合連合会")
|
||||
.put("3024", "福井県信用農業協同組合連合会")
|
||||
.put("3025", "滋賀県信用農業協同組合連合会")
|
||||
.put("3026", "京都府信用農業協同組合連合会")
|
||||
.put("3027", "大阪府信用農業協同組合連合会")
|
||||
.put("3028", "兵庫県信用農業協同組合連合会")
|
||||
.put("3030", "和歌山県信用農業協同組合連合会")
|
||||
.put("3031", "鳥取県信用農業協同組合連合会")
|
||||
.put("3034", "広島県信用農業協同組合連合会")
|
||||
.put("3035", "山口県信用農業協同組合連合会")
|
||||
.put("3036", "徳島県信用農業協同組合連合会")
|
||||
.put("3037", "香川県信用農業協同組合連合会")
|
||||
.put("3038", "愛媛県信用農業協同組合連合会")
|
||||
.put("3039", "高知県信用農業協同組合連合会")
|
||||
.put("3040", "福岡県信用農業協同組合連合会")
|
||||
.put("3041", "佐賀県信用農業協同組合連合会")
|
||||
.put("3044", "大分県信用農業協同組合連合会")
|
||||
.put("3045", "宮崎県信用農業協同組合連合会")
|
||||
.put("3046", "鹿児島県信用農業協同組合連合会")
|
||||
// }}}
|
||||
// {{{ "JA Bank" agricultural cooperative associations (3056 ~ 9375)
|
||||
// REMOVED: the farmers should use a real bank if they want to sell bitcoin
|
||||
// }}}
|
||||
// {{{ 信用漁業協同組合連合会 (9450 ~ 9496)
|
||||
.put("9450", "北海道信用漁業協同組合連合会")
|
||||
.put("9451", "青森県信用漁業協同組合連合会")
|
||||
.put("9452", "岩手県信用漁業協同組合連合会")
|
||||
.put("9453", "宮城県漁業協同組合")
|
||||
.put("9456", "福島県信用漁業協同組合連合会")
|
||||
.put("9457", "茨城県信用漁業協同組合連合会")
|
||||
.put("9461", "千葉県信用漁業協同組合連合会")
|
||||
.put("9462", "東京都信用漁業協同組合連合会")
|
||||
.put("9466", "新潟県信用漁業協同組合連合会")
|
||||
.put("9467", "富山県信用漁業協同組合連合会")
|
||||
.put("9468", "石川県信用漁業協同組合連合会")
|
||||
.put("9470", "静岡県信用漁業協同組合連合会")
|
||||
.put("9471", "愛知県信用漁業協同組合連合会")
|
||||
.put("9472", "三重県信用漁業協同組合連合会")
|
||||
.put("9473", "福井県信用漁業協同組合連合会")
|
||||
.put("9475", "京都府信用漁業協同組合連合会")
|
||||
.put("9477", "なぎさ信用漁業協同組合連合会")
|
||||
.put("9480", "鳥取県信用漁業協同組合連合会")
|
||||
.put("9481", "JFしまね漁業協同組合")
|
||||
.put("9483", "広島県信用漁業協同組合連合会")
|
||||
.put("9484", "山口県漁業協同組合")
|
||||
.put("9485", "徳島県信用漁業協同組合連合会")
|
||||
.put("9486", "香川県信用漁業協同組合連合会")
|
||||
.put("9487", "愛媛県信用漁業協同組合連合会")
|
||||
.put("9488", "高知県信用漁業協同組合連合会")
|
||||
.put("9489", "福岡県信用漁業協同組合連合会")
|
||||
.put("9490", "佐賀県信用漁業協同組合連合会")
|
||||
.put("9491", "長崎県信用漁業協同組合連合会")
|
||||
.put("9493", "大分県漁業協同組合")
|
||||
.put("9494", "宮崎県信用漁業協同組合連合会")
|
||||
.put("9495", "鹿児島県信用漁業協同組合連合会")
|
||||
.put("9496", "沖縄県信用漁業協同組合連合会")
|
||||
// }}}
|
||||
// {{{ securities firms
|
||||
.put("9500", "東京短資")
|
||||
.put("9501", "セントラル短資")
|
||||
.put("9507", "上田八木短資")
|
||||
.put("9510", "日本証券金融")
|
||||
.put("9520", "野村証券")
|
||||
.put("9521", "日興証券")
|
||||
.put("9523", "大和証券")
|
||||
.put("9524", "みずほ証券")
|
||||
.put("9528", "岡三証券")
|
||||
.put("9530", "岩井コスモ証券")
|
||||
.put("9532", "三菱UFJ証券")
|
||||
.put("9534", "丸三証券")
|
||||
.put("9535", "東洋証券")
|
||||
.put("9537", "水戸証券")
|
||||
.put("9539", "東海東京証券")
|
||||
.put("9542", "むさし証券")
|
||||
.put("9545", "いちよし証券")
|
||||
.put("9573", "極東証券")
|
||||
.put("9574", "立花証券")
|
||||
.put("9579", "光世証券")
|
||||
.put("9584", "ちばぎん証券")
|
||||
.put("9589", "シテイ証券")
|
||||
.put("9594", "CS証券")
|
||||
.put("9595", "スタンレー証券")
|
||||
.put("9930", "日本政策投資")
|
||||
.put("9932", "政策金融公庫")
|
||||
.put("9933", "国際協力")
|
||||
.put("9945", "預金保険機構")
|
||||
// }}}
|
||||
.build();
|
||||
|
||||
private final static String ID_OPEN = "";
|
||||
private final static String ID_CLOSE = "";
|
||||
private final static String JA_OPEN = "";
|
||||
private final static String JA_CLOSE = "";
|
||||
private final static String EN_OPEN = "";
|
||||
private final static String EN_CLOSE = "";
|
||||
public final static String SPACE = " ";
|
||||
|
||||
// don't localize these strings into all languages,
|
||||
// all we want is either Japanese or English here.
|
||||
public static String getString(String id) {
|
||||
boolean ja = GUIUtil.getUserLanguage().equals("ja");
|
||||
|
||||
switch (id) {
|
||||
case "bank":
|
||||
if (ja) return "銀行名 ・金融機関名";
|
||||
return "Bank or Financial Institution";
|
||||
case "bank.select":
|
||||
if (ja) return "金融機関 ・銀行検索 (名称入力検索)";
|
||||
return "Search for Bank or Financial Institution";
|
||||
case "bank.code":
|
||||
if (ja) return "銀行コード";
|
||||
return "Zengin Bank Code";
|
||||
case "bank.name":
|
||||
if (ja) return "金融機関名 ・銀行名";
|
||||
return "Financial Institution / Bank Name";
|
||||
|
||||
case "branch":
|
||||
if (ja) return "支店名";
|
||||
return "Bank Branch";
|
||||
case "branch.code":
|
||||
if (ja) return "支店コード";
|
||||
return "Zengin Branch Code";
|
||||
case "branch.code.validation.error":
|
||||
if (ja) return "入力は3桁の支店コードでなければなりません";
|
||||
return "Input must be a 3 digit branch code";
|
||||
case "branch.name":
|
||||
if (ja) return "支店名";
|
||||
return "Bank Branch Name";
|
||||
|
||||
case "account":
|
||||
if (ja) return "銀行口座";
|
||||
return "Bank Account";
|
||||
|
||||
case "account.type":
|
||||
if (ja) return "口座科目";
|
||||
return "Bank Account Type";
|
||||
case "account.type.select":
|
||||
if (ja) return "口座科目";
|
||||
return "Select Account Type";
|
||||
// displayed while creating account
|
||||
case "account.type.futsu":
|
||||
if (ja) return "普通";
|
||||
return "FUTSUU (ordinary) account";
|
||||
case "account.type.touza":
|
||||
if (ja) return "当座";
|
||||
return "TOUZA (checking) account";
|
||||
case "account.type.chochiku":
|
||||
if (ja) return "貯金";
|
||||
return "CHOCHIKU (special) account";
|
||||
// used when saving account info
|
||||
case "account.type.futsu.ja":
|
||||
return "普通";
|
||||
case "account.type.touza.ja":
|
||||
return "当座";
|
||||
case "account.type.chochiku.ja":
|
||||
return "貯金";
|
||||
|
||||
case "account.number":
|
||||
if (ja) return "口座番号";
|
||||
return "Bank Account Number";
|
||||
case "account.number.validation.error":
|
||||
if (ja) return "入力は4〜8桁の口座番号でなければなりません";
|
||||
return "Input must be 4 ~ 8 digit account number";
|
||||
case "account.name":
|
||||
if (ja) return "口座名義";
|
||||
return "Bank Account Name";
|
||||
|
||||
// for japanese-only input fields
|
||||
case "japanese.validation.error":
|
||||
if (ja) return "入力は漢字、ひらがな、またはカタカナでなければなりません";
|
||||
return "Input must be Kanji, Hiragana, or Katakana";
|
||||
case "japanese.validation.regex":
|
||||
// epic regex to only match Japanese input
|
||||
return "[" + // match any of these characters:
|
||||
// "A-z" + // full-width alphabet
|
||||
// "0-9" + // full-width numerals
|
||||
"一-龯" + // common Japanese kanji (0x4e00 ~ 0x9faf)
|
||||
"々" + // kanji iteration mark (0x3005)
|
||||
"〇" + // kanji number zero (0x3007)
|
||||
"ぁ-ゞ" + // hiragana (0x3041 ~ 0x309e)
|
||||
"ァ-・" + // full-width katakana (0x30a1 ~ 0x30fb)
|
||||
"ァ-ン゙゚" + // half-width katakana
|
||||
"ヽヾ゛゜ー" + // 0x30fd, 0x30fe, 0x309b, 0x309c, 0x30fc
|
||||
" " + // full-width space
|
||||
" " + // half-width space
|
||||
"]+"; // for any length
|
||||
}
|
||||
|
||||
return "null";
|
||||
}
|
||||
}
|
|
@ -76,29 +76,6 @@ import bisq.desktop.main.overlays.popups.Popup;
|
|||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.AdvancedCashValidator;
|
||||
import bisq.desktop.util.validation.AliPayValidator;
|
||||
import bisq.desktop.util.validation.AustraliaPayidValidator;
|
||||
import bisq.desktop.util.validation.BICValidator;
|
||||
import bisq.desktop.util.validation.CapitualValidator;
|
||||
import bisq.desktop.util.validation.ChaseQuickPayValidator;
|
||||
import bisq.desktop.util.validation.ClearXchangeValidator;
|
||||
import bisq.desktop.util.validation.F2FValidator;
|
||||
import bisq.desktop.util.validation.HalCashValidator;
|
||||
import bisq.desktop.util.validation.InteracETransferValidator;
|
||||
import bisq.desktop.util.validation.JapanBankTransferValidator;
|
||||
import bisq.desktop.util.validation.LengthValidator;
|
||||
import bisq.desktop.util.validation.MoneyBeamValidator;
|
||||
import bisq.desktop.util.validation.PerfectMoneyValidator;
|
||||
import bisq.desktop.util.validation.PopmoneyValidator;
|
||||
import bisq.desktop.util.validation.PromptPayValidator;
|
||||
import bisq.desktop.util.validation.RevolutValidator;
|
||||
import bisq.desktop.util.validation.SwishValidator;
|
||||
import bisq.desktop.util.validation.TransferwiseValidator;
|
||||
import bisq.desktop.util.validation.USPostalMoneyOrderValidator;
|
||||
import bisq.desktop.util.validation.UpholdValidator;
|
||||
import bisq.desktop.util.validation.WeChatPayValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.offer.OfferRestrictions;
|
||||
|
@ -116,6 +93,28 @@ import bisq.core.payment.RevolutAccount;
|
|||
import bisq.core.payment.USPostalMoneyOrderAccount;
|
||||
import bisq.core.payment.WesternUnionAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.validation.AdvancedCashValidator;
|
||||
import bisq.core.payment.validation.AliPayValidator;
|
||||
import bisq.core.payment.validation.AustraliaPayidValidator;
|
||||
import bisq.core.payment.validation.BICValidator;
|
||||
import bisq.core.payment.validation.CapitualValidator;
|
||||
import bisq.core.payment.validation.ChaseQuickPayValidator;
|
||||
import bisq.core.payment.validation.EmailOrMobileNrValidator;
|
||||
import bisq.core.payment.validation.F2FValidator;
|
||||
import bisq.core.payment.validation.HalCashValidator;
|
||||
import bisq.core.payment.validation.InteracETransferValidator;
|
||||
import bisq.core.payment.validation.JapanBankTransferValidator;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.payment.validation.MoneyBeamValidator;
|
||||
import bisq.core.payment.validation.PerfectMoneyValidator;
|
||||
import bisq.core.payment.validation.PopmoneyValidator;
|
||||
import bisq.core.payment.validation.PromptPayValidator;
|
||||
import bisq.core.payment.validation.RevolutValidator;
|
||||
import bisq.core.payment.validation.SwishValidator;
|
||||
import bisq.core.payment.validation.TransferwiseValidator;
|
||||
import bisq.core.payment.validation.USPostalMoneyOrderValidator;
|
||||
import bisq.core.payment.validation.UpholdValidator;
|
||||
import bisq.core.payment.validation.WeChatPayValidator;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
|
@ -164,7 +163,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
|
|||
private final AliPayValidator aliPayValidator;
|
||||
private final PerfectMoneyValidator perfectMoneyValidator;
|
||||
private final SwishValidator swishValidator;
|
||||
private final ClearXchangeValidator clearXchangeValidator;
|
||||
private final EmailOrMobileNrValidator clearXchangeValidator;
|
||||
private final ChaseQuickPayValidator chaseQuickPayValidator;
|
||||
private final InteracETransferValidator interacETransferValidator;
|
||||
private final JapanBankTransferValidator japanBankTransferValidator;
|
||||
|
@ -195,7 +194,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
|
|||
AliPayValidator aliPayValidator,
|
||||
PerfectMoneyValidator perfectMoneyValidator,
|
||||
SwishValidator swishValidator,
|
||||
ClearXchangeValidator clearXchangeValidator,
|
||||
EmailOrMobileNrValidator clearXchangeValidator,
|
||||
ChaseQuickPayValidator chaseQuickPayValidator,
|
||||
InteracETransferValidator interacETransferValidator,
|
||||
JapanBankTransferValidator japanBankTransferValidator,
|
||||
|
@ -427,7 +426,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
|
|||
paymentMethodComboBox = FormBuilder.addComboBox(root, gridRow, Res.get("shared.selectPaymentMethod"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
paymentMethodComboBox.setVisibleRowCount(11);
|
||||
paymentMethodComboBox.setPrefWidth(250);
|
||||
List<PaymentMethod> list = PaymentMethod.getPaymentMethods().stream()
|
||||
List<PaymentMethod> list = PaymentMethod.paymentMethods.stream()
|
||||
.filter(PaymentMethod::isFiat)
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -25,8 +25,6 @@ import bisq.desktop.main.overlays.popups.Popup;
|
|||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.PercentageNumberValidator;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -40,6 +38,7 @@ import bisq.core.notifications.alerts.market.MarketAlerts;
|
|||
import bisq.core.notifications.alerts.price.PriceAlert;
|
||||
import bisq.core.notifications.alerts.price.PriceAlertFilter;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.validation.PercentageNumberValidator;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
|
|
|
@ -31,7 +31,6 @@ import bisq.desktop.main.account.content.seedwords.SeedWordsView;
|
|||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.PasswordValidator;
|
||||
|
||||
import bisq.core.btc.wallet.WalletsManager;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.common.crypto.ScryptUtil;
|
||||
|
|
|
@ -27,10 +27,6 @@ import bisq.desktop.main.settings.SettingsView;
|
|||
import bisq.desktop.main.settings.preferences.PreferencesView;
|
||||
import bisq.desktop.util.DisplayUtils;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
|
@ -46,6 +42,9 @@ import bisq.core.offer.OfferRestrictions;
|
|||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.payment.validation.FiatVolumeValidator;
|
||||
import bisq.core.payment.validation.SecurityDepositValidator;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.provider.price.MarketPrice;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
|
|
|
@ -20,12 +20,11 @@ package bisq.desktop.main.offer.createoffer;
|
|||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.common.model.ViewModel;
|
||||
import bisq.desktop.main.offer.MutableOfferViewModel;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.payment.validation.FiatVolumeValidator;
|
||||
import bisq.core.payment.validation.SecurityDepositValidator;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
|
|
|
@ -349,7 +349,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
|
|||
}
|
||||
|
||||
ObservableList<PaymentMethod> getPaymentMethods() {
|
||||
ObservableList<PaymentMethod> list = FXCollections.observableArrayList(PaymentMethod.getPaymentMethods());
|
||||
ObservableList<PaymentMethod> list = FXCollections.observableArrayList(PaymentMethod.paymentMethods);
|
||||
if (preferences.isHideNonAccountPaymentMethods() && user.getPaymentAccounts() != null) {
|
||||
Set<PaymentMethod> supportedPaymentMethods = user.getPaymentAccounts().stream()
|
||||
.map(PaymentAccount::getPaymentMethod).collect(Collectors.toSet());
|
||||
|
|
|
@ -27,8 +27,6 @@ import bisq.desktop.main.offer.OfferViewModelUtil;
|
|||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.DisplayUtils;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
|
@ -40,6 +38,7 @@ import bisq.core.offer.OfferRestrictions;
|
|||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.trade.Trade;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
|
|
|
@ -22,9 +22,8 @@ import bisq.desktop.components.AutoTooltipLabel;
|
|||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.main.overlays.Overlay;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.LengthValidator;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.util.validation.UrlInputValidator;
|
||||
|
||||
import bisq.common.util.Tuple2;
|
||||
|
|
|
@ -23,8 +23,6 @@ import bisq.desktop.components.InputTextField;
|
|||
import bisq.desktop.main.overlays.Overlay;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.LengthValidator;
|
||||
import bisq.desktop.util.validation.PercentageNumberValidator;
|
||||
import bisq.core.api.CoreMoneroConnectionsService;
|
||||
import bisq.core.btc.exceptions.TransactionVerificationException;
|
||||
import bisq.core.btc.exceptions.TxBroadcastException;
|
||||
|
@ -33,6 +31,8 @@ import bisq.core.btc.wallet.TradeWalletService;
|
|||
import bisq.core.btc.wallet.TxBroadcaster;
|
||||
import bisq.core.btc.wallet.WalletsManager;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.payment.validation.PercentageNumberValidator;
|
||||
import bisq.core.support.dispute.Dispute;
|
||||
import bisq.core.support.dispute.mediation.MediationManager;
|
||||
import bisq.core.user.BlockChainExplorer;
|
||||
|
|
|
@ -170,7 +170,7 @@ public class SignPaymentAccountsWindow extends Overlay<SignPaymentAccountsWindow
|
|||
}
|
||||
|
||||
private List<PaymentMethod> getPaymentMethods() {
|
||||
return PaymentMethod.getPaymentMethods().stream()
|
||||
return PaymentMethod.paymentMethods.stream()
|
||||
.filter(PaymentMethod::isFiat)
|
||||
.filter(PaymentMethod::hasChargebackRisk)
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -20,10 +20,9 @@ package bisq.desktop.main.overlays.windows;
|
|||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.main.overlays.Overlay;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.RevolutValidator;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.RevolutAccount;
|
||||
import bisq.core.payment.validation.RevolutValidator;
|
||||
import bisq.core.user.User;
|
||||
|
||||
import javafx.scene.Scene;
|
||||
|
|
|
@ -19,14 +19,13 @@ package bisq.desktop.main.portfolio.duplicateoffer;
|
|||
|
||||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.main.offer.MutableOfferViewModel;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.offer.OfferPayload;
|
||||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.payment.validation.FiatVolumeValidator;
|
||||
import bisq.core.payment.validation.SecurityDepositValidator;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
|
|
|
@ -19,13 +19,12 @@ package bisq.desktop.main.portfolio.editoffer;
|
|||
|
||||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.main.offer.MutableOfferViewModel;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.offer.OpenOffer;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.payment.validation.FiatVolumeValidator;
|
||||
import bisq.core.payment.validation.SecurityDepositValidator;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
|
|
|
@ -30,8 +30,6 @@ import bisq.desktop.main.overlays.windows.EditCustomExplorerWindow;
|
|||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.ImageUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.filter.Filter;
|
||||
import bisq.core.filter.FilterManager;
|
||||
|
@ -45,6 +43,7 @@ import bisq.core.locale.Res;
|
|||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public final class AccountNrValidator extends BankValidator {
|
||||
public AccountNrValidator(String countryCode) {
|
||||
super(countryCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
int length;
|
||||
String input2;
|
||||
switch (countryCode) {
|
||||
case "GB":
|
||||
length = 8;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNr", length));
|
||||
case "US":
|
||||
if (isNumberInRange(input, 4, 17))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNr", "4 - 17"));
|
||||
case "BR":
|
||||
if (isStringInRange(input, 1, 20))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNrChars", "1 - 20"));
|
||||
case "NZ":
|
||||
input2 = input != null ? input.replaceAll("-", "") : null;
|
||||
if (isNumberInRange(input2, 15, 16))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNrFormat", "03-1587-0050000-00"));
|
||||
case "AU":
|
||||
if (isNumberInRange(input, 4, 10))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNr", "4 - 10"));
|
||||
case "CA":
|
||||
if (isNumberInRange(input, 7, 12))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNr", "7 - 12"));
|
||||
case "MX":
|
||||
length = 18;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
case "HK":
|
||||
input2 = input != null ? input.replaceAll("-", "") : null;
|
||||
if (isNumberInRange(input2, 9, 12))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.accountNrFormat", "005-231289-112"));
|
||||
case "NO":
|
||||
if (input != null) {
|
||||
length = 11;
|
||||
// Provided by sturles:
|
||||
// https://github.com/bisq-network/exchange/pull/707
|
||||
|
||||
// https://no.wikipedia.org/wiki/MOD11#Implementasjoner_i_forskjellige_programmeringspr.C3.A5k
|
||||
// https://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits6
|
||||
|
||||
// 11 digits, last digit is checksum. Checksum algoritm is
|
||||
// MOD11 with weights 2,3,4,5,6,7,2,3,4,5 right to left.
|
||||
// First remove whitespace and periods. Normal formatting is:
|
||||
// 1234.56.78903
|
||||
input2 = StringUtils.remove(input, " ");
|
||||
input2 = StringUtils.remove(input2, ".");
|
||||
// 11 digits, numbers only
|
||||
if (input2.length() != length || !StringUtils.isNumeric(input2))
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
int lastDigit = Character.getNumericValue(input2.charAt(input2.length() - 1));
|
||||
if (getMod11ControlDigit(input2) != lastDigit)
|
||||
return new ValidationResult(false, "Kontonummer har feil sjekksum"); // not translated
|
||||
else
|
||||
return super.validate(input);
|
||||
} else {
|
||||
return super.validate(null);
|
||||
}
|
||||
default:
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getMod11ControlDigit(String accountNrString) {
|
||||
int sumForMod = 0;
|
||||
int controlNumber = 2;
|
||||
char[] accountNr = accountNrString.toCharArray();
|
||||
|
||||
for (int i = accountNr.length - 2; i >= 0; i--) {
|
||||
sumForMod += (Character.getNumericValue(accountNr[i]) * controlNumber);
|
||||
controlNumber++;
|
||||
|
||||
if (controlNumber > 7) {
|
||||
controlNumber = 2;
|
||||
}
|
||||
}
|
||||
int calculus = (11 - sumForMod % 11);
|
||||
if (calculus == 11) {
|
||||
return 0;
|
||||
} else {
|
||||
return calculus;
|
||||
}
|
||||
}
|
||||
|
||||
private String getLabel() {
|
||||
String label = BankUtil.getAccountNrLabel(countryCode);
|
||||
return label.substring(0, label.length() - 1);
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class AdvancedCashValidator extends InputValidator {
|
||||
private EmailValidator emailValidator;
|
||||
private RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public AdvancedCashValidator(EmailValidator emailValidator, RegexValidator regexValidator) {
|
||||
|
||||
this.emailValidator = emailValidator;
|
||||
|
||||
regexValidator.setPattern("[A-Za-z]{1}\\d{12}");
|
||||
regexValidator.setErrorMessage(Res.get("validation.advancedCash.invalidFormat"));
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (!result.isValid)
|
||||
return result;
|
||||
|
||||
result = emailValidator.validate(input);
|
||||
|
||||
if (!result.isValid)
|
||||
result = regexValidator.validate(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class AliPayValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public final class AustraliaPayidAccountNameValidator extends InputValidator {
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (result.isValid)
|
||||
result = lengthValidator.validate(input);
|
||||
if (result.isValid)
|
||||
result = regexValidator.validate(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private final LengthValidator lengthValidator;
|
||||
private final RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public AustraliaPayidAccountNameValidator(LengthValidator lengthValidator, RegexValidator regexValidator) {
|
||||
|
||||
lengthValidator.setMinLength(1);
|
||||
lengthValidator.setMaxLength(40);
|
||||
this.lengthValidator = lengthValidator;
|
||||
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class AustraliaPayidValidator extends InputValidator {
|
||||
|
||||
private final EmailValidator emailValidator;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public AustraliaPayidValidator() {
|
||||
emailValidator = new EmailValidator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (!result.isValid) {
|
||||
return result;
|
||||
} else {
|
||||
ValidationResult emailResult = emailValidator.validate(input);
|
||||
if (emailResult.isValid)
|
||||
return emailResult;
|
||||
else
|
||||
return validatePhoneNumber(input);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO not impl yet -> see InteracETransferValidator
|
||||
private ValidationResult validatePhoneNumber(String input) {
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/*
|
||||
* BIC information taken from German wikipedia (2017-01-30)
|
||||
*
|
||||
* length 8 or 11 characters
|
||||
* General format: BBBB CC LL (bbb)
|
||||
* with B - Bank code
|
||||
* C - Country code
|
||||
* L - Location code
|
||||
* b - branch code (if applicable)
|
||||
*
|
||||
* B and C must be letters
|
||||
* first L cannot be 0 or 1, second L cannot be O (upper case 'o')
|
||||
* bbb cannot begin with X, unless it is XXX
|
||||
*/
|
||||
|
||||
// TODO Special letters like ä, å, ... are not detected as invalid
|
||||
|
||||
public final class BICValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO Add validation for primary and secondary IDs according to the selected type
|
||||
|
||||
// IBAN max 34 chars
|
||||
// bic: 8 or 11 chars
|
||||
|
||||
// check ensure length 8 or 11
|
||||
if (!isStringWithFixedLength(input, 8) && !isStringWithFixedLength(input, 11))
|
||||
return new ValidationResult(false, Res.get("validation.bic.invalidLength"));
|
||||
|
||||
input = input.toUpperCase(Locale.ROOT);
|
||||
|
||||
// ensure Bank and Country code to be letters only
|
||||
for (int k = 0; k < 6; k++) {
|
||||
if (!Character.isLetter(input.charAt(k)))
|
||||
return new ValidationResult(false, Res.get("validation.bic.letters"));
|
||||
}
|
||||
|
||||
// ensure location code starts not with 0 or 1 and ends not with O
|
||||
char ch = input.charAt(6);
|
||||
if (ch == '0' || ch == '1' || input.charAt(7) == 'O')
|
||||
return new ValidationResult(false, Res.get("validation.bic.invalidLocationCode"));
|
||||
|
||||
if (input.startsWith("REVO"))
|
||||
return new ValidationResult(false, Res.get("validation.bic.sepaRevolutBic"));
|
||||
|
||||
|
||||
// check complete for 8 char BIC
|
||||
if (input.length() == 8)
|
||||
return new ValidationResult(true);
|
||||
|
||||
// ensure branch code does not start with X unless it is XXX
|
||||
if (input.charAt(8) == 'X')
|
||||
if (input.charAt(9) != 'X' || input.charAt(10) != 'X')
|
||||
return new ValidationResult(false, Res.get("validation.bic.invalidBranchCode"));
|
||||
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
public final class BankIdValidator extends BankValidator {
|
||||
public BankIdValidator(String countryCode) {
|
||||
super(countryCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
int length;
|
||||
|
||||
switch (countryCode) {
|
||||
case "CA":
|
||||
length = 3;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.bankIdNumber", getLabel(), length));
|
||||
case "HK":
|
||||
length = 3;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.bankIdNumber", getLabel(), length));
|
||||
default:
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
||||
|
||||
private String getLabel() {
|
||||
String label = BankUtil.getBankIdLabel(countryCode);
|
||||
return label.substring(0, label.length() - 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public abstract class BankValidator extends InputValidator {
|
||||
protected String countryCode = "";
|
||||
|
||||
public BankValidator() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BankValidator(String countryCode) {
|
||||
this.countryCode = countryCode;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
public final class BranchIdValidator extends BankValidator {
|
||||
|
||||
public BranchIdValidator(String countryCode) {
|
||||
super(countryCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
int length;
|
||||
switch (countryCode) {
|
||||
case "GB":
|
||||
length = 6;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
case "US":
|
||||
length = 9;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
case "BR":
|
||||
if (isStringInRange(input, 2, 6))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeChars", getLabel(), "2 - 6"));
|
||||
case "AU":
|
||||
length = 6;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeChars", getLabel(), length));
|
||||
case "CA":
|
||||
length = 5;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
case "AR":
|
||||
length = 4;
|
||||
if(isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.sortCodeNumber", getLabel(), length));
|
||||
default:
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getLabel() {
|
||||
return BankUtil.getBranchIdLabel(countryCode);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.NumberValidator;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BtcValidator extends NumberValidator {
|
||||
|
||||
protected final CoinFormatter formatter;
|
||||
|
||||
@Nullable
|
||||
@Setter
|
||||
protected Coin minValue;
|
||||
|
||||
@Nullable
|
||||
@Setter
|
||||
protected Coin maxValue;
|
||||
|
||||
@Nullable
|
||||
@Setter
|
||||
@Getter
|
||||
protected Coin maxTradeLimit;
|
||||
|
||||
@Inject
|
||||
public BtcValidator(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) {
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (result.isValid) {
|
||||
input = cleanInput(input);
|
||||
result = validateIfNumber(input);
|
||||
}
|
||||
|
||||
if (result.isValid) {
|
||||
result = result.andValidation(input,
|
||||
this::validateIfNotZero,
|
||||
this::validateIfNotNegative,
|
||||
this::validateIfNotFractionalBtcValue,
|
||||
this::validateIfNotExceedsMaxTradeLimit,
|
||||
this::validateIfNotExceedsMaxBtcValue,
|
||||
this::validateIfNotUnderMinValue,
|
||||
this::validateIfAboveDust);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ValidationResult validateIfAboveDust(String input) {
|
||||
try {
|
||||
final Coin coin = Coin.parseCoin(input);
|
||||
if (Restrictions.isAboveDust(coin))
|
||||
return new ValidationResult(true);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.amountBelowDust",
|
||||
formatter.formatCoinWithCode(Restrictions.getMinNonDustOutput())));
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
protected ValidationResult validateIfNotFractionalBtcValue(String input) {
|
||||
try {
|
||||
BigDecimal bd = new BigDecimal(input);
|
||||
final BigDecimal satoshis = bd.movePointRight(8);
|
||||
if (satoshis.scale() > 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.fraction"));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
protected ValidationResult validateIfNotExceedsMaxBtcValue(String input) {
|
||||
try {
|
||||
final Coin coin = Coin.parseCoin(input);
|
||||
if (maxValue != null && coin.compareTo(maxValue) > 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.toLarge", formatter.formatCoinWithCode(maxValue)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
protected ValidationResult validateIfNotExceedsMaxTradeLimit(String input) {
|
||||
try {
|
||||
final Coin coin = Coin.parseCoin(input);
|
||||
if (maxTradeLimit != null && coin.compareTo(maxTradeLimit) > 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.exceedsMaxTradeLimit", formatter.formatCoinWithCode(maxTradeLimit)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
protected ValidationResult validateIfNotUnderMinValue(String input) {
|
||||
try {
|
||||
final Coin coin = Coin.parseCoin(input);
|
||||
if (minValue != null && coin.compareTo(minValue) < 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.toSmall", formatter.formatCoinWithCode(minValue)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class CapitualValidator extends InputValidator {
|
||||
private final RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public CapitualValidator(RegexValidator regexValidator) {
|
||||
regexValidator.setPattern("CAP-[A-Za-z0-9]{6}");
|
||||
regexValidator.setErrorMessage(Res.get("validation.capitual.invalidFormat"));
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
|
||||
return regexValidator.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class ChaseQuickPayValidator extends InputValidator {
|
||||
|
||||
private final EmailValidator emailValidator;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public ChaseQuickPayValidator() {
|
||||
super();
|
||||
emailValidator = new EmailValidator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
return emailValidator.validate(input);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class ClearXchangeValidator extends InputValidator {
|
||||
|
||||
private final EmailValidator emailValidator;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public ClearXchangeValidator() {
|
||||
emailValidator = new EmailValidator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (!result.isValid) {
|
||||
return result;
|
||||
} else {
|
||||
ValidationResult emailResult = emailValidator.validate(input);
|
||||
if (emailResult.isValid)
|
||||
return emailResult;
|
||||
else
|
||||
return validatePhoneNumber(input);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO not impl yet -> see InteracETransferValidator
|
||||
private ValidationResult validatePhoneNumber(String input) {
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,278 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
|
||||
final class CountryCallingCodes {
|
||||
/**
|
||||
* Immutable mapping of ISO 3166 alpha-2 country code to national dialing number.
|
||||
* <p>
|
||||
* In some regions, such as American Samoa ('AS'), there is only one area code, and
|
||||
* it is included in the mapping as part of the calling code.
|
||||
*
|
||||
* @see {@link <a href="https://en.wikipedia.org/wiki/E.164">https://en.wikipedia.org/wiki/E.164</a>}
|
||||
* @see {@link <a href="https://en.wikipedia.org/wiki/List_of_country_calling_codes">https://en.wikipedia.org/wiki/List_of_country_calling_codes</a>}
|
||||
*/
|
||||
private final static Map<String, String> CALLING_CODE_MAP = Map.ofEntries(
|
||||
entry("AD", "376"),
|
||||
entry("AE", "971"),
|
||||
entry("AF", "93"),
|
||||
entry("AG", "1-268"),
|
||||
entry("AI", "1-264"),
|
||||
entry("AL", "355"),
|
||||
entry("AM", "374"),
|
||||
entry("AO", "244"),
|
||||
entry("AQ", "672"),
|
||||
entry("AR", "54"),
|
||||
entry("AS", "1-684"),
|
||||
entry("AT", "43"),
|
||||
entry("AU", "61"),
|
||||
entry("AW", "297"),
|
||||
entry("AX", "358"),
|
||||
entry("AZ", "994"),
|
||||
entry("BA", "387"),
|
||||
entry("BB", "1-246"),
|
||||
entry("BD", "880"),
|
||||
entry("BE", "32"),
|
||||
entry("BF", "226"),
|
||||
entry("BG", "359"),
|
||||
entry("BH", "973"),
|
||||
entry("BI", "257"),
|
||||
entry("BJ", "229"),
|
||||
entry("BL", "590"),
|
||||
entry("BM", "1-441"),
|
||||
entry("BN", "673"),
|
||||
entry("BO", "591"),
|
||||
entry("BQ", "599"),
|
||||
entry("BR", "55"),
|
||||
entry("BS", "1-242"),
|
||||
entry("BT", "975"),
|
||||
entry("BV", "47"),
|
||||
entry("BW", "267"),
|
||||
entry("BY", "375"),
|
||||
entry("BZ", "501"),
|
||||
entry("CA", "1"),
|
||||
entry("CC", "61"),
|
||||
entry("CD", "243"),
|
||||
entry("CF", "236"),
|
||||
entry("CG", "242"),
|
||||
entry("CH", "41"),
|
||||
entry("CI", "225"),
|
||||
entry("CK", "682"),
|
||||
entry("CL", "56"),
|
||||
entry("CM", "237"),
|
||||
entry("CN", "86"),
|
||||
entry("CO", "57"),
|
||||
entry("CR", "506"),
|
||||
entry("CU", "53"),
|
||||
entry("CV", "238"),
|
||||
entry("CW", "599"),
|
||||
entry("CX", "61"),
|
||||
entry("CY", "357"),
|
||||
entry("CZ", "420"),
|
||||
entry("DE", "49"),
|
||||
entry("DJ", "253"),
|
||||
entry("DK", "45"),
|
||||
entry("DM", "1-767"),
|
||||
entry("DO", "1"), // DO has three area codes 809,829,849; let user define hers.
|
||||
entry("DZ", "213"),
|
||||
entry("EC", "593"),
|
||||
entry("EE", "372"),
|
||||
entry("EG", "20"),
|
||||
entry("EH", "212"),
|
||||
entry("ER", "291"),
|
||||
entry("ES", "34"),
|
||||
entry("ET", "251"),
|
||||
entry("FI", "358"),
|
||||
entry("FJ", "679"),
|
||||
entry("FK", "500"),
|
||||
entry("FM", "691"),
|
||||
entry("FO", "298"),
|
||||
entry("FR", "33"),
|
||||
entry("GA", "241"),
|
||||
entry("GB", "44"),
|
||||
entry("GD", "1-473"),
|
||||
entry("GE", "995"),
|
||||
entry("GF", "594"),
|
||||
entry("GG", "44"),
|
||||
entry("GH", "233"),
|
||||
entry("GI", "350"),
|
||||
entry("GL", "299"),
|
||||
entry("GM", "220"),
|
||||
entry("GN", "224"),
|
||||
entry("GP", "590"),
|
||||
entry("GQ", "240"),
|
||||
entry("GR", "30"),
|
||||
entry("GS", "500"),
|
||||
entry("GT", "502"),
|
||||
entry("GU", "1-671"),
|
||||
entry("GW", "245"),
|
||||
entry("GY", "592"),
|
||||
entry("HK", "852"),
|
||||
entry("HM", "672"),
|
||||
entry("HN", "504"),
|
||||
entry("HR", "385"),
|
||||
entry("HT", "509"),
|
||||
entry("HU", "36"),
|
||||
entry("ID", "62"),
|
||||
entry("IE", "353"),
|
||||
entry("IL", "972"),
|
||||
entry("IM", "44"),
|
||||
entry("IN", "91"),
|
||||
entry("IO", "246"),
|
||||
entry("IQ", "964"),
|
||||
entry("IR", "98"),
|
||||
entry("IS", "354"),
|
||||
entry("IT", "39"),
|
||||
entry("JE", "44"),
|
||||
entry("JM", "1-876"),
|
||||
entry("JO", "962"),
|
||||
entry("JP", "81"),
|
||||
entry("KE", "254"),
|
||||
entry("KG", "996"),
|
||||
entry("KH", "855"),
|
||||
entry("KI", "686"),
|
||||
entry("KM", "269"),
|
||||
entry("KN", "1-869"),
|
||||
entry("KP", "850"),
|
||||
entry("KR", "82"),
|
||||
entry("KW", "965"),
|
||||
entry("KY", "1-345"),
|
||||
entry("KZ", "7"),
|
||||
entry("LA", "856"),
|
||||
entry("LB", "961"),
|
||||
entry("LC", "1-758"),
|
||||
entry("LI", "423"),
|
||||
entry("LK", "94"),
|
||||
entry("LR", "231"),
|
||||
entry("LS", "266"),
|
||||
entry("LT", "370"),
|
||||
entry("LU", "352"),
|
||||
entry("LV", "371"),
|
||||
entry("LY", "218"),
|
||||
entry("MA", "212"),
|
||||
entry("MC", "377"),
|
||||
entry("MD", "373"),
|
||||
entry("ME", "382"),
|
||||
entry("MF", "590"),
|
||||
entry("MG", "261"),
|
||||
entry("MH", "692"),
|
||||
entry("MK", "389"),
|
||||
entry("ML", "223"),
|
||||
entry("MM", "95"),
|
||||
entry("MN", "976"),
|
||||
entry("MO", "853"),
|
||||
entry("MP", "1-670"),
|
||||
entry("MQ", "596"),
|
||||
entry("MR", "222"),
|
||||
entry("MS", "1-664"),
|
||||
entry("MT", "356"),
|
||||
entry("MU", "230"),
|
||||
entry("MV", "960"),
|
||||
entry("MW", "265"),
|
||||
entry("MX", "52"),
|
||||
entry("MY", "60"),
|
||||
entry("MZ", "258"),
|
||||
entry("NA", "264"),
|
||||
entry("NC", "687"),
|
||||
entry("NE", "227"),
|
||||
entry("NF", "672"),
|
||||
entry("NG", "234"),
|
||||
entry("NI", "505"),
|
||||
entry("NL", "31"),
|
||||
entry("NO", "47"),
|
||||
entry("NP", "977"),
|
||||
entry("NR", "674"),
|
||||
entry("NU", "683"),
|
||||
entry("NZ", "64"),
|
||||
entry("OM", "968"),
|
||||
entry("PA", "507"),
|
||||
entry("PE", "51"),
|
||||
entry("PF", "689"),
|
||||
entry("PG", "675"),
|
||||
entry("PH", "63"),
|
||||
entry("PK", "92"),
|
||||
entry("PL", "48"),
|
||||
entry("PM", "508"),
|
||||
entry("PN", "870"),
|
||||
entry("PR", "1"),
|
||||
entry("PS", "970"),
|
||||
entry("PT", "351"),
|
||||
entry("PW", "680"),
|
||||
entry("PY", "595"),
|
||||
entry("QA", "974"),
|
||||
entry("RE", "262"),
|
||||
entry("RO", "40"),
|
||||
entry("RS", "381 p"),
|
||||
entry("RU", "7"),
|
||||
entry("RW", "250"),
|
||||
entry("SA", "966"),
|
||||
entry("SB", "677"),
|
||||
entry("SC", "248"),
|
||||
entry("SD", "249"),
|
||||
entry("SE", "46"),
|
||||
entry("SG", "65"),
|
||||
entry("SH", "290 n"),
|
||||
entry("SI", "386"),
|
||||
entry("SJ", "47"),
|
||||
entry("SK", "421"),
|
||||
entry("SL", "232"),
|
||||
entry("SM", "378"),
|
||||
entry("SN", "221"),
|
||||
entry("SO", "252"),
|
||||
entry("SR", "597"),
|
||||
entry("SS", "211"),
|
||||
entry("ST", "239"),
|
||||
entry("SV", "503"),
|
||||
entry("SX", "1-721"),
|
||||
entry("SY", "963"),
|
||||
entry("SZ", "268"),
|
||||
entry("TC", "1-649"),
|
||||
entry("TD", "235"),
|
||||
entry("TF", "262"),
|
||||
entry("TG", "228"),
|
||||
entry("TH", "66"),
|
||||
entry("TJ", "992"),
|
||||
entry("TK", "690"),
|
||||
entry("TL", "670"),
|
||||
entry("TM", "993"),
|
||||
entry("TN", "216"),
|
||||
entry("TO", "676"),
|
||||
entry("TR", "90"),
|
||||
entry("TT", "1-868"),
|
||||
entry("TV", "688"),
|
||||
entry("TW", "886"),
|
||||
entry("TZ", "255"),
|
||||
entry("UA", "380"),
|
||||
entry("UG", "256"),
|
||||
// entry("UM", null),
|
||||
entry("US", "1"),
|
||||
entry("UY", "598"),
|
||||
entry("UZ", "998"),
|
||||
entry("VA", "39-06"),
|
||||
entry("VC", "1-784"),
|
||||
entry("VE", "58"),
|
||||
entry("VG", "1-284"),
|
||||
entry("VI", "1-340"),
|
||||
entry("VN", "84"),
|
||||
entry("VU", "678"),
|
||||
entry("WF", "681"),
|
||||
entry("WS", "685"),
|
||||
entry("YE", "967"),
|
||||
entry("YT", "262"),
|
||||
entry("ZA", "27"),
|
||||
entry("ZM", "260"),
|
||||
entry("ZW", "263")
|
||||
);
|
||||
|
||||
private static final String normalizedCallingCodeRegex = "[\\-]";
|
||||
|
||||
static String getCallingCode(String isoCountryCode) {
|
||||
return CALLING_CODE_MAP.get(isoCountryCode);
|
||||
}
|
||||
|
||||
static String getNormalizedCallingCode(String isoCountryCode) {
|
||||
return getCallingCode(isoCountryCode).replaceAll(normalizedCallingCodeRegex, "");
|
||||
}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
/*
|
||||
* Mail addresses consist of localPart @ domainPart
|
||||
*
|
||||
* Local part:
|
||||
* May contain lots of symbols A-Za-z0-9.!#$%&'*+-/=?^_`{|}~
|
||||
* but cannot begin or end with a dot (.)
|
||||
* between double quotes many more symbols are allowed:
|
||||
* "(),:;<>@[\] (ASCII: 32, 34, 40, 41, 44, 58, 59, 60, 62, 64, 91–93)
|
||||
*
|
||||
* Domain part:
|
||||
* Consists of name dot TLD
|
||||
* name can but usually doesn't (compatibility reasons) contain non-ASCII
|
||||
* symbols.
|
||||
* TLD is at least two letters long
|
||||
*/
|
||||
public final class EmailValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private final ValidationResult invalidAddress = new ValidationResult(false, Res.get("validation.email.invalidAddress"));
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
if (input == null || input.length() < 6 || input.length() > 100) // shortest address is l@d.cc, max length 100
|
||||
return invalidAddress;
|
||||
String[] subStrings;
|
||||
String local, domain;
|
||||
|
||||
subStrings = input.split("@", -1);
|
||||
|
||||
if (subStrings.length == 1) // address does not contain '@'
|
||||
return invalidAddress;
|
||||
if (subStrings.length > 2) // multiple @'s included -> check for valid double quotes
|
||||
if (!checkForValidQuotes(subStrings)) // around @'s -> "..@..@.." and concatenate local part
|
||||
return invalidAddress;
|
||||
local = subStrings[0];
|
||||
domain = subStrings[subStrings.length - 1];
|
||||
|
||||
if (local.isEmpty())
|
||||
return invalidAddress;
|
||||
|
||||
// local part cannot begin or end with '.'
|
||||
if (local.startsWith(".") || local.endsWith("."))
|
||||
return invalidAddress;
|
||||
|
||||
String[] splitDomain = domain.split("\\.", -1); // '.' is a regex in java and has to be escaped
|
||||
String tld = splitDomain[splitDomain.length - 1];
|
||||
if (splitDomain.length < 2)
|
||||
return invalidAddress;
|
||||
|
||||
if (splitDomain[0] == null || splitDomain[0].isEmpty())
|
||||
return invalidAddress;
|
||||
|
||||
// TLD length is at least two
|
||||
if (tld.length() < 2)
|
||||
return invalidAddress;
|
||||
|
||||
// TLD is letters only
|
||||
for (int k = 0; k < tld.length(); k++)
|
||||
if (!Character.isLetter(tld.charAt(k)))
|
||||
return invalidAddress;
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private boolean checkForValidQuotes(String[] subStrings) {
|
||||
int length = subStrings.length - 2; // is index on last substring of local part
|
||||
|
||||
// check for odd number of double quotes before first and after last '@'
|
||||
if ((subStrings[0].split("\"", -1).length % 2 == 1) || (subStrings[length].split("\"", -1).length % 2 == 1))
|
||||
return false;
|
||||
for (int k = 1; k < length; k++) {
|
||||
if (subStrings[k].split("\"", -1).length % 2 == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
String patchLocal = "";
|
||||
for (int k = 0; k <= length; k++) // remember: length is last index not array length
|
||||
patchLocal = patchLocal.concat(subStrings[k]); // @'s are not reinstalled, since not needed for further checks
|
||||
subStrings[0] = patchLocal;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class F2FValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.MonetaryValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class FiatVolumeValidator extends MonetaryValidator {
|
||||
@Override
|
||||
protected double getMinValue() {
|
||||
return 0.01;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getMaxValue() {
|
||||
// Hard to say what the max value should be (zimbabwe dollar....)?
|
||||
// Lets set it to Double.MAX_VALUE until we find some reasonable number
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public FiatVolumeValidator() {
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class HalCashValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
// TODO Does not yet recognize special letters like ä, ö, ü, å, ... as invalid characters
|
||||
public class IBANValidator extends InputValidator {
|
||||
|
||||
@Setter
|
||||
private String restrictToCountry = "";
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
public IBANValidator() {
|
||||
}
|
||||
|
||||
public IBANValidator(String restrictToCountry) {
|
||||
this.restrictToCountry = restrictToCountry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO Add validation for primary and secondary IDs according to the selected type
|
||||
|
||||
// IBAN max 34 chars, shortest is Norwegian with 15 chars, BBAN may include letters
|
||||
// bic: max 11 char
|
||||
|
||||
// check input length first
|
||||
if (isStringInRange(input, 15, 34)) {
|
||||
input = input.toUpperCase(Locale.ROOT); // ensure upper case
|
||||
|
||||
// check if country code is letters and checksum numeric
|
||||
if (!(Character.isLetter(input.charAt(0)) && Character.isLetter(input.charAt(1))))
|
||||
return new ValidationResult(false, Res.get("validation.iban.invalidCountryCode"));
|
||||
if (restrictToCountry.length() > 0 && !restrictToCountry.equals(input.substring(0, 2)))
|
||||
return new ValidationResult(false, Res.get("validation.iban.invalidCountryCode"));
|
||||
if (!(Character.isDigit(input.charAt(2)) && Character.isDigit(input.charAt(3))))
|
||||
return new ValidationResult(false, Res.get("validation.iban.checkSumNotNumeric"));
|
||||
|
||||
// reorder IBAN to format <account number> <country code> <checksum>
|
||||
String input2 = input.substring(4, input.length()) + input.substring(0, 4);
|
||||
|
||||
// check if input is alphanumeric and count included letters
|
||||
int charCount = 0;
|
||||
char ch;
|
||||
for (int k = 0; k < input2.length(); k++) {
|
||||
ch = input2.charAt(k);
|
||||
if (Character.isLetter(ch))
|
||||
charCount++;
|
||||
else if (!Character.isDigit(ch))
|
||||
return (new ValidationResult(false, Res.get("validation.iban.nonNumericChars")));
|
||||
}
|
||||
|
||||
// create final char array for checksum validation
|
||||
char[] charArray = new char[input2.length() + charCount];
|
||||
int i = 0;
|
||||
int tmp;
|
||||
for (int k = 0; k < input2.length(); k++) {
|
||||
ch = input2.charAt(k);
|
||||
if (Character.isLetter(ch)) {
|
||||
tmp = ch - ('A' - 10); // letters are transformed to two digit numbers A->10, B->11, ...
|
||||
String s = Integer.toString(tmp);
|
||||
charArray[i++] = s.charAt(0); // insert transformed
|
||||
charArray[i++] = s.charAt(1); // letters into char array
|
||||
} else charArray[i++] = ch; // transfer digits directly to char array
|
||||
}
|
||||
// System.out.print(Arrays.toString(charArray) + '\t');
|
||||
BigInteger bigInt = new BigInteger(new String(charArray));
|
||||
int result = bigInt.mod(new BigInteger(Integer.toString(97))).intValue();
|
||||
if (result == 1)
|
||||
return new ValidationResult(true);
|
||||
else
|
||||
return new ValidationResult(false, Res.get("validation.iban.checkSumInvalid"));
|
||||
}
|
||||
// return new ValidationResult(false, BSResources.get("validation.accountNrChars", "15 - 34"));
|
||||
return new ValidationResult(false, Res.get("validation.iban.invalidLength"));
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class InteracETransferAnswerValidator extends InputValidator {
|
||||
private LengthValidator lengthValidator;
|
||||
private RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public InteracETransferAnswerValidator(LengthValidator lengthValidator, RegexValidator regexValidator) {
|
||||
|
||||
lengthValidator.setMinLength(3);
|
||||
lengthValidator.setMaxLength(25);
|
||||
this.lengthValidator = lengthValidator;
|
||||
|
||||
regexValidator.setPattern("[A-Za-z0-9\\-]+");
|
||||
regexValidator.setErrorMessage(Res.get("validation.interacETransfer.invalidAnswer"));
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (result.isValid)
|
||||
result = lengthValidator.validate(input);
|
||||
if (result.isValid)
|
||||
result = regexValidator.validate(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class InteracETransferQuestionValidator extends InputValidator {
|
||||
private LengthValidator lengthValidator;
|
||||
private RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public InteracETransferQuestionValidator(LengthValidator lengthValidator, RegexValidator regexValidator) {
|
||||
|
||||
lengthValidator.setMinLength(1);
|
||||
lengthValidator.setMaxLength(40);
|
||||
this.lengthValidator = lengthValidator;
|
||||
|
||||
regexValidator.setPattern("[A-Za-z0-9\\-\\_\\'\\,\\.\\? ]+");
|
||||
regexValidator.setErrorMessage(Res.get("validation.interacETransfer.invalidQuestion"));
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (result.isValid)
|
||||
result = lengthValidator.validate(input);
|
||||
if (result.isValid)
|
||||
result = regexValidator.validate(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* Interac e-Transfer requires a mail address or Canadian (mobile) phone number
|
||||
*
|
||||
* Mail addresses are covered with class EmailValidator
|
||||
*
|
||||
* Phone numbers have 11 digits, expected format is +1 NPA xxx-xxxx
|
||||
* Plus, spaces and dash might be omitted
|
||||
* Canadian area codes (NPA) taken from http://www.cnac.ca/canadian_dial_plan/Current_&_Future_Dialling_Plan.pdf
|
||||
* Valid (as of 2017-06-27) NPAs are hardcoded here
|
||||
* They are to change in some future (according to the linked document around 2019/2020)
|
||||
*/
|
||||
public final class InteracETransferValidator extends InputValidator {
|
||||
|
||||
private static final String[] NPAS = {"204", "226", "236", "249", "250", "289", "306", "343", "365", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "705", "709", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"};
|
||||
private final EmailValidator emailValidator;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public InteracETransferValidator(EmailValidator emailValidator, InteracETransferQuestionValidator questionValidator, InteracETransferAnswerValidator answerValidator) {
|
||||
this.emailValidator = emailValidator;
|
||||
this.questionValidator = questionValidator;
|
||||
this.answerValidator = answerValidator;
|
||||
}
|
||||
|
||||
public final InputValidator answerValidator;
|
||||
|
||||
public final InputValidator questionValidator;
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (!result.isValid) {
|
||||
return result;
|
||||
} else {
|
||||
ValidationResult emailResult = emailValidator.validate(input);
|
||||
if (emailResult.isValid)
|
||||
return emailResult;
|
||||
else
|
||||
return validatePhoneNumber(input);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private ValidationResult validatePhoneNumber(String input) {
|
||||
// check for correct format and strip +, space and -
|
||||
if (input.matches("\\+?1[ -]?\\d{3}[ -]?\\d{3}[ -]?\\d{4}")) {
|
||||
input = input.replace("+", "");
|
||||
input = StringUtils.deleteWhitespace(input);
|
||||
input = input.replace("-", "");
|
||||
|
||||
String inputAreaCode = input.substring(1, 4);
|
||||
for (String s : NPAS) {
|
||||
// check area code agains list and return if valid
|
||||
if (inputAreaCode.compareTo(s) == 0)
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
return new ValidationResult(false, Res.get("validation.interacETransfer.invalidAreaCode"));
|
||||
} else {
|
||||
return new ValidationResult(false, Res.get("validation.interacETransfer.invalidPhone"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.desktop.components.paymentmethods.data.JapanBankData;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public final class JapanBankAccountNameValidator extends InputValidator
|
||||
{
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (result.isValid)
|
||||
result = lengthValidator.validate(input);
|
||||
if (result.isValid)
|
||||
result = regexValidator.validate(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private LengthValidator lengthValidator;
|
||||
private RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public JapanBankAccountNameValidator(LengthValidator lengthValidator, RegexValidator regexValidator) {
|
||||
|
||||
lengthValidator.setMinLength(1);
|
||||
lengthValidator.setMaxLength(40);
|
||||
this.lengthValidator = lengthValidator;
|
||||
|
||||
regexValidator.setPattern(JapanBankData.getString("japanese.validation.regex"));
|
||||
regexValidator.setErrorMessage(JapanBankData.getString("japanese.validation.error"));
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.desktop.components.paymentmethods.data.JapanBankData;
|
||||
|
||||
public final class JapanBankAccountNumberValidator extends InputValidator
|
||||
{
|
||||
@Override
|
||||
public ValidationResult validate(String input)
|
||||
{
|
||||
boolean lengthOK = (
|
||||
isNumberWithFixedLength(input, 3) ||
|
||||
isNumberWithFixedLength(input, 4) ||
|
||||
isNumberWithFixedLength(input, 5) ||
|
||||
isNumberWithFixedLength(input, 6) ||
|
||||
isNumberWithFixedLength(input, 7) ||
|
||||
isNumberWithFixedLength(input, 8));
|
||||
|
||||
if (lengthOK)
|
||||
return super.validate(input);
|
||||
|
||||
return new ValidationResult(false, JapanBankData.getString("account.number.validation.error"));
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.desktop.components.paymentmethods.data.JapanBankData;
|
||||
|
||||
public final class JapanBankBranchCodeValidator extends InputValidator
|
||||
{
|
||||
@Override
|
||||
public ValidationResult validate(String input)
|
||||
{
|
||||
if (isNumberWithFixedLength(input, 3))
|
||||
return super.validate(input);
|
||||
return new ValidationResult(false, JapanBankData.getString("branch.code.validation.error"));
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.desktop.components.paymentmethods.data.JapanBankData;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public final class JapanBankBranchNameValidator extends InputValidator
|
||||
{
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (result.isValid)
|
||||
result = lengthValidator.validate(input);
|
||||
if (result.isValid)
|
||||
result = regexValidator.validate(input);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private LengthValidator lengthValidator;
|
||||
private RegexValidator regexValidator;
|
||||
|
||||
@Inject
|
||||
public JapanBankBranchNameValidator(LengthValidator lengthValidator, RegexValidator regexValidator) {
|
||||
|
||||
lengthValidator.setMinLength(1);
|
||||
lengthValidator.setMaxLength(40);
|
||||
this.lengthValidator = lengthValidator;
|
||||
|
||||
regexValidator.setPattern(JapanBankData.getString("japanese.validation.regex"));
|
||||
regexValidator.setErrorMessage(JapanBankData.getString("japanese.validation.error"));
|
||||
this.regexValidator = regexValidator;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class JapanBankTransferValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public class LengthValidator extends InputValidator {
|
||||
private int minLength;
|
||||
private int maxLength;
|
||||
|
||||
public LengthValidator() {
|
||||
this(0, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public LengthValidator(int min, int max) {
|
||||
this.minLength = min;
|
||||
this.maxLength = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = new ValidationResult(true);
|
||||
int length = (input == null) ? 0 : input.length();
|
||||
|
||||
if (this.minLength == this.maxLength) {
|
||||
if (length != this.minLength)
|
||||
result = new ValidationResult(false, Res.get("validation.fixedLength", this.minLength));
|
||||
} else
|
||||
if (length < this.minLength || length > this.maxLength)
|
||||
result = new ValidationResult(false, Res.get("validation.length", this.minLength, this.maxLength));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setMinLength(int minLength) {
|
||||
this.minLength = minLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(int maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class MoneyBeamValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
public class NationalAccountIdValidator extends BankValidator {
|
||||
|
||||
public NationalAccountIdValidator(String countryCode) {
|
||||
super(countryCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
int length;
|
||||
|
||||
switch (countryCode) {
|
||||
case "AR":
|
||||
length = 22;
|
||||
if (isNumberWithFixedLength(input, length))
|
||||
return super.validate(input);
|
||||
else {
|
||||
String nationalAccountIdLabel = BankUtil.getNationalAccountIdLabel(countryCode);
|
||||
return new ValidationResult(false, Res.get("validation.nationalAccountId", nationalAccountIdLabel, length));
|
||||
}
|
||||
|
||||
default:
|
||||
return super.validate(input);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.NumberValidator;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class PercentageNumberValidator extends NumberValidator {
|
||||
@Nullable
|
||||
@Setter
|
||||
protected Double maxValue; // Keep it Double as we check for null
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (result.isValid) {
|
||||
input = input.replace("%", "");
|
||||
input = cleanInput(input);
|
||||
result = validateIfNumber(input);
|
||||
}
|
||||
return result.and(validateIfNotExceedsMaxValue(input));
|
||||
}
|
||||
|
||||
private ValidationResult validateIfNotExceedsMaxValue(String input) {
|
||||
try {
|
||||
double value = Double.parseDouble(input);
|
||||
if (maxValue != null && value > maxValue)
|
||||
return new ValidationResult(false, Res.get("validation.inputTooLarge", maxValue));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class PerfectMoneyValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Performs lenient validation of international phone numbers, and transforms given
|
||||
* input numbers into E.164 international form. The E.164 normalized phone number
|
||||
* can be accessed via {@link #getNormalizedPhoneNumber} after successful
|
||||
* validation -- {@link #getNormalizedPhoneNumber} will return null if validation
|
||||
* fails.
|
||||
* <p>
|
||||
* Area codes and mobile provider codes are not validated, but all numbers following
|
||||
* calling codes are included in the normalized number.
|
||||
* <p>
|
||||
* @see bisq.desktop.util.validation.CountryCallingCodes
|
||||
*/
|
||||
public class PhoneNumberValidator extends InputValidator {
|
||||
/**
|
||||
* ISO 3166-1 alpha-2 country code
|
||||
*/
|
||||
private String isoCountryCode;
|
||||
/**
|
||||
* The international calling code mapped to the 'isoCountryCode' constructor argument.
|
||||
*/
|
||||
@Nullable
|
||||
@Getter
|
||||
private String callingCode;
|
||||
/**
|
||||
* The normalized (digits only) representation of an international calling code.
|
||||
*/
|
||||
private String normalizedCallingCode;
|
||||
/**
|
||||
* Phone number in E.164 format.
|
||||
*/
|
||||
@Nullable
|
||||
@Getter
|
||||
private String normalizedPhoneNumber;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Public no-arg constructor required by Guice injector,
|
||||
// but isoCountryCode must be set before validation.
|
||||
public PhoneNumberValidator() {
|
||||
}
|
||||
|
||||
public PhoneNumberValidator(String isoCountryCode) {
|
||||
this.isoCountryCode = isoCountryCode;
|
||||
this.callingCode = CountryCallingCodes.getCallingCode(isoCountryCode);
|
||||
this.normalizedCallingCode = CountryCallingCodes.getNormalizedCallingCode(isoCountryCode);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
normalizedPhoneNumber = null;
|
||||
ValidationResult result = super.validate(isoCountryCode);
|
||||
if (!result.isValid) {
|
||||
return new ValidationResult(false, Res.get("validation.phone.missingCountryCode"));
|
||||
}
|
||||
result = super.validate(input);
|
||||
if (!result.isValid) {
|
||||
return result;
|
||||
}
|
||||
String trimmedInput = input.trim();
|
||||
boolean isCountryDialingCodeExplicit = trimmedInput.startsWith("+");
|
||||
// Remove non-alphanumeric chars. Letters may be left in the pureNumber string for
|
||||
// the isPositiveNumber(pureNumber) test. The US once had listed numbers with letters
|
||||
// -- I had one -- and I'm sure they are still used in some countries. In such cases,
|
||||
// users will be prompted to convert letters to numbers for normalization.
|
||||
String pureNumber = input.replaceAll("[^A-Za-z0-9]", "");
|
||||
boolean hasValidCallingCodePrefix = pureNumber.startsWith(normalizedCallingCode);
|
||||
boolean isCountryCallingCodeImplicit = !isCountryDialingCodeExplicit && hasValidCallingCodePrefix;
|
||||
|
||||
result = validateIsNumeric(input, pureNumber)
|
||||
.and(validateHasSufficientDigits(input, pureNumber))
|
||||
.and(validateIsNotTooLong(input, pureNumber))
|
||||
.and(validateIncludedCountryDialingCode(input, isCountryDialingCodeExplicit, hasValidCallingCodePrefix));
|
||||
|
||||
if (result.isValid) {
|
||||
// TODO corner cases: isCountryCallingCodeImplicit == true
|
||||
// && the country calling code is matched by following digits.
|
||||
// && Is this a problem?
|
||||
if (isCountryDialingCodeExplicit || isCountryCallingCodeImplicit) {
|
||||
normalizedPhoneNumber = "+" + pureNumber;
|
||||
} else {
|
||||
normalizedPhoneNumber = "+" + getCallingCode() + pureNumber;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for property 'isoCountryCode'.
|
||||
*
|
||||
* @param isoCountryCode Value to set for property 'isoCountryCode'.
|
||||
*/
|
||||
public void setIsoCountryCode(String isoCountryCode) {
|
||||
this.isoCountryCode = isoCountryCode;
|
||||
this.callingCode = CountryCallingCodes.getCallingCode(isoCountryCode);
|
||||
this.normalizedCallingCode = CountryCallingCodes.getNormalizedCallingCode(isoCountryCode);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private ValidationResult validateIsNumeric(String rawInput, String pureNumber) {
|
||||
try {
|
||||
if (isPositiveNumber(pureNumber)) {
|
||||
return new ValidationResult(true);
|
||||
} else {
|
||||
return new ValidationResult(false, Res.get("validation.phone.invalidCharacters", rawInput));
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private ValidationResult validateHasSufficientDigits(String rawInput, String pureNumber) {
|
||||
try {
|
||||
return ((pureNumber.length() - callingCode.length()) > 4)
|
||||
? new ValidationResult(true)
|
||||
: new ValidationResult(false, Res.get("validation.phone.insufficientDigits", rawInput));
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private ValidationResult validateIsNotTooLong(String rawInput, String pureNumber) {
|
||||
try {
|
||||
return ((pureNumber.length() - callingCode.length()) > 12)
|
||||
? new ValidationResult(false, Res.get("validation.phone.tooManyDigits", rawInput))
|
||||
: new ValidationResult(true);
|
||||
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private ValidationResult validateIncludedCountryDialingCode(String rawInput,
|
||||
boolean isCountryDialingCodeExplicit,
|
||||
boolean hasValidDialingCodePrefix) {
|
||||
try {
|
||||
if (isCountryDialingCodeExplicit && !hasValidDialingCodePrefix) {
|
||||
return new ValidationResult(false,
|
||||
Res.get("validation.phone.invalidDialingCode", rawInput, isoCountryCode, callingCode));
|
||||
} else {
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class PopmoneyValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class PromptPayValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
public final class RevolutValidator extends LengthValidator {
|
||||
public RevolutValidator() {
|
||||
// Not sure what are requirements for Revolut user names
|
||||
// Please keep in mind that even we force users to set user name at startup we should handle also the case
|
||||
// that the old accountID as phone number or email is displayed at the username text field and we do not
|
||||
// want to break validation in those cases. So being too strict on the validators might cause more troubles
|
||||
// as its worth...
|
||||
// UPDATE 04/2021: Revolut usernames could be edited (3-16 characters, lowercase a-z and numbers only)
|
||||
super(3, 100);
|
||||
}
|
||||
|
||||
public ValidationResult validate(String input) {
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.ParsingUtils;
|
||||
import bisq.core.util.validation.NumberValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class SecurityDepositValidator extends NumberValidator {
|
||||
|
||||
private PaymentAccount paymentAccount;
|
||||
|
||||
@Inject
|
||||
public SecurityDepositValidator() {
|
||||
}
|
||||
|
||||
public void setPaymentAccount(PaymentAccount paymentAccount) {
|
||||
this.paymentAccount = paymentAccount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = validateIfNotEmpty(input);
|
||||
if (result.isValid) {
|
||||
input = cleanInput(input);
|
||||
result = validateIfNumber(input);
|
||||
}
|
||||
|
||||
if (result.isValid) {
|
||||
result = result.andValidation(input,
|
||||
this::validateIfNotZero,
|
||||
this::validateIfNotNegative,
|
||||
this::validateIfNotTooLowPercentageValue,
|
||||
this::validateIfNotTooHighPercentageValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private ValidationResult validateIfNotTooLowPercentageValue(String input) {
|
||||
try {
|
||||
double percentage = ParsingUtils.parsePercentStringToDouble(input);
|
||||
double minPercentage = Restrictions.getMinBuyerSecurityDepositAsPercent();
|
||||
if (percentage < minPercentage)
|
||||
return new ValidationResult(false,
|
||||
Res.get("validation.inputTooSmall", FormattingUtils.formatToPercentWithSymbol(minPercentage)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private ValidationResult validateIfNotTooHighPercentageValue(String input) {
|
||||
try {
|
||||
double percentage = ParsingUtils.parsePercentStringToDouble(input);
|
||||
double maxPercentage = Restrictions.getMaxBuyerSecurityDepositAsPercent();
|
||||
if (percentage > maxPercentage)
|
||||
return new ValidationResult(false,
|
||||
Res.get("validation.inputTooLarge", FormattingUtils.formatToPercentWithSymbol(maxPercentage)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
return new ValidationResult(false, Res.get("validation.invalidInput", t.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class SepaIBANValidator extends IBANValidator {
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (result.isValid) {
|
||||
List<Country> sepaCountries = CountryUtil.getAllSepaCountries();
|
||||
String ibanCountryCode = input.substring(0, 2).toUpperCase();
|
||||
Optional<Country> ibanCountry = sepaCountries
|
||||
.stream()
|
||||
.filter(c -> c.code.equals(ibanCountryCode))
|
||||
.findFirst();
|
||||
|
||||
if (!ibanCountry.isPresent()) {
|
||||
return new ValidationResult(false, Res.get("validation.iban.sepaNotSupported"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
public final class SwishValidator extends PhoneNumberValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Public no-arg constructor required by Guice injector.
|
||||
// Superclass' isoCountryCode must be set before validation.
|
||||
public SwishValidator() {
|
||||
this.setIsoCountryCode("SE");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public final class TransferwiseValidator extends InputValidator {
|
||||
private final EmailValidator emailValidator;
|
||||
|
||||
@Inject
|
||||
public TransferwiseValidator(EmailValidator emailValidator) {
|
||||
this.emailValidator = emailValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
ValidationResult result = super.validate(input);
|
||||
|
||||
if (!result.isValid)
|
||||
return result;
|
||||
|
||||
return emailValidator.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class USPostalMoneyOrderValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class UpholdValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* 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.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
public final class WeChatPayValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
}
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
package bisq.desktop.main.offer.createoffer;
|
||||
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.btc.model.XmrAddressEntry;
|
||||
import bisq.core.btc.wallet.XmrWalletService;
|
||||
|
@ -33,6 +30,8 @@ import bisq.core.offer.OfferPayload;
|
|||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.payment.validation.SecurityDepositValidator;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.provider.price.MarketPrice;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import bisq.core.payment.validation.AccountNrValidator;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Before;
|
||||
|
|
|
@ -2,6 +2,8 @@ package bisq.desktop.util.validation;
|
|||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.validation.AdvancedCashValidator;
|
||||
import bisq.core.payment.validation.EmailValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import bisq.common.config.BaseCurrencyNetwork;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import bisq.core.payment.validation.BranchIdValidator;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Before;
|
||||
|
|
|
@ -22,6 +22,7 @@ import bisq.common.config.Config;
|
|||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.validation.BtcValidator;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.ImmutableCoinFormatter;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package bisq.desktop.util.validation;
|
|||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.validation.CapitualValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import bisq.common.config.BaseCurrencyNetwork;
|
||||
|
|
|
@ -19,7 +19,7 @@ package bisq.desktop.util.validation;
|
|||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import bisq.core.payment.validation.FiatVolumeValidator;
|
||||
import bisq.common.config.BaseCurrencyNetwork;
|
||||
import bisq.common.config.Config;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ package bisq.desktop.util.validation;
|
|||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.validation.InteracETransferAnswerValidator;
|
||||
import bisq.core.payment.validation.LengthValidator;
|
||||
import bisq.core.util.validation.RegexValidator;
|
||||
|
||||
import bisq.common.config.BaseCurrencyNetwork;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue