Merge pull request #6416 from Android-X13/fix-issue-5919

Don't ask for SEPA Instant payment when buyer has SEPA account
This commit is contained in:
Alejandro García 2022-11-29 14:42:53 +02:00 committed by GitHub
commit 3160342e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,8 @@ import bisq.core.payment.payload.HalCashAccountPayload;
import bisq.core.payment.payload.MoneyGramAccountPayload; import bisq.core.payment.payload.MoneyGramAccountPayload;
import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.payment.payload.PaymentMethod; import bisq.core.payment.payload.PaymentMethod;
import bisq.core.payment.payload.SepaAccountPayload;
import bisq.core.payment.payload.SepaInstantAccountPayload;
import bisq.core.payment.payload.SwiftAccountPayload; import bisq.core.payment.payload.SwiftAccountPayload;
import bisq.core.payment.payload.USPostalMoneyOrderAccountPayload; import bisq.core.payment.payload.USPostalMoneyOrderAccountPayload;
import bisq.core.payment.payload.WesternUnionAccountPayload; import bisq.core.payment.payload.WesternUnionAccountPayload;
@ -243,9 +245,17 @@ public class BuyerStep2View extends TradeStepView {
int rowSpanStart = gridRow; int rowSpanStart = gridRow;
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload(); PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
PaymentAccountPayload buyersPaymentAccountPayload = model.dataModel.getBuyersPaymentAccountPayload();
String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : ""; String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : "";
// consider special case where we might need to show buyer's (instead of seller's) payment method ID
String paymentMethodIdToDisplay = buyersPaymentAccountPayload instanceof SepaAccountPayload
&& paymentAccountPayload instanceof SepaInstantAccountPayload ?
buyersPaymentAccountPayload.getPaymentMethodId() :
paymentMethodId;
TitledGroupBg accountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 4, TitledGroupBg accountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 4,
Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodId)), Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodIdToDisplay)),
Layout.COMPACT_GROUP_DISTANCE); Layout.COMPACT_GROUP_DISTANCE);
GridPane.setColumnSpan(accountTitledGroupBg, 2); GridPane.setColumnSpan(accountTitledGroupBg, 2);
@ -425,7 +435,6 @@ public class BuyerStep2View extends TradeStepView {
Offer offer = trade.getOffer(); Offer offer = trade.getOffer();
List<PaymentAccount> possiblePaymentAccounts = PaymentAccountUtil.getPossiblePaymentAccounts(offer, List<PaymentAccount> possiblePaymentAccounts = PaymentAccountUtil.getPossiblePaymentAccounts(offer,
model.getUser().getPaymentAccounts(), model.dataModel.getAccountAgeWitnessService()); model.getUser().getPaymentAccounts(), model.dataModel.getAccountAgeWitnessService());
PaymentAccountPayload buyersPaymentAccountPayload = model.dataModel.getBuyersPaymentAccountPayload();
if (buyersPaymentAccountPayload != null && possiblePaymentAccounts.size() > 1) { if (buyersPaymentAccountPayload != null && possiblePaymentAccounts.size() > 1) {
String id = buyersPaymentAccountPayload.getId(); String id = buyersPaymentAccountPayload.getId();
possiblePaymentAccounts.stream() possiblePaymentAccounts.stream()