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

Epsilon Bid Adapter: requests have to be made in USD or it will be re… #3199

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

johnwier
Copy link
Contributor

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

this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
this.generateBidId = generateBidId;
this.mapper = Objects.requireNonNull(mapper);
this.currencyConversionService = Objects.requireNonNull(currencyConversionService);
Copy link

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?

Copy link
Contributor Author

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))) {
Copy link

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)
Copy link

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));
Copy link

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?

Copy link
Contributor Author

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

@SerhiiNahornyi
Copy link
Collaborator

@johnwier Java CI workflow is broken because of checkstyle. Please fix

@SerhiiNahornyi
Copy link
Collaborator

SerhiiNahornyi commented Jun 3, 2024

@johnwier ,The build failed because of EpsilonTest.
Please fix

@pycnvr
Copy link

pycnvr commented Jun 13, 2024

@SerhiiNahornyi John has pushed an update. Would you mind running the checks again? Thanks.

@johnwier
Copy link
Contributor Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants