Skip to content

Commit

Permalink
Conversant: Enable audio requests #3605 (#3616)
Browse files Browse the repository at this point in the history
  • Loading branch information
przemkaczmarek authored Dec 16, 2024
1 parent 3029de2 commit b9ed378
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,13 @@ private Bid updateBidWithId(Bid bid) {
private static BidType getType(String impId, List<Imp> imps) {
for (Imp imp : imps) {
if (imp.getId().equals(impId)) {
return imp.getVideo() != null ? BidType.video : BidType.banner;
if (imp.getVideo() != null) {
return BidType.video;
} else if (imp.getAudio() != null) {
return BidType.audio;
} else {
return BidType.banner;
}
}
}
return BidType.banner;
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/bidder-config/epsilon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ adapters:
app-media-types:
- banner
- video
- audio
site-media-types:
- banner
- video
- audio
supported-vendors:
vendor-id: 24
usersync:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.iab.openrtb.request.App;
import com.iab.openrtb.request.Audio;
import com.iab.openrtb.request.Banner;
import com.iab.openrtb.request.BidRequest;
import com.iab.openrtb.request.Imp;
Expand Down Expand Up @@ -41,6 +42,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.prebid.server.proto.openrtb.ext.response.BidType.audio;
import static org.prebid.server.proto.openrtb.ext.response.BidType.banner;
import static org.prebid.server.proto.openrtb.ext.response.BidType.video;

Expand Down Expand Up @@ -610,6 +612,25 @@ public void makeBidsShouldReturnVideoBidIfRequestImpHasVideo() throws JsonProces
.containsExactly(BidderBid.of(Bid.builder().impid("123").build(), video, "USD"));
}

@Test
public void makeBidsShouldReturnAudioBidIfRequestImpHasAudio() throws JsonProcessingException {
// given
final BidderCall<BidRequest> httpCall = givenHttpCall(
givenBidRequest(builder -> builder.id("123")
.audio(Audio.builder().build())
.banner(Banner.builder().build())),
mapper.writeValueAsString(
givenBidResponse(bidBuilder -> bidBuilder.impid("123"))));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, null);

// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue())
.containsExactly(BidderBid.of(Bid.builder().impid("123").build(), audio, "USD"));
}

@Test
public void makeBidsShouldUpdateBidWithUUIDIfGenerateBidIdIsTrue() throws JsonProcessingException {
// given
Expand Down

0 comments on commit b9ed378

Please sign in to comment.