-
Notifications
You must be signed in to change notification settings - Fork 190
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
Epsilon Bid Adapter: requests have to be made in USD or it will be re… #3199
Conversation
…jected on the backend
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl)); | ||
this.generateBidId = generateBidId; | ||
this.mapper = Objects.requireNonNull(mapper); | ||
this.currencyConversionService = Objects.requireNonNull(currencyConversionService); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is currencyConversionService
always available? Otherwise our bidder could not participate in the auction even if it's all USD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
} | ||
|
||
final Imp firstImp = requestImps.get(0); | ||
final ExtImpEpsilon extImp = parseImpExt(firstImp, 0); | ||
final String siteId = extImp.getSiteId(); | ||
final Site requestSite = bidRequest.getSite(); | ||
final App requestApp = bidRequest.getApp(); | ||
|
||
final List<String> cur = bidRequest.getCur(); | ||
if (cur != null && !cur.isEmpty() && !BIDDER_CURRENCY.equals(cur.get(0))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line at 108 and the section starting at line 120 are the same checks but written in different ways:
if (cur != null && !cur.isEmpty() && !BIDDER_CURRENCY.equals(cur.get(0))) {
&& !StringUtils.equalsIgnoreCase(bidfloorcur, BIDDER_CURRENCY)
&& StringUtils.isNotBlank(bidfloorcur)) {
In any case, it's OK to always overwrite bid level currency to USD without any check. In other words, remove line 107 to 109, and just add a line somewhere in the original builder like this:
return bidRequest.toBuilder()
.site(updateSite(requestSite, siteId))
.app(requestSite == null ? updateApp(requestApp, siteId) : requestApp)
.imp(modifiedImps)
.cur(Collections.singletonList(BIDDER_CURRENCY))
.build();
return bidRequest.toBuilder() | ||
.site(updateSite(requestSite, siteId)) | ||
.app(requestSite == null ? updateApp(requestApp, siteId) : requestApp) | ||
.imp(modifiedImps) | ||
.build(); | ||
} | ||
|
||
private BigDecimal resolveBidFloor(BidRequest bidRequest, String bidfloorcur, BigDecimal bidfloor) { | ||
if (BidderUtil.isValidPrice(bidfloor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to get a bad bidfloor?
final BigDecimal bidFloor = resolveBidFloor(bidRequest, | ||
imp.getBidfloorcur(), | ||
getBidFloor(imp.getBidfloor(), impExt.getBidfloor())); | ||
modifiedImps.add(modifyImp(imp, impExt, bidFloor)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Imp's bidfloorcur modified elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be set in modifyImp
@johnwier Java CI workflow is broken because of checkstyle. Please fix |
@johnwier ,The build failed because of EpsilonTest. |
@SerhiiNahornyi John has pushed an update. Would you mind running the checks again? Thanks. |
@SerhiiNahornyi The checks still seem to be failing but the errors don't look like they're related to my change. Do you have any suggestions on how to resolve it |
The backend server rejects any requests that don't have request.cur set to USD. For now, make the Conversant/Epsilon request, and floors in USD.
These changes are intended to match the changes made here prebid/prebid-server#3611