mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-30 02:08:58 -04:00
support paypal, cashapp, venmo
Co-authored-by: preland <89992615+preland@users.noreply.github.com>
This commit is contained in:
parent
26c32a8ff4
commit
fea804086b
51 changed files with 881 additions and 186 deletions
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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 haveno.desktop.components.paymentmethods;
|
||||
|
||||
import haveno.core.account.witness.AccountAgeWitnessService;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.payment.CashAppAccount;
|
||||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.payment.payload.CashAppAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.validation.EmailOrMobileNrOrCashtagValidator;
|
||||
import haveno.core.util.coin.CoinFormatter;
|
||||
import haveno.core.util.validation.InputValidator;
|
||||
import haveno.desktop.components.InputTextField;
|
||||
import haveno.desktop.util.FormBuilder;
|
||||
import haveno.desktop.util.Layout;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
import static haveno.desktop.util.FormBuilder.addTopLabelFlowPane;
|
||||
|
||||
public class CashAppForm extends PaymentMethodForm {
|
||||
private final CashAppAccount cashAppAccount;
|
||||
private final EmailOrMobileNrOrCashtagValidator cashAppValidator;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.email.mobile.cashtag"),
|
||||
((CashAppAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrCashtag());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public CashAppForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService,
|
||||
EmailOrMobileNrOrCashtagValidator cashAppValidator, InputValidator inputValidator, GridPane gridPane,
|
||||
int gridRow,
|
||||
CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.cashAppAccount = (CashAppAccount) paymentAccount;
|
||||
this.cashAppValidator = cashAppValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
|
||||
Res.get("payment.email.mobile.cashtag"));
|
||||
mobileNrInputTextField.setValidator(cashAppValidator);
|
||||
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
cashAppAccount.setEmailOrMobileNrOrCashtag(newValue.trim());
|
||||
updateFromInputs();
|
||||
});
|
||||
addCurrenciesGrid(true);
|
||||
addLimitations(false);
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
}
|
||||
|
||||
private void addCurrenciesGrid(boolean isEditable) {
|
||||
FlowPane flowPane = addTopLabelFlowPane(gridPane, ++gridRow,
|
||||
Res.get("payment.supportedCurrencies"), Layout.FLOATING_LABEL_DISTANCE * 3,
|
||||
Layout.FLOATING_LABEL_DISTANCE * 3).second;
|
||||
|
||||
if (isEditable)
|
||||
flowPane.setId("flow-pane-checkboxes-bg");
|
||||
else
|
||||
flowPane.setId("flow-pane-checkboxes-non-editable-bg");
|
||||
|
||||
cashAppAccount.getSupportedCurrencies().forEach(e ->
|
||||
fillUpFlowPaneWithCurrencies(isEditable, flowPane, e, cashAppAccount));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(cashAppAccount.getEmailOrMobileNrOrCashtag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForEditAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email.mobile.cashtag"),
|
||||
cashAppAccount.getEmailOrMobileNrOrCashtag()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLimitations(true);
|
||||
addCurrenciesGrid(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& cashAppValidator.validate(cashAppAccount.getEmailOrMobileNrOrCashtag()).isValid
|
||||
&& cashAppAccount.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* 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 haveno.desktop.components.paymentmethods;
|
||||
|
||||
import haveno.core.account.witness.AccountAgeWitnessService;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.payment.PayPalAccount;
|
||||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.payment.payload.PayPalAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.validation.EmailOrMobileNrOrUsernameValidator;
|
||||
import haveno.core.util.coin.CoinFormatter;
|
||||
import haveno.core.util.validation.InputValidator;
|
||||
import haveno.desktop.components.InputTextField;
|
||||
import haveno.desktop.util.FormBuilder;
|
||||
import haveno.desktop.util.Layout;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
import static haveno.desktop.util.FormBuilder.addTopLabelFlowPane;
|
||||
|
||||
public class PayPalForm extends PaymentMethodForm {
|
||||
private final PayPalAccount paypalAccount;
|
||||
private final EmailOrMobileNrOrUsernameValidator paypalValidator;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.email.mobile.username"),
|
||||
((PayPalAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public PayPalForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService,
|
||||
EmailOrMobileNrOrUsernameValidator paypalValidator, InputValidator inputValidator, GridPane gridPane,
|
||||
int gridRow,
|
||||
CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.paypalAccount = (PayPalAccount) paymentAccount;
|
||||
this.paypalValidator = paypalValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
|
||||
Res.get("payment.email.mobile.username"));
|
||||
mobileNrInputTextField.setValidator(paypalValidator);
|
||||
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
paypalAccount.setEmailOrMobileNrOrUsername(newValue.trim());
|
||||
updateFromInputs();
|
||||
});
|
||||
addCurrenciesGrid(true);
|
||||
addLimitations(false);
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
}
|
||||
|
||||
private void addCurrenciesGrid(boolean isEditable) {
|
||||
FlowPane flowPane = addTopLabelFlowPane(gridPane, ++gridRow,
|
||||
Res.get("payment.supportedCurrencies"), Layout.FLOATING_LABEL_DISTANCE * 3,
|
||||
Layout.FLOATING_LABEL_DISTANCE * 3).second;
|
||||
|
||||
if (isEditable)
|
||||
flowPane.setId("flow-pane-checkboxes-bg");
|
||||
else
|
||||
flowPane.setId("flow-pane-checkboxes-non-editable-bg");
|
||||
|
||||
paypalAccount.getSupportedCurrencies().forEach(e ->
|
||||
fillUpFlowPaneWithCurrencies(isEditable, flowPane, e, paypalAccount));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(paypalAccount.getEmailOrMobileNrOrUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForEditAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(paypalAccount.getPaymentMethod().getId()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow,
|
||||
Res.get("payment.email.mobile.username"),
|
||||
paypalAccount.getEmailOrMobileNrOrUsername()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLimitations(true);
|
||||
addCurrenciesGrid(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& paypalValidator.validate(paypalAccount.getEmailOrMobileNrOrUsername()).isValid
|
||||
&& paypalAccount.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
|
@ -63,10 +63,10 @@ public class RevolutForm extends PaymentMethodForm {
|
|||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField userNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.userName"));
|
||||
InputTextField userNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.username"));
|
||||
userNameInputTextField.setValidator(validator);
|
||||
userNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
account.setUserName(newValue.trim());
|
||||
account.setUsername(newValue.trim());
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class RevolutForm extends PaymentMethodForm {
|
|||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(account.getUserName());
|
||||
setAccountNameWithString(account.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,8 +101,8 @@ public class RevolutForm extends PaymentMethodForm {
|
|||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(account.getPaymentMethod().getId()));
|
||||
|
||||
String userName = account.getUserName();
|
||||
TextField userNameTf = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.userName"), userName).second;
|
||||
String userName = account.getUsername();
|
||||
TextField userNameTf = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.username"), userName).second;
|
||||
userNameTf.setMouseTransparent(false);
|
||||
|
||||
addLimitations(true);
|
||||
|
@ -112,7 +112,7 @@ public class RevolutForm extends PaymentMethodForm {
|
|||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& validator.validate(account.getUserName()).isValid
|
||||
&& validator.validate(account.getUsername()).isValid
|
||||
&& account.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class StrikeForm extends PaymentMethodForm {
|
|||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
PaymentAccountPayload paymentAccountPayload) {
|
||||
addTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.account.userName"),
|
||||
addTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.account.username"),
|
||||
((StrikeAccountPayload) paymentAccountPayload).getHolderName(), Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
return gridRow;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class StrikeForm extends PaymentMethodForm {
|
|||
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField holderNameField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.userName"));
|
||||
InputTextField holderNameField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.username"));
|
||||
holderNameField.setValidator(inputValidator);
|
||||
holderNameField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
account.setHolderName(newValue.trim());
|
||||
|
@ -84,7 +84,7 @@ public class StrikeForm extends PaymentMethodForm {
|
|||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(account.getPaymentMethod().getId()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.userName"),
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.username"),
|
||||
account.getHolderName()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), account.getSingleTradeCurrency().getNameAndCode());
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* 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 haveno.desktop.components.paymentmethods;
|
||||
|
||||
import haveno.core.account.witness.AccountAgeWitnessService;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.locale.TradeCurrency;
|
||||
import haveno.core.payment.VenmoAccount;
|
||||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.payment.payload.VenmoAccountPayload;
|
||||
import haveno.core.payment.payload.PaymentAccountPayload;
|
||||
import haveno.core.payment.validation.EmailOrMobileNrOrUsernameValidator;
|
||||
import haveno.core.util.coin.CoinFormatter;
|
||||
import haveno.core.util.validation.InputValidator;
|
||||
import haveno.desktop.components.InputTextField;
|
||||
import haveno.desktop.util.FormBuilder;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
import static haveno.desktop.util.FormBuilder.addTopLabelTextField;
|
||||
|
||||
public class VenmoForm extends PaymentMethodForm {
|
||||
private final VenmoAccount venmoAccount;
|
||||
private final EmailOrMobileNrOrUsernameValidator venmoValidator;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.email.mobile.username"),
|
||||
((VenmoAccountPayload) paymentAccountPayload).getEmailOrMobileNrOrUsername());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public VenmoForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService,
|
||||
EmailOrMobileNrOrUsernameValidator venmoValidator, InputValidator inputValidator, GridPane gridPane,
|
||||
int gridRow,
|
||||
CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.venmoAccount = (VenmoAccount) paymentAccount;
|
||||
this.venmoValidator = venmoValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
|
||||
Res.get("payment.email.mobile.username"));
|
||||
mobileNrInputTextField.setValidator(venmoValidator);
|
||||
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
venmoAccount.setNameOrUsernameOrEmailOrMobileNr(newValue.trim());
|
||||
updateFromInputs();
|
||||
});
|
||||
final TradeCurrency singleTradeCurrency = venmoAccount.getSingleTradeCurrency();
|
||||
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
|
||||
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"),
|
||||
nameAndCode);
|
||||
addLimitations(false);
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(venmoAccount.getNameOrUsernameOrEmailOrMobileNr());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForEditAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(venmoAccount.getPaymentMethod().getId()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow,
|
||||
Res.get("payment.email.mobile.username"),
|
||||
venmoAccount.getNameOrUsernameOrEmailOrMobileNr()).second;
|
||||
field.setMouseTransparent(false);
|
||||
final TradeCurrency singleTradeCurrency = venmoAccount.getSingleTradeCurrency();
|
||||
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"),
|
||||
nameAndCode);
|
||||
addLimitations(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& venmoValidator.validate(venmoAccount.getNameOrUsernameOrEmailOrMobileNr()).isValid
|
||||
&& venmoAccount.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ public class VerseForm extends PaymentMethodForm {
|
|||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.userName"),
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.username"),
|
||||
((VerseAccountPayload) paymentAccountPayload).getHolderName());
|
||||
return gridRow;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class VerseForm extends PaymentMethodForm {
|
|||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField holderNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.userName"));
|
||||
InputTextField holderNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.username"));
|
||||
holderNameInputTextField.setValidator(inputValidator);
|
||||
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
account.setHolderName(newValue.trim());
|
||||
|
@ -92,7 +92,7 @@ public class VerseForm extends PaymentMethodForm {
|
|||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(account.getPaymentMethod().getId()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.userName"),
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.username"),
|
||||
account.getHolderName()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLimitations(true);
|
||||
|
|
|
@ -28,16 +28,19 @@ import haveno.core.locale.Res;
|
|||
import haveno.core.offer.OfferRestrictions;
|
||||
import haveno.core.payment.AmazonGiftCardAccount;
|
||||
import haveno.core.payment.AustraliaPayidAccount;
|
||||
import haveno.core.payment.CashAppAccount;
|
||||
import haveno.core.payment.CashAtAtmAccount;
|
||||
import haveno.core.payment.CashDepositAccount;
|
||||
import haveno.core.payment.F2FAccount;
|
||||
import haveno.core.payment.HalCashAccount;
|
||||
import haveno.core.payment.MoneyGramAccount;
|
||||
import haveno.core.payment.PayByMailAccount;
|
||||
import haveno.core.payment.PayPalAccount;
|
||||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.payment.PaymentAccountFactory;
|
||||
import haveno.core.payment.RevolutAccount;
|
||||
import haveno.core.payment.USPostalMoneyOrderAccount;
|
||||
import haveno.core.payment.VenmoAccount;
|
||||
import haveno.core.payment.WesternUnionAccount;
|
||||
import haveno.core.payment.ZelleAccount;
|
||||
import haveno.core.payment.payload.PaymentMethod;
|
||||
|
@ -48,6 +51,8 @@ import haveno.core.payment.validation.BICValidator;
|
|||
import haveno.core.payment.validation.CapitualValidator;
|
||||
import haveno.core.payment.validation.ChaseQuickPayValidator;
|
||||
import haveno.core.payment.validation.EmailOrMobileNrValidator;
|
||||
import haveno.core.payment.validation.EmailOrMobileNrOrCashtagValidator;
|
||||
import haveno.core.payment.validation.EmailOrMobileNrOrUsernameValidator;
|
||||
import haveno.core.payment.validation.F2FValidator;
|
||||
import haveno.core.payment.validation.HalCashValidator;
|
||||
import haveno.core.payment.validation.InteracETransferValidator;
|
||||
|
@ -75,6 +80,7 @@ import haveno.desktop.components.paymentmethods.AmazonGiftCardForm;
|
|||
import haveno.desktop.components.paymentmethods.AustraliaPayidForm;
|
||||
import haveno.desktop.components.paymentmethods.BizumForm;
|
||||
import haveno.desktop.components.paymentmethods.CapitualForm;
|
||||
import haveno.desktop.components.paymentmethods.CashAppForm;
|
||||
import haveno.desktop.components.paymentmethods.CashAtAtmForm;
|
||||
import haveno.desktop.components.paymentmethods.CashDepositForm;
|
||||
import haveno.desktop.components.paymentmethods.CelPayForm;
|
||||
|
@ -94,6 +100,7 @@ import haveno.desktop.components.paymentmethods.NeftForm;
|
|||
import haveno.desktop.components.paymentmethods.NequiForm;
|
||||
import haveno.desktop.components.paymentmethods.PaxumForm;
|
||||
import haveno.desktop.components.paymentmethods.PayByMailForm;
|
||||
import haveno.desktop.components.paymentmethods.PayPalForm;
|
||||
import haveno.desktop.components.paymentmethods.PaymentMethodForm;
|
||||
import haveno.desktop.components.paymentmethods.PayseraForm;
|
||||
import haveno.desktop.components.paymentmethods.PaytmForm;
|
||||
|
@ -117,6 +124,7 @@ import haveno.desktop.components.paymentmethods.TransferwiseUsdForm;
|
|||
import haveno.desktop.components.paymentmethods.USPostalMoneyOrderForm;
|
||||
import haveno.desktop.components.paymentmethods.UpholdForm;
|
||||
import haveno.desktop.components.paymentmethods.UpiForm;
|
||||
import haveno.desktop.components.paymentmethods.VenmoForm;
|
||||
import haveno.desktop.components.paymentmethods.VerseForm;
|
||||
import haveno.desktop.components.paymentmethods.WeChatPayForm;
|
||||
import haveno.desktop.components.paymentmethods.WesternUnionForm;
|
||||
|
@ -158,6 +166,9 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
|||
private final PerfectMoneyValidator perfectMoneyValidator;
|
||||
private final SwishValidator swishValidator;
|
||||
private final EmailOrMobileNrValidator zelleValidator;
|
||||
private final EmailOrMobileNrOrUsernameValidator paypalValidator;
|
||||
private final EmailOrMobileNrOrUsernameValidator venmoValidator;
|
||||
private final EmailOrMobileNrOrCashtagValidator cashAppValidator;
|
||||
private final ChaseQuickPayValidator chaseQuickPayValidator;
|
||||
private final InteracETransferValidator interacETransferValidator;
|
||||
private final JapanBankTransferValidator japanBankTransferValidator;
|
||||
|
@ -189,6 +200,8 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
|||
PerfectMoneyValidator perfectMoneyValidator,
|
||||
SwishValidator swishValidator,
|
||||
EmailOrMobileNrValidator zelleValidator,
|
||||
EmailOrMobileNrOrCashtagValidator cashAppValidator,
|
||||
EmailOrMobileNrOrUsernameValidator emailMobileUsernameValidator,
|
||||
ChaseQuickPayValidator chaseQuickPayValidator,
|
||||
InteracETransferValidator interacETransferValidator,
|
||||
JapanBankTransferValidator japanBankTransferValidator,
|
||||
|
@ -217,6 +230,9 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
|||
this.perfectMoneyValidator = perfectMoneyValidator;
|
||||
this.swishValidator = swishValidator;
|
||||
this.zelleValidator = zelleValidator;
|
||||
this.paypalValidator = emailMobileUsernameValidator;
|
||||
this.venmoValidator = emailMobileUsernameValidator;
|
||||
this.cashAppValidator = cashAppValidator;
|
||||
this.chaseQuickPayValidator = chaseQuickPayValidator;
|
||||
this.interacETransferValidator = interacETransferValidator;
|
||||
this.japanBankTransferValidator = japanBankTransferValidator;
|
||||
|
@ -362,6 +378,27 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
|||
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||
.onAction(() -> doSaveNewAccount(paymentAccount))
|
||||
.show();
|
||||
} else if (paymentAccount instanceof CashAppAccount) {
|
||||
new Popup().warning(Res.get("payment.cashapp.info"))
|
||||
.width(700)
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||
.onAction(() -> doSaveNewAccount(paymentAccount))
|
||||
.show();
|
||||
} else if (paymentAccount instanceof VenmoAccount) {
|
||||
new Popup().warning(Res.get("payment.venmo.info"))
|
||||
.width(700)
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||
.onAction(() -> doSaveNewAccount(paymentAccount))
|
||||
.show();
|
||||
} else if (paymentAccount instanceof PayPalAccount) {
|
||||
new Popup().warning(Res.get("payment.paypal.info"))
|
||||
.width(700)
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||
.onAction(() -> doSaveNewAccount(paymentAccount))
|
||||
.show();
|
||||
} else {
|
||||
doSaveNewAccount(paymentAccount);
|
||||
}
|
||||
|
@ -624,6 +661,12 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
|||
return new AchTransferForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.DOMESTIC_WIRE_TRANSFER_ID:
|
||||
return new DomesticWireTransferForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.PAYPAL_ID:
|
||||
return new PayPalForm(paymentAccount, accountAgeWitnessService, paypalValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.VENMO_ID:
|
||||
return new VenmoForm(paymentAccount, accountAgeWitnessService, venmoValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CASH_APP_ID:
|
||||
return new CashAppForm(paymentAccount, accountAgeWitnessService, cashAppValidator, inputValidator, root, gridRow, formatter);
|
||||
default:
|
||||
log.error("Not supported PaymentMethod: " + paymentMethod);
|
||||
return null;
|
||||
|
@ -669,4 +712,3 @@ public class TraditionalAccountsView extends PaymentAccountsView<GridPane, Tradi
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class UpdateRevolutAccountWindow extends Overlay<UpdateRevolutAccountWind
|
|||
|
||||
private void addContent() {
|
||||
addLabel(gridPane, ++rowIndex, Res.get("payment.account.revolut.addUserNameInfo", Res.get("payment.revolut.info"), revolutAccount.getAccountName()));
|
||||
userNameInputTextField = addInputTextField(gridPane, ++rowIndex, Res.get("payment.account.userName"), Layout.COMPACT_FIRST_ROW_DISTANCE);
|
||||
userNameInputTextField = addInputTextField(gridPane, ++rowIndex, Res.get("payment.account.username"), Layout.COMPACT_FIRST_ROW_DISTANCE);
|
||||
userNameInputTextField.setValidator(revolutValidator);
|
||||
userNameInputTextField.textProperty().addListener((observable, oldValue, newValue) ->
|
||||
actionButton.setDisable(!revolutValidator.validate(newValue).isValid));
|
||||
|
@ -81,7 +81,7 @@ public class UpdateRevolutAccountWindow extends Overlay<UpdateRevolutAccountWind
|
|||
actionButton.setOnAction(event -> {
|
||||
String userName = userNameInputTextField.getText();
|
||||
if (revolutValidator.validate(userName).isValid) {
|
||||
revolutAccount.setUserName(userName);
|
||||
revolutAccount.setUsername(userName);
|
||||
user.requestPersistence();
|
||||
closeHandlerOptional.ifPresent(Runnable::run);
|
||||
hide();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue