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 - Parameters changed & dynamic endpoint #1417

Merged
merged 7 commits into from
Aug 19, 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 @@ -38,13 +38,22 @@ public InteractiveOffersBidder(String endpointUrl, JacksonMapper mapper) {

@Override
public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request) {
return Result.withValue(HttpRequest.<BidRequest>builder()
.method(HttpMethod.POST)
.uri(endpointUrl)
.headers(HttpUtil.headers())
.payload(request)
.body(mapper.encode(request))
.build());

try {
String partnerId = request.getImp().get(0).getExt().get("bidder").get("partnerId") + "";
if (partnerId.length() > 2) {
partnerId = partnerId.substring(1, partnerId.length() - 1);
}
return Result.withValue(HttpRequest.<BidRequest>builder()
.method(HttpMethod.POST)
.uri(endpointUrl.replace("{{PartnerId}}", partnerId))
.headers(HttpUtil.headers())
.payload(request)
.body(mapper.encode(request))
.build());
} catch (PreBidException e) {
return Result.withError(BidderError.badInput(e.getMessage()));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.prebid.server.proto.openrtb.ext.request.interactiveoffers;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Value;

Expand All @@ -10,5 +11,6 @@
@Value
public class ExtImpInteractiveoffers {

Integer pubid;
@JsonProperty("partnerId")
String partnerId;
nickluck9 marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 2 additions & 2 deletions src/main/resources/bidder-config/interactiveoffers.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
adapters:
interactiveoffers:
enabled: false
endpoint: https://prebid-server.ioadx.com/bidRequest/?partnerId=d9e56d418c4825d466ee96c7a31bf1da6b62fa04
endpoint: https://prebid-server.ioadx.com/bidRequest/?partnerId={{PartnerId}}
pbs-enforces-gdpr: true
pbs-enforces-ccpa: true
modifying-vast-xml-allowed: true
deprecated-names:
aliases: {}
meta-info:
maintainer-email: support@interactiveoffers.com
maintainer-email: dev@interactiveoffers.com
app-media-types:
- banner
site-media-types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"description": "A schema which validates params accepted by Interactive Offers adapter",
"type": "object",
"properties": {
"pubid": {
"type": "integer",
"description": "The publisher id"
"partnerId": {
"type": "string",
"description": "The partners id"
}
},
"required": [
"pubid"
"partnerId"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public void makeHttpRequestsShouldMakeOneRequestWithAllImps() {
@Test
public void makeHttpRequestsShouldUpdateImpExt() throws JsonProcessingException {
// given
final ObjectNode interactiveOffersExt = (ObjectNode) mapper.readTree("{\"bidder\":{\"pubid\":35}}");
final ObjectNode interactiveOffersExt = (ObjectNode) mapper.readTree("{\"bidder\":{\"partnerId\":\"abc123\"}}");
final BidRequest bidRequest = BidRequest.builder()
.imp(singletonList(Imp.builder()
.ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpInteractiveoffers.of(35))))
.ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpInteractiveoffers.of("abc123"))))
.build()))
.build();

Expand Down Expand Up @@ -205,7 +205,7 @@ private static Imp givenImp(Function<Imp.ImpBuilder, Imp.ImpBuilder> impCustomiz
return impCustomizer.apply(Imp.builder()
.id("123"))
.banner(Banner.builder().build())
.ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpInteractiveoffers.of(35))))
.ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpInteractiveoffers.of("35"))))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"ext": {
"interactiveoffers": {
"pubid": 35
"partnerId": "abc123"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"ext": {
"bidder": {
"pubid": 35
"partnerId": "abc123"
}
}
}
Expand Down