mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-24 14:59:37 -05:00
api returns offers for unconfigured payment method
This commit is contained in:
parent
4dafd57026
commit
f08c2036a7
@ -24,6 +24,7 @@ import bisq.core.offer.CreateOfferService;
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.offer.OfferBookService;
|
||||
import bisq.core.offer.OfferFilter;
|
||||
import bisq.core.offer.OfferFilter.Result;
|
||||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.offer.OpenOffer;
|
||||
import bisq.core.offer.OpenOfferManager;
|
||||
@ -110,7 +111,10 @@ class CoreOffersService {
|
||||
return offerBookService.getOffers().stream()
|
||||
.filter(o -> o.getId().equals(id))
|
||||
.filter(o -> !o.isMyOffer(keyRing))
|
||||
.filter(o -> offerFilter.canTakeOffer(o, coreContext.isApiUser()).isValid())
|
||||
.filter(o -> {
|
||||
Result result = offerFilter.canTakeOffer(o, coreContext.isApiUser());
|
||||
return result.isValid() || result == Result.HAS_NO_PAYMENT_ACCOUNT_VALID_FOR_OFFER;
|
||||
})
|
||||
.findAny().orElseThrow(() ->
|
||||
new IllegalStateException(format("offer with id '%s' not found", id)));
|
||||
}
|
||||
@ -127,7 +131,10 @@ class CoreOffersService {
|
||||
List<Offer> offers = offerBookService.getOffers().stream()
|
||||
.filter(o -> !o.isMyOffer(keyRing))
|
||||
.filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode))
|
||||
.filter(o -> offerFilter.canTakeOffer(o, coreContext.isApiUser()).isValid())
|
||||
.filter(o -> {
|
||||
Result result = offerFilter.canTakeOffer(o, coreContext.isApiUser());
|
||||
return result.isValid() || result == Result.HAS_NO_PAYMENT_ACCOUNT_VALID_FOR_OFFER;
|
||||
})
|
||||
.sorted(priceComparator(direction))
|
||||
.collect(Collectors.toList());
|
||||
offers.removeAll(getUnreservedOffers(offers));
|
||||
|
@ -101,9 +101,6 @@ public class OfferFilter {
|
||||
if (isTakerApiUser && filterManager.getFilter() != null && filterManager.getFilter().isDisableApi()) {
|
||||
return Result.API_DISABLED;
|
||||
}
|
||||
if (!isAnyPaymentAccountValidForOffer(offer)) {
|
||||
return Result.HAS_NO_PAYMENT_ACCOUNT_VALID_FOR_OFFER;
|
||||
}
|
||||
if (!hasSameProtocolVersion(offer)) {
|
||||
return Result.HAS_NOT_SAME_PROTOCOL_VERSION;
|
||||
}
|
||||
@ -134,6 +131,9 @@ public class OfferFilter {
|
||||
if (!hasValidSignature(offer)) {
|
||||
return Result.SIGNATURE_NOT_VALIDATED; // TODO (woodser): handle this wherever IS_MY_INSUFFICIENT_TRADE_LIMIT is handled
|
||||
}
|
||||
if (!isAnyPaymentAccountValidForOffer(offer)) {
|
||||
return Result.HAS_NO_PAYMENT_ACCOUNT_VALID_FOR_OFFER;
|
||||
}
|
||||
|
||||
return Result.VALID;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user