From fb7671dc7cd2b73b2f17d1fb0c371a57e91c57b1 Mon Sep 17 00:00:00 2001 From: oath-jac Date: Mon, 23 Nov 2020 14:34:40 +0200 Subject: [PATCH] Added app capabilities to VerizonMedia adapter --- adapters/verizonmedia/verizonmedia.go | 17 ++- .../exemplary/simple-app-banner.json | 117 ++++++++++++++++++ static/bidder-info/verizonmedia.yaml | 3 + 3 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 adapters/verizonmedia/verizonmediatest/exemplary/simple-app-banner.json diff --git a/adapters/verizonmedia/verizonmedia.go b/adapters/verizonmedia/verizonmedia.go index ac881df95a6..dc8e881a4bb 100644 --- a/adapters/verizonmedia/verizonmedia.go +++ b/adapters/verizonmedia/verizonmedia.go @@ -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) @@ -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 diff --git a/adapters/verizonmedia/verizonmediatest/exemplary/simple-app-banner.json b/adapters/verizonmedia/verizonmediatest/exemplary/simple-app-banner.json new file mode 100644 index 00000000000..dafa911d98e --- /dev/null +++ b/adapters/verizonmedia/verizonmediatest/exemplary/simple-app-banner.json @@ -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" + } + ] + } + ] +} diff --git a/static/bidder-info/verizonmedia.yaml b/static/bidder-info/verizonmedia.yaml index 024cafadec0..c00f2158d4b 100644 --- a/static/bidder-info/verizonmedia.yaml +++ b/static/bidder-info/verizonmedia.yaml @@ -1,6 +1,9 @@ maintainer: email: "dsp-supply-prebid@verizonmedia.com" capabilities: + app: + mediaTypes: + - banner site: mediaTypes: - banner