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

Interactiveoffers bidder #1306

Merged
merged 9 commits into from
Jun 11, 2021
Merged

Interactiveoffers bidder #1306

merged 9 commits into from
Jun 11, 2021

Conversation

nickluck9
Copy link

No description provided.

@nickluck9 nickluck9 requested a review from SerhiiNahornyi June 9, 2021 09:33
Comment on lines 48 to 62
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()));
}
}
Copy link
Collaborator

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

Comment on lines 70 to 71
.payload(outgoingRequest)
.body(mapper.encode(outgoingRequest))
Copy link
Collaborator

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

Comment on lines 86 to 94
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;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed

Comment on lines 113 to 119
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());
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can be removed

Comment on lines 34 to 36
private static final TypeReference<ExtPrebid<?, ExtImpInteractiveoffers>> INTERACTIVEOFFERS_EXT_TYPE_REFERENCE =
new TypeReference<ExtPrebid<?, ExtImpInteractiveoffers>>() {
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed


@Test
public void creationShouldFailOnInvalidEndpointUrl() {
assertThatIllegalArgumentException().isThrownBy(() -> new OnetagBidder("invalid_url", jacksonMapper));
Copy link
Collaborator

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

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

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")

SerhiiNahornyi
SerhiiNahornyi previously approved these changes Jun 11, 2021
@rpanchyk rpanchyk merged commit 84e78d3 into master Jun 11, 2021
@rpanchyk rpanchyk deleted the interactiveoffers-bidder branch June 11, 2021 13:12
nickluck9 pushed a commit that referenced this pull request Jun 14, 2021
nickluck9 pushed a commit that referenced this pull request Aug 9, 2021
nickluck9 pushed a commit that referenced this pull request Aug 10, 2021
nickluck9 pushed a commit that referenced this pull request Aug 10, 2021
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