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

Added app capabilities to VerizonMedia adapter #1596

Merged
merged 1 commit into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 13 additions & 4 deletions adapters/verizonmedia/verizonmedia.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo
reqCopy := *request
reqCopy.Imp = []openrtb.Imp{imp}

siteCopy := *request.Site
reqCopy.Site = &siteCopy
if request.Site != nil {
siteCopy := *request.Site
reqCopy.Site = &siteCopy
} else if request.App != nil {
appCopy := *request.App
reqCopy.App = &appCopy
}

if err := changeRequestForBidService(&reqCopy, &verizonMediaExt); err != nil {
errors = append(errors, err)
Expand Down Expand Up @@ -175,9 +180,13 @@ func getImpInfo(impId string, imps []openrtb.Imp) (bool, openrtb_ext.BidType) {
}

func changeRequestForBidService(request *openrtb.BidRequest, extension *openrtb_ext.ExtImpVerizonMedia) error {
/* Always override the tag ID and site ID of the request */
/* Always override the tag ID and (site ID or app ID) of the request */
request.Imp[0].TagID = extension.Pos
request.Site.ID = extension.Dcn
if request.Site != nil {
request.Site.ID = extension.Dcn
} else if request.App != nil {
request.App.ID = extension.Dcn
}

if request.Imp[0].Banner == nil {
return nil
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [{"w": 728, "h": 90}]
},
"tagid": "123",
"ext": {
"bidder": {
"dcn": "dcn1",
"pos": "pos2"
}
}
}
],
"device": {
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
"ip": "127.0.0.1"
},
"app": {
"id": "test-app-id"
}
},

"httpCalls": [
{
"expectedRequest": {
"headers": {
"Accept": [
"application/json"
],
"Content-Type": [
"application/json;charset=utf-8"
],
"User-Agent": [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
],
"X-Openrtb-Version": [
"2.5"
]
},
"uri": "",
"body": {
"device": {
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
"ip": "127.0.0.1"
},
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"tagid": "pos2",
"banner": {
"format": [{"w": 728, "h": 90}],
"w": 728,
"h": 90
},
"ext": {
"bidder": {
"dcn": "dcn1",
"pos": "pos2"
}
}
}
],
"app": {
"id": "dcn1"
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "verizonmedia",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 0.500000,
"adm": "some-test-ad",
"crid": "crid_10",
"h": 90,
"w": 728
}]
}
],
"cur": "USD"
}
}
}
],

"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": 728,
"h": 90
},
"type": "banner"
}
]
}
]
}
3 changes: 3 additions & 0 deletions static/bidder-info/verizonmedia.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
maintainer:
email: "dsp-supply-prebid@verizonmedia.com"
capabilities:
app:
mediaTypes:
- banner
site:
mediaTypes:
- banner