diff --git a/src/main/java/org/prebid/server/bidder/gumgum/GumgumBidder.java b/src/main/java/org/prebid/server/bidder/gumgum/GumgumBidder.java index 0d18952c98e..a1d3c563cdf 100644 --- a/src/main/java/org/prebid/server/bidder/gumgum/GumgumBidder.java +++ b/src/main/java/org/prebid/server/bidder/gumgum/GumgumBidder.java @@ -45,6 +45,8 @@ public class GumgumBidder implements Bidder { + private static final String REQUEST_EXT_PRODUCT = "product"; + private static final TypeReference> GUMGUM_EXT_TYPE_REFERENCE = new TypeReference<>() { }; @@ -116,6 +118,13 @@ private ExtImpGumgum parseImpExt(Imp imp) { private Imp modifyImp(Imp imp, ExtImpGumgum extImp) { final Imp.ImpBuilder impBuilder = imp.toBuilder(); + + final String product = extImp.getProduct(); + if (StringUtils.isNotEmpty(product)) { + final ObjectNode productExt = mapper.mapper().createObjectNode().put(REQUEST_EXT_PRODUCT, product); + impBuilder.ext(productExt); + } + final Banner banner = imp.getBanner(); if (banner != null) { final Banner resolvedBanner = resolveBanner(banner, extImp); @@ -133,7 +142,6 @@ private Imp modifyImp(Imp imp, ExtImpGumgum extImp) { impBuilder.video(resolvedVideo); } } - return impBuilder.build(); } @@ -256,3 +264,4 @@ private static String resolveAdm(String bidAdm, BigDecimal price) { return StringUtils.isNotBlank(bidAdm) ? bidAdm.replace("${AUCTION_PRICE}", String.valueOf(price)) : bidAdm; } } + diff --git a/src/main/java/org/prebid/server/proto/openrtb/ext/request/gumgum/ExtImpGumgum.java b/src/main/java/org/prebid/server/proto/openrtb/ext/request/gumgum/ExtImpGumgum.java index a2bba63f1d0..6f0803c9a6e 100644 --- a/src/main/java/org/prebid/server/proto/openrtb/ext/request/gumgum/ExtImpGumgum.java +++ b/src/main/java/org/prebid/server/proto/openrtb/ext/request/gumgum/ExtImpGumgum.java @@ -19,4 +19,6 @@ public class ExtImpGumgum { String irisId; Long slot; + + String product; } diff --git a/src/main/resources/static/bidder-params/gumgum.json b/src/main/resources/static/bidder-params/gumgum.json index a44e9b045b2..957229af298 100644 --- a/src/main/resources/static/bidder-params/gumgum.json +++ b/src/main/resources/static/bidder-params/gumgum.json @@ -20,6 +20,10 @@ "slot": { "type": "integer", "description": "A slot id used to identify a slot placement mapped to a GumGum zone or publisher" + }, + "product": { + "type": "string", + "description": "A product" } }, "anyOf": [ @@ -35,4 +39,3 @@ } ] } - diff --git a/src/test/java/org/prebid/server/bidder/gumgum/GumgumBidderTest.java b/src/test/java/org/prebid/server/bidder/gumgum/GumgumBidderTest.java index ff046f32bfe..2bb2a0bb7ba 100644 --- a/src/test/java/org/prebid/server/bidder/gumgum/GumgumBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/gumgum/GumgumBidderTest.java @@ -96,7 +96,7 @@ public void makeHttpRequestsShouldReturnErrorIfVideoFieldsAreNotValid() { .imp(singletonList(Imp.builder() .video(Video.builder().w(0).build()) .ext(mapper.valueToTree(ExtPrebid.of(null, - ExtImpGumgum.of("zone", BigInteger.TEN, "irisId", null)))) + ExtImpGumgum.of("zone", BigInteger.TEN, "irisId", null, null)))) .build())) .build(); @@ -124,7 +124,7 @@ public void makeHttpRequestsShouldModifyVideoExtOfIrisIdIsPresent() { .linearity(233) .build()) .ext(mapper.valueToTree(ExtPrebid.of(null, - ExtImpGumgum.of("zone", BigInteger.TEN, "irisId", null)))) + ExtImpGumgum.of("zone", BigInteger.TEN, "irisId", null, null)))) .build())) .build(); @@ -231,7 +231,7 @@ public void makeHttpRequestsShouldSetSiteIdFromLastValidImpExtZone() { givenImp(impBuilder -> impBuilder .banner(Banner.builder().build()) .ext(mapper.valueToTree(ExtPrebid.of(null, - ExtImpGumgum.of("ignored zone", BigInteger.TEN, "irisId", null))))), + ExtImpGumgum.of("ignored zone", BigInteger.TEN, "irisId", null, null))))), givenImp(identity()))) .build(); @@ -259,14 +259,14 @@ public void makeHttpRequestsShouldNotModifyBannerExtIfSlotIsZeroOrNull() { .format(singletonList(Format.builder().w(1).h(1).build())) .build()) .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpGumgum.of("ignored zone", - BigInteger.TEN, "irisId", 0L))))), + BigInteger.TEN, "irisId", 0L, null))))), givenImp(impBuilder -> impBuilder .id("345") .banner(Banner.builder() .format(singletonList(Format.builder().w(1).h(1).build())) .build()) .ext(mapper.valueToTree(ExtPrebid.of(null, - ExtImpGumgum.of("ignored zone", BigInteger.TEN, "irisId", null)))) + ExtImpGumgum.of("ignored zone", BigInteger.TEN, "irisId", null, null)))) ))) .build(); @@ -295,7 +295,7 @@ public void makeHttpRequestsShouldSetBannerExtWithBiggestBannerFormatIfSlotIsNot Format.builder().w(100).h(100).build())) .build()) .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpGumgum.of("ignored zone", - BigInteger.TEN, "irisId", 42L))))); + BigInteger.TEN, "irisId", 42L, null))))); // when final Result>> result = target.makeHttpRequests(bidRequest); @@ -441,7 +441,7 @@ private static Imp givenImp(Function impCustomiz .id("123") .banner(Banner.builder().id("banner_id").build()) .ext(mapper.valueToTree(ExtPrebid.of(null, - ExtImpGumgum.of("zone", BigInteger.TEN, "irisId", 1L))))) + ExtImpGumgum.of("zone", BigInteger.TEN, "irisId", 1L, null))))) .build(); } @@ -461,3 +461,4 @@ private static BidderCall givenHttpCall(BidRequest bidRequest, Strin null); } } +