Skip to content

Commit

Permalink
OTT-1687:ortbbidder support
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishshinde-pubm committed Mar 22, 2024
1 parent 25866c2 commit 3ff6d2f
Show file tree
Hide file tree
Showing 18 changed files with 1,006 additions and 3 deletions.
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

0 comments on commit 3ff6d2f

Please sign in to comment.