Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,6 +1,7 @@
package org.prebid.server.bidder.nexx360;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.iab.openrtb.request.BidRequest;
import com.iab.openrtb.request.Imp;
import com.iab.openrtb.response.Bid;
Expand Down Expand Up @@ -81,7 +82,9 @@ private ExtImpNexx360 parseImpExt(Imp imp) {

private Imp modifyImp(Imp imp) {
return imp.toBuilder()
.ext(mapper.mapper().createObjectNode().set(BIDDER_NAME, imp.getExt().get("bidder")))
.ext(imp.getExt().deepCopy()
.<ObjectNode>without("bidder")
.set(BIDDER_NAME, imp.getExt().get("bidder")))
.build();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/bidder-config/nexx360.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ adapters:
- native
- audio
supported-vendors:
vendor-id: 0
vendor-id: 965
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.UnaryOperator;

import static java.util.Collections.singletonList;
Expand Down Expand Up @@ -133,6 +134,30 @@ public void makeHttpRequestsShouldModifyImpExt() {
.containsExactly(expectedExt1, expectedExt2);
}

@Test
public void makeHttpRequestsShouldPreserveCustomFieldsInImpExt() {
// given
final BidRequest bidRequest = givenBidRequest(
imp -> imp.id("imp1").ext(mapper.valueToTree(
Map.of("bidder", ExtImpNexx360.of("tag1", "p1"),
"customField", "customValue"))));

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

// then
final ObjectNode expectedExt = mapper.valueToTree(
Map.of("nexx360", ExtImpNexx360.of("tag1", "p1"),
"customField", "customValue"));

assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).hasSize(1)
.extracting(HttpRequest::getPayload)
.flatExtracting(BidRequest::getImp)
.extracting(Imp::getExt)
.containsExactly(expectedExt);
}

@Test
public void makeHttpRequestsShouldModifyRequestExt() {
// given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"secure": 1,
"ext": {
"tid": "${json-unit.any-string}",
"nexx360": {
"placement": "placement"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"secure": 1,
"ext": {
"tid": "${json-unit.any-string}",
"nexx360": {
"placement": "placement"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"secure": 1,
"ext": {
"tid": "${json-unit.any-string}",
"nexx360": {
"placement": "placement"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"secure": 1,
"ext": {
"tid": "${json-unit.any-string}",
"nexx360": {
"placement": "placement"
}
Expand Down
Loading