use of bisq.core.trade.handlers.TradeResultHandler in project bisq-desktop by bisq-network.
the class TakeOfferDataModel method onTakeOffer.
// /////////////////////////////////////////////////////////////////////////////////////////
// UI actions
// /////////////////////////////////////////////////////////////////////////////////////////
// errorMessageHandler is used only in the check availability phase. As soon we have a trade we write the error msg in the trade object as we want to
// have it persisted as well.
void onTakeOffer(TradeResultHandler tradeResultHandler) {
checkNotNull(txFeeFromFeeService, "txFeeFromFeeService must not be null");
checkNotNull(getTakerFee(), "takerFee must not be null");
Coin fundsNeededForTrade = getSecurityDeposit().add(txFeeFromFeeService).add(txFeeFromFeeService);
if (isBuyOffer())
fundsNeededForTrade = fundsNeededForTrade.add(amount.get());
if (filterManager.isCurrencyBanned(offer.getCurrencyCode())) {
new Popup<>().warning(Res.get("offerbook.warning.currencyBanned")).show();
} else if (filterManager.isPaymentMethodBanned(offer.getPaymentMethod())) {
new Popup<>().warning(Res.get("offerbook.warning.paymentMethodBanned")).show();
} else if (filterManager.isOfferIdBanned(offer.getId())) {
new Popup<>().warning(Res.get("offerbook.warning.offerBlocked")).show();
} else if (filterManager.isNodeAddressBanned(offer.getMakerNodeAddress())) {
new Popup<>().warning(Res.get("offerbook.warning.nodeBlocked")).show();
} else {
tradeManager.onTakeOffer(amount.get(), txFeeFromFeeService, getTakerFee(), isCurrencyForTakerFeeBtc(), tradePrice.getValue(), fundsNeededForTrade, offer, paymentAccount.getId(), useSavingsWallet, tradeResultHandler, errorMessage -> {
log.warn(errorMessage);
new Popup<>().warning(errorMessage).show();
});
}
}
Aggregations