mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Added new payment methods: Chase QuickPay, Interac e-Transfer
This commit is contained in:
parent
ed72442f5c
commit
211b07ff59
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.FiatCurrency;
|
||||
|
||||
public final class ChaseQuickPayAccount extends PaymentAccount {
|
||||
// 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 ChaseQuickPayAccount() {
|
||||
super(PaymentMethod.CHASE_QUICK_PAY);
|
||||
setSingleTradeCurrency(new FiatCurrency("USD"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountContractData setContractData() {
|
||||
return new ChaseQuickPayAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
((ChaseQuickPayAccountContractData) contractData).setEmail(email);
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return ((ChaseQuickPayAccountContractData) contractData).getEmail();
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
((ChaseQuickPayAccountContractData) contractData).setHolderName(holderName);
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return ((ChaseQuickPayAccountContractData) contractData).getHolderName();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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 ChaseQuickPayAccountContractData 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 email;
|
||||
private String holderName;
|
||||
|
||||
public ChaseQuickPayAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Chase QuickPay - Holder name: " + holderName + ", email: " + email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return "Holder name: " + holderName + "\n" +
|
||||
"Email: " + email;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.FiatCurrency;
|
||||
|
||||
public final class InteracETransferAccount extends PaymentAccount {
|
||||
// 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 InteracETransferAccount() {
|
||||
super(PaymentMethod.INTERAC_E_TRANSFER);
|
||||
setSingleTradeCurrency(new FiatCurrency("CAD"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountContractData setContractData() {
|
||||
return new InteracETransferAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
((InteracETransferAccountContractData) contractData).setEmail(email);
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return ((InteracETransferAccountContractData) contractData).getEmail();
|
||||
}
|
||||
|
||||
public void setQuestion(String question) {
|
||||
((InteracETransferAccountContractData) contractData).setQuestion(question);
|
||||
}
|
||||
|
||||
public String getQuestion() {
|
||||
return ((InteracETransferAccountContractData) contractData).getQuestion();
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
((InteracETransferAccountContractData) contractData).setHolderName(holderName);
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return ((InteracETransferAccountContractData) contractData).getHolderName();
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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 InteracETransferAccountContractData 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 email;
|
||||
private String holderName;
|
||||
private String question;
|
||||
|
||||
public InteracETransferAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
public void setQuestion(String question) {
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Interac e-Transfer - Holder name: " + holderName + ", email: " + email + ", secret question: " + question;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return "Holder name: " + holderName + "\n" +
|
||||
"Email: " + email + "\n" +
|
||||
"Secret question: " + question;
|
||||
}
|
||||
}
|
@ -45,6 +45,10 @@ public class PaymentAccountFactory {
|
||||
return new SwishAccount();
|
||||
case PaymentMethod.CLEAR_X_CHANGE_ID:
|
||||
return new ClearXchangeAccount();
|
||||
case PaymentMethod.CHASE_QUICK_PAY_ID:
|
||||
return new ChaseQuickPayAccount();
|
||||
case PaymentMethod.INTERAC_E_TRANSFER_ID:
|
||||
return new InteracETransferAccount();
|
||||
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
|
||||
return new USPostalMoneyOrderAccount();
|
||||
case PaymentMethod.CASH_DEPOSIT_ID:
|
||||
|
@ -51,6 +51,8 @@ public final class PaymentMethod implements Persistable, Comparable {
|
||||
public static final String SWISH_ID = "SWISH";
|
||||
public static final String ALI_PAY_ID = "ALI_PAY";
|
||||
public static final String CLEAR_X_CHANGE_ID = "CLEAR_X_CHANGE";
|
||||
public static final String CHASE_QUICK_PAY_ID = "CHASE_QUICK_PAY";
|
||||
public static final String INTERAC_E_TRANSFER_ID = "INTERAC_E_TRANSFER";
|
||||
public static final String US_POSTAL_MONEY_ORDER_ID = "US_POSTAL_MONEY_ORDER";
|
||||
public static final String CASH_DEPOSIT_ID = "CASH_DEPOSIT";
|
||||
public static final String BLOCK_CHAINS_ID = "BLOCK_CHAINS";
|
||||
@ -65,23 +67,44 @@ public final class PaymentMethod implements Persistable, Comparable {
|
||||
public static PaymentMethod SWISH;
|
||||
public static PaymentMethod ALI_PAY;
|
||||
public static PaymentMethod CLEAR_X_CHANGE;
|
||||
public static PaymentMethod CHASE_QUICK_PAY;
|
||||
public static PaymentMethod INTERAC_E_TRANSFER;
|
||||
public static PaymentMethod US_POSTAL_MONEY_ORDER;
|
||||
public static PaymentMethod CASH_DEPOSIT;
|
||||
public static PaymentMethod BLOCK_CHAINS;
|
||||
|
||||
public static final List<PaymentMethod> ALL_VALUES = new ArrayList<>(Arrays.asList(
|
||||
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY, Coin.parseCoin("2")), // tx instant so min. wait time
|
||||
// EUR
|
||||
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY, Coin.parseCoin("1")), // sepa takes 1-3 business days. We use 8 days to include safety for holidays
|
||||
FASTER_PAYMENTS = new PaymentMethod(FASTER_PAYMENTS_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 0, 8 * DAY, Coin.parseCoin("1")),
|
||||
SWISH = new PaymentMethod(SWISH_ID, 0, DAY, Coin.parseCoin("2")),
|
||||
|
||||
// Global
|
||||
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 0, 4 * DAY, Coin.parseCoin("1")),
|
||||
SAME_BANK = new PaymentMethod(SAME_BANK_ID, 0, 2 * DAY, Coin.parseCoin("1")),
|
||||
SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 0, 4 * DAY, Coin.parseCoin("1")),
|
||||
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 0, 4 * DAY, Coin.parseCoin("1")),
|
||||
|
||||
// Trans national
|
||||
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY, Coin.parseCoin("2")),
|
||||
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
|
||||
// UK
|
||||
FASTER_PAYMENTS = new PaymentMethod(FASTER_PAYMENTS_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
|
||||
// Canada
|
||||
INTERAC_E_TRANSFER = new PaymentMethod(INTERAC_E_TRANSFER_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
|
||||
// US
|
||||
CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 0, 4 * DAY, Coin.parseCoin("1")),
|
||||
CHASE_QUICK_PAY = new PaymentMethod(CHASE_QUICK_PAY_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 0, 4 * DAY, Coin.parseCoin("1")),
|
||||
|
||||
// Sweden
|
||||
SWISH = new PaymentMethod(SWISH_ID, 0, DAY, Coin.parseCoin("2")),
|
||||
|
||||
// China
|
||||
ALI_PAY = new PaymentMethod(ALI_PAY_ID, 0, DAY, Coin.parseCoin("2")),
|
||||
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 0, 6 * DAY, Coin.parseCoin("1")),
|
||||
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 0, 6 * DAY, Coin.parseCoin("1")),
|
||||
|
||||
// Altcoins
|
||||
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, 0, DAY, Coin.parseCoin("3"))
|
||||
));
|
||||
|
||||
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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.ChaseQuickPayValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.payment.ChaseQuickPayAccount;
|
||||
import io.bitsquare.payment.ChaseQuickPayAccountContractData;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
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 ChaseQuickPayForm extends PaymentMethodForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(ChaseQuickPayForm.class);
|
||||
|
||||
private final ChaseQuickPayAccount chaseQuickPayAccount;
|
||||
private final ChaseQuickPayValidator chaseQuickPayValidator;
|
||||
private InputTextField mobileNrInputTextField;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", ((ChaseQuickPayAccountContractData) paymentAccountContractData).getHolderName());
|
||||
addLabelTextField(gridPane, ++gridRow, "Email:", ((ChaseQuickPayAccountContractData) paymentAccountContractData).getEmail());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public ChaseQuickPayForm(PaymentAccount paymentAccount, ChaseQuickPayValidator chaseQuickPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
|
||||
this.chaseQuickPayAccount = (ChaseQuickPayAccount) paymentAccount;
|
||||
this.chaseQuickPayValidator = chaseQuickPayValidator;
|
||||
}
|
||||
|
||||
@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) -> {
|
||||
chaseQuickPayAccount.setHolderName(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Email:").second;
|
||||
mobileNrInputTextField.setValidator(chaseQuickPayValidator);
|
||||
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
chaseQuickPayAccount.setEmail(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", chaseQuickPayAccount.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:", chaseQuickPayAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(chaseQuickPayAccount.getPaymentMethod().getId()));
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", chaseQuickPayAccount.getHolderName());
|
||||
TextField field = addLabelTextField(gridPane, ++gridRow, "Email:", chaseQuickPayAccount.getEmail()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", chaseQuickPayAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addAllowedPeriod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& chaseQuickPayValidator.validate(chaseQuickPayAccount.getEmail()).isValid
|
||||
&& inputValidator.validate(chaseQuickPayAccount.getHolderName()).isValid
|
||||
&& chaseQuickPayAccount.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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.InteracETransferValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.payment.InteracETransferAccount;
|
||||
import io.bitsquare.payment.InteracETransferAccountContractData;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
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 InteracETransferForm extends PaymentMethodForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(InteracETransferForm.class);
|
||||
|
||||
private final InteracETransferAccount interacETransferAccount;
|
||||
private final InteracETransferValidator interacETransferValidator;
|
||||
private InputTextField mobileNrInputTextField;
|
||||
private InputTextField questionInputTextField;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", ((InteracETransferAccountContractData) paymentAccountContractData).getHolderName());
|
||||
addLabelTextField(gridPane, ++gridRow, "Email:", ((InteracETransferAccountContractData) paymentAccountContractData).getEmail());
|
||||
addLabelTextField(gridPane, ++gridRow, "Secret question:", ((InteracETransferAccountContractData) paymentAccountContractData).getQuestion());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public InteracETransferForm(PaymentAccount paymentAccount, InteracETransferValidator interacETransferValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
|
||||
this.interacETransferAccount = (InteracETransferAccount) paymentAccount;
|
||||
this.interacETransferValidator = interacETransferValidator;
|
||||
}
|
||||
|
||||
@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) -> {
|
||||
interacETransferAccount.setHolderName(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Email:").second;
|
||||
mobileNrInputTextField.setValidator(interacETransferValidator);
|
||||
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
interacETransferAccount.setEmail(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
questionInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Secret question:").second;
|
||||
questionInputTextField.setValidator(interacETransferValidator);
|
||||
questionInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
interacETransferAccount.setQuestion(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", interacETransferAccount.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:", interacETransferAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(interacETransferAccount.getPaymentMethod().getId()));
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", interacETransferAccount.getHolderName());
|
||||
addLabelTextField(gridPane, ++gridRow, "Email:", interacETransferAccount.getEmail()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Secret question:", interacETransferAccount.getQuestion()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", interacETransferAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addAllowedPeriod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& interacETransferValidator.validate(interacETransferAccount.getEmail()).isValid
|
||||
&& inputValidator.validate(interacETransferAccount.getHolderName()).isValid
|
||||
&& inputValidator.validate(interacETransferAccount.getQuestion()).isValid
|
||||
&& interacETransferAccount.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
@ -66,6 +66,8 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
private final PerfectMoneyValidator perfectMoneyValidator;
|
||||
private final SwishValidator swishValidator;
|
||||
private final ClearXchangeValidator clearXchangeValidator;
|
||||
private final ChaseQuickPayValidator chaseQuickPayValidator;
|
||||
private final InteracETransferValidator interacETransferValidator;
|
||||
private final USPostalMoneyOrderValidator usPostalMoneyOrderValidator;
|
||||
|
||||
private BSFormatter formatter;
|
||||
@ -86,6 +88,8 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
PerfectMoneyValidator perfectMoneyValidator,
|
||||
SwishValidator swishValidator,
|
||||
ClearXchangeValidator clearXchangeValidator,
|
||||
ChaseQuickPayValidator chaseQuickPayValidator,
|
||||
InteracETransferValidator interacETransferValidator,
|
||||
USPostalMoneyOrderValidator usPostalMoneyOrderValidator,
|
||||
BSFormatter formatter) {
|
||||
super(model);
|
||||
@ -98,6 +102,8 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
this.perfectMoneyValidator = perfectMoneyValidator;
|
||||
this.swishValidator = swishValidator;
|
||||
this.clearXchangeValidator = clearXchangeValidator;
|
||||
this.chaseQuickPayValidator = chaseQuickPayValidator;
|
||||
this.interacETransferValidator = interacETransferValidator;
|
||||
this.usPostalMoneyOrderValidator = usPostalMoneyOrderValidator;
|
||||
this.formatter = formatter;
|
||||
}
|
||||
@ -321,6 +327,10 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
return new SwishForm(paymentAccount, swishValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CLEAR_X_CHANGE_ID:
|
||||
return new ClearXchangeForm(paymentAccount, clearXchangeValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CHASE_QUICK_PAY_ID:
|
||||
return new ChaseQuickPayForm(paymentAccount, chaseQuickPayValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.INTERAC_E_TRANSFER_ID:
|
||||
return new InteracETransferForm(paymentAccount, interacETransferValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
|
||||
return new USPostalMoneyOrderForm(paymentAccount, usPostalMoneyOrderValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CASH_DEPOSIT_ID:
|
||||
|
@ -193,6 +193,12 @@ public class BuyerStep2View extends TradeStepView {
|
||||
case PaymentMethod.CLEAR_X_CHANGE_ID:
|
||||
gridRow = ClearXchangeForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.CHASE_QUICK_PAY_ID:
|
||||
gridRow = ChaseQuickPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.INTERAC_E_TRANSFER_ID:
|
||||
gridRow = InteracETransferForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
|
||||
gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 ChaseQuickPayValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 InteracETransferValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public ValidationResult validate(String input) {
|
||||
// TODO
|
||||
return super.validate(input);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user