Add Payment method: Cash deposit (global)

This commit is contained in:
Manfred Karrer 2016-08-25 19:22:41 +02:00
parent cd4401a001
commit f1406b666e
14 changed files with 718 additions and 235 deletions

View file

@ -47,7 +47,7 @@ public abstract class BankAccountContractData extends CountryBasedPaymentAccount
@Override
public String getPaymentDetails() {
return "National Bank transfer - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
return "Bank account transfer - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
}
@Override

View file

@ -18,27 +18,27 @@
package io.bitsquare.payment;
import io.bitsquare.app.Version;
import io.bitsquare.locale.FiatCurrency;
public final class USCashDepositAccount extends PaymentAccount {
public final class CashDepositAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
public USCashDepositAccount() {
super(PaymentMethod.US_CASH_DEPOSIT);
setSingleTradeCurrency(new FiatCurrency("USD"));
public CashDepositAccount() {
super(PaymentMethod.CASH_DEPOSIT);
}
@Override
protected PaymentAccountContractData setContractData() {
return new USCashDepositAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
return new CashDepositAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setEmailOrMobileNr(String mobileNr) {
((USCashDepositAccountContractData) contractData).setEmailOrMobileNr(mobileNr);
@Override
public String getBankId() {
return ((BankAccountContractData) contractData).getBankId();
}
public String getEmailOrMobileNr() {
return ((USCashDepositAccountContractData) contractData).getEmailOrMobileNr();
@Override
public String getCountryCode() {
return getCountry() != null ? getCountry().code : "";
}
}

View file

@ -0,0 +1,138 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare 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.
*
* Bitsquare 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 Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.payment;
import io.bitsquare.app.Version;
import io.bitsquare.locale.BankUtil;
import io.bitsquare.locale.CountryUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
public class CashDepositAccountContractData extends CountryBasedPaymentAccountContractData {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
private static final Logger log = LoggerFactory.getLogger(CashDepositAccountContractData.class);
protected String holderName;
protected String bankName;
protected String bankId;
protected String branchId;
protected String accountNr;
protected String accountType;
@Nullable
protected String holderTaxId;
public CashDepositAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
super(paymentMethod, id, maxTradePeriod);
}
@Override
public String getPaymentDetails() {
return "Cash deposit - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
}
@Override
public String getPaymentDetailsForTradePopup() {
String bankName = BankUtil.isBankNameRequired(countryCode) ? BankUtil.getBankNameLabel(countryCode) + " " + this.bankName + "\n" : "";
String bankId = BankUtil.isBankIdRequired(countryCode) ? BankUtil.getBankIdLabel(countryCode) + " " + this.bankId + "\n" : "";
String branchId = BankUtil.isBranchIdRequired(countryCode) ? BankUtil.getBranchIdLabel(countryCode) + " " + this.branchId + "\n" : "";
String accountNr = BankUtil.isAccountNrRequired(countryCode) ? BankUtil.getAccountNrLabel(countryCode) + " " + this.accountNr + "\n" : "";
String accountType = BankUtil.isAccountTypeRequired(countryCode) ? BankUtil.getAccountTypeLabel(countryCode) + " " + this.accountType + "\n" : "";
String holderIdString = BankUtil.isHolderIdRequired(countryCode) ? (BankUtil.getHolderIdLabel(countryCode) + " " + holderTaxId + "\n") : "";
return "Holder name: " + holderName + "\n" +
bankName +
bankId +
branchId +
accountNr +
accountType +
holderIdString +
"Country of bank: " + CountryUtil.getNameAndCode(getCountryCode());
}
protected String getHolderIdLabel() {
return BankUtil.getHolderIdLabel(countryCode);
}
public void setHolderName(String holderName) {
this.holderName = holderName;
}
public String getHolderName() {
return holderName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
@Nullable
public String getBankName() {
return bankName;
}
public void setBankId(String bankId) {
this.bankId = bankId;
}
@Nullable
public String getBankId() {
return BankUtil.isBankIdRequired(countryCode) ? bankId : bankName;
}
public void setBranchId(String branchId) {
this.branchId = branchId;
}
@Nullable
public String getBranchId() {
return branchId;
}
public void setAccountNr(String accountNr) {
this.accountNr = accountNr;
}
@Nullable
public String getAccountNr() {
return accountNr;
}
public void setHolderTaxId(String holderTaxId) {
this.holderTaxId = holderTaxId;
}
@Nullable
public String getHolderTaxId() {
return holderTaxId;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
@Nullable
public String getAccountType() {
return accountType;
}
}

View file

@ -45,8 +45,8 @@ public class PaymentAccountFactory {
return new ClearXExchangeAccount();
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
return new USPostalMoneyOrderAccount();
case PaymentMethod.US_CASH_DEPOSIT_ID:
return new USCashDepositAccount();
case PaymentMethod.CASH_DEPOSIT_ID:
return new CashDepositAccount();
case PaymentMethod.BLOCK_CHAINS_ID:
return new CryptoCurrencyAccount();
default:

View file

@ -50,7 +50,7 @@ public final class PaymentMethod implements Persistable, Comparable {
public static final String ALI_PAY_ID = "ALI_PAY";
public static final String CLEAR_X_CHANGE_ID = "CLEAR_X_CHANGE";
public static final String US_POSTAL_MONEY_ORDER_ID = "US_POSTAL_MONEY_ORDER";
public static final String US_CASH_DEPOSIT_ID = "US_CASH_DEPOSIT";
public static final String CASH_DEPOSIT_ID = "CASH_DEPOSIT";
public static final String BLOCK_CHAINS_ID = "BLOCK_CHAINS";
public static PaymentMethod OK_PAY;
@ -63,7 +63,7 @@ public final class PaymentMethod implements Persistable, Comparable {
public static PaymentMethod ALI_PAY;
public static PaymentMethod CLEAR_X_CHANGE;
public static PaymentMethod US_POSTAL_MONEY_ORDER;
public static PaymentMethod US_CASH_DEPOSIT;
public static PaymentMethod CASH_DEPOSIT;
public static PaymentMethod BLOCK_CHAINS;
public static final List<PaymentMethod> ALL_VALUES = new ArrayList<>(Arrays.asList(
@ -77,7 +77,7 @@ public final class PaymentMethod implements Persistable, Comparable {
ALI_PAY = new PaymentMethod(ALI_PAY_ID, 0, DAY, Coin.parseCoin("1.5")),
CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 0, 8 * DAY, Coin.parseCoin("0.5")),
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
US_CASH_DEPOSIT = new PaymentMethod(US_CASH_DEPOSIT_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, 0, DAY, Coin.parseCoin("2"))
));

View file

@ -1,49 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare 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.
*
* Bitsquare 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 Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.payment;
import io.bitsquare.app.Version;
public final class USCashDepositAccountContractData extends PaymentAccountContractData {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
private String mobileNr;
public USCashDepositAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
super(paymentMethod, id, maxTradePeriod);
}
public void setEmailOrMobileNr(String mobileNr) {
this.mobileNr = mobileNr;
}
public String getEmailOrMobileNr() {
return mobileNr;
}
@Override
public String getPaymentDetails() {
return "US Cash Deposit - Email or mobile nr.: " + mobileNr;
}
@Override
public String getPaymentDetailsForTradePopup() {
return "Email or mobile nr.: " + mobileNr;
}
}

View file

@ -251,6 +251,7 @@ abstract class BankForm extends PaymentMethodForm {
ComboBox<Country> countryComboBox = tuple3.third;
countryComboBox.setVisibleRowCount(20);
countryComboBox.setDisable(true);
countryComboBox.setPromptText("Select country");
countryComboBox.setConverter(new StringConverter<Country>() {
@ -269,7 +270,7 @@ abstract class BankForm extends PaymentMethodForm {
if (selectedItem != null) {
if (selectedItem.code.equals("US")) {
new Popup<>().information("Bank transfer with WIRE or ACH is not supported for the US because WIRE is too expensive and ACH has a high chargeback risk.\n\n" +
"Please use payment methods \"ClearXchange\", \"US Postal Money Order\" or \"US Cash Deposit\" instead.")
"Please use payment methods \"ClearXchange\", \"US Postal Money Order\" or \"Cash Deposit\" instead.")
.onClose(() -> closeHandler.run())
.show();
} else {

View file

@ -0,0 +1,546 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare 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.
*
* Bitsquare 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 Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.components.paymentmethods;
import io.bitsquare.common.util.Tuple2;
import io.bitsquare.common.util.Tuple3;
import io.bitsquare.common.util.Tuple4;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.Layout;
import io.bitsquare.gui.util.validation.AccountNrValidator;
import io.bitsquare.gui.util.validation.BankIdValidator;
import io.bitsquare.gui.util.validation.BranchIdValidator;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.*;
import io.bitsquare.payment.CashDepositAccountContractData;
import io.bitsquare.payment.CountryBasedPaymentAccount;
import io.bitsquare.payment.PaymentAccount;
import io.bitsquare.payment.PaymentAccountContractData;
import javafx.collections.FXCollections;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.util.StringConverter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.FormBuilder.*;
public class CashDepositForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(CashDepositForm.class);
protected final CashDepositAccountContractData cashDepositAccountContractData;
private InputTextField bankNameInputTextField, bankIdInputTextField, branchIdInputTextField, accountNrInputTextField, holderIdInputTextField;
private TextField currencyTextField;
private Label holderIdLabel;
protected InputTextField holderNameInputTextField;
private Label bankIdLabel;
private Label branchIdLabel;
private Label accountNrLabel;
private Tuple2<Label, InputTextField> bankIdTuple;
private Tuple2<Label, InputTextField> accountNrTuple;
private Tuple2<Label, InputTextField> branchIdTuple;
private Tuple2<Label, InputTextField> bankNameTuple;
private Tuple2<Label, ComboBox> accountTypeTuple;
private Label accountTypeLabel;
private ComboBox<String> accountTypeComboBox;
private boolean validatorsApplied;
private boolean useHolderID;
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
CashDepositAccountContractData data = (CashDepositAccountContractData) paymentAccountContractData;
String countryCode = ((CashDepositAccountContractData) paymentAccountContractData).getCountryCode();
if (data.getHolderTaxId() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / " + BankUtil.getHolderIdLabel(countryCode),
data.getHolderName() + " / " + data.getHolderTaxId());
else
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name:", data.getHolderName());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(countryCode));
// We don't want to display more than 6 rows to avoid scrolling, so if we get too many fields we combine them horizontally
int nrRows = 0;
if (BankUtil.isBankNameRequired(countryCode))
nrRows++;
if (BankUtil.isBankIdRequired(countryCode))
nrRows++;
if (BankUtil.isBranchIdRequired(countryCode))
nrRows++;
if (BankUtil.isAccountNrRequired(countryCode))
nrRows++;
if (BankUtil.isAccountTypeRequired(countryCode))
nrRows++;
String bankNameLabel = BankUtil.getBankNameLabel(countryCode);
String bankIdLabel = BankUtil.getBankIdLabel(countryCode);
String branchIdLabel = BankUtil.getBranchIdLabel(countryCode);
String accountNrLabel = BankUtil.getAccountNrLabel(countryCode);
String accountTypeLabel = BankUtil.getAccountTypeLabel(countryCode);
boolean accountNrAccountTypeCombined = false;
boolean bankNameBankIdCombined = false;
boolean bankIdBranchIdCombined = false;
boolean bankNameBranchIdCombined = false;
boolean branchIdAccountNrCombined = false;
if (nrRows > 2) {
// Try combine AccountNr + AccountType
accountNrAccountTypeCombined = BankUtil.isAccountNrRequired(countryCode) && BankUtil.isAccountTypeRequired(countryCode);
if (accountNrAccountTypeCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankName + BankId
bankNameBankIdCombined = BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode);
if (bankNameBankIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankIdBranchIdCombined = !bankNameBankIdCombined && BankUtil.isBankIdRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankIdBranchIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankNameBranchIdCombined = !bankNameBankIdCombined && !bankIdBranchIdCombined &&
BankUtil.isBankNameRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankNameBranchIdCombined)
nrRows--;
if (nrRows > 2) {
branchIdAccountNrCombined = !bankNameBranchIdCombined && !bankIdBranchIdCombined && !accountNrAccountTypeCombined &&
BankUtil.isBranchIdRequired(countryCode) && BankUtil.isAccountNrRequired(countryCode);
if (branchIdAccountNrCombined)
nrRows--;
if (nrRows > 2)
log.warn("We still have too many rows....");
}
}
}
}
}
if (bankNameBankIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + bankIdLabel.substring(0, bankIdLabel.length() - 1) + ":",
data.getBankName() + " / " + data.getBankId());
}
if (bankNameBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":",
data.getBankName() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel, data.getBankName());
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && !branchIdAccountNrCombined && bankIdBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
bankIdLabel.substring(0, bankIdLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":",
data.getBankId() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel, data.getBankId());
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && branchIdAccountNrCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
branchIdLabel.substring(0, branchIdLabel.length() - 1) + " / " + accountNrLabel.substring(0, accountNrLabel.length() - 1) + ":",
data.getBranchId() + " / " + data.getAccountNr());
}
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && !branchIdAccountNrCombined && BankUtil.isBranchIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel, data.getBranchId());
if (!branchIdAccountNrCombined && accountNrAccountTypeCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
accountNrLabel.substring(0, accountNrLabel.length() - 1) + " / " + accountTypeLabel,
data.getAccountNr() + " / " + data.getAccountType());
}
if (!branchIdAccountNrCombined && !accountNrAccountTypeCombined && BankUtil.isAccountNrRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel, data.getAccountNr());
if (!accountNrAccountTypeCombined && BankUtil.isAccountTypeRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountTypeLabel, data.getAccountType());
return gridRow;
}
public CashDepositForm(PaymentAccount paymentAccount, InputValidator inputValidator,
GridPane gridPane, int gridRow, BSFormatter formatter) {
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
this.cashDepositAccountContractData = (CashDepositAccountContractData) paymentAccount.contractData;
}
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
String countryCode = cashDepositAccountContractData.getCountryCode();
addLabelTextField(gridPane, gridRow, "Account name:", paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(paymentAccount.getPaymentMethod().getId()));
addLabelTextField(gridPane, ++gridRow, "Country:", getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
addLabelTextField(gridPane, ++gridRow, "Currency:", paymentAccount.getSingleTradeCurrency().getNameAndCode());
addAcceptedBanksForDisplayAccount();
addHolderNameAndIdForDisplayAccount();
if (BankUtil.isBankNameRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, "Bank name:", cashDepositAccountContractData.getBankName()).second.setMouseTransparent(false);
if (BankUtil.isBankIdRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(countryCode), cashDepositAccountContractData.getBankId()).second.setMouseTransparent(false);
if (BankUtil.isBranchIdRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(countryCode), cashDepositAccountContractData.getBranchId()).second.setMouseTransparent(false);
if (BankUtil.isAccountNrRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(countryCode), cashDepositAccountContractData.getAccountNr()).second.setMouseTransparent(false);
if (BankUtil.isAccountTypeRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getAccountTypeLabel(countryCode), cashDepositAccountContractData.getAccountType()).second.setMouseTransparent(false);
addAllowedPeriod();
}
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:");
currencyTextField = addLabelTextField(gridPane, ++gridRow, "Currency:").second;
currencyTextField.setMouseTransparent(true);
ComboBox<Region> regionComboBox = tuple3.second;
regionComboBox.setPromptText("Select region");
regionComboBox.setConverter(new StringConverter<Region>() {
@Override
public String toString(Region region) {
return region.name;
}
@Override
public Region fromString(String s) {
return null;
}
});
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
ComboBox<Country> countryComboBox = tuple3.third;
countryComboBox.setVisibleRowCount(20);
countryComboBox.setDisable(true);
countryComboBox.setPromptText("Select country");
countryComboBox.setConverter(new StringConverter<Country>() {
@Override
public String toString(Country country) {
return country.name + " (" + country.code + ")";
}
@Override
public Country fromString(String s) {
return null;
}
});
countryComboBox.setOnAction(e -> {
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
getCountryBasedPaymentAccount().setCountry(selectedItem);
String countryCode = selectedItem.code;
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
paymentAccount.setSingleTradeCurrency(currency);
currencyTextField.setText(currency.getNameAndCode());
bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
bankNameInputTextField.setText("");
bankIdInputTextField.setText("");
branchIdInputTextField.setText("");
accountNrInputTextField.setText("");
accountTypeComboBox.getSelectionModel().clearSelection();
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
validatorsApplied = true;
if (useHolderID)
holderIdInputTextField.setValidator(inputValidator);
bankNameInputTextField.setValidator(inputValidator);
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
} else {
validatorsApplied = false;
if (useHolderID)
holderIdInputTextField.setValidator(null);
bankNameInputTextField.setValidator(null);
bankIdInputTextField.setValidator(null);
branchIdInputTextField.setValidator(null);
accountNrInputTextField.setValidator(null);
}
holderNameInputTextField.resetValidation();
bankNameInputTextField.resetValidation();
bankIdInputTextField.resetValidation();
branchIdInputTextField.resetValidation();
accountNrInputTextField.resetValidation();
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
if (requiresHolderId) {
holderNameInputTextField.minWidthProperty().unbind();
holderNameInputTextField.setMinWidth(300);
} else {
holderNameInputTextField.minWidthProperty().bind(currencyTextField.widthProperty());
}
if (useHolderID) {
if (!requiresHolderId)
holderIdInputTextField.setText("");
holderIdInputTextField.resetValidation();
holderIdInputTextField.setVisible(requiresHolderId);
holderIdInputTextField.setManaged(requiresHolderId);
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
holderIdLabel.setVisible(requiresHolderId);
holderIdLabel.setManaged(requiresHolderId);
}
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
bankNameTuple.first.setVisible(bankNameRequired);
bankNameTuple.first.setManaged(bankNameRequired);
bankNameInputTextField.setVisible(bankNameRequired);
bankNameInputTextField.setManaged(bankNameRequired);
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
bankIdTuple.first.setVisible(bankIdRequired);
bankIdTuple.first.setManaged(bankIdRequired);
bankIdInputTextField.setVisible(bankIdRequired);
bankIdInputTextField.setManaged(bankIdRequired);
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
branchIdTuple.first.setVisible(branchIdRequired);
branchIdTuple.first.setManaged(branchIdRequired);
branchIdInputTextField.setVisible(branchIdRequired);
branchIdInputTextField.setManaged(branchIdRequired);
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
accountNrTuple.first.setVisible(accountNrRequired);
accountNrTuple.first.setManaged(accountNrRequired);
accountNrInputTextField.setVisible(accountNrRequired);
accountNrInputTextField.setManaged(accountNrRequired);
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
accountTypeTuple.first.setVisible(accountTypeRequired);
accountTypeTuple.first.setManaged(accountTypeRequired);
accountTypeTuple.second.setVisible(accountTypeRequired);
accountTypeTuple.second.setManaged(accountTypeRequired);
updateFromInputs();
onCountryChanged();
}
});
regionComboBox.setOnAction(e -> {
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
countryComboBox.setDisable(false);
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
}
});
addAcceptedBanksForAddAccount();
addHolderNameAndId();
bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:");
bankNameInputTextField = bankNameTuple.second;
bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBankName(newValue);
updateFromInputs();
});
bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
bankIdLabel = bankIdTuple.first;
bankIdInputTextField = bankIdTuple.second;
bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBankId(newValue);
updateFromInputs();
});
branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
branchIdLabel = branchIdTuple.first;
branchIdInputTextField = branchIdTuple.second;
branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBranchId(newValue);
updateFromInputs();
});
accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
accountNrLabel = accountNrTuple.first;
accountNrInputTextField = accountNrTuple.second;
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setAccountNr(newValue);
updateFromInputs();
});
accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
accountTypeLabel = accountTypeTuple.first;
accountTypeComboBox = accountTypeTuple.second;
accountTypeComboBox.setPromptText("Select account type");
accountTypeComboBox.setOnAction(e -> {
if (BankUtil.isAccountTypeRequired(cashDepositAccountContractData.getCountryCode())) {
cashDepositAccountContractData.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem());
updateFromInputs();
}
});
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
updateFromInputs();
}
private CountryBasedPaymentAccount getCountryBasedPaymentAccount() {
return (CountryBasedPaymentAccount) this.paymentAccount;
}
protected void onCountryChanged() {
}
protected void addHolderNameAndId() {
Tuple4<Label, InputTextField, Label, InputTextField> tuple = addLabelInputTextFieldLabelInputTextField(gridPane, ++gridRow, "Account holder name:", BankUtil.getHolderIdLabel(""));
holderNameInputTextField = tuple.second;
holderNameInputTextField.setMinWidth(300);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setHolderName(newValue);
updateFromInputs();
});
holderNameInputTextField.minWidthProperty().bind(currencyTextField.widthProperty());
holderNameInputTextField.setValidator(inputValidator);
useHolderID = true;
holderIdLabel = tuple.third;
holderIdLabel.setVisible(false);
holderIdLabel.setManaged(false);
holderIdInputTextField = tuple.forth;
holderIdInputTextField.setVisible(false);
holderIdInputTextField.setManaged(false);
holderIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setHolderTaxId(newValue);
updateFromInputs();
});
}
@Override
protected void autoFillNameTextField() {
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
String bankId = null;
String countryCode = cashDepositAccountContractData.getCountryCode();
if (countryCode == null)
countryCode = "";
if (BankUtil.isBankIdRequired(countryCode)) {
bankId = bankIdInputTextField.getText();
if (bankId.length() > 9)
bankId = StringUtils.abbreviate(bankId, 9);
} else if (BankUtil.isBranchIdRequired(countryCode)) {
bankId = branchIdInputTextField.getText();
if (bankId.length() > 9)
bankId = StringUtils.abbreviate(bankId, 9);
} else if (BankUtil.isBankNameRequired(countryCode)) {
bankId = bankNameInputTextField.getText();
if (bankId.length() > 9)
bankId = StringUtils.abbreviate(bankId, 9);
}
String accountNr = accountNrInputTextField.getText();
if (accountNr.length() > 9)
accountNr = StringUtils.abbreviate(accountNr, 9);
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
if (bankId != null && !bankId.isEmpty())
accountNameTextField.setText(method.concat(": ").concat(bankId).concat(", ").concat(accountNr));
else
accountNameTextField.setText(method.concat(": ").concat(accountNr));
}
}
@Override
public void updateAllInputsValid() {
boolean result = isAccountNameValid()
&& paymentAccount.getSingleTradeCurrency() != null
&& getCountryBasedPaymentAccount().getCountry() != null
&& holderNameInputTextField.getValidator().validate(cashDepositAccountContractData.getHolderName()).isValid;
String countryCode = cashDepositAccountContractData.getCountryCode();
if (validatorsApplied && BankUtil.useValidation(countryCode)) {
if (BankUtil.isBankNameRequired(countryCode))
result &= bankNameInputTextField.getValidator().validate(cashDepositAccountContractData.getBankName()).isValid;
if (BankUtil.isBankIdRequired(countryCode))
result &= bankIdInputTextField.getValidator().validate(cashDepositAccountContractData.getBankId()).isValid;
if (BankUtil.isBranchIdRequired(countryCode))
result &= branchIdInputTextField.getValidator().validate(cashDepositAccountContractData.getBranchId()).isValid;
if (BankUtil.isAccountNrRequired(countryCode))
result &= accountNrInputTextField.getValidator().validate(cashDepositAccountContractData.getAccountNr()).isValid;
if (BankUtil.isAccountTypeRequired(countryCode))
result &= cashDepositAccountContractData.getAccountType() != null;
if (useHolderID && BankUtil.isHolderIdRequired(countryCode))
result &= holderIdInputTextField.getValidator().validate(cashDepositAccountContractData.getHolderTaxId()).isValid;
}
allInputsValid.set(result);
}
protected void addHolderNameAndIdForDisplayAccount() {
String countryCode = cashDepositAccountContractData.getCountryCode();
if (BankUtil.isHolderIdRequired(countryCode)) {
Tuple4<Label, TextField, Label, TextField> tuple = addLabelTextFieldLabelTextField(gridPane, ++gridRow,
"Account holder name:", BankUtil.getHolderIdLabel(countryCode));
TextField holderNameTextField = tuple.second;
holderNameTextField.setText(cashDepositAccountContractData.getHolderName());
holderNameTextField.setMinWidth(300);
tuple.forth.setText(cashDepositAccountContractData.getHolderTaxId());
} else {
addLabelTextField(gridPane, ++gridRow, "Account holder name:", cashDepositAccountContractData.getHolderName());
}
}
protected void addAcceptedBanksForAddAccount() {
}
public void addAcceptedBanksForDisplayAccount() {
}
}

View file

@ -1,110 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare 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.
*
* Bitsquare 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 Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.components.paymentmethods;
import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.Layout;
import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.util.validation.USCashDepositValidator;
import io.bitsquare.locale.BSResources;
import io.bitsquare.payment.PaymentAccount;
import io.bitsquare.payment.PaymentAccountContractData;
import io.bitsquare.payment.USCashDepositAccount;
import io.bitsquare.payment.USCashDepositAccountContractData;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.FormBuilder.addLabelInputTextField;
import static io.bitsquare.gui.util.FormBuilder.addLabelTextField;
public class USCashDepositForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(USCashDepositForm.class);
private final USCashDepositAccount usCashDepositAccount;
private final USCashDepositValidator usCashDepositValidator;
private InputTextField mobileNrInputTextField;
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
addLabelTextField(gridPane, ++gridRow, "Account holder name:", ((USCashDepositAccountContractData) paymentAccountContractData).getEmailOrMobileNr());
addLabelTextField(gridPane, ++gridRow, "Mobile nr.:", ((USCashDepositAccountContractData) paymentAccountContractData).getEmailOrMobileNr());
return gridRow;
}
public USCashDepositForm(PaymentAccount paymentAccount, USCashDepositValidator usCashDepositValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
this.usCashDepositAccount = (USCashDepositAccount) paymentAccount;
this.usCashDepositValidator = usCashDepositValidator;
}
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
holderNameInputTextField.setValidator(inputValidator);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
usCashDepositAccount.setEmailOrMobileNr(newValue);
updateFromInputs();
});
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Mobile nr.:").second;
mobileNrInputTextField.setValidator(usCashDepositValidator);
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
usCashDepositAccount.setEmailOrMobileNr(newValue);
updateFromInputs();
});
addLabelTextField(gridPane, ++gridRow, "Currency:", usCashDepositAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
}
@Override
protected void autoFillNameTextField() {
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
String mobileNr = mobileNrInputTextField.getText();
mobileNr = StringUtils.abbreviate(mobileNr, 9);
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
accountNameTextField.setText(method.concat(": ").concat(mobileNr));
}
}
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
addLabelTextField(gridPane, gridRow, "Account name:", usCashDepositAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(usCashDepositAccount.getPaymentMethod().getId()));
addLabelTextField(gridPane, ++gridRow, "Account holder name:", usCashDepositAccount.getEmailOrMobileNr());
TextField field = addLabelTextField(gridPane, ++gridRow, "Mobile nr.:", usCashDepositAccount.getEmailOrMobileNr()).second;
field.setMouseTransparent(false);
addLabelTextField(gridPane, ++gridRow, "Currency:", usCashDepositAccount.getSingleTradeCurrency().getNameAndCode());
addAllowedPeriod();
}
@Override
public void updateAllInputsValid() {
allInputsValid.set(isAccountNameValid()
&& usCashDepositValidator.validate(usCashDepositAccount.getEmailOrMobileNr()).isValid
&& inputValidator.validate(usCashDepositAccount.getEmailOrMobileNr()).isValid
&& usCashDepositAccount.getTradeCurrencies().size() > 0);
}
}

View file

@ -56,7 +56,7 @@ import static io.bitsquare.gui.util.FormBuilder.*;
public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAccountsViewModel> {
private ListView<PaymentAccount> paymentAccountsListView;
private ComboBox<PaymentMethod> paymentMethodsComboBox;
private ComboBox<PaymentMethod> paymentMethodComboBox;
private final IBANValidator ibanValidator;
private final BICValidator bicValidator;
@ -67,9 +67,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
private final SwishValidator swishValidator;
private final ClearXExchangeValidator clearXExchangeValidator;
private final USPostalMoneyOrderValidator usPostalMoneyOrderValidator;
private final USCashDepositValidator usCashDepositValidator;
private final AltCoinAddressValidator altCoinAddressValidator;
private BSFormatter formatter;
private PaymentMethodForm paymentMethodForm;
@ -89,8 +87,6 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
SwishValidator swishValidator,
ClearXExchangeValidator clearXExchangeValidator,
USPostalMoneyOrderValidator usPostalMoneyOrderValidator,
USCashDepositValidator usCashDepositValidator,
AltCoinAddressValidator altCoinAddressValidator,
BSFormatter formatter) {
super(model);
@ -103,8 +99,6 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
this.swishValidator = swishValidator;
this.clearXExchangeValidator = clearXExchangeValidator;
this.usPostalMoneyOrderValidator = usPostalMoneyOrderValidator;
this.usCashDepositValidator = usCashDepositValidator;
this.altCoinAddressValidator = altCoinAddressValidator;
this.formatter = formatter;
}
@ -233,14 +227,15 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
removeAccountRows();
addAccountButton.setDisable(true);
accountTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, "Create new account", Layout.GROUP_DISTANCE);
paymentMethodsComboBox = addLabelComboBox(root, gridRow, "Payment method:", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
paymentMethodsComboBox.setPromptText("Select payment method");
paymentMethodsComboBox.setPrefWidth(250);
paymentMethodComboBox = addLabelComboBox(root, gridRow, "Payment method:", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
paymentMethodComboBox.setPromptText("Select payment method");
paymentMethodComboBox.setVisibleRowCount(20);
paymentMethodComboBox.setPrefWidth(250);
List<PaymentMethod> list = PaymentMethod.ALL_VALUES.stream()
.filter(paymentMethod -> !paymentMethod.getId().equals(PaymentMethod.BLOCK_CHAINS_ID))
.collect(Collectors.toList());
paymentMethodsComboBox.setItems(FXCollections.observableArrayList(list));
paymentMethodsComboBox.setConverter(new StringConverter<PaymentMethod>() {
paymentMethodComboBox.setItems(FXCollections.observableArrayList(list));
paymentMethodComboBox.setConverter(new StringConverter<PaymentMethod>() {
@Override
public String toString(PaymentMethod paymentMethod) {
return paymentMethod != null ? BSResources.get(paymentMethod.getId()) : "";
@ -251,13 +246,13 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
return null;
}
});
paymentMethodsComboBox.setOnAction(e -> {
paymentMethodComboBox.setOnAction(e -> {
if (paymentMethodForm != null) {
FormBuilder.removeRowsFromGridPane(root, 3, paymentMethodForm.getGridRow() + 1);
GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
}
gridRow = 2;
paymentMethodForm = getPaymentMethodForm(paymentMethodsComboBox.getSelectionModel().getSelectedItem());
paymentMethodForm = getPaymentMethodForm(paymentMethodComboBox.getSelectionModel().getSelectedItem());
if (paymentMethodForm != null) {
paymentMethodForm.addFormForAddAccount();
gridRow = paymentMethodForm.getGridRow();
@ -326,8 +321,8 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
return new ClearXExchangeForm(paymentAccount, clearXExchangeValidator, inputValidator, root, gridRow, formatter);
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
return new USPostalMoneyOrderForm(paymentAccount, usPostalMoneyOrderValidator, inputValidator, root, gridRow, formatter);
case PaymentMethod.US_CASH_DEPOSIT_ID:
return new USCashDepositForm(paymentAccount, usCashDepositValidator, inputValidator, root, gridRow, formatter);
case PaymentMethod.CASH_DEPOSIT_ID:
return new CashDepositForm(paymentAccount, inputValidator, root, gridRow, formatter);
default:
log.error("Not supported PaymentMethod: " + paymentMethod);
return null;

View file

@ -115,6 +115,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
paymentMethodComboBox = addLabelComboBox(root, ++gridRow, "Filter by payment method:").second;
paymentMethodComboBox.setPromptText("Select payment method");
paymentMethodComboBox.setVisibleRowCount(20);
paymentMethodComboBox.setConverter(new StringConverter<PaymentMethod>() {
@Override
public String toString(PaymentMethod paymentMethod) {

View file

@ -166,8 +166,8 @@ public class BuyerStep2View extends TradeStepView {
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
break;
case PaymentMethod.US_CASH_DEPOSIT_ID:
gridRow = USCashDepositForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
case PaymentMethod.CASH_DEPOSIT_ID:
gridRow = CashDepositForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
break;
case PaymentMethod.BLOCK_CHAINS_ID:
String labelTitle = "Sellers " + CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()) + " address:";

View file

@ -1,39 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare 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.
*
* Bitsquare 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 Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.util.validation;
public final class USCashDepositValidator extends InputValidator {
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public ValidationResult validate(String input) {
// TODO
return super.validate(input);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
}

View file

@ -156,7 +156,7 @@ SPECIFIC_BANKS=Transfers with specific banks
SWISH= Swish
CLEAR_X_CHANGE=ClearXchange
US_POSTAL_MONEY_ORDER=US Postal money order
US_CASH_DEPOSIT=US Cash Deposit
CASH_DEPOSIT=Cash Deposit
BLOCK_CHAINS=Altcoins
@ -172,6 +172,6 @@ FED_WIRE_SHORT=Fed Wire
SWISH_SHORT= Swish
CLEAR_X_CHANGE_SHORT=ClearXchange
US_POSTAL_MONEY_ORDER_SHORT=US money order
US_CASH_DEPOSIT_SHORT=US Cash Deposit
CASH_DEPOSIT_SHORT=Cash Deposit
BLOCK_CHAINS_SHORT=Altcoins