use of bisq.core.payment.payload.CashDepositAccountPayload in project bisq-desktop by bisq-network.
the class CashDepositForm method addFormForBuyer.
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
CashDepositAccountPayload data = (CashDepositAccountPayload) paymentAccountPayload;
String countryCode = data.getCountryCode();
String requirements = data.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (data.getHolderTaxId() != null)
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.name.emailAndHolderId", BankUtil.getHolderIdLabel(countryCode)), data.getHolderName() + " / " + data.getHolderEmail() + " / " + data.getHolderTaxId());
else
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.name.email"), data.getHolderName() + " / " + data.getHolderEmail());
if (!showRequirements)
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("payment.bank.country"), CountryUtil.getNameAndCode(countryCode));
else
requirements += "\n" + Res.get("payment.bank.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 (bankNameBankIdCombined) {
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + bankIdLabel.substring(0, bankIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBankId());
}
if (bankNameBranchIdCombined) {
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel, data.getBankName());
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && !branchIdAccountNrCombined && bankIdBranchIdCombined) {
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel.substring(0, bankIdLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankId() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankIdRequired(countryCode))
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel, data.getBankId());
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && branchIdAccountNrCombined) {
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel.substring(0, branchIdLabel.length() - 1) + " / " + accountNrLabel.substring(0, accountNrLabel.length() - 1) + ":", data.getBranchId() + " / " + data.getAccountNr());
}
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && !branchIdAccountNrCombined && BankUtil.isBranchIdRequired(countryCode))
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel, data.getBranchId());
if (!branchIdAccountNrCombined && accountNrAccountTypeCombined) {
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel.substring(0, accountNrLabel.length() - 1) + " / " + accountTypeLabel, data.getAccountNr() + " / " + data.getAccountType());
}
if (!branchIdAccountNrCombined && !accountNrAccountTypeCombined && BankUtil.isAccountNrRequired(countryCode))
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel, data.getAccountNr());
if (!accountNrAccountTypeCombined && BankUtil.isAccountTypeRequired(countryCode))
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountTypeLabel, data.getAccountType());
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);
}
return gridRow;
}
use of bisq.core.payment.payload.CashDepositAccountPayload in project bisq-desktop by bisq-network.
the class SellerStep3View method showPopup.
@SuppressWarnings("PointlessBooleanExpression")
private void showPopup() {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
// noinspection UnusedAssignment
String key = "confirmPayment" + trade.getId();
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);
String id = trade.getShortId();
if (paymentAccountPayload instanceof CryptoCurrencyAccountPayload) {
String address = ((CryptoCurrencyAccountPayload) paymentAccountPayload).getAddress();
// noinspection UnusedAssignment
message = Res.get("portfolio.pending.step3_seller.altcoin", part1, currencyName, address, tradeVolumeWithCode, currencyName);
} else {
if (paymentAccountPayload instanceof USPostalMoneyOrderAccountPayload)
message = Res.get("portfolio.pending.step3_seller.postal", part1, tradeVolumeWithCode, id);
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()) {
// noinspection UnusedAssignment
message = message + Res.get("portfolio.pending.step3_seller.bankCheck", optionalHolderName.get(), part);
}
}
// noinspection ConstantConditions
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
DontShowAgainLookup.dontShowAgain(key, true);
new Popup<>().headLine(Res.get("popup.attention.forTradeWithId", id)).attention(message).show();
}
}
use of bisq.core.payment.payload.CashDepositAccountPayload in project bisq-desktop by bisq-network.
the class BuyerStep2View method showPopup.
@SuppressWarnings("PointlessBooleanExpression")
private void showPopup() {
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
if (paymentAccountPayload != null) {
String paymentDetailsForTradePopup = paymentAccountPayload.getPaymentDetailsForTradePopup();
String message = Res.get("portfolio.pending.step2.confReached");
String copyPaste = Res.get("portfolio.pending.step2_buyer.copyPaste");
String refTextWarn = Res.get("portfolio.pending.step2_buyer.refTextWarn");
String accountDetails = Res.get("portfolio.pending.step2_buyer.accountDetails");
String tradeId = Res.get("portfolio.pending.step2_buyer.tradeId");
String assign = Res.get("portfolio.pending.step2_buyer.assign");
String fees = Res.get("portfolio.pending.step2_buyer.fees");
String id = trade.getShortId();
String paddedId = " " + id + " ";
String amount = model.btcFormatter.formatVolumeWithCode(trade.getTradeVolume());
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;
} 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");
} else if (paymentAccountPayload instanceof WesternUnionAccountPayload) {
final String email = ((WesternUnionAccountPayload) paymentAccountPayload).getEmail();
final String extra = Res.get("portfolio.pending.step2_buyer.westernUnion.extra", email);
message += Res.get("portfolio.pending.step2_buyer.westernUnion", amount) + accountDetails + paymentDetailsForTradePopup + ".\n" + copyPaste + "\n\n" + extra;
} 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;
} 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;
}
// noinspection ConstantConditions,UnusedAssignment
String key = "startPayment" + trade.getId();
// noinspection ConstantConditions,ConstantConditions
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
DontShowAgainLookup.dontShowAgain(key, true);
new Popup<>().headLine(Res.get("popup.attention.forTradeWithId", id)).attention(message).show();
}
}
}
use of bisq.core.payment.payload.CashDepositAccountPayload in project bisq-desktop by bisq-network.
the class BuyerStep2View method onPaymentStarted.
// /////////////////////////////////////////////////////////////////////////////////////////
// UI Handlers
// /////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("PointlessBooleanExpression")
private void onPaymentStarted() {
if (model.p2PService.isBootstrapped()) {
if (model.dataModel.getSellersPaymentAccountPayload() instanceof CashDepositAccountPayload) {
// noinspection UnusedAssignment
String key = "confirmPaperReceiptSent";
// noinspection ConstantConditions
if (!DevEnv.isDevMode() && 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();
} else {
showConfirmPaymentStartedPopup();
}
} else if (model.dataModel.getSellersPaymentAccountPayload() instanceof WesternUnionAccountPayload) {
// noinspection UnusedAssignment
// noinspection ConstantConditions
String key = "westernUnionMTCNSent";
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
String email = ((WesternUnionAccountPayload) model.dataModel.getSellersPaymentAccountPayload()).getEmail();
Popup popup = new Popup<>();
popup.headLine(Res.get("portfolio.pending.step2_buyer.westernUnionMTCNInfo.headline")).feedback(Res.get("portfolio.pending.step2_buyer.westernUnionMTCNInfo.msg", email)).onAction(this::showConfirmPaymentStartedPopup).actionButtonText(Res.get("shared.yes")).closeButtonText(Res.get("shared.no")).onClose(popup::hide).dontShowAgainId(key).show();
} else {
showConfirmPaymentStartedPopup();
}
} else {
showConfirmPaymentStartedPopup();
}
} else {
new Popup<>().information(Res.get("popup.warning.notFullyConnected")).show();
}
}
Aggregations