diff --git a/adapters/synacormedia/params_test.go b/adapters/synacormedia/params_test.go index ffd891f4e84..a216818e382 100644 --- a/adapters/synacormedia/params_test.go +++ b/adapters/synacormedia/params_test.go @@ -40,9 +40,9 @@ func TestInvalidParams(t *testing.T) { } var validParams = []string{ - `{"seatId": "123"}`, + `{"seatId": "123", "tagId":"234"}`, } var invalidParams = []string{ - `{"seatId": 123}`, + `{"seatId": 123, "tagId":234}`, } diff --git a/adapters/synacormedia/synacormedia.go b/adapters/synacormedia/synacormedia.go index ccb2798f8cf..2d913f026b4 100644 --- a/adapters/synacormedia/synacormedia.go +++ b/adapters/synacormedia/synacormedia.go @@ -20,6 +20,7 @@ type SynacorMediaAdapter struct { type SyncEndpointTemplateParams struct { SeatId string + TagId string } type ReqExt struct { @@ -55,14 +56,23 @@ func (a *SynacorMediaAdapter) makeRequest(request *openrtb.BidRequest) (*adapter var firstExtImp *openrtb_ext.ExtImpSynacormedia = nil for _, imp := range request.Imp { - validImp, err := getExtImpObj(&imp) + validExtImpObj, err := getExtImpObj(&imp) // getExtImpObj returns {seatId:"", tagId:""} if err != nil { errs = append(errs, err) continue } + // if the bid request is missing seatId or TagId then ignore it + if validExtImpObj.SeatId == "" || validExtImpObj.TagId == "" { + errs = append(errs, &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Invalid Impression"), + }) + continue + } + // right here is where we need to take out the tagId and then add it to imp + imp.TagID = validExtImpObj.TagId validImps = append(validImps, imp) if firstExtImp == nil { - firstExtImp = validImp + firstExtImp = validExtImpObj } } @@ -72,11 +82,12 @@ func (a *SynacorMediaAdapter) makeRequest(request *openrtb.BidRequest) (*adapter var err error - if firstExtImp == nil || firstExtImp.SeatId == "" { + if firstExtImp == nil || firstExtImp.SeatId == "" || firstExtImp.TagId == "" { return nil, append(errs, &errortypes.BadServerResponse{ - Message: fmt.Sprintf("Impression missing seat id"), + Message: fmt.Sprintf("Invalid Impression"), }) } + // this is where the empty seatId is filled re = &ReqExt{SeatId: firstExtImp.SeatId} // create JSON Request Body diff --git a/adapters/synacormedia/synacormediatest/exemplary/simple-banner.json b/adapters/synacormedia/synacormediatest/exemplary/simple-banner.json index 013891b6fa8..944e6e549ab 100644 --- a/adapters/synacormedia/synacormediatest/exemplary/simple-banner.json +++ b/adapters/synacormedia/synacormediatest/exemplary/simple-banner.json @@ -14,7 +14,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -24,15 +25,16 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "banner": { "format": [ {"w":300,"h":250} @@ -40,7 +42,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/exemplary/simple-video.json b/adapters/synacormedia/synacormediatest/exemplary/simple-video.json index f12556105db..2cddd5220f9 100644 --- a/adapters/synacormedia/synacormediatest/exemplary/simple-video.json +++ b/adapters/synacormedia/synacormediatest/exemplary/simple-video.json @@ -10,7 +10,6 @@ "imp": [ { "id": "i3", - "tagid": "3020", "video": { "w": 300, "h": 250, @@ -21,8 +20,9 @@ }, "metric": [], "ext": { - "bidder":{ - "seatId":"1927" + "bidder": { + "seatId":"prebid", + "tagId": "demo1" } } } @@ -31,7 +31,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "1", "site": { @@ -40,12 +40,12 @@ "publisher": {} }, "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id": "i3", - "tagid": "3020", + "tagid": "demo1", "video": { "w": 300, "h": 250, @@ -56,7 +56,8 @@ }, "ext": { "bidder":{ - "seatId":"1927" + "seatId":"prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/params/banner.json b/adapters/synacormedia/synacormediatest/params/banner.json index d6f4e7e9641..bb55ddfc48c 100644 --- a/adapters/synacormedia/synacormediatest/params/banner.json +++ b/adapters/synacormedia/synacormediatest/params/banner.json @@ -1,3 +1,4 @@ { - "seatId": "123" + "seatId": "123", + "tagId": "234" } diff --git a/adapters/synacormedia/synacormediatest/params/video.json b/adapters/synacormedia/synacormediatest/params/video.json index d6f4e7e9641..bb55ddfc48c 100644 --- a/adapters/synacormedia/synacormediatest/params/video.json +++ b/adapters/synacormedia/synacormediatest/params/video.json @@ -1,3 +1,4 @@ { - "seatId": "123" + "seatId": "123", + "tagId": "234" } diff --git a/adapters/synacormedia/synacormediatest/supplemental/audio_response.json b/adapters/synacormedia/synacormediatest/supplemental/audio_response.json index 172a81efa85..752d610aa72 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/audio_response.json +++ b/adapters/synacormedia/synacormediatest/supplemental/audio_response.json @@ -9,7 +9,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -19,21 +20,23 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "audio": { "mimes": ["video/mp4"] }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/supplemental/bad_response.json b/adapters/synacormedia/synacormediatest/supplemental/bad_response.json index 0893598bd1d..8e8b9a4d944 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/bad_response.json +++ b/adapters/synacormedia/synacormediatest/supplemental/bad_response.json @@ -18,7 +18,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -28,15 +29,16 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "banner": { "format": [ {"w":300,"h":250}, @@ -45,7 +47,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/supplemental/bad_seat_id.json b/adapters/synacormedia/synacormediatest/supplemental/bad_seat_id.json index bb144f1c6db..00dd2c23707 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/bad_seat_id.json +++ b/adapters/synacormedia/synacormediatest/supplemental/bad_seat_id.json @@ -14,7 +14,8 @@ }, "ext": { "bidder": { - "seatId": 1927 + "seatId": 1927, + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/supplemental/missing_seat_id.json b/adapters/synacormedia/synacormediatest/supplemental/missing_seat_id.json index a085b6e64f9..b85b88e4189 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/missing_seat_id.json +++ b/adapters/synacormedia/synacormediatest/supplemental/missing_seat_id.json @@ -14,6 +14,7 @@ }, "ext": { "bidder": { + "tagId": "demo1" } } } @@ -22,7 +23,7 @@ "expectedMakeRequestsErrors": [ { - "value": "Impression missing seat id", + "value": "Invalid Impression", "comparison": "literal" } ] diff --git a/adapters/synacormedia/synacormediatest/supplemental/missing_tag_id.json b/adapters/synacormedia/synacormediatest/supplemental/missing_tag_id.json new file mode 100644 index 00000000000..2e1ef6ada65 --- /dev/null +++ b/adapters/synacormedia/synacormediatest/supplemental/missing_tag_id.json @@ -0,0 +1,30 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "seatId": "prebid" + } + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + { + "value": "Invalid Impression", + "comparison": "literal" + } + ] +} diff --git a/adapters/synacormedia/synacormediatest/supplemental/native_response.json b/adapters/synacormedia/synacormediatest/supplemental/native_response.json index 89742d6e0df..1428ac1ccd3 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/native_response.json +++ b/adapters/synacormedia/synacormediatest/supplemental/native_response.json @@ -9,7 +9,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -19,21 +20,23 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "native": { "request": "" }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/supplemental/one_bad_ext.json b/adapters/synacormedia/synacormediatest/supplemental/one_bad_ext.json new file mode 100644 index 00000000000..5749aadba98 --- /dev/null +++ b/adapters/synacormedia/synacormediatest/supplemental/one_bad_ext.json @@ -0,0 +1,136 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-bad", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "seatId": "", + "tagId": "" + } + } + }, + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "seatId": "prebid", + "tagId": "demo1" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", + "body": { + "id": "test-request-id", + "ext": { + "seatId": "prebid" + }, + "imp": [ + { + "id":"test-imp-id", + "tagid": "demo1", + "banner": { + "format": [ + {"w":300,"h":250} + ] + }, + "ext": { + "bidder": { + "seatId": "prebid", + "tagId": "demo1" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "1", + "seatbid": [ + { + "bid": [ + { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 2.69, + "adomain": [ + "psacentral.org" + ], + "cid": "mock-crid", + "crid": "mock-cid", + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "synacormedia" + } + ], + "ext": { + "responsetimemillis": { + "synacormedia": 339 + } + } + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adomain": [ + "psacentral.org" + ], + "cid": "mock-crid", + "crid": "mock-cid", + "ext": { + "prebid": { + "type": "banner" + } + }, + "id": "test-request-id", + "impid": "test-imp-id", + "price": 2.69 + }, + "type": "banner" + } + ] + } + ], + "expectedMakeRequestsErrors": [ + { + "value": "Invalid Impression", + "comparison": "literal" + } + ] +} diff --git a/adapters/synacormedia/synacormediatest/supplemental/status_204.json b/adapters/synacormedia/synacormediatest/supplemental/status_204.json index f53ff1ec918..76f97f9cdfa 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/status_204.json +++ b/adapters/synacormedia/synacormediatest/supplemental/status_204.json @@ -18,7 +18,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -28,15 +29,16 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "banner": { "format": [ {"w":300,"h":250}, @@ -45,7 +47,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/supplemental/status_400.json b/adapters/synacormedia/synacormediatest/supplemental/status_400.json index a0667658e1d..1bb2cf6fa45 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/status_400.json +++ b/adapters/synacormedia/synacormediatest/supplemental/status_400.json @@ -18,7 +18,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -28,15 +29,16 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "banner": { "format": [ {"w":300,"h":250}, @@ -45,7 +47,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/adapters/synacormedia/synacormediatest/supplemental/status_500.json b/adapters/synacormedia/synacormediatest/supplemental/status_500.json index 125829c2328..37ca398e59e 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/status_500.json +++ b/adapters/synacormedia/synacormediatest/supplemental/status_500.json @@ -18,7 +18,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } @@ -28,15 +29,16 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://1927.technoratimedia.com/openrtb/bids/1927", + "uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid", "body": { "id": "test-request-id", "ext": { - "seatId": "1927" + "seatId": "prebid" }, "imp": [ { "id":"test-imp-id", + "tagid": "demo1", "banner": { "format": [ {"w":300,"h":250}, @@ -45,7 +47,8 @@ }, "ext": { "bidder": { - "seatId": "1927" + "seatId": "prebid", + "tagId": "demo1" } } } diff --git a/openrtb_ext/imp_synacormedia.go b/openrtb_ext/imp_synacormedia.go index 1b044ceaa9c..af48c7dfd01 100644 --- a/openrtb_ext/imp_synacormedia.go +++ b/openrtb_ext/imp_synacormedia.go @@ -3,4 +3,5 @@ package openrtb_ext // ExtImpSynacormedia defines the contract for bidrequest.imp[i].ext.synacormedia type ExtImpSynacormedia struct { SeatId string `json:"seatId"` + TagId string `json:"tagId"` } diff --git a/static/bidder-params/synacormedia.json b/static/bidder-params/synacormedia.json index b2dff8faca1..8c74ada2e85 100644 --- a/static/bidder-params/synacormedia.json +++ b/static/bidder-params/synacormedia.json @@ -8,6 +8,10 @@ "seatId": { "type": "string", "description": "The seat id." + }, + "tagId": { + "type": "string", + "description": "The tag id." } },