Skip to content

Commit

Permalink
Merge pull request #7258 from cparke2/same-bank-blank-bic
Browse files Browse the repository at this point in the history
Improve exception msg and handling when 'Same Bank' BIC/SWIFT blank
  • Loading branch information
HenrikJannsen authored Sep 26, 2024
2 parents 1480fe2 + 7aa61fb commit 68f5625
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 68f5625

Please sign in to comment.