diff --git a/src/main/java/org/prebid/server/bidder/amx/AmxBidder.java b/src/main/java/org/prebid/server/bidder/amx/AmxBidder.java index 602f47ab5d6..9f12e60c357 100644 --- a/src/main/java/org/prebid/server/bidder/amx/AmxBidder.java +++ b/src/main/java/org/prebid/server/bidder/amx/AmxBidder.java @@ -44,7 +44,7 @@ public class AmxBidder implements Bidder { new TypeReference>() { }; - private static final String ADAPTER_VERSION = "pbs1.0"; + private static final String ADAPTER_VERSION = "pbs1.1"; private static final String VERSION_PARAM = "v"; private static final String VAST_SEARCH_POINT = ""; private static final String VAST_IMPRESSION_FORMAT = ""; @@ -162,11 +162,12 @@ private List bidsFromResponse(BidResponse bidResponse, List errors) { - AmxBidExt amxBidExt = null; + final AmxBidExt amxBidExt; try { amxBidExt = parseBidderExt(bid.getExt()); } catch (PreBidException e) { errors.add(BidderError.badInput(e.getMessage())); + return null; } final BidType bidType = getMediaType(amxBidExt); diff --git a/src/test/java/org/prebid/server/bidder/amx/AmxBidderTest.java b/src/test/java/org/prebid/server/bidder/amx/AmxBidderTest.java index 1aafc804b8c..eb5deed54fc 100644 --- a/src/test/java/org/prebid/server/bidder/amx/AmxBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/amx/AmxBidderTest.java @@ -77,7 +77,7 @@ public void makeHttpRequestsShouldCreateCorrectURL() { assertThat(result.getErrors()).isEmpty(); assertThat(result.getValue()).hasSize(1) .extracting(HttpRequest::getUri) - .containsExactly("https://test.com/prebid/bid?v=pbs1.0"); + .containsExactly("https://test.com/prebid/bid?v=pbs1.1"); } @Test @@ -215,6 +215,31 @@ public void makeBidsShouldReturnErrorIfAdmNotContainSearchPoint() throws JsonPro BidderError.badServerResponse("Adm should contain vast search point in bidder: bidId")); } + @Test + public void makeBidsShouldSkipBidAndAddErrorIfFailedToParseBidExt() throws JsonProcessingException { + // given + final ObjectNode bidExt = mapper.createObjectNode(); + bidExt.put("startdelay", "2"); + final HttpCall httpCall = givenHttpCall(BidRequest.builder().build(), + mapper.writeValueAsString( + givenBidResponse(bidBuilder -> bidBuilder + .id("bidId") + .adm("") + .ext(mapper.createObjectNode().set("startdelay", mapper.createObjectNode()))))); + + // when + final Result> result = amxBidder.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).hasSize(1) + .satisfies(error -> { + assertThat(error).extracting(BidderError::getType).containsExactly(BidderError.Type.bad_input); + assertThat(error).extracting(BidderError::getMessage) + .element(0).asString().startsWith("Cannot deserialize instance"); + }); + assertThat(result.getValue()).isEmpty(); + } + @Test public void makeBidsShouldReturnErrorIfAdmIsNotPresent() throws JsonProcessingException { // given diff --git a/src/test/java/org/prebid/server/it/AmxTest.java b/src/test/java/org/prebid/server/it/AmxTest.java index 2ec0bb9fd15..98b5aa4e9db 100644 --- a/src/test/java/org/prebid/server/it/AmxTest.java +++ b/src/test/java/org/prebid/server/it/AmxTest.java @@ -27,7 +27,7 @@ public void openrtb2AuctionShouldRespondWithBidsFromAmx() throws IOException, JS // given // Amx bid response for imp WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/amx-exchange")) - .withQueryParam("v", equalTo("pbs1.0")) + .withQueryParam("v", equalTo("pbs1.1")) .withHeader("Content-Type", equalToIgnoreCase("application/json;charset=UTF-8")) .withRequestBody(equalToJson(jsonFrom("openrtb2/amx/test-amx-bid-request.json"))) .willReturn(aResponse().withBody(