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

OTT-1687: add support for owortb_testbidder (oRTB integration) #735

Merged
merged 13 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions adapters/adapterstest/test_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func getTestExtraRequestInfo(t *testing.T, filename string, spec *testSpec, isAm
} else if isVideoTest {
reqInfo.PbsEntryPoint = "video"
}
reqInfo = updateRequestInfoForOW(reqInfo, filename) // OW specific : required for oRTB bidder

return &reqInfo
}
Expand Down
20 changes: 20 additions & 0 deletions adapters/adapterstest/test_json_ow.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package adapterstest

import (
"strings"

"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/openrtb_ext"
)

// updateRequestInfoForOW updates the reqInfo as per OW requirement
func updateRequestInfoForOW(reqInfo adapters.ExtraRequestInfo, fileName string) adapters.ExtraRequestInfo {
// for oRTB bidders (having prefix as 'ortb_', set the bidderName from file)
if strings.HasPrefix(fileName, "ortb_") {
files := strings.Split(fileName, "/")
if len(files) > 0 {
reqInfo.BidderCoreName = openrtb_ext.BidderName(files[0])
}
}
return reqInfo
}
2 changes: 2 additions & 0 deletions adapters/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ type ExtraRequestInfo struct {
PbsEntryPoint metrics.RequestType
GlobalPrivacyControlHeader string
CurrencyConversions currency.Conversions

BidderCoreName openrtb_ext.BidderName // OW specific: required for oRTB bidder
}

func NewExtraRequestInfo(c currency.Conversions) ExtraRequestInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id-1",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_1",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_1": "value_1"
}
}
}
}
},
{
"id": "test-imp-id-2",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_2",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_2": "value_2"
}
}
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "http://test_bidder.com",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id-1",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_1",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_1": "value_1"
}
}
}
}
},
{
"id": "test-imp-id-2",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_2",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_2": "value_2"
}
}
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "magnite",
"bid": [{
"id": "bid-1",
"impid": "test-imp-id-1",
"price": 0.500000,
"adm": "some-test-ad",
"crid": "crid_10",
"mtype": 2
},{
"id": "bid-2",
"impid": "test-imp-id-2",
"price": 10,
"adm": "some-test-ad-2",
"crid": "crid_10",
"mtype": 2
}]
}
],
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"bids": [
{
"bid": {
"id": "bid-1",
"impid": "test-imp-id-1",
"price": 0.5,
"adm": "some-test-ad",
"crid": "crid_10",
"mtype":2
},
"type": "video"
},
{
"bid": {
"id": "bid-2",
"impid": "test-imp-id-2",
"price": 10,
"adm": "some-test-ad-2",
"crid": "crid_10",
"mtype":2
},
"type": "video"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id-1",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_1",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_1": "value_1"
}
}
}
}
},
{
"id": "test-imp-id-2",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_2",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_2": "value_2"
}
}
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "http://test_bidder.com",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id-1",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_1",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_1": "value_1"
}
}
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "magnite",
"bid": [{
"id": "bid-1",
"impid": "test-imp-id-1",
"price": 0.500000,
"adm": "some-test-ad",
"crid": "crid_10",
"mtype": 2
}]
}
],
"cur": "USD"
}
}
},
{
"expectedRequest": {
"uri": "http://test_bidder.com",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id-2",
"video": {
"mimes": ["video/mp4"]
},
"tagid": "tagid_2",
"ext": {
"prebid": {
"bidder": {
"magnite": {
"bidder_param_2": "value_2"
}
}
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "magnite",
"bid": [{
"id": "bid-2",
"impid": "test-imp-id-2",
"price": 10,
"adm": "some-test-ad-2",
"crid": "crid_10",
"mtype": 2
}]
}
],
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"bids": [
{
"bid": {
"id": "bid-1",
"impid": "test-imp-id-1",
"price": 0.5,
"adm": "some-test-ad",
"crid": "crid_10",
"mtype":2
},
"type": "video"
}
]
},
{
"bids": [
{
"bid": {
"id": "bid-2",
"impid": "test-imp-id-2",
"price": 10,
"adm": "some-test-ad-2",
"crid": "crid_10",
"mtype":2
},
"type": "video"
}
]
}
]
}
Loading
Loading