Add missing parts for WU support

This commit is contained in:
Manfred Karrer 2017-11-11 15:23:10 -05:00
parent 8b72eba1e0
commit 6f0a7e7036
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
12 changed files with 278 additions and 342 deletions

View file

@ -39,7 +39,7 @@ public class BankUtil {
case "CA":
case "SE":
case "HK":
// We show always the bank name as it is needed in specific banks.
// We show always the bank name as it is needed in specific banks.
// Though that handling should be optimized in futures.
return true;
// return false;
@ -250,4 +250,18 @@ public class BankUtil {
return false;
}
}
public static boolean isStateRequired(String countryCode) {
switch (countryCode) {
case "US":
case "CA":
case "AU":
case "MY":
case "MX":
case "CN":
return true;
default:
return false;
}
}
}

View file

@ -873,14 +873,9 @@ message CashDepositAccountPayload {
message WesternUnionAccountPayload {
string holder_name = 1;
string holder_email = 2;
string bank_name = 3;
string bank_id = 4;
string branch_id = 5;
string account_nr = 6;
string account_type = 7;
string requirements = 8;
string holder_tax_id = 9;
string city = 2;
string state = 3;
string email = 4;
}
message SepaAccountPayload {

View file

@ -465,7 +465,7 @@ portfolio.pending.step2.confReached=Your trade has reached at least one blockcha
portfolio.pending.step2_buyer.copyPaste=(You can copy & paste the values from the main screen after closing that popup.)
portfolio.pending.step2_buyer.refTextWarn=DO NOT use any additional notice in the \"reason for payment\" text like Bitcoin, BTC or Bisq.
# suppress inspection "TrailingSpacesInProperty"
portfolio.pending.step2_buyer.accountDetails=Here are the trading account details of the BTC seller:\n
portfolio.pending.step2_buyer.accountDetails=Here are the trade account details of the BTC seller:\n
portfolio.pending.step2_buyer.tradeId=Please don't forget to add the trade ID
# suppress inspection "TrailingSpacesInProperty"
portfolio.pending.step2_buyer.assign= as \"reason for payment\" so the receiver can assign your payment to this trade.\n\n
@ -475,6 +475,9 @@ portfolio.pending.step2_buyer.altcoin=Please transfer from your external {0} wal
# suppress inspection "TrailingSpacesInProperty"
portfolio.pending.step2_buyer.cash=Please go to a bank and pay {0} to the BTC seller.\n\n
portfolio.pending.step2_buyer.cash.extra=IMPORTANT REQUIREMENT:\nAfter you have done the payment write on the paper receipt: NO REFUNDS.\nThen tear it in 2 parts, make a photo and send it to the BTC seller's email address.
portfolio.pending.step2_buyer.westernUnion=Please pay {0} to the BTC seller by using Western Union.\n\n
portfolio.pending.step2_buyer.westernUnion.extra=IMPORTANT REQUIREMENT:\nAfter you have done the payment send the MTCN (tracking number) to the seller by email. The seller''s email is: {0}.
# suppress inspection "TrailingSpacesInProperty"
portfolio.pending.step2_buyer.postal=Please send {0} by \"US Postal Money Order\" to the BTC seller.\n\n
# suppress inspection "TrailingSpacesInProperty"
@ -489,6 +492,10 @@ portfolio.pending.step2_buyer.paperReceipt.headline=Did you sent the paper recei
portfolio.pending.step2_buyer.paperReceipt.msg=Remember:\n\
You need to write on the paper receipt: NO REFUNDS.\n\
Then tear it in 2 parts, make a photo and send it to the BTC seller's email address.
portfolio.pending.step2_buyer.westernUnionMTCNInfo.headline=Send tracking number
portfolio.pending.step2_buyer.westernUnionMTCNInfo.msg=You need to send the MTCN (tracking number) to the BTC seller by email. The seller''s email is: {0}.\n\n\
Did you sent the MTCN already to the seller?
portfolio.pending.step2_buyer.confirmStart.headline=Confirm that you have started the payment
portfolio.pending.step2_buyer.confirmStart.msg=Did you initiate the {0} payment to your trading partner?
portfolio.pending.step2_buyer.confirmStart.yes=Yes, I have started the payment
@ -518,6 +525,9 @@ The trade ID (\"reason for payment\" text) of the transaction is: \"{2}\"
portfolio.pending.step3_seller.cash=\n\nBecause the payment is done via Cash Deposit the BTC buyer has to write \"NO REFUND\" on the paper receipt, tear it in 2 parts and send you a photo by email.\n\n\
To avoid chargeback risk, only confirm if you received the email and if you are sure the paper receipt is valid.\n\
If you are not sure, {0}
portfolio.pending.step3_seller.westernUnion=The buyer has to sent you the MTCN (tracking number) by email. Please check your email if you received the MTCN.\n\n\
After closing that popup you will see the BTC buyer's name and address for picking up the money from Western Union.
portfolio.pending.step3_seller.bankCheck=\n\nPlease also verify that the sender's name in your bank statement matches that one from the trade contract:\nSender's name: {0}\n\n\
If the name is not the same as the one displayed here, {1}
portfolio.pending.step3_seller.openDispute=please don't confirm but open a dispute by entering \"alt + o\" or \"option + o\".
@ -1536,6 +1546,9 @@ seed.restore.error=An error occurred when restoring the wallets with seed words.
payment.account.no=Account no.:
payment.account.name=Account name:
payment.account.owner=Account owner full name
payment.account.fullName=Full name (first, middle, last)
payment.account.state=State/Province/Region:
payment.account.city=City:
payment.bank.country=Country of bank:
payment.account.name.email=Account owner full name / email
payment.account.name.emailAndHolderId=Account owner full name / email / {0}
@ -1614,11 +1627,7 @@ If you have not fulfilled the above requirements you will lose your security dep
to get in contact with the {1} buyer by using the provided email address or mobile number to verify that he or she \
is really the owner of the Zelle (ClearXchange) account.
popup.info.revertIdCheckRequirement=With this version we remove the requirement introduced in version 0.5.0 for verifying the peers ID by email when payment methods \
with bank transfer or Faster Payment was used.\n\n\
The email address is not exposed anymore in Sepa, Faster Payment and national bank transfer payment methods.\n\n\
Please see the discussion on the Bisq Forum for further background:\n\
https://forum.bisq.network/t/new-requirement-for-payment-accounts-with-charge-back-risk/2376
payment.westernUnion.info=When using Western Union the BTC buyer has to send the MTCN (tracking number) by email to the BTC seller after the money is sent. You will get instructed in the trade process.
# We use constants from the code so we do not use our normal naming convention
# dynamic values are not recognized by IntelliJ

View file

@ -23,8 +23,8 @@ import io.bisq.common.proto.ProtoUtil;
import io.bisq.common.util.JsonExclude;
import io.bisq.generated.protobuffer.PB;
import io.bisq.network.p2p.NodeAddress;
import io.bisq.network.p2p.storage.payload.RequiresOwnerIsOnlinePayload;
import io.bisq.network.p2p.storage.payload.ProtectedStoragePayload;
import io.bisq.network.p2p.storage.payload.RequiresOwnerIsOnlinePayload;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

View file

@ -17,13 +17,11 @@
package io.bisq.core.payment;
import io.bisq.core.payment.payload.WesternUnionAccountPayload;
import io.bisq.core.payment.payload.PaymentAccountPayload;
import io.bisq.core.payment.payload.PaymentMethod;
import io.bisq.core.payment.payload.WesternUnionAccountPayload;
import javax.annotation.Nullable;
public final class WesternUnionAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount {
public final class WesternUnionAccount extends CountryBasedPaymentAccount {
public WesternUnionAccount() {
super(PaymentMethod.WESTERN_UNION);
}
@ -33,22 +31,35 @@ public final class WesternUnionAccount extends CountryBasedPaymentAccount implem
return new WesternUnionAccountPayload(paymentMethod.getId(), id);
}
@Override
public String getBankId() {
return "";
public String getEmail() {
return ((WesternUnionAccountPayload) paymentAccountPayload).getEmail();
}
@Override
public String getCountryCode() {
return getCountry() != null ? getCountry().code : "";
public void setEmail(String email) {
((WesternUnionAccountPayload) paymentAccountPayload).setEmail(email);
}
@Nullable
public String getRequirements() {
return ((WesternUnionAccountPayload) paymentAccountPayload).getRequirements();
public String getFullName() {
return ((WesternUnionAccountPayload) paymentAccountPayload).getHolderName();
}
public void setRequirements(String requirements) {
((WesternUnionAccountPayload) paymentAccountPayload).setRequirements(requirements);
public void setFullName(String email) {
((WesternUnionAccountPayload) paymentAccountPayload).setHolderName(email);
}
public String getCity() {
return ((WesternUnionAccountPayload) paymentAccountPayload).getCity();
}
public void setCity(String email) {
((WesternUnionAccountPayload) paymentAccountPayload).setCity(email);
}
public String getState() {
return ((WesternUnionAccountPayload) paymentAccountPayload).getState();
}
public void setState(String email) {
((WesternUnionAccountPayload) paymentAccountPayload).setState(email);
}
}

View file

@ -20,7 +20,6 @@ package io.bisq.core.payment.payload;
import com.google.protobuf.Message;
import io.bisq.common.locale.BankUtil;
import io.bisq.common.locale.CountryUtil;
import io.bisq.common.locale.Res;
import io.bisq.generated.protobuffer.PB;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@ -33,7 +32,6 @@ import javax.annotation.Nullable;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@EqualsAndHashCode(callSuper = true)
@ToString
@ -41,9 +39,10 @@ import java.util.Optional;
@Getter
@Slf4j
public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayload {
private String holderName="";
@Nullable
private String requirements;
private String holderName;
private String city;
private String state = ""; // is optional. we don't use @Nullable because it would makes UI code more complex.
private String email;
public WesternUnionAccountPayload(String paymentMethod, String id) {
super(paymentMethod, id);
@ -55,27 +54,33 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
///////////////////////////////////////////////////////////////////////////////////////////
private WesternUnionAccountPayload(String paymentMethodName,
String id,
String countryCode,
String holderName,
@Nullable String requirements,
long maxTradePeriod,
@Nullable Map<String, String> excludeFromJsonDataMap) {
String id,
String countryCode,
String holderName,
String city,
String state,
String email,
long maxTradePeriod,
@Nullable Map<String, String> excludeFromJsonDataMap) {
super(paymentMethodName,
id,
countryCode,
maxTradePeriod,
excludeFromJsonDataMap);
this.holderName = holderName;
this.requirements = requirements;
this.city = city;
this.state = state;
this.email = email;
}
@Override
public Message toProtoMessage() {
PB.WesternUnionAccountPayload.Builder builder =
PB.WesternUnionAccountPayload.newBuilder()
.setHolderName(holderName);
Optional.ofNullable(requirements).ifPresent(builder::setRequirements);
.setHolderName(holderName)
.setCity(city)
.setState(state)
.setEmail(email);
final PB.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
.getCountryBasedPaymentAccountPayloadBuilder()
@ -92,7 +97,9 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
proto.getId(),
countryBasedPaymentAccountPayload.getCountryCode(),
westernUnionAccountPayload.getHolderName(),
westernUnionAccountPayload.getRequirements().isEmpty() ? null : westernUnionAccountPayload.getRequirements(),
westernUnionAccountPayload.getCity(),
westernUnionAccountPayload.getState(),
westernUnionAccountPayload.getEmail(),
proto.getMaxTradePeriod(),
CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap()));
}
@ -104,30 +111,24 @@ public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayloa
@Override
public String getPaymentDetails() {
return "WU deposit - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
return "Western Union - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
}
@Override
public String getPaymentDetailsForTradePopup() {
String requirementsString = requirements != null && !requirements.isEmpty() ?
("Extra requirements: " + requirements + "\n") : "";
return "Holder name: " + holderName + "\n" +
requirementsString +
CountryUtil.getNameByCode(countryCode);
String cityState = BankUtil.isStateRequired(countryCode) ? ("City / State: " + city + " / " + state + "\n")
: ("City: " + city + "\n");
return "Full name: " + holderName + "\n" +
cityState +
"County: " + CountryUtil.getNameByCode(countryCode) + "\n" +
"Email: " + email;
}
@Override
public byte[] getAgeWitnessInputData() {
// We don't add holderName and holderEmail because we don't want to break age validation if the user recreates an account with
// slight changes in holder name (e.g. add or remove middle name)
String all = this.countryCode +
this.holderName +
this.requirements;
this.email;
return super.getAgeWitnessInputData(all.getBytes(Charset.forName("UTF-8")));
}
}

View file

@ -20,141 +20,59 @@ package io.bisq.gui.components.paymentmethods;
import io.bisq.common.locale.*;
import io.bisq.common.util.Tuple2;
import io.bisq.common.util.Tuple3;
import io.bisq.common.util.Tuple4;
import io.bisq.core.payment.AccountAgeWitnessService;
import io.bisq.core.payment.CountryBasedPaymentAccount;
import io.bisq.core.payment.PaymentAccount;
import io.bisq.core.payment.payload.WesternUnionAccountPayload;
import io.bisq.core.payment.payload.PaymentAccountPayload;
import io.bisq.core.payment.payload.WesternUnionAccountPayload;
import io.bisq.gui.components.InputTextField;
import io.bisq.gui.main.overlays.popups.Popup;
import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.FormBuilder;
import io.bisq.gui.util.Layout;
import io.bisq.gui.util.validation.*;
import io.bisq.gui.util.validation.EmailValidator;
import io.bisq.gui.util.validation.InputValidator;
import javafx.collections.FXCollections;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.util.StringConverter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bisq.gui.util.FormBuilder.addLabelTextFieldWithCopyIcon;
@Slf4j
public class WesternUnionForm extends PaymentMethodForm {
private static final Logger log = LoggerFactory.getLogger(WesternUnionForm.class);
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
WesternUnionAccountPayload data = (WesternUnionAccountPayload) paymentAccountPayload;
String holderName = data.getHolderName();
String countryCode = data.getCountryCode();
String requirements = data.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.owner"),
data.getHolderName());
if (!showRequirements)
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.country"),
CountryUtil.getNameAndCode(countryCode));
else
requirements += "\n" + Res.get("payment.country") + " " + 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 (showRequirements) {
TextArea textArea = FormBuilder.addLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second;
textArea.setMinHeight(45);
textArea.setMaxHeight(45);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(requirements);
}
public static int addFormForBuyer(GridPane gridPane, int gridRow,
PaymentAccountPayload paymentAccountPayload) {
final WesternUnionAccountPayload payload = (WesternUnionAccountPayload) paymentAccountPayload;
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName"),
payload.getHolderName());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.account.city"),
payload.getCity());
if (BankUtil.isStateRequired(payload.getCountryCode()))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.account.state"),
payload.getState());
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.email"),
payload.getEmail());
return gridRow;
}
protected final WesternUnionAccountPayload westernUnionAccountPayload;
private Label holderIdLabel;
protected InputTextField holderNameInputTextField;
private Tuple2<Label, InputTextField> accountNrTuple;
private Tuple2<Label, ComboBox> accountTypeTuple;
private Label accountTypeLabel;
private ComboBox<String> accountTypeComboBox;
private boolean validatorsApplied;
protected InputTextField holderNameInputTextField, emailInputTextField, cityInputTextField, stateInputTextField;
private Label stateLabel;
private ComboBox<TradeCurrency> currencyComboBox;
private final EmailValidator emailValidator;
public WesternUnionForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
GridPane gridPane, int gridRow, BSFormatter formatter) {
GridPane gridPane, int gridRow, BSFormatter formatter) {
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
this.westernUnionAccountPayload = (WesternUnionAccountPayload) paymentAccount.paymentAccountPayload;
emailValidator = new EmailValidator();
}
@Override
@ -171,19 +89,15 @@ public class WesternUnionForm extends PaymentMethodForm {
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"),
nameAndCode);
addHolderNameAndIdForDisplayAccount();
String requirements = westernUnionAccountPayload.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (showRequirements) {
TextArea textArea = FormBuilder.addLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second;
textArea.setMinHeight(30);
textArea.setMaxHeight(30);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(requirements);
}
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName"),
westernUnionAccountPayload.getHolderName());
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.city"),
westernUnionAccountPayload.getCity()).second.setMouseTransparent(false);
if (BankUtil.isStateRequired(westernUnionAccountPayload.getCountryCode()))
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.state"),
westernUnionAccountPayload.getState()).second.setMouseTransparent(false);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"),
westernUnionAccountPayload.getEmail());
addLimitations();
}
@ -234,12 +148,10 @@ public class WesternUnionForm extends PaymentMethodForm {
paymentAccount.setSingleTradeCurrency(currency);
currencyComboBox.setDisable(false);
currencyComboBox.getSelectionModel().select(currency);
holderNameInputTextField.resetValidation();
updateFromInputs();
onCountryChanged();
applyIsStateRequired();
cityInputTextField.setText("");
stateInputTextField.setText("");
}
});
@ -286,15 +198,37 @@ public class WesternUnionForm extends PaymentMethodForm {
});
currencyComboBox.setDisable(true);
addHolderNameAndId();
TextArea requirementsTextArea = FormBuilder.addLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second;
requirementsTextArea.setMinHeight(30);
requirementsTextArea.setMaxHeight(30);
requirementsTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setRequirements(newValue);
holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane,
++gridRow, Res.getWithCol("payment.account.fullName")).second;
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setHolderName(newValue);
updateFromInputs();
});
holderNameInputTextField.setValidator(inputValidator);
cityInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.city")).second;
cityInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setCity(newValue);
updateFromInputs();
});
final Tuple2<Label, InputTextField> tuple2 = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.state"));
stateLabel = tuple2.first;
stateInputTextField = tuple2.second;
stateInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setState(newValue);
updateFromInputs();
});
applyIsStateRequired();
emailInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.email")).second;
emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setEmail(newValue);
updateFromInputs();
});
emailInputTextField.setValidator(emailValidator);
addLimitations();
addAccountNameTextFieldWithAutoFillCheckBox();
@ -302,44 +236,24 @@ public class WesternUnionForm extends PaymentMethodForm {
updateFromInputs();
}
private void applyIsStateRequired() {
final boolean stateRequired = BankUtil.isStateRequired(westernUnionAccountPayload.getCountryCode());
stateLabel.setManaged(stateRequired);
stateLabel.setVisible(stateRequired);
stateInputTextField.setManaged(stateRequired);
stateInputTextField.setVisible(stateRequired);
}
private CountryBasedPaymentAccount getCountryBasedPaymentAccount() {
return (CountryBasedPaymentAccount) this.paymentAccount;
}
protected void onCountryChanged() {
}
protected void addHolderNameAndId() {
Tuple2<Label, InputTextField> tuple = FormBuilder.addLabelInputTextField(gridPane,
++gridRow, Res.getWithCol("payment.account.owner"));
holderNameInputTextField = tuple.second;
holderNameInputTextField.setMinWidth(300);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setHolderName(newValue);
updateFromInputs();
});
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
holderNameInputTextField.setValidator(inputValidator);
/* emailInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.email")).second; */
/* emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { */
/* westernUnionAccountPayload.setHolderEmail(newValue); */
/* updateFromInputs(); */
/* }); */
/* emailInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty()); */
/* emailInputTextField.setValidator(emailValidator); */
}
@Override
protected void autoFillNameTextField() {
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
String bankId = null;
String countryCode = westernUnionAccountPayload.getCountryCode();
if (countryCode == null)
countryCode = "";
String method = Res.get(paymentAccount.getPaymentMethod().getId());
accountNameTextField.setText(Res.get(paymentAccount.getPaymentMethod().getId())
.concat(": ")
.concat(StringUtils.abbreviate(holderNameInputTextField.getText(), 9)));
}
}
@ -348,22 +262,9 @@ public class WesternUnionForm extends PaymentMethodForm {
boolean result = isAccountNameValid()
&& paymentAccount.getSingleTradeCurrency() != null
&& getCountryBasedPaymentAccount().getCountry() != null
&& holderNameInputTextField.getValidator().validate(westernUnionAccountPayload.getHolderName()).isValid;
String countryCode = westernUnionAccountPayload.getCountryCode();
&& inputValidator.validate(westernUnionAccountPayload.getHolderName()).isValid
&& inputValidator.validate(westernUnionAccountPayload.getCity()).isValid
&& emailValidator.validate(westernUnionAccountPayload.getEmail()).isValid;
allInputsValid.set(result);
}
protected void addHolderNameAndIdForDisplayAccount() {
String countryCode = westernUnionAccountPayload.getCountryCode();
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"),
westernUnionAccountPayload.getHolderName());
}
protected void addAcceptedBanksForAddAccount() {
}
public void addAcceptedBanksForDisplayAccount() {
}
}

View file

@ -22,10 +22,7 @@ import io.bisq.common.locale.Res;
import io.bisq.common.util.Tuple2;
import io.bisq.common.util.Tuple3;
import io.bisq.core.app.BisqEnvironment;
import io.bisq.core.payment.AccountAgeWitnessService;
import io.bisq.core.payment.ClearXchangeAccount;
import io.bisq.core.payment.PaymentAccount;
import io.bisq.core.payment.PaymentAccountFactory;
import io.bisq.core.payment.*;
import io.bisq.core.payment.payload.PaymentMethod;
import io.bisq.gui.common.view.ActivatableViewAndModel;
import io.bisq.gui.common.view.FxmlView;
@ -157,38 +154,16 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
.actionButtonText(Res.get("shared.iConfirm"))
.onAction(() -> doSaveNewAccount(paymentAccount))
.show();
} else {
doSaveNewAccount(paymentAccount);
}
/* if (paymentAccount instanceof SepaAccount ||
paymentAccount instanceof BankAccount ||
paymentAccount instanceof ClearXchangeAccount ||
paymentAccount instanceof FasterPaymentsAccount ||
paymentAccount instanceof ChaseQuickPayAccount ||
paymentAccount instanceof InteracETransferAccount) {
new Popup<>().information(Res.get("payment.chargeback.info", currencyName))
.width(800)
} else if (paymentAccount instanceof WesternUnionAccount) {
new Popup<>().information(Res.get("payment.westernUnion.info", currencyName, currencyName))
.width(700)
.closeButtonText(Res.get("shared.cancel"))
.actionButtonText(Res.get("shared.iConfirm"))
.onAction(() -> {
if (paymentAccount instanceof ClearXchangeAccount) {
UserThread.runAfter(() -> {
new Popup<>().information(Res.get("payment.clearXchange.info", currencyName, currencyName))
.width(900)
.closeButtonText(Res.get("shared.cancel"))
.actionButtonText(Res.get("shared.iConfirm"))
.onAction(() -> doSaveNewAccount(paymentAccount))
.show();
}, 1);
} else {
doSaveNewAccount(paymentAccount);
}
})
.actionButtonText(Res.get("shared.iUnderstand"))
.onAction(() -> doSaveNewAccount(paymentAccount))
.show();
} else {
doSaveNewAccount(paymentAccount);
}*/
}
}
private void doSaveNewAccount(PaymentAccount paymentAccount) {

View file

@ -226,15 +226,15 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
final String method = Res.get(paymentMethod.getId());
String paymentMethodLabel = Res.getWithCol("shared.paymentMethod");
if (isNationalBanks || isSpecificBanks || isSepa) {
String mathodWithBankId = method + bankId;
String methodWithBankId = method + bankId;
if (BankUtil.isBankIdRequired(offer.getCountryCode()))
addLabelTextField(gridPane, ++rowIndex,
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offererBankId"),
mathodWithBankId);
methodWithBankId);
else if (BankUtil.isBankNameRequired(offer.getCountryCode()))
addLabelTextField(gridPane, ++rowIndex,
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offerersBankName"),
mathodWithBankId);
methodWithBankId);
} else {
addLabelTextField(gridPane, ++rowIndex, paymentMethodLabel, method);
}

View file

@ -146,11 +146,11 @@ public class BuyerStep2View extends TradeStepView {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : "";
TitledGroupBg accountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 1,
Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodId)),
Layout.GROUP_DISTANCE);
Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodId)),
Layout.GROUP_DISTANCE);
TextFieldWithCopyIcon field = addLabelTextFieldWithCopyIcon(gridPane, gridRow, Res.get("portfolio.pending.step2_buyer.amountToTransfer"),
model.getFiatVolume(),
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
model.getFiatVolume(),
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
field.setCopyWithoutCurrencyPostFix(true);
switch (paymentMethodId) {
@ -201,7 +201,7 @@ public class BuyerStep2View extends TradeStepView {
break;
case PaymentMethod.BLOCK_CHAINS_ID:
String labelTitle = Res.get("portfolio.pending.step2_buyer.sellersAddress",
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()));
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()));
gridRow = CryptoCurrencyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload, labelTitle);
break;
default:
@ -210,12 +210,12 @@ public class BuyerStep2View extends TradeStepView {
if (!(paymentAccountPayload instanceof CryptoCurrencyAccountPayload))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
Res.getWithCol("shared.reasonForPayment"), model.dataModel.getReference());
Res.getWithCol("shared.reasonForPayment"), model.dataModel.getReference());
GridPane.setRowSpan(accountTitledGroupBg, gridRow - 3);
Tuple3<Button, BusyAnimation, Label> tuple3 = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow,
Res.get("portfolio.pending.step2_buyer.paymentStarted"));
Res.get("portfolio.pending.step2_buyer.paymentStarted"));
confirmButton = tuple3.first;
confirmButton.setOnAction(e -> onPaymentStarted());
busyAnimation = tuple3.second;
@ -231,8 +231,8 @@ public class BuyerStep2View extends TradeStepView {
protected String getWarningText() {
setWarningHeadline();
return Res.get("portfolio.pending.step2_buyer.warn",
model.dataModel.getCurrencyCode(),
model.getDateForOpenDispute());
model.dataModel.getCurrencyCode(),
model.getDateForOpenDispute());
}
@ -265,12 +265,30 @@ public class BuyerStep2View extends TradeStepView {
if (!DevEnv.DEV_MODE && DontShowAgainLookup.showAgain(key)) {
Popup popup = new Popup<>();
popup.headLine(Res.get("portfolio.pending.step2_buyer.paperReceipt.headline"))
.feedback(Res.get("portfolio.pending.step2_buyer.paperReceipt.msg"))
.onAction(this::showConfirmPaymentStartedPopup)
.closeButtonText(Res.get("shared.no"))
.onClose(popup::hide)
.dontShowAgainId(key)
.show();
.feedback(Res.get("portfolio.pending.step2_buyer.paperReceipt.msg"))
.onAction(this::showConfirmPaymentStartedPopup)
.closeButtonText(Res.get("shared.no"))
.onClose(popup::hide)
.dontShowAgainId(key)
.show();
} else {
showConfirmPaymentStartedPopup();
}
} else if (model.dataModel.getSellersPaymentAccountPayload() instanceof WesternUnionAccountPayload) {
//noinspection UnusedAssignment
//noinspection ConstantConditions
String key = "westernUnionMTCNSent";
if (!DevEnv.DEV_MODE && DontShowAgainLookup.showAgain(key)) {
Popup popup = new Popup<>();
popup.headLine(Res.get("portfolio.pending.step2_buyer.westernUnionMTCNInfo.headline"))
.feedback(Res.get("portfolio.pending.step2_buyer.westernUnionMTCNInfo.msg",
((WesternUnionAccountPayload) model.dataModel.getSellersPaymentAccountPayload()).getEmail()))
.onAction(this::showConfirmPaymentStartedPopup)
.actionButtonText(Res.get("shared.yes"))
.closeButtonText(Res.get("shared.no"))
.onClose(popup::hide)
.dontShowAgainId(key)
.show();
} else {
showConfirmPaymentStartedPopup();
}
@ -290,15 +308,15 @@ public class BuyerStep2View extends TradeStepView {
if (!DevEnv.DEV_MODE && DontShowAgainLookup.showAgain(key)) {
Popup popup = new Popup<>();
popup.headLine(Res.get("portfolio.pending.step2_buyer.confirmStart.headline"))
.confirmation(Res.get("portfolio.pending.step2_buyer.confirmStart.msg",
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode())))
.width(700)
.actionButtonText(Res.get("portfolio.pending.step2_buyer.confirmStart.yes"))
.onAction(this::confirmPaymentStarted)
.closeButtonText(Res.get("shared.no"))
.onClose(popup::hide)
.dontShowAgainId(key)
.show();
.confirmation(Res.get("portfolio.pending.step2_buyer.confirmStart.msg",
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode())))
.width(700)
.actionButtonText(Res.get("portfolio.pending.step2_buyer.confirmStart.yes"))
.onAction(this::confirmPaymentStarted)
.closeButtonText(Res.get("shared.no"))
.onClose(popup::hide)
.dontShowAgainId(key)
.show();
} else {
confirmPaymentStarted();
}
@ -342,42 +360,51 @@ public class BuyerStep2View extends TradeStepView {
if (paymentAccountPayload instanceof CryptoCurrencyAccountPayload)
//noinspection UnusedAssignment
message += Res.get("portfolio.pending.step2_buyer.altcoin",
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()),
amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n\n" +
copyPaste;
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()),
amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n\n" +
copyPaste;
else if (paymentAccountPayload instanceof CashDepositAccountPayload)
//noinspection UnusedAssignment
message += Res.get("portfolio.pending.step2_buyer.cash",
amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
tradeId + paddedId +
assign +
refTextWarn + "\n\n" +
fees + "\n\n" +
Res.get("portfolio.pending.step2_buyer.cash.extra");
amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
tradeId + paddedId +
assign +
refTextWarn + "\n\n" +
fees + "\n\n" +
Res.get("portfolio.pending.step2_buyer.cash.extra");
else if (paymentAccountPayload instanceof WesternUnionAccountPayload)
//noinspection UnusedAssignment
message += Res.get("portfolio.pending.step2_buyer.westernUnion",
amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
Res.get("portfolio.pending.step2_buyer.westernUnion.extra",
((WesternUnionAccountPayload) paymentAccountPayload).getEmail());
else if (paymentAccountPayload instanceof USPostalMoneyOrderAccountPayload)
//noinspection UnusedAssignment
message += Res.get("portfolio.pending.step2_buyer.postal", amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
tradeId + paddedId +
assign +
refTextWarn;
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
tradeId + paddedId +
assign +
refTextWarn;
else
//noinspection UnusedAssignment
message += Res.get("portfolio.pending.step2_buyer.bank", amount) +
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
tradeId + paddedId +
assign +
refTextWarn + "\n\n" +
fees;
accountDetails +
paymentDetailsForTradePopup + ".\n" +
copyPaste + "\n\n" +
tradeId + paddedId +
assign +
refTextWarn + "\n\n" +
fees;
//noinspection ConstantConditions,UnusedAssignment
String key = "startPayment" + trade.getId();
@ -385,8 +412,8 @@ public class BuyerStep2View extends TradeStepView {
if (!DevEnv.DEV_MODE && DontShowAgainLookup.showAgain(key)) {
DontShowAgainLookup.dontShowAgain(key, true);
new Popup<>().headLine(Res.get("popup.attention.forTradeWithId", id))
.attention(message)
.show();
.attention(message)
.show();
}
}
}

View file

@ -147,7 +147,7 @@ public class SellerStep3View extends TradeStepView {
TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 3, Res.get("portfolio.pending.step3_seller.confirmPaymentReceipt"), Layout.GROUP_DISTANCE);
TextFieldWithCopyIcon field = addLabelTextFieldWithCopyIcon(gridPane, gridRow, Res.get("portfolio.pending.step3_seller.amountToReceive"),
model.getFiatVolume(), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
model.getFiatVolume(), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
field.setCopyWithoutCurrencyPostFix(true);
String myPaymentDetails = "";
@ -219,8 +219,8 @@ public class SellerStep3View extends TradeStepView {
protected String getWarningText() {
setWarningHeadline();
String substitute = model.isBlockChainMethod() ?
Res.get("portfolio.pending.step3_seller.warn.part1a", model.dataModel.getCurrencyCode()) :
Res.get("portfolio.pending.step3_seller.warn.part1b");
Res.get("portfolio.pending.step3_seller.warn.part1a", model.dataModel.getCurrencyCode()) :
Res.get("portfolio.pending.step3_seller.warn.part1b");
return Res.get("portfolio.pending.step3_seller.warn.part2", substitute, model.getDateForOpenDispute());
@ -257,7 +257,8 @@ public class SellerStep3View extends TradeStepView {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
String message = Res.get("portfolio.pending.step3_seller.onPaymentReceived.part1", CurrencyUtil.getNameByCode(model.dataModel.getCurrencyCode()));
if (!(paymentAccountPayload instanceof CryptoCurrencyAccountPayload)) {
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId());
if (!(paymentAccountPayload instanceof WesternUnionAccountPayload))
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId());
Optional<String> optionalHolderName = getOptionalHolderName();
if (optionalHolderName.isPresent()) {
@ -266,13 +267,13 @@ public class SellerStep3View extends TradeStepView {
}
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.note");
new Popup<>()
.headLine(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.headline"))
.confirmation(message)
.width(700)
.actionButtonText(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.yes"))
.onAction(this::confirmPaymentReceived)
.closeButtonText(Res.get("shared.cancel"))
.show();
.headLine(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.headline"))
.confirmation(message)
.width(700)
.actionButtonText(Res.get("portfolio.pending.step3_seller.onPaymentReceived.confirm.yes"))
.onAction(this::confirmPaymentReceived)
.closeButtonText(Res.get("shared.cancel"))
.show();
} else {
confirmPaymentReceived();
}
@ -287,7 +288,7 @@ public class SellerStep3View extends TradeStepView {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
//noinspection UnusedAssignment
String key = "confirmPayment" + trade.getId();
String message;
String message = "";
String tradeVolumeWithCode = model.btcFormatter.formatVolumeWithCode(trade.getTradeVolume());
String currencyName = CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode());
String part1 = Res.get("portfolio.pending.step3_seller.part", currencyName);
@ -299,12 +300,14 @@ public class SellerStep3View extends TradeStepView {
} else {
if (paymentAccountPayload instanceof USPostalMoneyOrderAccountPayload)
message = Res.get("portfolio.pending.step3_seller.postal", part1, tradeVolumeWithCode, id);
else
else if (!(paymentAccountPayload instanceof WesternUnionAccountPayload))
message = Res.get("portfolio.pending.step3_seller.bank", currencyName, tradeVolumeWithCode, id);
String part = Res.get("portfolio.pending.step3_seller.openDispute");
if (paymentAccountPayload instanceof CashDepositAccountPayload)
message = message + Res.get("portfolio.pending.step3_seller.cash", part);
else if (paymentAccountPayload instanceof WesternUnionAccountPayload)
message = message + Res.get("portfolio.pending.step3_seller.westernUnion", part);
Optional<String> optionalHolderName = getOptionalHolderName();
if (optionalHolderName.isPresent()) {
@ -316,8 +319,8 @@ public class SellerStep3View extends TradeStepView {
if (!DevEnv.DEV_MODE && DontShowAgainLookup.showAgain(key)) {
DontShowAgainLookup.dontShowAgain(key, true);
new Popup<>().headLine(Res.get("popup.attention.forTradeWithId", id))
.attention(message)
.show();
.attention(message)
.show();
}
}

View file

@ -298,7 +298,7 @@ public class BSFormatter {
public String formatVolumeLabel(String currencyCode, String postFix) {
return Res.get("formatter.formatVolumeLabel",
CurrencyUtil.getNameByCode(currencyCode), postFix);
currencyCode, postFix);
}
public String formatMinVolumeAndVolume(Offer offer) {