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

Update SmartyAds sync url and fix Decenterads imp.ext resolving #1248

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request

for (Imp imp : request.getImp()) {
try {
final JsonNode resolvedImpExt = resolveImpExt(imp.getExt());
final Imp updatedImp = updateImp(imp, resolvedImpExt);
final ObjectNode decenteradsImpExt = parseAndValidateImpExt(imp.getExt());
final Imp updatedImp = updateImp(imp, decenteradsImpExt);

validRequests.add(createRequest(request, updatedImp));
} catch (PreBidException e) {
Expand All @@ -59,16 +59,16 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request
return Result.of(validRequests, errors);
}

private static JsonNode resolveImpExt(ObjectNode impExt) {
final JsonNode newImExt = impExt.get("bidder");
if (newImExt.isEmpty()) {
private static ObjectNode parseAndValidateImpExt(ObjectNode impExt) {
final JsonNode ext = impExt.get("bidder");
if (ext.isEmpty() || !ext.isObject()) {
throw new PreBidException("bidder parameters required");
}
return newImExt;
return (ObjectNode) ext;
}

private static Imp updateImp(Imp imp, JsonNode newExt) {
return imp.toBuilder().ext(newExt.deepCopy()).build();
private static Imp updateImp(Imp imp, ObjectNode impExt) {
return imp.toBuilder().ext(impExt).build();
}

private HttpRequest<BidRequest> createRequest(BidRequest request, Imp requestImp) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/bidder-config/smartyads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ adapters:
supported-vendors:
vendor-id: 0
usersync:
url: https://as.ck-ie.com/prebid.gif?gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&redir=
redirect-url: /setuid?bidder=smartyads&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&uid=[uid]
url: https://us.ck-ie.com/yhsfle286.gif?redir=
redirect-url: /setuid?bidder=smartyads&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&uid={$PARTNER_UID}
cookie-family-name: smartyads
type: redirect
support-cors: false