diff --git a/adapters/cwire/cwire.go b/adapters/cwire/cwire.go index f0b3fc20887..99deac6b7c5 100644 --- a/adapters/cwire/cwire.go +++ b/adapters/cwire/cwire.go @@ -91,12 +91,28 @@ func (a *adapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.Request bidderResponse.Currency = resp.Cur for _, sb := range resp.SeatBid { for i := range sb.Bid { + bidType, err := getBidType(sb.Bid[i]) + if err != nil { + return nil, []error{err} + } bidderResponse.Bids = append(bidderResponse.Bids, &adapters.TypedBid{ Bid: &sb.Bid[i], - BidType: openrtb_ext.BidTypeBanner, + BidType: bidType, }) } } return bidderResponse, nil } + +func getBidType(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + // determinate media type by bid response field mtype + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + } + + return "", fmt.Errorf("could not define media type for C Wire impression: %s", bid.ImpID) +} diff --git a/adapters/cwire/cwiretest/exemplary/video.json b/adapters/cwire/cwiretest/exemplary/video.json new file mode 100644 index 00000000000..980522c0906 --- /dev/null +++ b/adapters/cwire/cwiretest/exemplary/video.json @@ -0,0 +1,152 @@ +{ + "mockBidRequest": { + "id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22", + "cur": [ + "CHF" + ], + "imp": [ + { + "id": "103", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "placementId": 15, + "domainId": 42 + } + } + } + ], + "site": { + "page": "http://www.foobar.com/1234.html" + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0" + }, + "user": { + "id": "55816b39711f9b5acf3b90e313ed29e51665623f", + "geo": { + "country": "ch", + "region": "basel-stadt", + "city": "basel" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://cwi.re/prebid/adapter-endpoint", + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22", + "cur": [ + "CHF" + ], + "imp": [ + { + "id": "103", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "placementId": 15, + "domainId": 42 + } + } + } + ], + "site": { + "page": "http://www.foobar.com/1234.html" + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0" + }, + "user": { + "id": "55816b39711f9b5acf3b90e313ed29e51665623f", + "geo": { + "country": "ch", + "region": "basel-stadt", + "city": "basel" + } + } + }, + "impIDs": [ + "103" + ] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "80ce30c53c16e6ede735f123ef6e32361bfc7b22", + "cur": "CHF", + "seatbid": [ + { + "seat": "cwire", + "group": 0, + "bid": [ + { + "id": "334", + "impid": "103", + "price": 8.00, + "crid": "9999", + "adm": "", + "w": 640, + "h": 480, + "nurl": "https://embed.cwi.re/delivery/prebid-server/win/334", + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "CHF", + "bids": [ + { + "bid": { + "id": "334", + "impid": "103", + "price": 8.00, + "crid": "9999", + "adm": "", + "w": 640, + "h": 480, + "nurl": "https://embed.cwi.re/delivery/prebid-server/win/334", + "mtype": 2 + }, + "type": "video" + } + ] + } + ] +} diff --git a/static/bidder-info/cwire.yaml b/static/bidder-info/cwire.yaml index b7a16e05c36..c8503cf2436 100644 --- a/static/bidder-info/cwire.yaml +++ b/static/bidder-info/cwire.yaml @@ -8,9 +8,13 @@ capabilities: app: mediaTypes: - banner + - video site: mediaTypes: - banner + - video +openrtb: + multiformat-supported: false userSync: iframe: url: https://prebid.cwi.re/v1/usersync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&rd={{.RedirectURL}}