From 71f20302f7436cd2c707b58f0cc237c2f8d56677 Mon Sep 17 00:00:00 2001 From: Bryan DeLong Date: Wed, 27 Dec 2023 06:29:21 -0500 Subject: [PATCH] Consumable: App video and audio support (#3338) --- adapters/consumable/adtypes.go | 64 --- adapters/consumable/consumable.go | 383 +++++------------- .../consumable/exemplary/app-audio.json | 113 ++++++ .../consumable/exemplary/app-banner.json | 111 +++++ .../consumable/exemplary/app-video.json | 126 ++++++ .../consumable/exemplary/simple-banner.json | 133 +++--- .../supplemental/app-audio-bad-params.json | 37 ++ .../supplemental/app-banner-no-ad.json | 75 ++++ .../supplemental/app-video-no-media-type.json | 110 +++++ .../supplemental/bad-dsp-request-example.json | 78 ++++ .../dsp-server-internal-error-example.json | 78 ++++ .../simple-banner-content-meta.json | 117 +++--- .../supplemental/simple-banner-coppa.json | 110 +++-- .../supplemental/simple-banner-eids.json | 163 ++++---- .../supplemental/simple-banner-gdpr-2.json | 112 +++-- .../supplemental/simple-banner-gdpr-3.json | 119 +++--- .../supplemental/simple-banner-gdpr.json | 126 +++--- .../supplemental/simple-banner-gpp.json | 125 +++--- .../supplemental/simple-banner-meta.json | 114 +++--- .../simple-banner-no-impressionUrl.json | 130 +++--- .../supplemental/simple-banner-no-params.json | 43 ++ .../supplemental/simple-banner-schain.json | 132 +++--- .../simple-banner-us-privacy.json | 119 +++--- .../unknown-status-code-example.json | 78 ++++ adapters/consumable/consumable_test.go | 85 +++- adapters/consumable/instant.go | 21 - adapters/consumable/params_test.go | 2 + adapters/consumable/retrieveAd.go | 10 - openrtb_ext/imp_consumable.go | 3 +- static/bidder-info/consumable.yaml | 3 + static/bidder-params/consumable.json | 10 +- 31 files changed, 1750 insertions(+), 1180 deletions(-) delete mode 100644 adapters/consumable/adtypes.go create mode 100644 adapters/consumable/consumable/exemplary/app-audio.json create mode 100644 adapters/consumable/consumable/exemplary/app-banner.json create mode 100644 adapters/consumable/consumable/exemplary/app-video.json create mode 100644 adapters/consumable/consumable/supplemental/app-audio-bad-params.json create mode 100644 adapters/consumable/consumable/supplemental/app-banner-no-ad.json create mode 100644 adapters/consumable/consumable/supplemental/app-video-no-media-type.json create mode 100644 adapters/consumable/consumable/supplemental/bad-dsp-request-example.json create mode 100644 adapters/consumable/consumable/supplemental/dsp-server-internal-error-example.json create mode 100644 adapters/consumable/consumable/supplemental/simple-banner-no-params.json create mode 100644 adapters/consumable/consumable/supplemental/unknown-status-code-example.json delete mode 100644 adapters/consumable/instant.go delete mode 100644 adapters/consumable/retrieveAd.go diff --git a/adapters/consumable/adtypes.go b/adapters/consumable/adtypes.go deleted file mode 100644 index 9974a4f26d6..00000000000 --- a/adapters/consumable/adtypes.go +++ /dev/null @@ -1,64 +0,0 @@ -package consumable - -import ( - "strconv" - - "github.com/prebid/openrtb/v19/openrtb2" -) - -/* Turn array of openrtb formats into consumable's code*/ -func getSizeCodes(Formats []openrtb2.Format) []int { - - codes := make([]int, 0) - for _, format := range Formats { - str := strconv.FormatInt(format.W, 10) + "x" + strconv.FormatInt(format.H, 10) - if code, ok := sizeMap[str]; ok { - codes = append(codes, code) - } - } - return codes -} - -var sizeMap = map[string]int{ - "120x90": 1, - // 120x90 is in twice in prebid.js implementation - probably as spacer - "468x60": 3, - "728x90": 4, - "300x250": 5, - "160x600": 6, - "120x600": 7, - "300x100": 8, - "180x150": 9, - "336x280": 10, - "240x400": 11, - "234x60": 12, - "88x31": 13, - "120x60": 14, - "120x240": 15, - "125x125": 16, - "220x250": 17, - "250x250": 18, - "250x90": 19, - "0x0": 20, // TODO: can this be removed - I suspect it's padding in prebid.js impl - "200x90": 21, - "300x50": 22, - "320x50": 23, - "320x480": 24, - "185x185": 25, - "620x45": 26, - "300x125": 27, - "800x250": 28, - // below order is preserved from prebid.js implementation for easy comparison - "970x90": 77, - "970x250": 123, - "300x600": 43, - "970x66": 286, - "970x280": 3230, - "486x60": 429, - "700x500": 374, - "300x1050": 934, - "320x100": 1578, - "320x250": 331, - "320x267": 3301, - "728x250": 2730, -} diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index 635bc7058ed..932a58b5679 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -3,319 +3,144 @@ package consumable import ( "encoding/json" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/prebid/openrtb/v19/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/errortypes" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/prebid/prebid-server/v2/privacy/ccpa" + "net/http" ) -type ConsumableAdapter struct { - clock instant +type adapter struct { endpoint string } -type bidRequest struct { - Placements []placement `json:"placements"` - Time int64 `json:"time"` - NetworkId int `json:"networkId,omitempty"` - SiteId int `json:"siteId"` - UnitId int `json:"unitId"` - UnitName string `json:"unitName,omitempty"` - IncludePricingData bool `json:"includePricingData"` - User user `json:"user,omitempty"` - Referrer string `json:"referrer,omitempty"` - Ip string `json:"ip,omitempty"` - Url string `json:"url,omitempty"` - EnableBotFiltering bool `json:"enableBotFiltering,omitempty"` - Parallel bool `json:"parallel"` - CCPA string `json:"ccpa,omitempty"` - GDPR *bidGdpr `json:"gdpr,omitempty"` - Coppa bool `json:"coppa,omitempty"` - SChain openrtb2.SupplyChain `json:"schain"` - Content *openrtb2.Content `json:"content,omitempty"` - GPP string `json:"gpp,omitempty"` - GPPSID []int8 `json:"gpp_sid,omitempty"` -} - -type placement struct { - DivName string `json:"divName"` - NetworkId int `json:"networkId,omitempty"` - SiteId int `json:"siteId"` - UnitId int `json:"unitId"` - UnitName string `json:"unitName,omitempty"` - AdTypes []int `json:"adTypes"` -} - -type user struct { - Key string `json:"key,omitempty"` - Eids []openrtb2.EID `json:"eids,omitempty"` -} - -type bidGdpr struct { - Applies *bool `json:"applies,omitempty"` - Consent string `json:"consent,omitempty"` -} - -type bidResponse struct { - Decisions map[string]decision `json:"decisions"` // map by bidId -} - -/** - * See https://dev.adzerk.com/v1.0/reference/response - */ -type decision struct { - Pricing *pricing `json:"pricing"` - AdID int64 `json:"adId"` - BidderName string `json:"bidderName,omitempty"` - CreativeID string `json:"creativeId,omitempty"` - Contents []contents `json:"contents"` - ImpressionUrl *string `json:"impressionUrl,omitempty"` - Width uint64 `json:"width,omitempty"` // Consumable extension, not defined by Adzerk - Height uint64 `json:"height,omitempty"` // Consumable extension, not defined by Adzerk - Adomain []string `json:"adomain,omitempty"` - Cats []string `json:"cats,omitempty"` -} - -type contents struct { - Body string `json:"body"` -} - -type pricing struct { - ClearPrice *float64 `json:"clearPrice"` -} - -func (a *ConsumableAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - headers := http.Header{ "Content-Type": {"application/json"}, "Accept": {"application/json"}, } - - if request.Device != nil { - if request.Device.UA != "" { - headers.Set("User-Agent", request.Device.UA) - } - - if request.Device.IP != "" { - headers.Set("Forwarded", "for="+request.Device.IP) - headers.Set("X-Forwarded-For", request.Device.IP) - } - } - - // Set azk cookie to one we got via sync - if request.User != nil { - userID := strings.TrimSpace(request.User.BuyerUID) - if len(userID) > 0 { - headers.Add("Cookie", fmt.Sprintf("%s=%s", "azk", userID)) - } - } - - if request.Site != nil && request.Site.Page != "" { - headers.Set("Referer", request.Site.Page) - - pageUrl, err := url.Parse(request.Site.Page) - if err != nil { - errs = append(errs, err) - } else { - origin := url.URL{ - Scheme: pageUrl.Scheme, - Opaque: pageUrl.Opaque, - Host: pageUrl.Host, - } - headers.Set("Origin", origin.String()) - } - } - - body := bidRequest{ - Placements: make([]placement, len(request.Imp)), - Time: a.clock.Now().Unix(), - IncludePricingData: true, - EnableBotFiltering: true, - Parallel: true, - } - - if request.Site != nil { - body.Referrer = request.Site.Ref // Effectively the previous page to the page where the ad will be shown - body.Url = request.Site.Page // where the impression will be made - } - - gdpr := bidGdpr{} - - ccpaPolicy, err := ccpa.ReadFromRequest(request) + bodyBytes, err := json.Marshal(request) if err != nil { - errs = append(errs, err) - } else { - body.CCPA = ccpaPolicy.Consent + return nil, []error{err} } - if request.Regs != nil && request.Regs.Ext != nil { - var extRegs openrtb_ext.ExtRegs - if err := json.Unmarshal(request.Regs.Ext, &extRegs); err != nil { - errs = append(errs, err) - } else { - if extRegs.GDPR != nil { - applies := *extRegs.GDPR != 0 - gdpr.Applies = &applies - body.GDPR = &gdpr - } + if request.Site != nil { + _, consumableExt, err := extractExtensions(request.Imp[0]) + if err != nil { + return nil, err } - } - - if request.User != nil && request.User.Ext != nil { - var extUser openrtb_ext.ExtUser - if err := json.Unmarshal(request.User.Ext, &extUser); err != nil { - errs = append(errs, err) - } else { - gdpr.Consent = extUser.Consent - body.GDPR = &gdpr - - if hasEids(extUser.Eids) { - body.User.Eids = extUser.Eids - } + if consumableExt.SiteId == 0 && consumableExt.NetworkId == 0 && consumableExt.UnitId == 0 { + return nil, []error{&errortypes.FailedToRequestBids{ + Message: "SiteId, NetworkId and UnitId are all required for site requests", + }} } - } - - if request.Source != nil && request.Source.Ext != nil { - var extSChain openrtb_ext.ExtRequestPrebidSChain - if err := json.Unmarshal(request.Source.Ext, &extSChain); err != nil { - errs = append(errs, err) - } else { - body.SChain = extSChain.SChain + requests := []*adapters.RequestData{ + { + Method: "POST", + Uri: "https://e.serverbid.com/sb/rtb", + Body: bodyBytes, + Headers: headers, + }, } - } - - body.Coppa = request.Regs != nil && request.Regs.COPPA > 0 - - if request.Regs != nil && request.Regs.GPP != "" { - body.GPP = request.Regs.GPP - } - - if request.Regs != nil && request.Regs.GPPSID != nil { - body.GPPSID = request.Regs.GPPSID - } - - if request.Site != nil && request.Site.Content != nil { - body.Content = request.Site.Content - } else if request.App != nil && request.App.Content != nil { - body.Content = request.App.Content - } - - for i, impression := range request.Imp { - - _, consumableExt, err := extractExtensions(impression) + return requests, errs + } else { + _, consumableExt, err := extractExtensions(request.Imp[0]) if err != nil { return nil, err } - // These get set on the first one in observed working requests - if i == 0 { - body.NetworkId = consumableExt.NetworkId - body.SiteId = consumableExt.SiteId - body.UnitId = consumableExt.UnitId - body.UnitName = consumableExt.UnitName + if consumableExt.PlacementId == "" { + return nil, []error{&errortypes.FailedToRequestBids{ + Message: "PlacementId is required for non-site requests", + }} } - - body.Placements[i] = placement{ - DivName: impression.ID, - NetworkId: consumableExt.NetworkId, - SiteId: consumableExt.SiteId, - UnitId: consumableExt.UnitId, - UnitName: consumableExt.UnitName, - AdTypes: getSizeCodes(impression.Banner.Format), // was adTypes: bid.adTypes || getSize(bid.sizes) in prebid.js + requests := []*adapters.RequestData{ + { + Method: "POST", + Uri: "https://e.serverbid.com/rtb/bid?s=" + consumableExt.PlacementId, + Body: bodyBytes, + Headers: headers, + }, } + return requests, errs } - bodyBytes, err := json.Marshal(body) - if err != nil { - return nil, []error{err} - } - - requests := []*adapters.RequestData{ - { - Method: "POST", - Uri: "https://e.serverbid.com/api/v2", - Body: bodyBytes, - Headers: headers, - }, - } - - return requests, errs } - -/* -internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) -*/ -func (a *ConsumableAdapter) MakeBids( - internalRequest *openrtb2.BidRequest, - externalRequest *adapters.RequestData, - response *adapters.ResponseData, -) (*adapters.BidderResponse, []error) { - - if response.StatusCode == http.StatusNoContent { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil } - if response.StatusCode == http.StatusBadRequest { - return nil, []error{&errortypes.BadInput{ - Message: fmt.Sprintf("unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), - }} - } - - if response.StatusCode != http.StatusOK { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), - }} + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{err} } - var serverResponse bidResponse // response from Consumable - if err := json.Unmarshal(response.Body, &serverResponse); err != nil { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("error while decoding response, err: %s", err), - }} + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} } - bidderResponse := adapters.NewBidderResponse() + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur var errors []error + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errors = append(errors, err) + continue + } + var bidVideo *openrtb_ext.ExtBidPrebidVideo + if bidType == openrtb_ext.BidTypeVideo { + bidVideo = &openrtb_ext.ExtBidPrebidVideo{Duration: int(bid.Dur)} + } + switch bidType { + case openrtb_ext.BidTypeAudio: + seatBid.Bid[i].MType = openrtb2.MarkupAudio + break + case openrtb_ext.BidTypeVideo: + seatBid.Bid[i].MType = openrtb2.MarkupVideo + break + case openrtb_ext.BidTypeBanner: + seatBid.Bid[i].MType = openrtb2.MarkupBanner + break + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidType, + BidVideo: bidVideo, + }) + } + } + return bidResponse, nil +} - for impID, decision := range serverResponse.Decisions { +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + if bid.MType != 0 { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + case openrtb2.MarkupAudio: + return openrtb_ext.BidTypeAudio, nil + } + } - if decision.Pricing != nil && decision.Pricing.ClearPrice != nil { - bid := openrtb2.Bid{} - bid.ID = internalRequest.ID - bid.ImpID = impID - bid.Price = *decision.Pricing.ClearPrice - bid.AdM = retrieveAd(decision) - bid.W = int64(decision.Width) - bid.H = int64(decision.Height) - bid.CrID = strconv.FormatInt(decision.AdID, 10) - bid.Exp = 30 // TODO: Check this is intention of TTL - bid.ADomain = decision.Adomain - bid.Cat = decision.Cats - // not yet ported from prebid.js adapter - //bid.requestId = bidId; - //bid.currency = 'USD'; - //bid.netRevenue = true; - //bid.referrer = utils.getTopWindowUrl(); + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Failed to parse impression \"%s\" mediatype", bid.ImpID), + } +} - bidderResponse.Bids = append(bidderResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - // Consumable units are always HTML, never VAST. - // From Prebid's point of view, this means that Consumable units - // are always "banners". - BidType: openrtb_ext.BidTypeBanner, - }) - } +// Builder builds a new instance of the Consumable adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, } - return bidderResponse, errors + return bidder, nil } func extractExtensions(impression openrtb2.Imp) (*adapters.ExtImpBidder, *openrtb_ext.ExtImpConsumable, []error) { @@ -335,21 +160,3 @@ func extractExtensions(impression openrtb2.Imp) (*adapters.ExtImpBidder, *openrt return &bidderExt, &consumableExt, nil } - -// Builder builds a new instance of the Consumable adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { - bidder := &ConsumableAdapter{ - clock: realInstant{}, - endpoint: config.Endpoint, - } - return bidder, nil -} - -func hasEids(eids []openrtb2.EID) bool { - for i := 0; i < len(eids); i++ { - if len(eids[i].UIDs) > 0 && eids[i].UIDs[0].ID != "" { - return true - } - } - return false -} diff --git a/adapters/consumable/consumable/exemplary/app-audio.json b/adapters/consumable/consumable/exemplary/app-audio.json new file mode 100644 index 00000000000..589842c8876 --- /dev/null +++ b/adapters/consumable/consumable/exemplary/app-audio.json @@ -0,0 +1,113 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp3" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp3" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ + { + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "mtype": 3 + } + ] + } + ], + "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", + "mtype": 3 + }, + "type": "audio" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/consumable/consumable/exemplary/app-banner.json b/adapters/consumable/consumable/exemplary/app-banner.json new file mode 100644 index 00000000000..688ccb74c05 --- /dev/null +++ b/adapters/consumable/consumable/exemplary/app-banner.json @@ -0,0 +1,111 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "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, + "mtype": 1 + } + ] + } + ], + "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, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/consumable/consumable/exemplary/app-video.json b/adapters/consumable/consumable/exemplary/app-video.json new file mode 100644 index 00000000000..a3772933aba --- /dev/null +++ b/adapters/consumable/consumable/exemplary/app-video.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "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, + "cat": ["IAB15"], + "dur": 30, + "mtype": 2 + } + ] + } + ], + "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, + "cat": ["IAB15"], + "dur": 30, + "mtype": 2 + }, + "type": "video", + "BidType": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/consumable/consumable/exemplary/simple-banner.json b/adapters/consumable/consumable/exemplary/simple-banner.json index 173104ee9ad..2e401b88087 100644 --- a/adapters/consumable/consumable/exemplary/simple-banner.json +++ b/adapters/consumable/consumable/exemplary/simple-banner.json @@ -5,20 +5,32 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { "networkId": 11, "siteId": 32, - "unitId": 42 + "unitId": 42, + "unitName": "cnsmbl-audio-728x90-slider" } } } ], "device": { "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123" + "ip": "123.123.123.123", + "geo": { + "country": "USA", + "region": "IL", + "city": "Elgin", + "zip": "60123" + } }, "site": { "domain": "www.some.com", @@ -28,75 +40,68 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "geo": { + "country": "USA", + "region": "IL", + "city": "Elgin", + "zip": "60123" + } + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42, + "unitName": "cnsmbl-audio-728x90-slider" + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" - }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -107,14 +112,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/app-audio-bad-params.json b/adapters/consumable/consumable/supplemental/app-audio-bad-params.json new file mode 100644 index 00000000000..2dadc39c111 --- /dev/null +++ b/adapters/consumable/consumable/supplemental/app-audio-bad-params.json @@ -0,0 +1,37 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "PlacementId is required for non-site requests", + "comparison": "literal" + } + ] +} diff --git a/adapters/consumable/consumable/supplemental/app-banner-no-ad.json b/adapters/consumable/consumable/supplemental/app-banner-no-ad.json new file mode 100644 index 00000000000..c3d7238e104 --- /dev/null +++ b/adapters/consumable/consumable/supplemental/app-banner-no-ad.json @@ -0,0 +1,75 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": { + } + } + } + ], + "expectedBidResponses": [ + + ] +} \ No newline at end of file diff --git a/adapters/consumable/consumable/supplemental/app-video-no-media-type.json b/adapters/consumable/consumable/supplemental/app-video-no-media-type.json new file mode 100644 index 00000000000..3cba39bb5b5 --- /dev/null +++ b/adapters/consumable/consumable/supplemental/app-video-no-media-type.json @@ -0,0 +1,110 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "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, + "cat": ["IAB15"], + "dur": 30 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + + ] + } + ] +} \ No newline at end of file diff --git a/adapters/consumable/consumable/supplemental/bad-dsp-request-example.json b/adapters/consumable/consumable/supplemental/bad-dsp-request-example.json new file mode 100644 index 00000000000..c66bb9ab5de --- /dev/null +++ b/adapters/consumable/consumable/supplemental/bad-dsp-request-example.json @@ -0,0 +1,78 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": { + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/consumable/consumable/supplemental/dsp-server-internal-error-example.json b/adapters/consumable/consumable/supplemental/dsp-server-internal-error-example.json new file mode 100644 index 00000000000..07ad8e2358a --- /dev/null +++ b/adapters/consumable/consumable/supplemental/dsp-server-internal-error-example.json @@ -0,0 +1,78 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 500, + "body": { + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/consumable/consumable/supplemental/simple-banner-content-meta.json b/adapters/consumable/consumable/supplemental/simple-banner-content-meta.json index 56d24166fec..220c8ab2069 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-content-meta.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-content-meta.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{ "w": 728, "h": 250 }] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -36,71 +41,69 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": ["application/json"], - "Content-Type": ["application/json"], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": ["123.123.123.123"], - "Forwarded": ["for=123.123.123.123"], - "Origin": ["http://www.some.com"], - "Referer": ["http://www.some.com/page-where-ad-will-be-shown"] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "content": { - "id": "1009680902", - "title": "What You Know Bout Love", - "context": 3, - "url": "https://www.deezer.com/track/1009680902", - "artist": "Pop Smoke", - "album": "Shoot For The Stars Aim For The Moon" + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" }, - "placements": [ + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" - }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user": {}, - "enableBotFiltering": true, - "parallel": true + "site": { + "content": { + "album": "Shoot For The Stars Aim For The Moon", + "artist": "Pop Smoke", + "context": 3, + "id": "1009680902", + "title": "What You Know Bout Love", + "url": "https://www.deezer.com/track/1009680902" + }, + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents": [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -111,14 +114,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-coppa.json b/adapters/consumable/consumable/supplemental/simple-banner-coppa.json index d1551c92e7c..25b732a21ce 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-coppa.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-coppa.json @@ -31,76 +31,64 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "regs": { + "coppa": 1 }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "coppa": true + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -111,14 +99,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-eids.json b/adapters/consumable/consumable/supplemental/simple-banner-eids.json index 106796e21c0..d273117b1ae 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-eids.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-eids.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -26,103 +31,99 @@ }, "user": { "ext": { - "eids": [{ - "source": "adserver.org", - "uids": [{ - "id": "TTD_ID", - "atype": 1, - "ext": { - "rtiPartner": "TDID" - } - }] - }] + "eids": [ + { + "source": "adserver.org", + "uids": [ + { + "id": "TTD_ID", + "atype": 1, + "ext": { + "rtiPartner": "TDID" + } + } + ] + } + ] } } }, "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, "user": { - "eids": [{ - "source": "adserver.org", - "uids": [{ - "id": "TTD_ID", - "atype": 1, - "ext": { - "rtiPartner": "TDID" + "ext": { + "eids": [ + { + "source": "adserver.org", + "uids": [ + { + "atype": 1, + "ext": { + "rtiPartner": "TDID" + }, + "id": "TTD_ID" + } + ] } - }] - }] - }, - "enableBotFiltering": true, - "gdpr": {}, - "parallel": true + ] + } + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -133,14 +134,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-gdpr-2.json b/adapters/consumable/consumable/supplemental/simple-banner-gdpr-2.json index 2e2d8588326..b2dbc9bdfbf 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-gdpr-2.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-gdpr-2.json @@ -33,78 +33,66 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "regs": { + "ext": { + "gdpr": 0 + } }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "gdpr": { - "applies": false + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -115,14 +103,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-gdpr-3.json b/adapters/consumable/consumable/supplemental/simple-banner-gdpr-3.json index ea7be2342b2..fccc96ed6df 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-gdpr-3.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-gdpr-3.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -33,78 +38,66 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "gdpr": { - "consent": "abcdefghijklm" + "user": { + "ext": { + "consent": "abcdefghijklm" + } } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -115,14 +108,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-gdpr.json b/adapters/consumable/consumable/supplemental/simple-banner-gdpr.json index 3f6a953efa8..99105a77325 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-gdpr.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-gdpr.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -38,79 +43,71 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "regs": { + "ext": { + "gdpr": 1 + } + }, + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "gdpr": { - "applies": true, - "consent": "abcdefghijklm" + "user": { + "ext": { + "consent": "abcdefghijklm" + } } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -121,14 +118,15 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 + }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-gpp.json b/adapters/consumable/consumable/supplemental/simple-banner-gpp.json index 9b2e3d75031..eae291c1c61 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-gpp.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-gpp.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -26,83 +31,75 @@ }, "regs": { "gpp": "gppString", - "gpp_sid": [7] + "gpp_sid": [ + 7 + ] } }, "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "regs": { + "gpp": "gppString", + "gpp_sid": [ + 7 + ] }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "gpp": "gppString", - "gpp_sid": [7] + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -113,14 +110,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-meta.json b/adapters/consumable/consumable/supplemental/simple-banner-meta.json index 6c94c835aab..782ddc7bbe7 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-meta.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-meta.json @@ -28,77 +28,61 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" - }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } - ], - "adomain": ["consumabletv.com"], - "cats": ["IAB1", "IAB2"] + ] } - } + ], + "cur": "USD" } } } @@ -109,16 +93,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250, - "adomain": ["consumabletv.com"], - "cat": ["IAB1", "IAB2"] + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-no-impressionUrl.json b/adapters/consumable/consumable/supplemental/simple-banner-no-impressionUrl.json index 6e9787ee163..fddf160a548 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-no-impressionUrl.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-no-impressionUrl.json @@ -5,7 +5,12 @@ { "id": "test-no-impUrl-id", "banner": { - "format": [{"w": 300, "h": 250}] + "format": [ + { + "w": 300, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -30,104 +35,87 @@ "buyeruid": "azk-user-id" } }, - "httpCalls": [ { "expectedRequest": { - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "Cookie": [ - "azk=azk-user-id" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, - "uri": "https://e.serverbid.com/api/v2", + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [5], - "divName": "test-no-impUrl-id", - "networkId": 11, - "siteId": 32, - "unitId": 42, - "unitName": "the-answer" + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42, + "unitName": "the-answer" + } + }, + "id": "test-no-impUrl-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown", + "ref": "http://www.some.com/page-before-the-ad-if-any" }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "unitName": "the-answer", - "time": 1451651415, - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "referrer": "http://www.some.com/page-before-the-ad-if-any" + "user": { + "buyeruid": "azk-user-id" + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-no-impUrl-id": { - "adId": 1234567890, - "bidderName": "aol", - "pricing": { - "clearPrice": 0.5 - }, - "width": 300, - "height": 250, - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } ], - "expectedBidResponses": [ { "currency": "USD", "bids": [ { "bid": { - "id": "test-request-id", - "crid": "1234567890", - "impid": "test-no-impUrl-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "exp": 30, - "w": 300, - "h": 250 + "adm": "some-test-ad", + "crid": "crid_10", + "w": 728, + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-no-params.json b/adapters/consumable/consumable/supplemental/simple-banner-no-params.json new file mode 100644 index 00000000000..03d1ca9ce3e --- /dev/null +++ b/adapters/consumable/consumable/supplemental/simple-banner-no-params.json @@ -0,0 +1,43 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "geo": { + "country": "USA", + "region": "IL", + "city": "Elgin", + "zip": "60123" + } + }, + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "SiteId, NetworkId and UnitId are all required for site requests", + "comparison": "literal" + } + ] +} diff --git a/adapters/consumable/consumable/supplemental/simple-banner-schain.json b/adapters/consumable/consumable/supplemental/simple-banner-schain.json index 0b963a507e7..c3491e6d1e0 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-schain.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-schain.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -43,81 +48,76 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "schain": { - "complete": 1, - "nodes": [ - { - "asi": "indirectseller.com", - "hp": 1, - "sid": "00001" + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" + }, + "source": { + "ext": { + "schain": { + "complete": 1, + "nodes": [ + { + "asi": "indirectseller.com", + "hp": 1, + "sid": "00001" + } + ], + "ver": "1.0" } - ], - "ver": "1.0" + } } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -128,14 +128,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/simple-banner-us-privacy.json b/adapters/consumable/consumable/supplemental/simple-banner-us-privacy.json index c09200c4bd3..bf27672805c 100644 --- a/adapters/consumable/consumable/supplemental/simple-banner-us-privacy.json +++ b/adapters/consumable/consumable/supplemental/simple-banner-us-privacy.json @@ -5,7 +5,12 @@ { "id": "test-imp-id", "banner": { - "format": [{"w": 728, "h": 250}] + "format": [ + { + "w": 728, + "h": 250 + } + ] }, "ext": { "bidder": { @@ -33,76 +38,66 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://e.serverbid.com/api/v2", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Forwarded": [ - "for=123.123.123.123" - ], - "Origin": [ - "http://www.some.com" - ], - "Referer": [ - "http://www.some.com/page-where-ad-will-be-shown" - ] - }, + "uri": "https://e.serverbid.com/sb/rtb", "body": { - "placements": [ + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + }, + "id": "test-request-id", + "imp": [ { - "adTypes": [2730], - "divName": "test-imp-id", - "networkId": 11, - "siteId": 32, - "unitId": 42 + "banner": { + "format": [ + { + "h": 250, + "w": 728 + } + ] + }, + "ext": { + "bidder": { + "networkId": 11, + "siteId": 32, + "unitId": 42 + } + }, + "id": "test-imp-id" } ], - "schain": { - "complete": 0, - "nodes": null, - "ver": "" + "site": { + "domain": "www.some.com", + "page": "http://www.some.com/page-where-ad-will-be-shown" }, - "networkId": 11, - "siteId": 32, - "unitId": 42, - "time": 1451651415, - "url": "http://www.some.com/page-where-ad-will-be-shown", - "includePricingData": true, - "user":{}, - "enableBotFiltering": true, - "parallel": true, - "ccpa": "1NYN" + "regs": { + "ext": { + "us_privacy": "1NYN" + } + } } }, "mockResponse": { "status": 200, "body": { - "decisions": { - "test-imp-id": { - "adId": 1234567890, - "pricing": { - "clearPrice": 0.5 - }, - "width": 728, - "height": 250, - "impressionUrl": "http://localhost:8080/shown", - "contents" : [ + "id": "test-request-id", + "seatbid": [ + { + "seat": "bmtm", + "bid": [ { - "body": "Remember this: https://www.google.com/search?q=blink+tag ?" + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 90, + "w": 728, + "mtype": 1 } ] } - } + ], + "cur": "USD" } } } @@ -113,14 +108,14 @@ "bids": [ { "bid": { - "id": "test-request-id", + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", "impid": "test-imp-id", "price": 0.5, - "adm": "Remember this: https://www.google.com/search?q=blink+tag ?", - "crid": "1234567890", - "exp": 30, + "adm": "some-test-ad", + "crid": "crid_10", "w": 728, - "h": 250 + "h": 90, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/consumable/consumable/supplemental/unknown-status-code-example.json b/adapters/consumable/consumable/supplemental/unknown-status-code-example.json new file mode 100644 index 00000000000..58fafcff6b2 --- /dev/null +++ b/adapters/consumable/consumable/supplemental/unknown-status-code-example.json @@ -0,0 +1,78 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://e.serverbid.com/rtb/bid?s=0421008445828ceb46f496700a5fa65e", + "body": { + "id": "test-request-id", + "app": { + "id": "1", + "bundle": "com.foo.bar" + }, + "device": { + "ua": "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36", + "ip": "73.55.27.72" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "placementId": "0421008445828ceb46f496700a5fa65e" + } + } + } + ] + } + }, + "mockResponse": { + "status": 301, + "body": { + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 301. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/consumable/consumable_test.go b/adapters/consumable/consumable_test.go index e3bedce5e2f..75e69535f20 100644 --- a/adapters/consumable/consumable_test.go +++ b/adapters/consumable/consumable_test.go @@ -1,14 +1,14 @@ package consumable import ( - "testing" - "time" - + "encoding/json" + "github.com/prebid/openrtb/v19/adcom1" + "github.com/prebid/openrtb/v19/openrtb2" "github.com/prebid/prebid-server/v2/adapters" "github.com/prebid/prebid-server/v2/adapters/adapterstest" "github.com/prebid/prebid-server/v2/config" "github.com/prebid/prebid-server/v2/openrtb_ext" - "github.com/stretchr/testify/assert" + "testing" ) func TestJsonSamples(t *testing.T) { @@ -19,18 +19,75 @@ func TestJsonSamples(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - assertClock(t, bidder) - replaceClockWithKnownTime(bidder) - adapterstest.RunJSONBidderTest(t, "consumable", bidder) } -func assertClock(t *testing.T, bidder adapters.Bidder) { - bidderConsumable, _ := bidder.(*ConsumableAdapter) - assert.NotNil(t, bidderConsumable.clock) -} +func TestConsumableMakeBidsWithCategoryDuration(t *testing.T) { + bidder := &adapter{} + + mockedReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ + ID: "1_1", + Video: &openrtb2.Video{ + W: 640, + H: 360, + MIMEs: []string{"video/mp4"}, + MaxDuration: 60, + Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, + }, + Ext: json.RawMessage( + `{ + "prebid": {}, + "bidder": { + "placementId": "123456" + } + }`, + )}, + }, + } + mockedExtReq := &adapters.RequestData{} + mockedBidResponse := &openrtb2.BidResponse{ + ID: "test-1", + SeatBid: []openrtb2.SeatBid{{ + Seat: "Buyer", + Bid: []openrtb2.Bid{{ + ID: "1", + ImpID: "1_1", + Price: 1.23, + AdID: "123", + Cat: []string{"IAB18-1"}, + Dur: 30, + MType: openrtb2.MarkupVideo, + }}, + }}, + } + body, _ := json.Marshal(mockedBidResponse) + mockedRes := &adapters.ResponseData{ + StatusCode: 200, + Body: body, + } + + expectedBidCount := 1 + expectedBidType := openrtb_ext.BidTypeVideo + expectedBidDuration := 30 + expectedBidCategory := "IAB18-1" + expectedErrorCount := 0 -func replaceClockWithKnownTime(bidder adapters.Bidder) { - bidderConsumable, _ := bidder.(*ConsumableAdapter) - bidderConsumable.clock = knownInstant(time.Date(2016, 1, 1, 12, 30, 15, 0, time.UTC)) + bidResponse, errors := bidder.MakeBids(mockedReq, mockedExtReq, mockedRes) + + if len(bidResponse.Bids) != expectedBidCount { + t.Errorf("should have 1 bid, bids=%v", bidResponse.Bids) + } + if bidResponse.Bids[0].BidType != expectedBidType { + t.Errorf("bid type should be video, bidType=%s", bidResponse.Bids[0].BidType) + } + if bidResponse.Bids[0].BidVideo.Duration != expectedBidDuration { + t.Errorf("video duration should be set") + } + if bidResponse.Bids[0].Bid.Cat[0] != expectedBidCategory { + t.Errorf("bid category should be set") + } + if len(errors) != expectedErrorCount { + t.Errorf("should not have any errors, errors=%v", errors) + } } diff --git a/adapters/consumable/instant.go b/adapters/consumable/instant.go deleted file mode 100644 index a6162d44e22..00000000000 --- a/adapters/consumable/instant.go +++ /dev/null @@ -1,21 +0,0 @@ -package consumable - -import "time" - -type instant interface { - Now() time.Time -} - -// Send a real instance when you construct it in adapter_map.go -type realInstant struct{} - -func (realInstant) Now() time.Time { - return time.Now() -} - -// Use this for tests e.g. knownInstant(time.Date(y, m, ..., time.UTC)) -type knownInstant time.Time - -func (i knownInstant) Now() time.Time { - return time.Time(i) -} diff --git a/adapters/consumable/params_test.go b/adapters/consumable/params_test.go index fdb3edec41b..99a993e9752 100644 --- a/adapters/consumable/params_test.go +++ b/adapters/consumable/params_test.go @@ -43,6 +43,7 @@ var validParams = []string{ `{"networkId": 22, "siteId": 1, "unitId": 101, "unitName": "unit-1"}`, `{"networkId": 22, "siteId": 1, "unitId": 101, "unitName": "-unit-1"}`, // unitName can start with a dash `{"networkId": 22, "siteId": 1, "unitId": 101}`, // unitName can be omitted (although prebid.js doesn't allow that) + `{"placementId": "abcdjk232"}`, } var invalidParams = []string{ @@ -56,4 +57,5 @@ var invalidParams = []string{ `{"siteId": 1, "unitId": 101, "unitName": 11}`, // networkId must be present `{"networkId": 22, "unitId": 101, "unitName": 11}`, // siteId must be present `{"siteId": 1, "networkId": 22, "unitName": 11}`, // unitId must be present + `{"placementId": "---abjk;jkewj;k;jwejklfs}`, // placementId must be alphanumeric } diff --git a/adapters/consumable/retrieveAd.go b/adapters/consumable/retrieveAd.go deleted file mode 100644 index 7f69a1bbc23..00000000000 --- a/adapters/consumable/retrieveAd.go +++ /dev/null @@ -1,10 +0,0 @@ -package consumable - -func retrieveAd(decision decision) string { - - if decision.Contents != nil && len(decision.Contents) > 0 { - return decision.Contents[0].Body - } - - return "" -} diff --git a/openrtb_ext/imp_consumable.go b/openrtb_ext/imp_consumable.go index fe916b09972..8158b41d2cc 100644 --- a/openrtb_ext/imp_consumable.go +++ b/openrtb_ext/imp_consumable.go @@ -6,5 +6,6 @@ type ExtImpConsumable struct { SiteId int `json:"siteId,omitempty"` UnitId int `json:"unitId,omitempty"` /* UnitName gets used as a classname and in the URL when building the ad markup */ - UnitName string `json:"unitName,omitempty"` + UnitName string `json:"unitName,omitempty"` + PlacementId string `json:"placementid,omitempty"` } diff --git a/static/bidder-info/consumable.yaml b/static/bidder-info/consumable.yaml index cc290149be2..0f240e87942 100644 --- a/static/bidder-info/consumable.yaml +++ b/static/bidder-info/consumable.yaml @@ -2,10 +2,13 @@ endpoint: "https://e.serverbid.com/api/v2" maintainer: email: "prebid@consumable.com" gvlVendorID: 591 +endpointCompression: gzip capabilities: app: mediaTypes: - banner + - video + - audio site: mediaTypes: - banner diff --git a/static/bidder-params/consumable.json b/static/bidder-params/consumable.json index b1db53568b9..7709ab09d37 100644 --- a/static/bidder-params/consumable.json +++ b/static/bidder-params/consumable.json @@ -24,7 +24,15 @@ "type": "string", "description": "The unit name from Consumable (expected to be a valid CSS class name)", "pattern": "^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$" + }, + "placementId": { + "type": "string", + "description": "The placementID from Consumable, Required for non-site requests", + "pattern": "^[a-zA-Z0-9]+$" } }, - "required": ["siteId", "networkId","unitId"] + "oneOf": [ + {"required": ["siteId", "networkId","unitId"] }, + {"required": ["placementId"] } + ] }