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.Offer;
|
||||||
import bisq.core.offer.OfferBookService;
|
import bisq.core.offer.OfferBookService;
|
||||||
import bisq.core.offer.OfferFilter;
|
import bisq.core.offer.OfferFilter;
|
||||||
|
import bisq.core.offer.OfferFilter.Result;
|
||||||
import bisq.core.offer.OfferUtil;
|
import bisq.core.offer.OfferUtil;
|
||||||
import bisq.core.offer.OpenOffer;
|
import bisq.core.offer.OpenOffer;
|
||||||
import bisq.core.offer.OpenOfferManager;
|
import bisq.core.offer.OpenOfferManager;
|
||||||
@ -110,7 +111,10 @@ class CoreOffersService {
|
|||||||
return offerBookService.getOffers().stream()
|
return offerBookService.getOffers().stream()
|
||||||
.filter(o -> o.getId().equals(id))
|
.filter(o -> o.getId().equals(id))
|
||||||
.filter(o -> !o.isMyOffer(keyRing))
|
.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(() ->
|
.findAny().orElseThrow(() ->
|
||||||
new IllegalStateException(format("offer with id '%s' not found", id)));
|
new IllegalStateException(format("offer with id '%s' not found", id)));
|
||||||
}
|
}
|
||||||
@ -127,7 +131,10 @@ class CoreOffersService {
|
|||||||
List<Offer> offers = offerBookService.getOffers().stream()
|
List<Offer> offers = offerBookService.getOffers().stream()
|
||||||
.filter(o -> !o.isMyOffer(keyRing))
|
.filter(o -> !o.isMyOffer(keyRing))
|
||||||
.filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode))
|
.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))
|
.sorted(priceComparator(direction))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
offers.removeAll(getUnreservedOffers(offers));
|
offers.removeAll(getUnreservedOffers(offers));
|
||||||
|
@ -101,9 +101,6 @@ public class OfferFilter {
|
|||||||
if (isTakerApiUser && filterManager.getFilter() != null && filterManager.getFilter().isDisableApi()) {
|
if (isTakerApiUser && filterManager.getFilter() != null && filterManager.getFilter().isDisableApi()) {
|
||||||
return Result.API_DISABLED;
|
return Result.API_DISABLED;
|
||||||
}
|
}
|
||||||
if (!isAnyPaymentAccountValidForOffer(offer)) {
|
|
||||||
return Result.HAS_NO_PAYMENT_ACCOUNT_VALID_FOR_OFFER;
|
|
||||||
}
|
|
||||||
if (!hasSameProtocolVersion(offer)) {
|
if (!hasSameProtocolVersion(offer)) {
|
||||||
return Result.HAS_NOT_SAME_PROTOCOL_VERSION;
|
return Result.HAS_NOT_SAME_PROTOCOL_VERSION;
|
||||||
}
|
}
|
||||||
@ -134,6 +131,9 @@ public class OfferFilter {
|
|||||||
if (!hasValidSignature(offer)) {
|
if (!hasValidSignature(offer)) {
|
||||||
return Result.SIGNATURE_NOT_VALIDATED; // TODO (woodser): handle this wherever IS_MY_INSUFFICIENT_TRADE_LIMIT is handled
|
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;
|
return Result.VALID;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user