Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YahooAdvertising rebranding to Yahoo Ads #2460

Merged
merged 7 commits into from
Aug 11, 2023
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.prebid.server.bidder.yahooadvertising;
package org.prebid.server.bidder.yahooads;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ArrayNode;
Expand Down Expand Up @@ -34,7 +34,7 @@
import org.prebid.server.proto.openrtb.ext.ExtPrebid;
import org.prebid.server.proto.openrtb.ext.FlexibleExtension;
import org.prebid.server.proto.openrtb.ext.request.ExtRegs;
import org.prebid.server.proto.openrtb.ext.request.yahooadvertising.ExtImpYahooAdvertising;
import org.prebid.server.proto.openrtb.ext.request.yahooads.ExtImpYahooAds;
import org.prebid.server.proto.openrtb.ext.response.BidType;
import org.prebid.server.util.HttpUtil;

Expand All @@ -45,19 +45,19 @@
import java.util.Objects;
import java.util.Optional;

public class YahooAdvertisingBidder implements Bidder<BidRequest> {
public class YahooAdsBidder implements Bidder<BidRequest> {

private static final TypeReference<ExtPrebid<?, ExtImpYahooAdvertising>> YAHOO_ADVERTISING_EXT_TYPE_REFERENCE =
private static final TypeReference<ExtPrebid<?, ExtImpYahooAds>> YAHOO_ADVERTISING_EXT_TYPE_REFERENCE =
new TypeReference<>() {
};

private final String endpointUrl;
private final BidRequestOrtbVersionConversionManager conversionManager;
private final JacksonMapper mapper;

public YahooAdvertisingBidder(String endpointUrl,
BidRequestOrtbVersionConversionManager conversionManager,
JacksonMapper mapper) {
public YahooAdsBidder(String endpointUrl,
BidRequestOrtbVersionConversionManager conversionManager,
JacksonMapper mapper) {
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
this.mapper = Objects.requireNonNull(mapper);
this.conversionManager = Objects.requireNonNull(conversionManager);
Expand All @@ -76,8 +76,8 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest bidRequ
for (int i = 0; i < impList.size(); i++) {
try {
final Imp imp = impList.get(i);
final ExtImpYahooAdvertising extImpYahooAdvertising = parseAndValidateImpExt(imp.getExt(), i);
final BidRequest modifiedRequest = modifyRequest(bidRequestOpenRtb25, imp, extImpYahooAdvertising,
final ExtImpYahooAds extImpYahooAds = parseAndValidateImpExt(imp.getExt(), i);
final BidRequest modifiedRequest = modifyRequest(bidRequestOpenRtb25, imp, extImpYahooAds,
regs);
bidRequests.add(makeHttpRequest(modifiedRequest));
} catch (PreBidException e) {
Expand All @@ -88,54 +88,54 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest bidRequ
return Result.of(bidRequests, errors);
}

private ExtImpYahooAdvertising parseAndValidateImpExt(ObjectNode impExtNode, int index) {
final ExtImpYahooAdvertising extImpYahooAdvertising;
private ExtImpYahooAds parseAndValidateImpExt(ObjectNode impExtNode, int index) {
final ExtImpYahooAds extImpYahooAds;
try {
extImpYahooAdvertising = mapper.mapper().convertValue(impExtNode,
extImpYahooAds = mapper.mapper().convertValue(impExtNode,
YAHOO_ADVERTISING_EXT_TYPE_REFERENCE).getBidder();
} catch (IllegalArgumentException e) {
throw new PreBidException("imp #%s: %s".formatted(index, e.getMessage()));
}

final String dcn = extImpYahooAdvertising.getDcn();
final String dcn = extImpYahooAds.getDcn();
if (StringUtils.isBlank(dcn)) {
throw new PreBidException("imp #%s: missing param dcn".formatted(index));
}

final String pos = extImpYahooAdvertising.getPos();
final String pos = extImpYahooAds.getPos();
if (StringUtils.isBlank(pos)) {
throw new PreBidException("imp #%s: missing param pos".formatted(index));
}

return extImpYahooAdvertising;
return extImpYahooAds;
}

private BidRequest modifyRequest(BidRequest request, Imp imp, ExtImpYahooAdvertising extImpYahooAdvertising,
private BidRequest modifyRequest(BidRequest request, Imp imp, ExtImpYahooAds extImpYahooAds,
Regs regs) {
final BidRequest.BidRequestBuilder requestBuilder = request.toBuilder();

final Site site = request.getSite();
final App app = request.getApp();

if (site != null) {
requestBuilder.site(site.toBuilder().id(extImpYahooAdvertising.getDcn()).build());
requestBuilder.site(site.toBuilder().id(extImpYahooAds.getDcn()).build());
} else if (app != null) {
requestBuilder.app(app.toBuilder().id(extImpYahooAdvertising.getDcn()).build());
requestBuilder.app(app.toBuilder().id(extImpYahooAds.getDcn()).build());
}

if (regs != null) {
requestBuilder.regs(modifyRegs(regs));
}

return requestBuilder
.imp(Collections.singletonList(modifyImp(imp, extImpYahooAdvertising)))
.imp(Collections.singletonList(modifyImp(imp, extImpYahooAds)))
.build();
}

private static Imp modifyImp(Imp imp, ExtImpYahooAdvertising extImpYahooAdvertising) {
private static Imp modifyImp(Imp imp, ExtImpYahooAds extImpYahooAds) {
final Banner banner = imp.getBanner();
return imp.toBuilder()
.tagid(extImpYahooAdvertising.getPos())
.tagid(extImpYahooAds.getPos())
.banner(banner != null ? modifyBanner(imp.getBanner()) : null)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.prebid.server.proto.openrtb.ext.request.yahooads;

import lombok.AllArgsConstructor;
import lombok.Value;

@AllArgsConstructor(staticName = "of")
@Value
public class ExtImpYahooAds {

String dcn;

String pos;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.prebid.server.auction.versionconverter.BidRequestOrtbVersionConversionManager;
import org.prebid.server.bidder.BidderDeps;
import org.prebid.server.bidder.yahooadvertising.YahooAdvertisingBidder;
import org.prebid.server.bidder.yahooads.YahooAdsBidder;
import org.prebid.server.json.JacksonMapper;
import org.prebid.server.spring.config.bidder.model.BidderConfigurationProperties;
import org.prebid.server.spring.config.bidder.util.BidderDepsAssembler;
Expand All @@ -17,27 +17,27 @@
import javax.validation.constraints.NotBlank;

@Configuration
@PropertySource(value = "classpath:/bidder-config/yahooAdvertising.yaml", factory = YamlPropertySourceFactory.class)
public class YahooAdvertisingConfiguration {
@PropertySource(value = "classpath:/bidder-config/yahooAds.yaml", factory = YamlPropertySourceFactory.class)
public class YahooAdsConfiguration {

private static final String BIDDER_NAME = "yahooAdvertising";
private static final String BIDDER_NAME = "yahooAds";

@Bean("yahooAdvertisingConfigurationProperties")
@ConfigurationProperties("adapters.yahooadvertising")
@Bean("yahooAdsConfigurationProperties")
@ConfigurationProperties("adapters.yahooads")
BidderConfigurationProperties configurationProperties() {
return new BidderConfigurationProperties();
}

@Bean
BidderDeps yahooAdvertisingBidderDeps(BidderConfigurationProperties yahooAdvertisingConfigurationProperties,
BidderDeps yahooAdsBidderDeps(BidderConfigurationProperties yahooAdsConfigurationProperties,
@NotBlank @Value("${external-url}") String externalUrl,
JacksonMapper mapper,
BidRequestOrtbVersionConversionManager conversionManager) {

return BidderDepsAssembler.forBidder(BIDDER_NAME)
.withConfig(yahooAdvertisingConfigurationProperties)
.withConfig(yahooAdsConfigurationProperties)
.usersyncerCreator(UsersyncerCreator.create(externalUrl))
.bidderCreator(config -> new YahooAdvertisingBidder(config.getEndpoint(), conversionManager, mapper))
.bidderCreator(config -> new YahooAdsBidder(config.getEndpoint(), conversionManager, mapper))
.assemble();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
adapters:
yahooAdvertising:
yahooAds:
radubarbos marked this conversation as resolved.
Show resolved Hide resolved
endpoint: https://s2shb.ssp.yahoo.com/admax/bid/partners/PBS
ortb-version: "2.6"
aliases:
yssp:
enabled: false
endpoint: https://s2shb.ssp.yahoo.com/admax/bid/partners/PBS
yahoossp:
enabled: false
endpoint: https://s2shb.ssp.yahoo.com/admax/bid/partners/PBS
yahooAdvertising:
endpoint: https://s2shb.ssp.yahoo.com/admax/bid/partners/PBS
meta-info:
maintainer-email: dsp-supply-prebid@verizonmedia.com
maintainer-email: hb-fe-tech@yahooinc.com
app-media-types:
- banner
- video
Expand All @@ -18,7 +20,7 @@ adapters:
supported-vendors:
vendor-id: 25
usersync:
cookie-family-name: yahooAdvertising
cookie-family-name: yahooAds
redirect:
url: https://ups.analytics.yahoo.com/ups/58401/sync?redir=true&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}
support-cors: false
Loading