-
Couldn't load subscription status.
- Fork 220
RTBHouse: Add PMP Removal and Publisher ID Extraction #4229
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
base: master
Are you sure you want to change the base?
RTBHouse: Add PMP Removal and Publisher ID Extraction #4229
Conversation
…o site.publisher.id
src/main/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidder.java
Outdated
Show resolved
Hide resolved
| static BidRequest updateSitePublisherId(BidRequest bidRequest, String publisherId) { | ||
| if (bidRequest == null || publisherId == null) { | ||
| return bidRequest; | ||
| } | ||
|
|
||
| final Site site = bidRequest.getSite(); | ||
| Publisher publisher = (site != null) ? site.getPublisher() : null; | ||
|
|
||
| final PublisherBuilder publisherBuilder = (publisher != null) | ||
| ? publisher.toBuilder() | ||
| : Publisher.builder(); | ||
|
|
||
| publisherBuilder.id(publisherId); | ||
| publisher = publisherBuilder.build(); | ||
|
|
||
| final Site updatedSite = (site != null) | ||
| ? site.toBuilder().publisher(publisher).build() | ||
| : Site.builder().publisher(publisher).build(); | ||
|
|
||
| return bidRequest.toBuilder().site(updatedSite).build(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Site modifySite(Site site, String siteId) {
final Publisher publisher = Optional.ofNullable(site)
.map(Site::getPublisher)
.map(Publisher::toBuilder)
.orElseGet(Publisher::builder)
.ext(ExtPublisher.of(ExtPublisherPrebid.of(siteId)))
.build();
return Optional.ofNullable(site)
.map(Site::toBuilder)
.orElseGet(Site::builder)
.publisher(publisher)
.build();
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can dig into the code, .ext(ExtPublisher.of(ExtPublisherPrebid.of(siteId))) suggests that siteId will be assigned to some other place within request.site.publisher.ext.prebid...., which is not exactly what we wanted to achieve. After some deeper analysis we decided to not overwrite request.site.publisher.id but instead copy it to some other place suggested by your code, so we decided to pick request.site.publisher.ext.prebid.publisherId. How should we proceed with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I gave you an incorrect refactoring example for your case.
It should have been something like the following and it would be totally fine (I can spot a lot of other bidders that do similar things you try to do)
private static Site modifySite(Site site, String id) {
return Optional.ofNullable(site)
.map(Site::toBuilder)
.map(builder -> builder.publisher(modifyPublisher(site.getPublisher(), id)))
.map(Site.SiteBuilder::build)
.orElse(null);
}
private static Publisher modifyPublisher(Publisher publisher, String id) {
return Optional.ofNullable(publisher)
.map(Publisher::toBuilder)
.orElseGet(Publisher::builder)
.id(id)
.build();
} But If you'd like to set the siteId to another target request.site.publisher.ext.prebid.publisherId I can suggest adding a publisherId property to the ExtPublisherPrebid class - but you have to make sure other bidders that uses the same class will be able to compile and the tests will pass after the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanations. Initially, I considered modifying ExtPublisherPrebid, but since it might be used elsewhere, I chose a different approach - see my recent updates to modifySite(). Does this look okay to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't need request.site.publisher.ext.prebid.parentAccount field your approach is fine, otherwise your code removes the parentAccount field from the request.site.publisher.ext.prebid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this field. Thank you for clarification.
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/rtbhouse/RtbhouseBidderTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CTMBNara All issues have been addressed
🔧 Type of changes
✨ What's the context?
Related PR (Golang): prebid/prebid-server#4564
These changes address specific RTBHouse bidder requirements:
📋 Description
This PR implements two key enhancements to the RTBHouse bidder adapter:
imp[].pmpobject from all impressions in outgoing bid requests to RTBHousesite.publisher.ext.prebid.publisherIdin the bid request🧪 Testing results
Tests run: 22, Failures: 0, Errors: 0, Skipped: 0All RTBHouse bidder tests pass successfully, including:
Other information
Please reach us at inventory_support@rtbhouse.com with piotr.jaworski@rtbhouse.com and cc leandro.otani@rtbhouse.com.