Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
OpenX adapter: Pass rewarded video flag (prebid#1290)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 authored May 13, 2020
1 parent 6cf1940 commit 678cd3e
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error {
}
}

if imp.Video != nil {
if bidderExt.Prebid != nil && bidderExt.Prebid.IsRewardedInventory == 1 {
imp.Video.Ext = json.RawMessage(`{"rewarded":1}`)
} else {
imp.Video.Ext = nil
}
}

return nil
}

Expand Down
102 changes: 102 additions & 0 deletions adapters/openx/openxtest/exemplary/video-rewarded.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": ["video/mp4"],
"protocols": [2, 5],
"w": 1024,
"h": 576,
"ext": {
"foo": "bar"
}
},
"instl": 1,
"ext": {
"bidder": {
"unit": "539439964",
"delDomain": "se-demo-d.openx.net"
},
"prebid": {
"is_rewarded_inventory": 1
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://rtb.openx.net/prebid",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": ["video/mp4"],
"protocols": [2, 5],
"w": 1024,
"h": 576,
"ext": {
"rewarded": 1
}
},
"tagid": "539439964",
"instl": 1
}
],
"ext": {
"bc": "hb_pbs_1.0.0",
"delDomain": "se-demo-d.openx.net"
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"cur": "USD",
"seatbid": [
{
"seat": "openx",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 0.500000,
"adm": "some-test-ad",
"crid": "crid_10",
"w": 1024,
"h": 576
}]
}
]
}
}
}
],


"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"crid": "crid_10",
"w": 1024,
"h": 576
},
"type": "video"
}
]
}
]
}

0 comments on commit 678cd3e

Please sign in to comment.