-
Notifications
You must be signed in to change notification settings - Fork 181
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
Interactiveoffers bidder #1306
Interactiveoffers bidder #1306
Conversation
final List<Imp> modifiedImps = new ArrayList<>(); | ||
|
||
for (Imp imp : request.getImp()) { | ||
try { | ||
final ExtImpInteractiveoffers impExt = parseImpExt(imp); | ||
|
||
if (impExt.getPubId() == null) { | ||
throw new PreBidException("The pubid must be present"); | ||
} | ||
|
||
modifiedImps.add(imp.toBuilder().ext(impExtToObjectNode(impExt)).build()); | ||
} catch (PreBidException e) { | ||
return Result.withError(BidderError.badInput(e.getMessage())); | ||
} | ||
} |
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.
We don't need this, they don't do it in go, and also server will not process invalid ext request because of json validation schema
.payload(outgoingRequest) | ||
.body(mapper.encode(outgoingRequest)) |
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.
.payload(request)
.body(mapper.encode(request))
Since we don't need any updated request
private ObjectNode impExtToObjectNode(ExtImpInteractiveoffers interactiveOffersBidder) { | ||
final ObjectNode impExt; | ||
try { | ||
impExt = mapper.mapper().valueToTree(ExtPrebid.of(null, interactiveOffersBidder)); | ||
} catch (IllegalArgumentException e) { | ||
throw new PreBidException(String.format("Failed to create imp.ext with error: %s", e.getMessage())); | ||
} | ||
return impExt; | ||
} |
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.
Can be removed
private ExtImpInteractiveoffers parseImpExt(Imp imp) { | ||
try { | ||
return mapper.mapper().convertValue(imp.getExt(), INTERACTIVEOFFERS_EXT_TYPE_REFERENCE).getBidder(); | ||
} catch (IllegalArgumentException e) { | ||
throw new PreBidException(e.getMessage()); | ||
} | ||
} |
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.
Also can be removed
private static final TypeReference<ExtPrebid<?, ExtImpInteractiveoffers>> INTERACTIVEOFFERS_EXT_TYPE_REFERENCE = | ||
new TypeReference<ExtPrebid<?, ExtImpInteractiveoffers>>() { | ||
}; |
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.
Can be removed
src/main/java/org/prebid/server/bidder/interactiveoffers/InteractiveOffersBidder.java
Show resolved
Hide resolved
|
||
@Test | ||
public void creationShouldFailOnInvalidEndpointUrl() { | ||
assertThatIllegalArgumentException().isThrownBy(() -> new OnetagBidder("invalid_url", jacksonMapper)); |
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.
new InteractiveOffersBidder
.header("User-Agent", "userAgent") | ||
.header("Origin", "http://www.example.com") | ||
// this uids cookie value stands for {"uids":{"interactiveoffers":"interactiveoffers-UID"}} | ||
.cookie("uids", "eyJ1aWRzIjp7ImFkbWFuIjoiQUQtVUlEIn19") |
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 one stands for {"uids":{"adman":"AD-UID"}}
Use this resource https://www.base64encode.org/ to create cookie that stands for {"uids":{"interactiveoffers":"IO-UID"}}
public class ExtImpInteractiveoffers { | ||
|
||
@JsonProperty("pubid") | ||
Integer pubId; |
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.
Let's name it as pubid, and then we don't need @JsonProperty("pubid")
No description provided.