Search in sources :

Example 1 with CryptoCurrencyAccountPayload

use of bisq.core.payment.payload.CryptoCurrencyAccountPayload 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();
    }
}
Also used : CashDepositAccountPayload(bisq.core.payment.payload.CashDepositAccountPayload) USPostalMoneyOrderAccountPayload(bisq.core.payment.payload.USPostalMoneyOrderAccountPayload) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) WesternUnionAccountPayload(bisq.core.payment.payload.WesternUnionAccountPayload) CryptoCurrencyAccountPayload(bisq.core.payment.payload.CryptoCurrencyAccountPayload)

Example 2 with CryptoCurrencyAccountPayload

use of bisq.core.payment.payload.CryptoCurrencyAccountPayload in project bisq-desktop by bisq-network.

the class SellerStep3View method addContent.

// /////////////////////////////////////////////////////////////////////////////////////////
// Content
// /////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void addContent() {
    addTradeInfoBlock();
    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;
    field.setCopyWithoutCurrencyPostFix(true);
    String myPaymentDetails = "";
    String peersPaymentDetails = "";
    String myTitle = "";
    String peersTitle = "";
    boolean isBlockChain = false;
    String nameByCode = CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode());
    Contract contract = trade.getContract();
    if (contract != null) {
        PaymentAccountPayload myPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
        PaymentAccountPayload peersPaymentAccountPayload = contract.getBuyerPaymentAccountPayload();
        if (myPaymentAccountPayload instanceof CryptoCurrencyAccountPayload) {
            myPaymentDetails = ((CryptoCurrencyAccountPayload) myPaymentAccountPayload).getAddress();
            peersPaymentDetails = ((CryptoCurrencyAccountPayload) peersPaymentAccountPayload).getAddress();
            myTitle = Res.get("portfolio.pending.step3_seller.yourAddress", nameByCode);
            peersTitle = Res.get("portfolio.pending.step3_seller.buyersAddress", nameByCode);
            isBlockChain = true;
        } else {
            myPaymentDetails = myPaymentAccountPayload.getPaymentDetails();
            peersPaymentDetails = peersPaymentAccountPayload.getPaymentDetails();
            myTitle = Res.get("portfolio.pending.step3_seller.yourAccount");
            peersTitle = Res.get("portfolio.pending.step3_seller.buyersAccount");
        }
    }
    TextFieldWithCopyIcon myPaymentDetailsTextField = addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, myTitle, myPaymentDetails).second;
    myPaymentDetailsTextField.setMouseTransparent(false);
    myPaymentDetailsTextField.setTooltip(new Tooltip(myPaymentDetails));
    TextFieldWithCopyIcon peersPaymentDetailsTextField = addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, peersTitle, peersPaymentDetails).second;
    peersPaymentDetailsTextField.setMouseTransparent(false);
    peersPaymentDetailsTextField.setTooltip(new Tooltip(peersPaymentDetails));
    if (!isBlockChain) {
        addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("shared.reasonForPayment"), model.dataModel.getReference());
        GridPane.setRowSpan(titledGroupBg, 4);
    }
    Tuple3<Button, BusyAnimation, Label> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, Res.get("portfolio.pending.step3_seller.confirmReceipt"));
    confirmButton = tuple.first;
    confirmButton.setOnAction(e -> onPaymentReceived());
    busyAnimation = tuple.second;
    statusLabel = tuple.third;
}
Also used : BusyAnimation(bisq.desktop.components.BusyAnimation) Button(javafx.scene.control.Button) FormBuilder.addLabelTextFieldWithCopyIcon(bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon) TextFieldWithCopyIcon(bisq.desktop.components.TextFieldWithCopyIcon) Tooltip(javafx.scene.control.Tooltip) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) Label(javafx.scene.control.Label) TitledGroupBg(bisq.desktop.components.TitledGroupBg) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) Contract(bisq.core.trade.Contract) CryptoCurrencyAccountPayload(bisq.core.payment.payload.CryptoCurrencyAccountPayload)

Example 3 with CryptoCurrencyAccountPayload

use of bisq.core.payment.payload.CryptoCurrencyAccountPayload 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();
        }
    }
}
Also used : CashDepositAccountPayload(bisq.core.payment.payload.CashDepositAccountPayload) USPostalMoneyOrderAccountPayload(bisq.core.payment.payload.USPostalMoneyOrderAccountPayload) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) WesternUnionAccountPayload(bisq.core.payment.payload.WesternUnionAccountPayload) CryptoCurrencyAccountPayload(bisq.core.payment.payload.CryptoCurrencyAccountPayload)

Example 4 with CryptoCurrencyAccountPayload

use of bisq.core.payment.payload.CryptoCurrencyAccountPayload in project bisq-desktop by bisq-network.

the class SellerStep3View method onPaymentReceived.

// //////////////////////////////////////////////////////////////////////////////////////
// UI Handlers
// /////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("PointlessBooleanExpression")
private void onPaymentReceived() {
    // are well connected to the Bitcoin network before triggering the broadcast.
    if (model.dataModel.isReadyForTxBroadcast()) {
        // noinspection UnusedAssignment
        String key = "confirmPaymentReceived";
        // noinspection ConstantConditions
        if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
            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();
                if (optionalHolderName.isPresent()) {
                    message += Res.get("portfolio.pending.step3_seller.onPaymentReceived.name", optionalHolderName.get());
                }
            }
            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();
        } else {
            confirmPaymentReceived();
        }
    } else {
        model.dataModel.showNotReadyForTxBroadcastPopups();
    }
}
Also used : PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) WesternUnionAccountPayload(bisq.core.payment.payload.WesternUnionAccountPayload) CryptoCurrencyAccountPayload(bisq.core.payment.payload.CryptoCurrencyAccountPayload)

Example 5 with CryptoCurrencyAccountPayload

use of bisq.core.payment.payload.CryptoCurrencyAccountPayload in project bisq-desktop by bisq-network.

the class BuyerStep2View method addContent.

// /////////////////////////////////////////////////////////////////////////////////////////
// Content
// /////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void addContent() {
    addTradeInfoBlock();
    PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
    String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : "";
    TitledGroupBg accountTitledGroupBg = FormBuilder.addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodId)), Layout.GROUP_DISTANCE);
    TextFieldWithCopyIcon field = FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, gridRow, Res.get("portfolio.pending.step2_buyer.amountToTransfer"), model.getFiatVolume(), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
    field.setCopyWithoutCurrencyPostFix(true);
    switch(paymentMethodId) {
        case PaymentMethod.OK_PAY_ID:
            gridRow = OKPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.UPHOLD_ID:
            gridRow = UpholdForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.CASH_APP_ID:
            gridRow = CashAppForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.MONEY_BEAM_ID:
            gridRow = MoneyBeamForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.VENMO_ID:
            gridRow = VenmoForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.POPMONEY_ID:
            gridRow = PopmoneyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.REVOLUT_ID:
            gridRow = RevolutForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.PERFECT_MONEY_ID:
            gridRow = PerfectMoneyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.SEPA_ID:
            gridRow = SepaForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.FASTER_PAYMENTS_ID:
            gridRow = FasterPaymentsForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.NATIONAL_BANK_ID:
            gridRow = NationalBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.SAME_BANK_ID:
            gridRow = SameBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.SPECIFIC_BANKS_ID:
            gridRow = SpecificBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.SWISH_ID:
            gridRow = SwishForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.ALI_PAY_ID:
            gridRow = AliPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.CLEAR_X_CHANGE_ID:
            gridRow = ClearXchangeForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.CHASE_QUICK_PAY_ID:
            gridRow = ChaseQuickPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.INTERAC_E_TRANSFER_ID:
            gridRow = InteracETransferForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
            gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
            break;
        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()));
            gridRow = CryptoCurrencyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload, labelTitle);
            break;
        default:
            log.error("Not supported PaymentMethod: " + paymentMethodId);
    }
    if (!(paymentAccountPayload instanceof CryptoCurrencyAccountPayload))
        FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("shared.reasonForPayment"), model.dataModel.getReference());
    GridPane.setRowSpan(accountTitledGroupBg, gridRow - 3);
    Tuple3<Button, BusyAnimation, Label> tuple3 = FormBuilder.addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, Res.get("portfolio.pending.step2_buyer.paymentStarted"));
    confirmButton = tuple3.first;
    confirmButton.setOnAction(e -> onPaymentStarted());
    busyAnimation = tuple3.second;
    statusLabel = tuple3.third;
}
Also used : BusyAnimation(bisq.desktop.components.BusyAnimation) Button(javafx.scene.control.Button) TextFieldWithCopyIcon(bisq.desktop.components.TextFieldWithCopyIcon) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) Label(javafx.scene.control.Label) TitledGroupBg(bisq.desktop.components.TitledGroupBg) CryptoCurrencyAccountPayload(bisq.core.payment.payload.CryptoCurrencyAccountPayload)

Aggregations

CryptoCurrencyAccountPayload (bisq.core.payment.payload.CryptoCurrencyAccountPayload)5 PaymentAccountPayload (bisq.core.payment.payload.PaymentAccountPayload)5 WesternUnionAccountPayload (bisq.core.payment.payload.WesternUnionAccountPayload)3 CashDepositAccountPayload (bisq.core.payment.payload.CashDepositAccountPayload)2 USPostalMoneyOrderAccountPayload (bisq.core.payment.payload.USPostalMoneyOrderAccountPayload)2 BusyAnimation (bisq.desktop.components.BusyAnimation)2 TextFieldWithCopyIcon (bisq.desktop.components.TextFieldWithCopyIcon)2 TitledGroupBg (bisq.desktop.components.TitledGroupBg)2 Button (javafx.scene.control.Button)2 Label (javafx.scene.control.Label)2 Contract (bisq.core.trade.Contract)1 FormBuilder.addLabelTextFieldWithCopyIcon (bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon)1 FormBuilder.addTitledGroupBg (bisq.desktop.util.FormBuilder.addTitledGroupBg)1 Tooltip (javafx.scene.control.Tooltip)1