Search in sources :

Example 11 with PaymentAccountPayload

use of bisq.core.payment.payload.PaymentAccountPayload 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 12 with PaymentAccountPayload

use of bisq.core.payment.payload.PaymentAccountPayload 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)

Example 13 with PaymentAccountPayload

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

the class CheckIfPeerIsBanned method run.

@Override
protected void run() {
    try {
        runInterceptHook();
        final NodeAddress nodeAddress = processModel.getTempTradingPeerNodeAddress();
        PaymentAccountPayload paymentAccountPayload = checkNotNull(processModel.getTradingPeer().getPaymentAccountPayload());
        final PaymentAccountFilter[] appliedPaymentAccountFilter = new PaymentAccountFilter[1];
        if (nodeAddress != null && processModel.getFilterManager().isNodeAddressBanned(nodeAddress)) {
            failed("Other trader is banned by his node address.\n" + "tradingPeerNodeAddress=" + nodeAddress);
        } else if (processModel.getFilterManager().isOfferIdBanned(trade.getId())) {
            failed("Offer ID is banned.\n" + "Offer ID=" + trade.getId());
        } else if (processModel.getFilterManager().isCurrencyBanned(trade.getOffer().getCurrencyCode())) {
            failed("Currency is banned.\n" + "Currency code=" + trade.getOffer().getCurrencyCode());
        } else if (processModel.getFilterManager().isPaymentMethodBanned(trade.getOffer().getPaymentMethod())) {
            failed("Payment method is banned.\n" + "Payment method=" + trade.getOffer().getPaymentMethod().getId());
        } else if (processModel.getFilterManager().isPeersPaymentAccountDataAreBanned(paymentAccountPayload, appliedPaymentAccountFilter)) {
            failed("Other trader is banned by his trading account data.\n" + "paymentAccountPayload=" + paymentAccountPayload.getPaymentDetails() + "\n" + "banFilter=" + appliedPaymentAccountFilter[0].toString());
        } else {
            complete();
        }
    } catch (Throwable t) {
        failed(t);
    }
}
Also used : PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) PaymentAccountFilter(bisq.core.filter.PaymentAccountFilter) NodeAddress(bisq.network.p2p.NodeAddress)

Example 14 with PaymentAccountPayload

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

the class TakerVerifyAndSignContract method run.

@Override
protected void run() {
    try {
        runInterceptHook();
        checkNotNull(trade.getTakerFeeTxId(), "TakeOfferFeeTxId must not be null");
        TradingPeer maker = processModel.getTradingPeer();
        PaymentAccountPayload makerPaymentAccountPayload = maker.getPaymentAccountPayload();
        PaymentAccountPayload takerPaymentAccountPayload = processModel.getPaymentAccountPayload(trade);
        boolean isBuyerMakerAndSellerTaker = trade instanceof SellerAsTakerTrade;
        NodeAddress buyerNodeAddress = isBuyerMakerAndSellerTaker ? processModel.getTempTradingPeerNodeAddress() : processModel.getMyNodeAddress();
        NodeAddress sellerNodeAddress = isBuyerMakerAndSellerTaker ? processModel.getMyNodeAddress() : processModel.getTempTradingPeerNodeAddress();
        log.debug("isBuyerMakerAndSellerTaker " + isBuyerMakerAndSellerTaker);
        log.debug("buyerAddress " + buyerNodeAddress);
        log.debug("sellerAddress " + sellerNodeAddress);
        BtcWalletService walletService = processModel.getBtcWalletService();
        String id = processModel.getOffer().getId();
        AddressEntry takerPayoutAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.TRADE_PAYOUT);
        String takerPayoutAddressString = takerPayoutAddressEntry.getAddressString();
        AddressEntry takerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG);
        byte[] takerMultiSigPubKey = processModel.getMyMultiSigPubKey();
        checkArgument(Arrays.equals(takerMultiSigPubKey, takerMultiSigAddressEntry.getPubKey()), "takerMultiSigPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
        final Coin tradeAmount = trade.getTradeAmount();
        checkNotNull(tradeAmount, "tradeAmount must not be null");
        Contract contract = new Contract(processModel.getOffer().getOfferPayload(), tradeAmount.value, trade.getTradePrice().getValue(), trade.getTakerFeeTxId(), buyerNodeAddress, sellerNodeAddress, trade.getArbitratorNodeAddress(), trade.getMediatorNodeAddress(), isBuyerMakerAndSellerTaker, maker.getAccountId(), processModel.getAccountId(), makerPaymentAccountPayload, takerPaymentAccountPayload, maker.getPubKeyRing(), processModel.getPubKeyRing(), maker.getPayoutAddressString(), takerPayoutAddressString, maker.getMultiSigPubKey(), takerMultiSigPubKey);
        String contractAsJson = Utilities.objectToJson(contract);
        log.trace("Contract as json:{}", contractAsJson);
        contract.printDiff(processModel.getTradingPeer().getContractAsJson());
        checkArgument(contractAsJson.equals(processModel.getTradingPeer().getContractAsJson()), "Contracts are not matching");
        String signature = Sig.sign(processModel.getKeyRing().getSignatureKeyPair().getPrivate(), contractAsJson);
        trade.setContract(contract);
        trade.setContractAsJson(contractAsJson);
        trade.setTakerContractSignature(signature);
        try {
            checkNotNull(maker.getPubKeyRing(), "maker.getPubKeyRing() must nto be null");
            Sig.verify(maker.getPubKeyRing().getSignaturePubKey(), contractAsJson, maker.getContractSignature());
            complete();
        } catch (Throwable t) {
            failed("Signature verification failed. " + t.getMessage());
        }
    } catch (Throwable t) {
        failed(t);
    }
}
Also used : Coin(org.bitcoinj.core.Coin) TradingPeer(bisq.core.trade.protocol.TradingPeer) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) AddressEntry(bisq.core.btc.AddressEntry) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) SellerAsTakerTrade(bisq.core.trade.SellerAsTakerTrade) NodeAddress(bisq.network.p2p.NodeAddress) Contract(bisq.core.trade.Contract)

Aggregations

PaymentAccountPayload (bisq.core.payment.payload.PaymentAccountPayload)14 CryptoCurrencyAccountPayload (bisq.core.payment.payload.CryptoCurrencyAccountPayload)5 Contract (bisq.core.trade.Contract)5 AddressEntry (bisq.core.btc.AddressEntry)4 BtcWalletService (bisq.core.btc.wallet.BtcWalletService)4 NodeAddress (bisq.network.p2p.NodeAddress)4 Button (javafx.scene.control.Button)4 WesternUnionAccountPayload (bisq.core.payment.payload.WesternUnionAccountPayload)3 TradingPeer (bisq.core.trade.protocol.TradingPeer)3 TextFieldWithCopyIcon (bisq.desktop.components.TextFieldWithCopyIcon)3 Date (java.util.Date)3 Tooltip (javafx.scene.control.Tooltip)3 Offer (bisq.core.offer.Offer)2 CashDepositAccountPayload (bisq.core.payment.payload.CashDepositAccountPayload)2 USPostalMoneyOrderAccountPayload (bisq.core.payment.payload.USPostalMoneyOrderAccountPayload)2 BusyAnimation (bisq.desktop.components.BusyAnimation)2 TitledGroupBg (bisq.desktop.components.TitledGroupBg)2 Scene (javafx.scene.Scene)2 Label (javafx.scene.control.Label)2 TextArea (javafx.scene.control.TextArea)2