mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Add holder name to cleadXchange, fix naming
This commit is contained in:
parent
ebce160031
commit
8d22db1bba
@ -20,25 +20,33 @@ package io.bitsquare.payment;
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.locale.FiatCurrency;
|
||||
|
||||
public final class ClearXExchangeAccount extends PaymentAccount {
|
||||
public final class ClearXchangeAccount 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 ClearXExchangeAccount() {
|
||||
public ClearXchangeAccount() {
|
||||
super(PaymentMethod.CLEAR_X_CHANGE);
|
||||
setSingleTradeCurrency(new FiatCurrency("USD"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountContractData setContractData() {
|
||||
return new ClearXExchangeAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
|
||||
return new ClearXchangeAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
|
||||
}
|
||||
|
||||
public void setEmailOrMobileNr(String mobileNr) {
|
||||
((ClearXExchangeAccountContractData) contractData).setEmailOrMobileNr(mobileNr);
|
||||
((ClearXchangeAccountContractData) contractData).setEmailOrMobileNr(mobileNr);
|
||||
}
|
||||
|
||||
public String getEmailOrMobileNr() {
|
||||
return ((ClearXExchangeAccountContractData) contractData).getEmailOrMobileNr();
|
||||
return ((ClearXchangeAccountContractData) contractData).getEmailOrMobileNr();
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
((ClearXchangeAccountContractData) contractData).setHolderName(holderName);
|
||||
}
|
||||
|
||||
public String getHolderName() {
|
||||
return ((ClearXchangeAccountContractData) contractData).getHolderName();
|
||||
}
|
||||
}
|
@ -19,31 +19,41 @@ package io.bitsquare.payment;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
|
||||
public final class ClearXExchangeAccountContractData extends PaymentAccountContractData {
|
||||
public final class ClearXchangeAccountContractData 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;
|
||||
private String holderName;
|
||||
private String emailOrMobileNr;
|
||||
|
||||
public ClearXExchangeAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
|
||||
public ClearXchangeAccountContractData(String paymentMethod, String id, long maxTradePeriod) {
|
||||
super(paymentMethod, id, maxTradePeriod);
|
||||
}
|
||||
|
||||
public void setEmailOrMobileNr(String mobileNr) {
|
||||
this.mobileNr = mobileNr;
|
||||
public String getHolderName() {
|
||||
return holderName;
|
||||
}
|
||||
|
||||
public void setHolderName(String holderName) {
|
||||
this.holderName = holderName;
|
||||
}
|
||||
|
||||
public void setEmailOrMobileNr(String emailOrMobileNr) {
|
||||
this.emailOrMobileNr = emailOrMobileNr;
|
||||
}
|
||||
|
||||
public String getEmailOrMobileNr() {
|
||||
return mobileNr;
|
||||
return emailOrMobileNr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "ClearXExchange - Email or mobile nr.: " + mobileNr;
|
||||
return "ClearXchange - Holder name: " + holderName + ", email or mobile nr.: " + emailOrMobileNr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return "Email or mobile nr.: " + mobileNr;
|
||||
return "Holder name: " + holderName + "\n" +
|
||||
"Email or mobile nr.: " + emailOrMobileNr;
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ public class PaymentAccountFactory {
|
||||
case PaymentMethod.SWISH_ID:
|
||||
return new SwishAccount();
|
||||
case PaymentMethod.CLEAR_X_CHANGE_ID:
|
||||
return new ClearXExchangeAccount();
|
||||
return new ClearXchangeAccount();
|
||||
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
|
||||
return new USPostalMoneyOrderAccount();
|
||||
case PaymentMethod.CASH_DEPOSIT_ID:
|
||||
|
@ -20,11 +20,11 @@ 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.ClearXExchangeValidator;
|
||||
import io.bitsquare.gui.util.validation.ClearXchangeValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.payment.ClearXExchangeAccount;
|
||||
import io.bitsquare.payment.ClearXExchangeAccountContractData;
|
||||
import io.bitsquare.payment.ClearXchangeAccount;
|
||||
import io.bitsquare.payment.ClearXchangeAccountContractData;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import javafx.scene.control.TextField;
|
||||
@ -36,36 +36,44 @@ import org.slf4j.LoggerFactory;
|
||||
import static io.bitsquare.gui.util.FormBuilder.addLabelInputTextField;
|
||||
import static io.bitsquare.gui.util.FormBuilder.addLabelTextField;
|
||||
|
||||
public class ClearXExchangeForm extends PaymentMethodForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(ClearXExchangeForm.class);
|
||||
public class ClearXchangeForm extends PaymentMethodForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(ClearXchangeForm.class);
|
||||
|
||||
private final ClearXExchangeAccount clearXExchangeAccount;
|
||||
private final ClearXExchangeValidator clearXExchangeValidator;
|
||||
private final ClearXchangeAccount clearXchangeAccount;
|
||||
private final ClearXchangeValidator clearXchangeValidator;
|
||||
private InputTextField mobileNrInputTextField;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||
addLabelTextField(gridPane, ++gridRow, "Email or mobile nr.:", ((ClearXExchangeAccountContractData) paymentAccountContractData).getEmailOrMobileNr());
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", ((ClearXchangeAccountContractData) paymentAccountContractData).getHolderName());
|
||||
addLabelTextField(gridPane, ++gridRow, "Email or mobile nr.:", ((ClearXchangeAccountContractData) paymentAccountContractData).getEmailOrMobileNr());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public ClearXExchangeForm(PaymentAccount paymentAccount, ClearXExchangeValidator clearXExchangeValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
public ClearXchangeForm(PaymentAccount paymentAccount, ClearXchangeValidator clearXchangeValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, inputValidator, gridPane, gridRow, formatter);
|
||||
this.clearXExchangeAccount = (ClearXExchangeAccount) paymentAccount;
|
||||
this.clearXExchangeValidator = clearXExchangeValidator;
|
||||
this.clearXchangeAccount = (ClearXchangeAccount) paymentAccount;
|
||||
this.clearXchangeValidator = clearXchangeValidator;
|
||||
}
|
||||
|
||||
@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) -> {
|
||||
clearXchangeAccount.setHolderName(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Email or mobile nr.:").second;
|
||||
mobileNrInputTextField.setValidator(clearXExchangeValidator);
|
||||
mobileNrInputTextField.setValidator(clearXchangeValidator);
|
||||
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
clearXExchangeAccount.setEmailOrMobileNr(newValue);
|
||||
clearXchangeAccount.setEmailOrMobileNr(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", clearXExchangeAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", clearXchangeAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addAllowedPeriod();
|
||||
addAccountNameTextFieldWithAutoFillCheckBox();
|
||||
}
|
||||
@ -83,18 +91,20 @@ public class ClearXExchangeForm extends PaymentMethodForm {
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addLabelTextField(gridPane, gridRow, "Account name:", clearXExchangeAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(clearXExchangeAccount.getPaymentMethod().getId()));
|
||||
TextField field = addLabelTextField(gridPane, ++gridRow, "Email or mobile nr.:", clearXExchangeAccount.getEmailOrMobileNr()).second;
|
||||
addLabelTextField(gridPane, gridRow, "Account name:", clearXchangeAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(clearXchangeAccount.getPaymentMethod().getId()));
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", clearXchangeAccount.getHolderName());
|
||||
TextField field = addLabelTextField(gridPane, ++gridRow, "Email or mobile nr.:", clearXchangeAccount.getEmailOrMobileNr()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", clearXExchangeAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", clearXchangeAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addAllowedPeriod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& clearXExchangeValidator.validate(clearXExchangeAccount.getEmailOrMobileNr()).isValid
|
||||
&& clearXExchangeAccount.getTradeCurrencies().size() > 0);
|
||||
&& clearXchangeValidator.validate(clearXchangeAccount.getEmailOrMobileNr()).isValid
|
||||
&& inputValidator.validate(clearXchangeAccount.getHolderName()).isValid
|
||||
&& clearXchangeAccount.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
@ -65,7 +65,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
private final AliPayValidator aliPayValidator;
|
||||
private final PerfectMoneyValidator perfectMoneyValidator;
|
||||
private final SwishValidator swishValidator;
|
||||
private final ClearXExchangeValidator clearXExchangeValidator;
|
||||
private final ClearXchangeValidator clearXchangeValidator;
|
||||
private final USPostalMoneyOrderValidator usPostalMoneyOrderValidator;
|
||||
|
||||
private BSFormatter formatter;
|
||||
@ -85,7 +85,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
AliPayValidator aliPayValidator,
|
||||
PerfectMoneyValidator perfectMoneyValidator,
|
||||
SwishValidator swishValidator,
|
||||
ClearXExchangeValidator clearXExchangeValidator,
|
||||
ClearXchangeValidator clearXchangeValidator,
|
||||
USPostalMoneyOrderValidator usPostalMoneyOrderValidator,
|
||||
BSFormatter formatter) {
|
||||
super(model);
|
||||
@ -97,7 +97,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
this.aliPayValidator = aliPayValidator;
|
||||
this.perfectMoneyValidator = perfectMoneyValidator;
|
||||
this.swishValidator = swishValidator;
|
||||
this.clearXExchangeValidator = clearXExchangeValidator;
|
||||
this.clearXchangeValidator = clearXchangeValidator;
|
||||
this.usPostalMoneyOrderValidator = usPostalMoneyOrderValidator;
|
||||
this.formatter = formatter;
|
||||
}
|
||||
@ -318,7 +318,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
case PaymentMethod.SWISH_ID:
|
||||
return new SwishForm(paymentAccount, swishValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CLEAR_X_CHANGE_ID:
|
||||
return new ClearXExchangeForm(paymentAccount, clearXExchangeValidator, inputValidator, root, gridRow, formatter);
|
||||
return new ClearXchangeForm(paymentAccount, clearXchangeValidator, 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:
|
||||
|
@ -178,7 +178,7 @@ public class BuyerStep2View extends TradeStepView {
|
||||
gridRow = AliPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.CLEAR_X_CHANGE_ID:
|
||||
gridRow = ClearXExchangeForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
gridRow = ClearXchangeForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
|
||||
gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
|
@ -18,7 +18,7 @@
|
||||
package io.bitsquare.gui.util.validation;
|
||||
|
||||
|
||||
public final class ClearXExchangeValidator extends InputValidator {
|
||||
public final class ClearXchangeValidator extends InputValidator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
Loading…
Reference in New Issue
Block a user