mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Merge branch 'Nolaan-Nolaan-Western_Union_integration' into Development
This commit is contained in:
commit
04743295f3
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -829,6 +829,7 @@ message CountryBasedPaymentAccountPayload {
|
||||
BankAccountPayload bank_account_payload = 2;
|
||||
CashDepositAccountPayload cash_deposit_account_payload = 3;
|
||||
SepaAccountPayload sepa_account_payload = 4;
|
||||
WesternUnionAccountPayload western_union_account_payload = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@ -870,6 +871,13 @@ message CashDepositAccountPayload {
|
||||
string holder_tax_id = 9;
|
||||
}
|
||||
|
||||
message WesternUnionAccountPayload {
|
||||
string holder_name = 1;
|
||||
string city = 2;
|
||||
string state = 3;
|
||||
string email = 4;
|
||||
}
|
||||
|
||||
message SepaAccountPayload {
|
||||
string holder_name = 1;
|
||||
string iban = 2;
|
||||
|
@ -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
|
||||
@ -1629,6 +1638,7 @@ SAME_BANK=Transfer with same bank
|
||||
SPECIFIC_BANKS=Transfers with specific banks
|
||||
US_POSTAL_MONEY_ORDER=US Postal Money Order
|
||||
CASH_DEPOSIT=Cash Deposit
|
||||
WESTERN_UNION=Western Union
|
||||
|
||||
# suppress inspection "UnusedProperty"
|
||||
NATIONAL_BANK_SHORT=National banks
|
||||
@ -1640,6 +1650,7 @@ SPECIFIC_BANKS_SHORT=Specific banks
|
||||
US_POSTAL_MONEY_ORDER_SHORT=US Money Order
|
||||
# suppress inspection "UnusedProperty"
|
||||
CASH_DEPOSIT_SHORT=Cash Deposit
|
||||
WESTERN_UNION_SHORT=Western Union
|
||||
|
||||
# Do not translate brand names
|
||||
OK_PAY=OKPay
|
||||
|
@ -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;
|
||||
|
@ -52,6 +52,8 @@ public class PaymentAccountFactory {
|
||||
return new CashDepositAccount();
|
||||
case PaymentMethod.BLOCK_CHAINS_ID:
|
||||
return new CryptoCurrencyAccount();
|
||||
case PaymentMethod.WESTERN_UNION_ID:
|
||||
return new WesternUnionAccount();
|
||||
default:
|
||||
throw new RuntimeException("Not supported PaymentMethod: " + paymentMethod);
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq 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.
|
||||
*
|
||||
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bisq.core.payment;
|
||||
|
||||
import io.bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import io.bisq.core.payment.payload.PaymentMethod;
|
||||
import io.bisq.core.payment.payload.WesternUnionAccountPayload;
|
||||
|
||||
public final class WesternUnionAccount extends CountryBasedPaymentAccount {
|
||||
public WesternUnionAccount() {
|
||||
super(PaymentMethod.WESTERN_UNION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountPayload createPayload() {
|
||||
return new WesternUnionAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return ((WesternUnionAccountPayload) paymentAccountPayload).getEmail();
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
((WesternUnionAccountPayload) paymentAccountPayload).setEmail(email);
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
return ((WesternUnionAccountPayload) paymentAccountPayload).getHolderName();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -60,6 +60,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable {
|
||||
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 WESTERN_UNION_ID = "WESTERN_UNION";
|
||||
public static final String BLOCK_CHAINS_ID = "BLOCK_CHAINS";
|
||||
|
||||
public static PaymentMethod OK_PAY;
|
||||
@ -76,6 +77,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable {
|
||||
public static PaymentMethod INTERAC_E_TRANSFER;
|
||||
public static PaymentMethod US_POSTAL_MONEY_ORDER;
|
||||
public static PaymentMethod CASH_DEPOSIT;
|
||||
public static PaymentMethod WESTERN_UNION;
|
||||
public static PaymentMethod BLOCK_CHAINS;
|
||||
|
||||
private static List<PaymentMethod> ALL_VALUES;
|
||||
@ -171,6 +173,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable {
|
||||
|
||||
// Global
|
||||
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 4 * DAY, maxTradeLimitMidRisk),
|
||||
WESTERN_UNION = new PaymentMethod(WESTERN_UNION_ID, 4 * DAY, maxTradeLimitMidRisk),
|
||||
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 4 * DAY, maxTradeLimitMidRisk),
|
||||
SAME_BANK = new PaymentMethod(SAME_BANK_ID, 2 * DAY, maxTradeLimitMidRisk),
|
||||
SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 4 * DAY, maxTradeLimitMidRisk),
|
||||
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq 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.
|
||||
*
|
||||
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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.generated.protobuffer.PB;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Setter
|
||||
@Getter
|
||||
@Slf4j
|
||||
public class WesternUnionAccountPayload extends CountryBasedPaymentAccountPayload {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private WesternUnionAccountPayload(String paymentMethodName,
|
||||
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.city = city;
|
||||
this.state = state;
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message toProtoMessage() {
|
||||
PB.WesternUnionAccountPayload.Builder builder =
|
||||
PB.WesternUnionAccountPayload.newBuilder()
|
||||
.setHolderName(holderName)
|
||||
.setCity(city)
|
||||
.setState(state)
|
||||
.setEmail(email);
|
||||
|
||||
final PB.CountryBasedPaymentAccountPayload.Builder countryBasedPaymentAccountPayload = getPaymentAccountPayloadBuilder()
|
||||
.getCountryBasedPaymentAccountPayloadBuilder()
|
||||
.setWesternUnionAccountPayload(builder);
|
||||
return getPaymentAccountPayloadBuilder()
|
||||
.setCountryBasedPaymentAccountPayload(countryBasedPaymentAccountPayload)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static PaymentAccountPayload fromProto(PB.PaymentAccountPayload proto) {
|
||||
PB.CountryBasedPaymentAccountPayload countryBasedPaymentAccountPayload = proto.getCountryBasedPaymentAccountPayload();
|
||||
PB.WesternUnionAccountPayload westernUnionAccountPayload = countryBasedPaymentAccountPayload.getWesternUnionAccountPayload();
|
||||
return new WesternUnionAccountPayload(proto.getPaymentMethodId(),
|
||||
proto.getId(),
|
||||
countryBasedPaymentAccountPayload.getCountryCode(),
|
||||
westernUnionAccountPayload.getHolderName(),
|
||||
westernUnionAccountPayload.getCity(),
|
||||
westernUnionAccountPayload.getState(),
|
||||
westernUnionAccountPayload.getEmail(),
|
||||
proto.getMaxTradePeriod(),
|
||||
CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Western Union - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
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() {
|
||||
String all = this.countryCode +
|
||||
this.holderName +
|
||||
this.email;
|
||||
return super.getAgeWitnessInputData(all.getBytes(Charset.forName("UTF-8")));
|
||||
}
|
||||
}
|
@ -35,6 +35,8 @@ public class CoreProtoResolver implements ProtoResolver {
|
||||
"(PB.PaymentAccountPayload.CountryBasedPaymentAccountPayload.BankAccountPayload). " +
|
||||
"messageCase=" + proto.getMessageCase());
|
||||
}
|
||||
case WESTERN_UNION_ACCOUNT_PAYLOAD:
|
||||
return WesternUnionAccountPayload.fromProto(proto);
|
||||
case CASH_DEPOSIT_ACCOUNT_PAYLOAD:
|
||||
return CashDepositAccountPayload.fromProto(proto);
|
||||
case SEPA_ACCOUNT_PAYLOAD:
|
||||
|
@ -0,0 +1,270 @@
|
||||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq 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.
|
||||
*
|
||||
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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.core.payment.AccountAgeWitnessService;
|
||||
import io.bisq.core.payment.CountryBasedPaymentAccount;
|
||||
import io.bisq.core.payment.PaymentAccount;
|
||||
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.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.layout.GridPane;
|
||||
import javafx.util.StringConverter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static io.bisq.gui.util.FormBuilder.addLabelTextFieldWithCopyIcon;
|
||||
|
||||
@Slf4j
|
||||
public class WesternUnionForm extends PaymentMethodForm {
|
||||
|
||||
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;
|
||||
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) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.westernUnionAccountPayload = (WesternUnionAccountPayload) paymentAccount.paymentAccountPayload;
|
||||
|
||||
emailValidator = new EmailValidator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
String countryCode = westernUnionAccountPayload.getCountryCode();
|
||||
|
||||
FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"),
|
||||
Res.get(paymentAccount.getPaymentMethod().getId()));
|
||||
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.country"),
|
||||
getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
|
||||
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
|
||||
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
|
||||
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"),
|
||||
nameAndCode);
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedItem);
|
||||
String countryCode = selectedItem.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
updateFromInputs();
|
||||
applyIsStateRequired();
|
||||
cityInputTextField.setText("");
|
||||
stateInputTextField.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
currencyComboBox = FormBuilder.addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
|
||||
if (!defaultCurrency.equals(selectedItem)) {
|
||||
new Popup<>().warning(Res.get("payment.foreign.currency"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
})
|
||||
.closeButtonText(Res.get("payment.restore.default"))
|
||||
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
|
||||
.show();
|
||||
} else {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
}
|
||||
});
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
public String toString(TradeCurrency currency) {
|
||||
return currency.getNameAndCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeCurrency fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
currencyComboBox.setDisable(true);
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||
accountNameTextField.setText(Res.get(paymentAccount.getPaymentMethod().getId())
|
||||
.concat(": ")
|
||||
.concat(StringUtils.abbreviate(holderNameInputTextField.getText(), 9)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
boolean result = isAccountNameValid()
|
||||
&& paymentAccount.getSingleTradeCurrency() != null
|
||||
&& getCountryBasedPaymentAccount().getCountry() != null
|
||||
&& inputValidator.validate(westernUnionAccountPayload.getHolderName()).isValid
|
||||
&& inputValidator.validate(westernUnionAccountPayload.getCity()).isValid
|
||||
&& emailValidator.validate(westernUnionAccountPayload.getEmail()).isValid;
|
||||
allInputsValid.set(result);
|
||||
}
|
||||
}
|
@ -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"))
|
||||
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||
.onAction(() -> doSaveNewAccount(paymentAccount))
|
||||
.show();
|
||||
}, 1);
|
||||
} else {
|
||||
doSaveNewAccount(paymentAccount);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
doSaveNewAccount(paymentAccount);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void doSaveNewAccount(PaymentAccount paymentAccount) {
|
||||
@ -388,6 +363,8 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
return new InteracETransferForm(paymentAccount, accountAgeWitnessService, interacETransferValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
|
||||
return new USPostalMoneyOrderForm(paymentAccount, accountAgeWitnessService, usPostalMoneyOrderValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.WESTERN_UNION_ID:
|
||||
return new WesternUnionForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CASH_DEPOSIT_ID:
|
||||
return new CashDepositForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
default:
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -196,6 +196,9 @@ public class BuyerStep2View extends TradeStepView {
|
||||
case PaymentMethod.CASH_DEPOSIT_ID:
|
||||
gridRow = CashDepositForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
|
||||
break;
|
||||
case PaymentMethod.WESTERN_UNION_ID:
|
||||
gridRow = WesternUnionForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
|
||||
break;
|
||||
case PaymentMethod.BLOCK_CHAINS_ID:
|
||||
String labelTitle = Res.get("portfolio.pending.step2_buyer.sellersAddress",
|
||||
CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()));
|
||||
@ -271,6 +274,24 @@ public class BuyerStep2View extends TradeStepView {
|
||||
} 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();
|
||||
}
|
||||
} else {
|
||||
showConfirmPaymentStartedPopup();
|
||||
}
|
||||
@ -356,6 +377,15 @@ public class BuyerStep2View extends TradeStepView {
|
||||
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) +
|
||||
|
@ -257,6 +257,7 @@ 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)) {
|
||||
if (!(paymentAccountPayload instanceof WesternUnionAccountPayload))
|
||||
message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.fiat", trade.getShortId());
|
||||
|
||||
Optional<String> optionalHolderName = getOptionalHolderName();
|
||||
@ -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()) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user