Skip to content
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
9 changes: 0 additions & 9 deletions src/main/java/org/prebid/server/bidder/sovrn/SovrnBidder.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
public class SovrnBidder implements Bidder<BidRequest> {

private static final String LJT_READER_COOKIE_NAME = "ljt_reader";
private static final String EXT_AD_UNIT_CODE_PARAM = "adunitcode";

private static final TypeReference<ExtPrebid<?, ExtImpSovrn>> SOVRN_EXT_TYPE_REFERENCE =
new TypeReference<>() {
Expand Down Expand Up @@ -91,7 +90,6 @@ private Imp makeImp(Imp imp) {
return imp.toBuilder()
.bidfloor(resolveBidFloor(imp.getBidfloor(), sovrnExt.getBidfloor()))
.tagid(resolveTagId(sovrnExt))
.ext(resolveImpExt(sovrnExt, impExt))
.build();
}

Expand All @@ -117,13 +115,6 @@ private String resolveTagId(ExtImpSovrn sovrnExt) {
return tagId;
}

private ObjectNode resolveImpExt(ExtImpSovrn sovrnExt, ObjectNode impExt) {
final ObjectNode sovrnImpExt = impExt.deepCopy();
return StringUtils.isNotBlank(sovrnExt.getAdunitcode())
? sovrnImpExt.putPOJO(EXT_AD_UNIT_CODE_PARAM, sovrnExt.getAdunitcode())
: sovrnImpExt;
}

private Result<List<HttpRequest<BidRequest>>> makeHttpRequest(BidRequest bidRequest,
List<BidderError> errors) {

Expand Down
24 changes: 3 additions & 21 deletions src/test/java/org/prebid/server/bidder/sovrn/SovrnBidderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,8 @@ public void makeHttpRequestsShouldReturnResultWithHttpRequestContainingExpectedF
.extracting(HttpRequest::getBody)
.extracting(SovrnBidderTest::mappedToBidRequest)
.flatExtracting(BidRequest::getImp)
.extracting(Imp::getBidfloor, Imp::getTagid, e -> e.getExt().get("adunitcode"))
.containsExactly(tuple(BigDecimal.TEN, "tagid", mapper.valueToTree("sovrn_auc")));
}

@Test
public void makeHttpRequestsShouldSetAdUnitCodeFromExtIfPresent() {
// given
final BidRequest bidRequest = givenBidRequest(identity());

// when
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

// then
assertThat(result.getValue()).hasSize(1)
.extracting(HttpRequest::getBody)
.extracting(SovrnBidderTest::mappedToBidRequest)
.flatExtracting(BidRequest::getImp)
.extracting(Imp::getExt)
.extracting(e -> e.get("adunitcode"))
.containsExactly(mapper.valueToTree("sovrn_auc"));
.extracting(Imp::getBidfloor, Imp::getTagid, e -> e.getExt().get("bidder").get("adunitcode"))
.containsExactly(tuple(BigDecimal.TEN, "tagid", mapper.valueToTree("sovrn_auc_bidder")));
}

@Test
Expand Down Expand Up @@ -545,7 +527,7 @@ private static Imp givenImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) {
.protocols(singletonList(1))
.build())
.ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpSovrn.of("tagid",
"legacyTagId", BigDecimal.TEN, "sovrn_auc")))))
"legacyTagId", BigDecimal.TEN, "sovrn_auc_bidder")))))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
},
"ext": {
"sovrn": {
"adunitcode": "sovrn_auc",
"adunitcode": "sovrn_auc_bidder",
"tagid": "tag_id"
}
},
"gpid": "test_gpid"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"tid": "${json-unit.any-string}",
"bidder": {
"tagid": "tag_id",
"adunitcode": "sovrn_auc"
"adunitcode": "sovrn_auc_bidder"
},
"adunitcode": "sovrn_auc"
"gpid": "test_gpid"
}
}
],
Expand Down
Loading