From f7f32df893d2b3d8a0b995d62cdb6f2997a6433e Mon Sep 17 00:00:00 2001 From: Viktor Kryshtal <33136089+Lightwood13@users.noreply.github.com> Date: Tue, 19 May 2026 16:14:56 +0300 Subject: [PATCH 1/5] Add cookie family name to 360playvid adapter config (#4489) --- src/main/resources/bidder-config/teqblaze.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/bidder-config/teqblaze.yaml b/src/main/resources/bidder-config/teqblaze.yaml index f0110abf62f..4edd997e843 100644 --- a/src/main/resources/bidder-config/teqblaze.yaml +++ b/src/main/resources/bidder-config/teqblaze.yaml @@ -9,6 +9,7 @@ adapters: maintainer-email: prebid@360playvid.com usersync: enabled: true + cookie-family-name: 360playvid redirect: url: https://cookie.360playvid.com/pbserver?gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&coppa={{us_privacy}}&gpp={{gpp}}&gpp_sid={{gpp_sid}}&redir={{redirect_url}} support-cors: false From 4cab9bdadb955829cb314456f29e35aa30a97ca6 Mon Sep 17 00:00:00 2001 From: akshatgmnet Date: Tue, 19 May 2026 18:46:09 +0530 Subject: [PATCH 2/5] Medianet: Update cookie sync url (#4443) --- src/main/resources/bidder-config/medianet.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/bidder-config/medianet.yaml b/src/main/resources/bidder-config/medianet.yaml index cf4119e4147..de4b19a5142 100644 --- a/src/main/resources/bidder-config/medianet.yaml +++ b/src/main/resources/bidder-config/medianet.yaml @@ -22,6 +22,6 @@ adapters: support-cors: false uid-macro: '' redirect: - url: https://hbx.media.net/cksync.php?cs=1&type=pbs&ovsid=setstatuscode&bidder=medianet&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&gpp={{gpp}}&gpp_sid={{gpp_sid}}&redirect={{redirect_url}} + url: https://cs.media.net/cksync.php?cs=1&type=pbs&ovsid=setstatuscode&bidder=medianet&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&gpp={{gpp}}&gpp_sid={{gpp_sid}}&redirect={{redirect_url}} support-cors: false uid-macro: '' From 4ebd41077f1f450539232de29e62238ed25dd876 Mon Sep 17 00:00:00 2001 From: sangarbe Date: Tue, 19 May 2026 15:16:39 +0200 Subject: [PATCH 3/5] Seedtag: adds ron id support for seedtag adapter (#4466) --- .../server/bidder/seedtag/SeedtagBidder.java | 27 +++- .../ext/request/seedtag/ExtImpSeedtag.java | 6 + .../static/bidder-params/seedtag.json | 15 ++- .../bidder/seedtag/SeedtagBidderTest.java | 121 +++++++++++++++++- .../org/prebid/server/it/SeedtagTest.java | 1 + 5 files changed, 166 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/prebid/server/bidder/seedtag/SeedtagBidder.java b/src/main/java/org/prebid/server/bidder/seedtag/SeedtagBidder.java index ea15def357c..389fb88b147 100644 --- a/src/main/java/org/prebid/server/bidder/seedtag/SeedtagBidder.java +++ b/src/main/java/org/prebid/server/bidder/seedtag/SeedtagBidder.java @@ -7,6 +7,7 @@ import com.iab.openrtb.response.BidResponse; import com.iab.openrtb.response.SeatBid; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.prebid.server.bidder.Bidder; import org.prebid.server.bidder.model.BidderBid; import org.prebid.server.bidder.model.BidderCall; @@ -37,6 +38,7 @@ public class SeedtagBidder implements Bidder { new TypeReference<>() { }; private static final String BIDDER_CURRENCY = "USD"; + private static final String INTEGRATION_TYPE_RON_ID = "ronId"; private final String endpointUrl; private final JacksonMapper mapper; @@ -58,8 +60,8 @@ public Result>> makeHttpRequests(BidRequest request for (Imp imp : request.getImp()) { try { + validateImpExt(imp); final Price bidFloorPrice = resolveBidFloor(imp, request); - modifiedImps.add(modifyImp(imp, bidFloorPrice)); } catch (PreBidException e) { errors.add(BidderError.badInput(e.getMessage())); @@ -79,6 +81,29 @@ public Result>> makeHttpRequests(BidRequest request errors); } + private void validateImpExt(Imp imp) { + final ExtImpSeedtag ext; + try { + ext = mapper.mapper().convertValue(imp.getExt(), SEEDTAG_EXT_TYPE_REFERENCE).getBidder(); + } catch (Exception e) { + throw new PreBidException("Invalid imp.ext.bidder for imp id: %s".formatted(imp.getId())); + } + + if (INTEGRATION_TYPE_RON_ID.equals(ext.getIntegrationType())) { + if (StringUtils.isBlank(ext.getPublisherId())) { + throw new PreBidException( + "imp id %s: publisherId is required when integrationType is '%s'" + .formatted(imp.getId(), INTEGRATION_TYPE_RON_ID)); + } + } else { + if (StringUtils.isBlank(ext.getAdUnitId())) { + throw new PreBidException( + "imp id %s: adUnitId is required when integrationType is not '%s'" + .formatted(imp.getId(), INTEGRATION_TYPE_RON_ID)); + } + } + } + private static Imp modifyImp(Imp imp, Price bidFloorPrice) { return imp.toBuilder() .bidfloorcur(bidFloorPrice.getCurrency()) diff --git a/src/main/java/org/prebid/server/proto/openrtb/ext/request/seedtag/ExtImpSeedtag.java b/src/main/java/org/prebid/server/proto/openrtb/ext/request/seedtag/ExtImpSeedtag.java index 364b63fb7dc..57e44c16ff5 100644 --- a/src/main/java/org/prebid/server/proto/openrtb/ext/request/seedtag/ExtImpSeedtag.java +++ b/src/main/java/org/prebid/server/proto/openrtb/ext/request/seedtag/ExtImpSeedtag.java @@ -9,4 +9,10 @@ public class ExtImpSeedtag { @JsonProperty("adUnitId") String adUnitId; + @JsonProperty("publisherId") + String publisherId; + + @JsonProperty("integrationType") + String integrationType; + } diff --git a/src/main/resources/static/bidder-params/seedtag.json b/src/main/resources/static/bidder-params/seedtag.json index 8d84b059fd0..4e09dd7eb69 100644 --- a/src/main/resources/static/bidder-params/seedtag.json +++ b/src/main/resources/static/bidder-params/seedtag.json @@ -8,9 +8,20 @@ "type": "string", "description": "Ad Unit ID", "minLength": 1 + }, + "publisherId": { + "type": "string", + "description": "Publisher ID (editorial group ID)", + "minLength": 1 + }, + "integrationType": { + "type": "string", + "description": "Integration type", + "enum": ["ronId"] } }, - "required": [ - "adUnitId" + "oneOf": [ + { "required": ["adUnitId"] }, + { "required": ["publisherId", "integrationType"] } ] } diff --git a/src/test/java/org/prebid/server/bidder/seedtag/SeedtagBidderTest.java b/src/test/java/org/prebid/server/bidder/seedtag/SeedtagBidderTest.java index a0e0fb5880b..e16d40f46b4 100644 --- a/src/test/java/org/prebid/server/bidder/seedtag/SeedtagBidderTest.java +++ b/src/test/java/org/prebid/server/bidder/seedtag/SeedtagBidderTest.java @@ -1,6 +1,7 @@ package org.prebid.server.bidder.seedtag; import com.fasterxml.jackson.core.JsonProcessingException; +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; @@ -20,6 +21,7 @@ import org.prebid.server.bidder.model.Result; import org.prebid.server.currency.CurrencyConversionService; import org.prebid.server.exception.PreBidException; +import org.prebid.server.proto.openrtb.ext.request.seedtag.ExtImpSeedtag; import java.math.BigDecimal; import java.util.List; @@ -127,6 +129,115 @@ public void makeHttpRequestsShouldSkipImpsWithCurrencyThatCanNotBeConverted() { .hasSize(1); } + @Test + public void makeHttpRequestsShouldSucceedWithPublisherIdAndRonIdIntegrationType() { + // given + final BidRequest bidRequest = givenBidRequest( + identity(), + requestBuilder -> requestBuilder.imp(singletonList( + givenImp(ExtImpSeedtag.of(null, "somePubId", "ronId"))))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1); + assertThat(result.getValue().get(0).getPayload().getImp()).hasSize(1); + } + + @Test + public void makeHttpRequestsShouldSucceedWithAdUnitIdAndPublisherIdWhenIntegrationTypeIsRonId() { + // given: adUnitId is irrelevant when integrationType is ronId — publisherId is what matters + final BidRequest bidRequest = givenBidRequest( + identity(), + requestBuilder -> requestBuilder.imp(singletonList( + givenImp(ExtImpSeedtag.of("someAdUnitId", "somePubId", "ronId"))))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1); + } + + @Test + public void makeHttpRequestsShouldSucceedWithAdUnitIdWhenIntegrationTypeIsAbsent() { + // given + final BidRequest bidRequest = givenBidRequest( + identity(), + requestBuilder -> requestBuilder.imp(singletonList( + givenImp(ExtImpSeedtag.of("someAdUnitId", null, null))))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1); + } + + @Test + public void makeHttpRequestsShouldSkipImpWithRonIdIntegrationTypeButMissingPublisherId() { + // given + final BidRequest bidRequest = givenBidRequest( + identity(), + requestBuilder -> requestBuilder.imp(singletonList( + givenImp(ExtImpSeedtag.of("someAdUnitId", null, "ronId"))))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .allSatisfy(error -> { + assertThat(error.getType()).isEqualTo(BidderError.Type.bad_input); + assertThat(error.getMessage()).contains("publisherId is required when integrationType is 'ronId'"); + }); + } + + @Test + public void makeHttpRequestsShouldSkipImpWithNoAdUnitIdAndNoRonIdIntegrationType() { + // given: no adUnitId and integrationType is not ronId → adUnitId is required + final BidRequest bidRequest = givenBidRequest( + identity(), + requestBuilder -> requestBuilder.imp(singletonList( + givenImp(ExtImpSeedtag.of(null, "somePubId", null))))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .allSatisfy(error -> { + assertThat(error.getType()).isEqualTo(BidderError.Type.bad_input); + assertThat(error.getMessage()).contains("adUnitId is required when integrationType is not 'ronId'"); + }); + } + + @Test + public void makeHttpRequestsShouldSkipImpWithNoAdUnitIdAndNoParams() { + // given + final BidRequest bidRequest = givenBidRequest( + identity(), + requestBuilder -> requestBuilder.imp(singletonList( + givenImp(ExtImpSeedtag.of(null, null, null))))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .allSatisfy(error -> { + assertThat(error.getType()).isEqualTo(BidderError.Type.bad_input); + assertThat(error.getMessage()).contains("adUnitId is required when integrationType is not 'ronId'"); + }); + } + @Test public void makeBidsShouldReturnEmptyListIfBidResponseIsNull() throws JsonProcessingException { // given @@ -231,7 +342,15 @@ private static BidRequest givenBidRequest(UnaryOperator impCusto } private static Imp givenImp(UnaryOperator impCustomizer) { - return impCustomizer.apply(Imp.builder().id("123")).build(); + final ObjectNode bidderExt = mapper.createObjectNode(); + bidderExt.set("bidder", mapper.valueToTree(ExtImpSeedtag.of("someAdUnitId", null, null))); + return impCustomizer.apply(Imp.builder().id("123").ext(bidderExt)).build(); + } + + private static Imp givenImp(ExtImpSeedtag extImpSeedtag) { + final ObjectNode bidderExt = mapper.createObjectNode(); + bidderExt.set("bidder", mapper.valueToTree(extImpSeedtag)); + return Imp.builder().id("123").ext(bidderExt).build(); } private static BidResponse givenBidResponse(UnaryOperator bidCustomizer) { diff --git a/src/test/java/org/prebid/server/it/SeedtagTest.java b/src/test/java/org/prebid/server/it/SeedtagTest.java index 318f2bb506d..f4892edbec5 100644 --- a/src/test/java/org/prebid/server/it/SeedtagTest.java +++ b/src/test/java/org/prebid/server/it/SeedtagTest.java @@ -30,4 +30,5 @@ public void openrtb2AuctionShouldRespondWithBidsFromSeedtag() throws IOException assertJsonEquals("openrtb2/seedtag/test-auction-seedtag-response.json", response, singletonList("seedtag")); } + } From c619f54103ad5176be38181184ee7f8a3b5d084e Mon Sep 17 00:00:00 2001 From: Velraj <132557157+VelRaj21@users.noreply.github.com> Date: Tue, 19 May 2026 18:49:43 +0530 Subject: [PATCH 4/5] Alkimi: Adding alkimi vendor-id and user-sync url modification (#4490) --- src/main/resources/bidder-config/alkimi.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/bidder-config/alkimi.yaml b/src/main/resources/bidder-config/alkimi.yaml index 1a4173a4ed3..5e4b0a8df6d 100644 --- a/src/main/resources/bidder-config/alkimi.yaml +++ b/src/main/resources/bidder-config/alkimi.yaml @@ -12,10 +12,10 @@ adapters: - video - audio supported-vendors: - vendor-id: 0 + vendor-id: 1169 usersync: cookie-family-name: alkimi redirect: - url: https://user-sync.alkimi-onboarding.com/ssp-sync?gdpr={{gdpr}}&us_privacy={{us_privacy}}&redirect={{redirect_url}} + url: https://user-sync.alkimi-onboarding.com/ssp-sync?gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&gpp={{gpp}}&gpp_sid={{gpp_sid}}&redirect={{redirect_url}} support-cors: false uid-macro: '${UID}' From c86aa479391668e983eb51c19c31f45830ff4e45 Mon Sep 17 00:00:00 2001 From: przemkaczmarek <167743744+przemkaczmarek@users.noreply.github.com> Date: Tue, 19 May 2026 15:31:05 +0200 Subject: [PATCH 5/5] New Adapter: BeOp (#4476) --- .../prebid/server/bidder/beop/BeopBidder.java | 149 +++++++++++ .../openrtb/ext/request/beop/ExtImpBeop.java | 13 + .../config/bidder/BeopConfiguration.java | 41 +++ src/main/resources/bidder-config/beop.yaml | 14 + .../resources/static/bidder-params/beop.json | 33 +++ .../server/bidder/beop/BeopBidderTest.java | 253 ++++++++++++++++++ .../java/org/prebid/server/it/BeopTest.java | 32 +++ .../beop/test-auction-beop-request.json | 23 ++ .../beop/test-auction-beop-response.json | 38 +++ .../openrtb2/beop/test-beop-bid-request.json | 52 ++++ .../openrtb2/beop/test-beop-bid-response.json | 21 ++ .../server/it/test-application.properties | 2 + 12 files changed, 671 insertions(+) create mode 100644 src/main/java/org/prebid/server/bidder/beop/BeopBidder.java create mode 100644 src/main/java/org/prebid/server/proto/openrtb/ext/request/beop/ExtImpBeop.java create mode 100644 src/main/java/org/prebid/server/spring/config/bidder/BeopConfiguration.java create mode 100644 src/main/resources/bidder-config/beop.yaml create mode 100644 src/main/resources/static/bidder-params/beop.json create mode 100644 src/test/java/org/prebid/server/bidder/beop/BeopBidderTest.java create mode 100644 src/test/java/org/prebid/server/it/BeopTest.java create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-response.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-request.json create mode 100644 src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-response.json diff --git a/src/main/java/org/prebid/server/bidder/beop/BeopBidder.java b/src/main/java/org/prebid/server/bidder/beop/BeopBidder.java new file mode 100644 index 00000000000..975f6c02573 --- /dev/null +++ b/src/main/java/org/prebid/server/bidder/beop/BeopBidder.java @@ -0,0 +1,149 @@ +package org.prebid.server.bidder.beop; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.iab.openrtb.request.BidRequest; +import com.iab.openrtb.request.Imp; +import com.iab.openrtb.response.Bid; +import com.iab.openrtb.response.BidResponse; +import com.iab.openrtb.response.SeatBid; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.utils.URIBuilder; +import org.prebid.server.bidder.Bidder; +import org.prebid.server.bidder.model.BidderBid; +import org.prebid.server.bidder.model.BidderCall; +import org.prebid.server.bidder.model.BidderError; +import org.prebid.server.bidder.model.HttpRequest; +import org.prebid.server.bidder.model.Result; +import org.prebid.server.exception.PreBidException; +import org.prebid.server.json.DecodeException; +import org.prebid.server.json.JacksonMapper; +import org.prebid.server.proto.openrtb.ext.ExtPrebid; +import org.prebid.server.proto.openrtb.ext.request.beop.ExtImpBeop; +import org.prebid.server.proto.openrtb.ext.response.BidType; +import org.prebid.server.util.BidderUtil; +import org.prebid.server.util.HttpUtil; + +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; + +public class BeopBidder implements Bidder { + + private static final TypeReference> BEOP_EXT_TYPE_REFERENCE = new TypeReference<>() { + }; + + private final String endpointUrl; + private final JacksonMapper mapper; + + public BeopBidder(String endpointUrl, JacksonMapper mapper) { + this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl)); + this.mapper = Objects.requireNonNull(mapper); + } + + @Override + public Result>> makeHttpRequests(BidRequest bidRequest) { + final List imps = bidRequest.getImp(); + + final ExtImpBeop extImpBeop; + try { + extImpBeop = parseImpExt(imps.getFirst()); + } catch (PreBidException e) { + return Result.withError(BidderError.badInput(e.getMessage())); + } + + final String resolvedUrl; + try { + resolvedUrl = buildEndpointUrl(extImpBeop); + } catch (PreBidException e) { + return Result.withError(BidderError.badInput(e.getMessage())); + } + + return Result.withValue(BidderUtil.defaultRequest(bidRequest, resolvedUrl, mapper)); + } + + private ExtImpBeop parseImpExt(Imp imp) { + try { + return mapper.mapper().convertValue(imp.getExt(), BEOP_EXT_TYPE_REFERENCE).getBidder(); + } catch (IllegalArgumentException e) { + throw new PreBidException("ext.bidder not provided: " + e.getMessage()); + } + } + + private String buildEndpointUrl(ExtImpBeop ext) { + final URIBuilder uriBuilder; + try { + uriBuilder = new URIBuilder(endpointUrl); + } catch (URISyntaxException e) { + throw new PreBidException("Invalid endpoint URL: " + e.getMessage()); + } + + final String pid = StringUtils.trimToNull(ext.getPid()); + if (StringUtils.isNotEmpty(pid)) { + uriBuilder.addParameter("pid", pid); + } + + final String nid = StringUtils.trimToNull(ext.getNid()); + if (StringUtils.isNotEmpty(nid)) { + uriBuilder.addParameter("nid", nid); + } + + final String nptnid = StringUtils.trimToNull(ext.getNtpnid()); + if (StringUtils.isNotEmpty(nptnid)) { + uriBuilder.addParameter("nptnid", nptnid); + } + + return uriBuilder.toString(); + } + + @Override + public Result> makeBids(BidderCall httpCall, BidRequest bidRequest) { + final BidResponse bidResponse; + try { + bidResponse = mapper.decodeValue(httpCall.getResponse().getBody(), BidResponse.class); + } catch (DecodeException e) { + return Result.withError(BidderError.badServerResponse(e.getMessage())); + } + + if (bidResponse == null || CollectionUtils.isEmpty(bidResponse.getSeatbid())) { + return Result.empty(); + } + + final List errors = new ArrayList<>(); + final List bids = extractBids(bidResponse, errors); + return Result.of(bids, errors); + } + + private static List extractBids(BidResponse bidResponse, List errors) { + return bidResponse.getSeatbid().stream() + .filter(Objects::nonNull) + .map(SeatBid::getBid) + .filter(Objects::nonNull) + .flatMap(Collection::stream) + .filter(Objects::nonNull) + .map(bid -> makeBidderBid(bid, bidResponse.getCur(), errors)) + .filter(Objects::nonNull) + .toList(); + } + + private static BidderBid makeBidderBid(Bid bid, String currency, List errors) { + try { + return BidderBid.of(bid, resolveBidType(bid), currency); + } catch (PreBidException e) { + errors.add(BidderError.badServerResponse(e.getMessage())); + return null; + } + } + + private static BidType resolveBidType(Bid bid) { + final Integer mtype = bid.getMtype(); + return switch (mtype) { + case 1 -> BidType.banner; + case 2 -> BidType.video; + case null, default -> throw new PreBidException( + "Failed to parse bid mtype for impression \"%s\"".formatted(bid.getImpid())); + }; + } +} diff --git a/src/main/java/org/prebid/server/proto/openrtb/ext/request/beop/ExtImpBeop.java b/src/main/java/org/prebid/server/proto/openrtb/ext/request/beop/ExtImpBeop.java new file mode 100644 index 00000000000..4c073898871 --- /dev/null +++ b/src/main/java/org/prebid/server/proto/openrtb/ext/request/beop/ExtImpBeop.java @@ -0,0 +1,13 @@ +package org.prebid.server.proto.openrtb.ext.request.beop; + +import lombok.Value; + +@Value(staticConstructor = "of") +public class ExtImpBeop { + + String pid; + + String nid; + + String ntpnid; +} diff --git a/src/main/java/org/prebid/server/spring/config/bidder/BeopConfiguration.java b/src/main/java/org/prebid/server/spring/config/bidder/BeopConfiguration.java new file mode 100644 index 00000000000..a0f94bee00b --- /dev/null +++ b/src/main/java/org/prebid/server/spring/config/bidder/BeopConfiguration.java @@ -0,0 +1,41 @@ +package org.prebid.server.spring.config.bidder; + +import org.prebid.server.bidder.BidderDeps; +import org.prebid.server.bidder.beop.BeopBidder; +import org.prebid.server.json.JacksonMapper; +import org.prebid.server.spring.config.bidder.model.BidderConfigurationProperties; +import org.prebid.server.spring.config.bidder.util.BidderDepsAssembler; +import org.prebid.server.spring.config.bidder.util.UsersyncerCreator; +import org.prebid.server.spring.env.YamlPropertySourceFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +import jakarta.validation.constraints.NotBlank; + +@Configuration +@PropertySource(value = "classpath:/bidder-config/beop.yaml", factory = YamlPropertySourceFactory.class) +public class BeopConfiguration { + + private static final String BIDDER_NAME = "beop"; + + @Bean("beopConfigurationProperties") + @ConfigurationProperties("adapters.beop") + BidderConfigurationProperties configurationProperties() { + return new BidderConfigurationProperties(); + } + + @Bean + BidderDeps beopBidderDeps(BidderConfigurationProperties beopConfigurationProperties, + @NotBlank @Value("${external-url}") String externalUrl, + JacksonMapper mapper) { + + return BidderDepsAssembler.forBidder(BIDDER_NAME) + .withConfig(beopConfigurationProperties) + .usersyncerCreator(UsersyncerCreator.create(externalUrl)) + .bidderCreator(config -> new BeopBidder(config.getEndpoint(), mapper)) + .assemble(); + } +} diff --git a/src/main/resources/bidder-config/beop.yaml b/src/main/resources/bidder-config/beop.yaml new file mode 100644 index 00000000000..c71eac10157 --- /dev/null +++ b/src/main/resources/bidder-config/beop.yaml @@ -0,0 +1,14 @@ +adapters: + beop: + endpoint: "https://hb.collectiveaudience.co/rtb/bid" + ortb-version: "2.6" + endpoint-compression: gzip + geoscope: + - USA + meta-info: + maintainer-email: "tech@collectiveaudience.co" + site-media-types: + - banner + - video + supported-vendors: [] + vendor-id: 666 diff --git a/src/main/resources/static/bidder-params/beop.json b/src/main/resources/static/bidder-params/beop.json new file mode 100644 index 00000000000..8b34ac91f70 --- /dev/null +++ b/src/main/resources/static/bidder-params/beop.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "BeOp Adapter Params", + "description": "A schema which validates params accepted by the BeOp adapter", + "type": "object", + "properties": { + "pid": { + "type": "string", + "description": "Beop publisher ID" + }, + "nid": { + "type": "string", + "description": "Beop Network ID" + }, + "ntpnid": { + "type": "string", + "description": "Network partner ID" + } + }, + "oneOf": [ + { + "required": [ + "pid" + ] + }, + { + "required": [ + "nid", + "ntpnid" + ] + } + ] +} diff --git a/src/test/java/org/prebid/server/bidder/beop/BeopBidderTest.java b/src/test/java/org/prebid/server/bidder/beop/BeopBidderTest.java new file mode 100644 index 00000000000..972650f64ce --- /dev/null +++ b/src/test/java/org/prebid/server/bidder/beop/BeopBidderTest.java @@ -0,0 +1,253 @@ +package org.prebid.server.bidder.beop; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.iab.openrtb.request.BidRequest; +import com.iab.openrtb.request.Imp; +import com.iab.openrtb.response.Bid; +import com.iab.openrtb.response.BidResponse; +import com.iab.openrtb.response.SeatBid; +import org.junit.jupiter.api.Test; +import org.prebid.server.VertxTest; +import org.prebid.server.bidder.model.BidderBid; +import org.prebid.server.bidder.model.BidderCall; +import org.prebid.server.bidder.model.BidderError; +import org.prebid.server.bidder.model.HttpRequest; +import org.prebid.server.bidder.model.HttpResponse; +import org.prebid.server.bidder.model.Result; +import org.prebid.server.proto.openrtb.ext.ExtPrebid; +import org.prebid.server.proto.openrtb.ext.request.beop.ExtImpBeop; +import org.prebid.server.proto.openrtb.ext.response.BidType; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; + +public class BeopBidderTest extends VertxTest { + + private static final String ENDPOINT_URL = "https://test.com/test"; + + private final BeopBidder target = new BeopBidder(ENDPOINT_URL, jacksonMapper); + + @Test + public void creationShouldFailOnInvalidEndpointUrl() { + assertThatIllegalArgumentException().isThrownBy(() -> new BeopBidder("invalid_url", jacksonMapper)); + } + + @Test + public void makeHttpRequestsShouldReturnErrorWhenImpExtCouldNotBeParsed() { + // given + final BidRequest bidRequest = BidRequest.builder() + .imp(List.of(Imp.builder() + .ext(mapper.valueToTree(ExtPrebid.of(null, mapper.createArrayNode()))) + .build())) + .build(); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .extracting(BidderError::getMessage) + .allMatch(message -> message.startsWith("ext.bidder not provided:")); + } + + @Test + public void makeHttpRequestsShouldCreateRequestWithPidInUri() { + // given + final BidRequest bidRequest = givenBidRequest(givenImp(ExtImpBeop.of("publisherId", null, null))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1) + .extracting(HttpRequest::getUri) + .containsExactly(ENDPOINT_URL + "?pid=publisherId"); + } + + @Test + public void makeHttpRequestsShouldCreateRequestWithNidAndNtpnidInUri() { + // given + final BidRequest bidRequest = givenBidRequest(givenImp(ExtImpBeop.of(null, "networkId", "partnerId"))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1) + .extracting(HttpRequest::getUri) + .containsExactly(ENDPOINT_URL + "?nid=networkId&nptnid=partnerId"); + } + + @Test + public void makeHttpRequestsShouldCreateRequestWithOriginalPayload() { + // given + final BidRequest bidRequest = givenBidRequest(givenImp(ExtImpBeop.of("publisherId", null, null))); + + // when + final Result>> result = target.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1) + .extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) + .containsOnly(bidRequest); + } + + @Test + public void makeBidsShouldReturnErrorIfResponseBodyCouldNotBeParsed() { + // given + final BidderCall httpCall = givenHttpCall("invalid"); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .allSatisfy(error -> assertThat(error.getType()).isEqualTo(BidderError.Type.bad_server_response)); + } + + @Test + public void makeBidsShouldReturnEmptyResultIfBidResponseIsNull() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall(mapper.writeValueAsString(null)); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).isEmpty(); + } + + @Test + public void makeBidsShouldReturnEmptyResultIfSeatBidIsNull() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall( + mapper.writeValueAsString(BidResponse.builder().build())); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).isEmpty(); + } + + @Test + public void makeBidsShouldReturnBannerBidIfMTypeIsOne() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall( + mapper.writeValueAsString(givenBidResponse(Bid.builder().impid("imp-1").mtype(1).build()))); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1) + .extracting(BidderBid::getType) + .containsExactly(BidType.banner); + } + + @Test + public void makeBidsShouldReturnVideoBidIfMTypeIsTwo() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall( + mapper.writeValueAsString(givenBidResponse(Bid.builder().impid("imp-1").mtype(2).build()))); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()).hasSize(1) + .extracting(BidderBid::getType) + .containsExactly(BidType.video); + } + + @Test + public void makeBidsShouldReturnErrorForBidWithoutMType() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall( + mapper.writeValueAsString(givenBidResponse(Bid.builder().impid("imp-1").build()))); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .extracting(BidderError::getMessage) + .containsExactly("Failed to parse bid mtype for impression \"imp-1\""); + } + + @Test + public void makeBidsShouldReturnErrorForBidWithUnsupportedMType() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall( + mapper.writeValueAsString(givenBidResponse(Bid.builder().impid("imp-1").mtype(3).build()))); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()).hasSize(1) + .extracting(BidderError::getMessage) + .containsExactly("Failed to parse bid mtype for impression \"imp-1\""); + } + + @Test + public void makeBidsShouldReturnValidBidsAndErrorsForMixedMTypes() throws JsonProcessingException { + // given + final BidderCall httpCall = givenHttpCall( + mapper.writeValueAsString(givenBidResponse( + Bid.builder().impid("imp-1").mtype(1).build(), + Bid.builder().impid("imp-2").mtype(2).build(), + Bid.builder().impid("imp-3").mtype(3).build()))); + + // when + final Result> result = target.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).hasSize(2) + .extracting(BidderBid::getType) + .containsExactly(BidType.banner, BidType.video); + assertThat(result.getErrors()).hasSize(1) + .extracting(BidderError::getMessage) + .containsExactly("Failed to parse bid mtype for impression \"imp-3\""); + } + + private static BidRequest givenBidRequest(Imp... imps) { + return BidRequest.builder().imp(List.of(imps)).build(); + } + + private static Imp givenImp(ExtImpBeop extImpBeop) { + return Imp.builder() + .id("imp-1") + .ext(mapper.valueToTree(ExtPrebid.of(null, extImpBeop))) + .build(); + } + + private static BidderCall givenHttpCall(String body) { + return BidderCall.succeededHttp( + HttpRequest.builder().build(), + HttpResponse.of(200, null, body), + null); + } + + private static BidResponse givenBidResponse(Bid... bids) { + return BidResponse.builder() + .cur("USD") + .seatbid(List.of(SeatBid.builder() + .bid(List.of(bids)) + .build())) + .build(); + } +} diff --git a/src/test/java/org/prebid/server/it/BeopTest.java b/src/test/java/org/prebid/server/it/BeopTest.java new file mode 100644 index 00000000000..f2d0232ce88 --- /dev/null +++ b/src/test/java/org/prebid/server/it/BeopTest.java @@ -0,0 +1,32 @@ +package org.prebid.server.it; + +import io.restassured.response.Response; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.prebid.server.model.Endpoint; + +import java.io.IOException; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static java.util.Collections.singletonList; + +public class BeopTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromBeop() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/beop-exchange")) + .withRequestBody(equalToJson(jsonFrom("openrtb2/beop/test-beop-bid-request.json"))) + .willReturn(aResponse().withBody(jsonFrom("openrtb2/beop/test-beop-bid-response.json")))); + + // when + final Response response = responseFor("openrtb2/beop/test-auction-beop-request.json", + Endpoint.openrtb2_auction); + + // then + assertJsonEquals("openrtb2/beop/test-auction-beop-response.json", response, singletonList("beop")); + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-request.json b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-request.json new file mode 100644 index 00000000000..eec1d9548aa --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-request.json @@ -0,0 +1,23 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "beop": { + "pid": "testPublisherId" + } + } + } + ], + "tmax": 5000, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-response.json b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-response.json new file mode 100644 index 00000000000..455999aced3 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-auction-beop-response.json @@ -0,0 +1,38 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "exp": 300, + "price": 3.33, + "crid": "creativeId", + "mtype": 1, + "ext": { + "origbidcpm": 3.33, + "prebid": { + "type": "banner", + "meta": { + "adaptercode": "beop" + } + } + } + } + ], + "seat": "beop", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "beop": "{{ beop.response_time_ms }}" + }, + "prebid": { + "auctiontimestamp": 0 + }, + "tmaxrequest": 5000 + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-request.json new file mode 100644 index 00000000000..ee6da17cd38 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-request.json @@ -0,0 +1,52 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 250 + }, + "secure": 1, + "ext": { + "tid": "${json-unit.any-string}", + "bidder": { + "pid": "testPublisherId" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com", + "publisher": { + "domain": "example.com" + }, + "ext": { + "amp": 0 + } + }, + "device": { + "ua": "userAgent", + "ip": "193.168.244.1" + }, + "at": 1, + "tmax": "${json-unit.any-number}", + "cur": ["USD"], + "source" : { + "tid" : "${json-unit.any-string}" + }, + "regs": { + "gdpr": 0 + }, + "ext": { + "prebid": { + "server": { + "externalurl": "http://localhost:8080", + "gvlid": 1, + "datacenter": "local", + "endpoint": "/openrtb2/auction" + } + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-response.json new file mode 100644 index 00000000000..180173549d8 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/beop/test-beop-bid-response.json @@ -0,0 +1,21 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "price": 3.33, + "crid": "creativeId", + "mtype": 1, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ] + } + ] +} diff --git a/src/test/resources/org/prebid/server/it/test-application.properties b/src/test/resources/org/prebid/server/it/test-application.properties index 8bd2ee5d7bd..5b0b91b257c 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -161,6 +161,8 @@ adapters.beintoo.enabled=true adapters.beintoo.endpoint=http://localhost:8090/beintoo-exchange adapters.bematterfull.enabled=true adapters.bematterfull.endpoint=http://localhost:8090/bematterfull-exchange?host={{Host}}&pid={{SourceId}} +adapters.beop.enabled=true +adapters.beop.endpoint=http://localhost:8090/beop-exchange adapters.bidscube.enabled=true adapters.bidscube.endpoint=http://localhost:8090/bidscube-exchange adapters.bidstack.enabled=true