Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve exception msg and handling when 'Same Bank' BIC/SWIFT blank #7258

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/src/main/java/bisq/core/offer/OfferUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import bisq.core.payment.CashByMailAccount;
import bisq.core.payment.F2FAccount;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.SameBankAccount;
import bisq.core.payment.SpecificBanksAccount;
import bisq.core.payment.payload.PaymentMethod;
import bisq.core.provider.fee.FeeService;
import bisq.core.provider.price.MarketPrice;
Expand Down Expand Up @@ -60,6 +62,7 @@
import javax.inject.Singleton;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -389,7 +392,8 @@ public Map<String, String> getExtraDataMap(PaymentAccount paymentAccount,
public void validateOfferData(double buyerSecurityDeposit,
PaymentAccount paymentAccount,
String currencyCode,
Coin makerFeeAsCoin) {
Coin makerFeeAsCoin,
List<String> acceptedBanks) {
validateBasicOfferData(paymentAccount.getPaymentMethod(), currencyCode);
checkNotNull(makerFeeAsCoin, "makerFee must not be null");
checkArgument(buyerSecurityDeposit <= getMaxBuyerSecurityDepositAsPercent(),
Expand All @@ -398,6 +402,9 @@ public void validateOfferData(double buyerSecurityDeposit,
checkArgument(buyerSecurityDeposit >= getMinBuyerSecurityDepositAsPercent(),
"securityDeposit must not be less than " +
getMinBuyerSecurityDepositAsPercent());
if ((paymentAccount instanceof SameBankAccount) || (paymentAccount instanceof SpecificBanksAccount) ) {
checkArgument(!acceptedBanks.contains(null), "acceptedBanks must not be null for SAME_BANK or SPECIFIC_BANKS accounts");
}
}

public void validateBasicOfferData(PaymentMethod paymentMethod, String currencyCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public Offer createAndGetOffer(String offerId,
buyerSecurityDepositAsDouble,
paymentAccount,
currencyCode,
makerFeeAsCoin);
makerFeeAsCoin,
acceptedBanks);

OfferPayload offerPayload = new OfferPayload(offerId,
creationTime,
Expand Down
Loading