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();
}
}
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;
}
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);
}
}
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);
}
}
Aggregations