diff --git a/adapters/adagio/adagio.go b/adapters/adagio/adagio.go new file mode 100644 index 00000000000..0da4d6ac9e4 --- /dev/null +++ b/adapters/adagio/adagio.go @@ -0,0 +1,139 @@ +package adagio + +import ( + "bytes" + "compress/gzip" + "encoding/json" + "fmt" + "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" + "net/http" +) + +// Builder builds a new instance of the Adagio adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +type adapter struct { + endpoint string +} + +type extBid struct { + Prebid *openrtb_ext.ExtBidPrebid +} + +// MakeRequests prepares the HTTP requests which should be made to fetch bids. +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + json, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + + if request.Device != nil { + if len(request.Device.IPv6) > 0 { + headers.Add("X-Forwarded-For", request.Device.IPv6) + } + if len(request.Device.IP) > 0 { + headers.Add("X-Forwarded-For", request.Device.IP) + } + } + + if request.Test == 0 { + // Gzip the body + // Note: Gzipping could be handled natively later: https://github.com/prebid/prebid-server/issues/1812 + var bodyBuf bytes.Buffer + gz := gzip.NewWriter(&bodyBuf) + if _, err = gz.Write(json); err == nil { + if err = gz.Close(); err == nil { + json = bodyBuf.Bytes() + headers.Add("Content-Encoding", "gzip") + // /!\ Go already sets the `Accept-Encoding: gzip` header. Never add it manually, or Go won't decompress the response. + //headers.Add("Accept-Encoding", "gzip") + } + } + } + + requestToBidder := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: json, + Headers: headers, + } + + return []*adapters.RequestData{requestToBidder}, nil +} + +const unexpectedStatusCodeFormat = "Unexpected status code: %d. Run with request.debug = 1 for more info" + +// MakeBids unpacks the server's response into Bids. +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, _ *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + switch response.StatusCode { + case http.StatusOK: + break + case http.StatusNoContent: + return nil, nil + case http.StatusServiceUnavailable: + fallthrough + case http.StatusBadRequest: + fallthrough + case http.StatusUnauthorized: + fallthrough + case http.StatusForbidden: + err := &errortypes.BadInput{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, response.StatusCode), + } + return nil, []error{err} + default: + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, response.StatusCode), + } + return nil, []error{err} + } + + var openRTBBidderResponse openrtb2.BidResponse + if err := json.Unmarshal(response.Body, &openRTBBidderResponse); err != nil { + return nil, []error{err} + } + + bidsCapacity := len(internalRequest.Imp) + errs := make([]error, 0, bidsCapacity) + bidderResponse := adapters.NewBidderResponseWithBidsCapacity(bidsCapacity) + var typedBid *adapters.TypedBid + for _, seatBid := range openRTBBidderResponse.SeatBid { + for _, bid := range seatBid.Bid { + activeBid := bid + + activeExt := &extBid{} + if err := json.Unmarshal(activeBid.Ext, activeExt); err != nil { + errs = append(errs, err) + } + + var bidType openrtb_ext.BidType + if activeExt.Prebid != nil && activeExt.Prebid.Type != "" { + bidType = activeExt.Prebid.Type + } else { + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Failed to find native/banner/video mediaType \"%s\" ", activeBid.ImpID), + } + errs = append(errs, err) + continue + } + + typedBid = &adapters.TypedBid{Bid: &activeBid, BidType: bidType} + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + } + } + + return bidderResponse, nil +} diff --git a/adapters/adagio/adagio_test.go b/adapters/adagio/adagio_test.go new file mode 100644 index 00000000000..d5e25c7836d --- /dev/null +++ b/adapters/adagio/adagio_test.go @@ -0,0 +1,75 @@ +package adagio + +import ( + "encoding/json" + "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/stretchr/testify/assert" + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +func buildFakeBidRequest() openrtb2.BidRequest { + imp1 := openrtb2.Imp{ + ID: "some-impression-id", + Banner: &openrtb2.Banner{}, + Ext: json.RawMessage(`{"bidder": {"organizationId": "1000", "site": "site-name", "placement": "ban_atf"}}`), + } + + fakeBidRequest := openrtb2.BidRequest{ + ID: "some-request-id", + Imp: []openrtb2.Imp{imp1}, + } + + return fakeBidRequest +} + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderAdagio, config.Adapter{ + Endpoint: "http://localhost/prebid_server"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "adagiotest", bidder) +} + +func TestMakeRequests_NoGzip(t *testing.T) { + fakeBidRequest := buildFakeBidRequest() + fakeBidRequest.Test = 1 // Do not use Gzip in Test Mode. + + bidder, buildErr := Builder(openrtb_ext.BidderAdagio, config.Adapter{ + Endpoint: "http://localhost/prebid_server"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + requestData, errs := bidder.MakeRequests(&fakeBidRequest, nil) + + assert.Nil(t, errs) + assert.Equal(t, 1, len(requestData)) + + body := &openrtb2.BidRequest{} + err := json.Unmarshal(requestData[0].Body, body) + assert.NoError(t, err, "Request body unmarshalling error should be nil") + assert.Equal(t, 1, len(body.Imp)) +} + +func TestMakeRequests_Gzip(t *testing.T) { + fakeBidRequest := buildFakeBidRequest() + + bidder, buildErr := Builder(openrtb_ext.BidderAdagio, config.Adapter{ + Endpoint: "http://localhost/prebid_server"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + requestData, errs := bidder.MakeRequests(&fakeBidRequest, nil) + assert.Empty(t, errs, "Got errors while making requests") + assert.Equal(t, []string{"gzip"}, requestData[0].Headers["Content-Encoding"]) +} diff --git a/adapters/adagio/adagiotest/exemplary/banner-web.json b/adapters/adagio/adagiotest/exemplary/banner-web.json new file mode 100644 index 00000000000..732b40d2c1d --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/banner-web.json @@ -0,0 +1,155 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/multi-format.json b/adapters/adagio/adagiotest/exemplary/multi-format.json new file mode 100644 index 00000000000..85e0be26131 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/multi-format.json @@ -0,0 +1,165 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "multi-format-id", + "banner": { + "w":320, + "h":50 + }, + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "multi-format-id", + "banner": { + "w":320, + "h":50 + }, + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "multi-format-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "multi-format-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/multi-imp.json b/adapters/adagio/adagiotest/exemplary/multi-imp.json new file mode 100644 index 00000000000..66af28ea559 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/multi-imp.json @@ -0,0 +1,222 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "banner-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + }, + { + "id": "video-impression-id", + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "banner-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + }, + { + "id": "video-impression-id", + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "banner-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + { + "id": "b4ae1b4e2fc24a4fb45540082e98e162", + "impid": "video-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 640, + "h": 480, + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "banner-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + }, + { + "bid": { + "id": "b4ae1b4e2fc24a4fb45540082e98e162", + "impid": "video-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 640, + "h": 480, + "ext": { + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/native-web.json b/adapters/adagio/adagiotest/exemplary/native-web.json new file mode 100644 index 00000000000..0085aaddc64 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/native-web.json @@ -0,0 +1,151 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "2607:fb90:f27:4512:d800:cb23:a603:e245" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "ext": { + "prebid": { + "type": "native" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "acuityads": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "ext": { + "prebid": { + "type": "native" + } + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/video-web.json b/adapters/adagio/adagiotest/exemplary/video-web.json new file mode 100644 index 00000000000..353420ee962 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/video-web.json @@ -0,0 +1,175 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video\/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video\/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "adagio": { + "outstream": { + "bvwUrl": "https://cool.io" + } + }, + "prebid": { + "type": "video" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "adagio": { + "outstream": { + "bvwUrl": "https://cool.io" + } + }, + "prebid": { + "type": "video" + } + } + }, + "type":"video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/params/race/banner.json b/adapters/adagio/adagiotest/params/race/banner.json new file mode 100644 index 00000000000..66694466d84 --- /dev/null +++ b/adapters/adagio/adagiotest/params/race/banner.json @@ -0,0 +1,5 @@ +{ + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" +} diff --git a/adapters/adagio/adagiotest/params/race/native.json b/adapters/adagio/adagiotest/params/race/native.json new file mode 100644 index 00000000000..4affd5b232c --- /dev/null +++ b/adapters/adagio/adagiotest/params/race/native.json @@ -0,0 +1,5 @@ +{ + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" +} diff --git a/adapters/adagio/adagiotest/params/race/video.json b/adapters/adagio/adagiotest/params/race/video.json new file mode 100644 index 00000000000..4affd5b232c --- /dev/null +++ b/adapters/adagio/adagiotest/params/race/video.json @@ -0,0 +1,5 @@ +{ + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" +} diff --git a/adapters/adagio/adagiotest/supplemental/response-miss-ext-bid-type.json b/adapters/adagio/adagiotest/supplemental/response-miss-ext-bid-type.json new file mode 100644 index 00000000000..7b1267f6d50 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/response-miss-ext-bid-type.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": {} + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [] + } + ] +} diff --git a/adapters/adagio/adagiotest/supplemental/status-204.json b/adapters/adagio/adagiotest/supplemental/status-204.json new file mode 100644 index 00000000000..4d604a01fb9 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-204.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/adagio/adagiotest/supplemental/status-400.json b/adapters/adagio/adagiotest/supplemental/status-400.json new file mode 100644 index 00000000000..093c5458c0a --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-400.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": "bad request" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-401.json b/adapters/adagio/adagiotest/supplemental/status-401.json new file mode 100644 index 00000000000..a33aca203d0 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-401.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 401, + "body": "unauthorized" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 401. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-403.json b/adapters/adagio/adagiotest/supplemental/status-403.json new file mode 100644 index 00000000000..59c5a9cbf6b --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-403.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 403, + "body": "forbidden" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 403. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-500.json b/adapters/adagio/adagiotest/supplemental/status-500.json new file mode 100644 index 00000000000..0077d7457f9 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-500.json @@ -0,0 +1,68 @@ +{ + "mockBidRequest": { + "test": 1, + "debug": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 500, + "body": "internal error" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-503.json b/adapters/adagio/adagiotest/supplemental/status-503.json new file mode 100644 index 00000000000..d2a52893de5 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-503.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 503, + "body": "Service unavailable" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 503. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/adagio/adagiotest/supplemental/status-504.json b/adapters/adagio/adagiotest/supplemental/status-504.json new file mode 100644 index 00000000000..1b779d5c83f --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-504.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 504, + "body": "gateway timeout" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 504. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/params_test.go b/adapters/adagio/params_test.go new file mode 100644 index 00000000000..ee8f702e451 --- /dev/null +++ b/adapters/adagio/params_test.go @@ -0,0 +1,57 @@ +package adagio + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +var validParams = []string{ + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf" }`, + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf", "_unknown": "ban_atf"}`, + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf", "features": {"a": "a", "b": "b"}}`, +} + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderAdagio, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Adagio params: %s", validParam) + } + } +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"adCode": "string", "seatCode": 5, "originalPublisherid": "string"}`, + `{ "organizationId": "", "site": "", "placement": "" }`, + `{ "organizationId": "", "site": "2", "placement": "3" }`, + `{ "organizationId": "1", "site": "", "placement": "3" }`, + `{ "organizationId": "1", "site": "2", "placement": "" }`, + `{ "organizationId": 1, "site": "2", "placement": "3" }`, + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf", "features": {"a": "a", "notastring": true}}`, +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderAdagio, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} diff --git a/adapters/adagio/usersync.go b/adapters/adagio/usersync.go new file mode 100644 index 00000000000..a7230feaada --- /dev/null +++ b/adapters/adagio/usersync.go @@ -0,0 +1,12 @@ +package adagio + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewAdagioSyncer(tmpl *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("adagio", tmpl, adapters.SyncTypeRedirect) +} diff --git a/adapters/adagio/usersync_test.go b/adapters/adagio/usersync_test.go new file mode 100644 index 00000000000..cd4195e16df --- /dev/null +++ b/adapters/adagio/usersync_test.go @@ -0,0 +1,34 @@ +package adagio + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestAdagioSyncer(t *testing.T) { + syncURL := "https://mp.4dex.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dadagio%26uid%3D%5BUID%5D" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewAdagioSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "0", + Consent: "ANDFJDS", + }, + CCPA: ccpa.Policy{ + Consent: "1-YY", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "https://mp.4dex.io/sync?gdpr=0&gdpr_consent=ANDFJDS&us_privacy=1-YY&redirect=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dadagio%26uid%3D%5BUID%5D", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index ec49950a17e..5008b0ce5c6 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -100,14 +100,17 @@ func preprocess(imp *openrtb2.Imp) error { } //don't use regexp due to possible performance reduce - if len(admixerExt.ZoneId) != 36 { + if len(admixerExt.ZoneId) < 32 || len(admixerExt.ZoneId) > 36 { return &errortypes.BadInput{ Message: "ZoneId must be UUID/GUID", } } imp.TagID = admixerExt.ZoneId - imp.BidFloor = admixerExt.CustomBidFloor + + if imp.BidFloor == 0 && admixerExt.CustomBidFloor > 0 { + imp.BidFloor = admixerExt.CustomBidFloor + } imp.Ext = nil diff --git a/adapters/admixer/admixertest/exemplary/optional-params.json b/adapters/admixer/admixertest/exemplary/optional-params.json index 8ef112bbdb5..b93aa9c8154 100644 --- a/adapters/admixer/admixertest/exemplary/optional-params.json +++ b/adapters/admixer/admixertest/exemplary/optional-params.json @@ -44,6 +44,76 @@ } } } + }, + { + "id": "test-imp-id", + "bidfloor": 0.5, + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "zone": "2eb6bd58-865c-47ce-af7f-a918108c3fd2", + "customParams": { + "foo": [ + "bar", + "baz" + ] + } + } + } + }, + { + "id": "test-imp-id", + "bidfloor": 0.5, + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "zone": "2eb6bd58-865c-47ce-af7f-a918108c3fd2", + "customParams": { + "foo": [ + "bar", + "baz" + ] + } + }, + "customFloor": 0.9 + } + }, + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "ext": { + "bidder": { + "customFloor": 0.9, + "zone": "2eb6bd58-865c-47ce-af7f-a918108c3fd2", + "customParams": { + "foo": [ + "bar", + "baz" + ] + } + } + } } ] }, @@ -92,6 +162,69 @@ ] } } + }, + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "tagid": "2eb6bd58-865c-47ce-af7f-a918108c3fd2", + "bidfloor": 0.5, + "ext": { + "customParams": { + "foo": [ + "bar", + "baz" + ] + } + } + }, + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "tagid": "2eb6bd58-865c-47ce-af7f-a918108c3fd2", + "bidfloor": 0.5, + "ext": { + "customParams": { + "foo": [ + "bar", + "baz" + ] + } + } + }, + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 728, + "h": 90 + } + ] + }, + "tagid": "2eb6bd58-865c-47ce-af7f-a918108c3fd2", + "bidfloor": 0.9, + "ext": { + "customParams": { + "foo": [ + "bar", + "baz" + ] + } + } } ] } diff --git a/adapters/admixer/params_test.go b/adapters/admixer/params_test.go index 71cccb6a3da..11f3feb0657 100644 --- a/adapters/admixer/params_test.go +++ b/adapters/admixer/params_test.go @@ -44,6 +44,8 @@ var validParams = []string{ `{"zone": "9FF668A2-4122-462E-AAF8-36EA3A54BA21", "customFloor": 0.1}`, `{"zone": "9FF668A2-4122-462E-AAF8-36EA3A54BA21", "customParams": {"foo": "bar"}}`, `{"zone": "9ff668a2-4122-462e-aaf8-36ea3a54ba21", "customFloor": 0.1, "customParams": {"foo": ["bar", "baz"]}}`, + `{"zone": "9FF668A24122462EAAF836EA3A54BA21"}`, + `{"zone": "9FF668A24122462EAAF836EA3A54BA212"}`, } var invalidParams = []string{ @@ -54,4 +56,6 @@ var invalidParams = []string{ `{"zone": "123", "customFloor": "0.1"}`, `{"zone": "9FF668A2-4122-462E-AAF8-36EA3A54BA21", "customFloor": -0.1}`, `{"zone": "9FF668A2-4122-462E-AAF8-36EA3A54BA21", "customParams": "foo: bar"}`, + `{"zone": "9FF668A24122462EAAF836EA3A54BA2"}`, + `{"zone": "9FF668A24122462EAAF836EA3A54BA2112336"}`, } diff --git a/adapters/axonix/axonix.go b/adapters/axonix/axonix.go index d3016235319..268b0e3ee2f 100644 --- a/adapters/axonix/axonix.go +++ b/adapters/axonix/axonix.go @@ -4,25 +4,39 @@ import ( "encoding/json" "fmt" "net/http" + "net/url" + "text/template" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" "github.com/prebid/prebid-server/openrtb_ext" ) type adapter struct { - URI string + EndpointTemplate template.Template } func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + endpoint, err := template.New("endpointTemplate").Parse(config.Endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + } bidder := &adapter{ - URI: config.Endpoint, + EndpointTemplate: *endpoint, } return bidder, nil } +func (a *adapter) getEndpoint(ext *openrtb_ext.ExtImpAxonix) (string, error) { + endpointParams := macros.EndpointTemplateParams{ + AccountID: url.PathEscape(ext.SupplyId), + } + return macros.ResolveMacros(a.EndpointTemplate, endpointParams) +} + func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors []error @@ -44,9 +58,10 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte return nil, errors } - thisURI := a.URI - if len(thisURI) == 0 { - thisURI = "https://openrtb-us-east-1.axonix.com/supply/prebid-server/" + axonixExt.SupplyId + endpoint, err := a.getEndpoint(&axonixExt) + if err != nil { + errors = append(errors, err) + return nil, errors } requestJSON, err := json.Marshal(request) @@ -60,7 +75,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte requestData := &adapters.RequestData{ Method: "POST", - Uri: thisURI, + Uri: endpoint, Body: requestJSON, Headers: headers, } diff --git a/adapters/axonix/axonix_test.go b/adapters/axonix/axonix_test.go index 6c4a3eb34d6..fcac320075f 100644 --- a/adapters/axonix/axonix_test.go +++ b/adapters/axonix/axonix_test.go @@ -1,6 +1,7 @@ package axonix import ( + "github.com/stretchr/testify/assert" "testing" "github.com/prebid/prebid-server/adapters/adapterstest" @@ -8,9 +9,10 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) -func TestJsonSamplesWithConfiguredURI(t *testing.T) { +func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderAxonix, config.Adapter{ - Endpoint: "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8"}) + Endpoint: "https://axonix.com/supply/prebid-server/{{.AccountID}}", + }) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) @@ -19,12 +21,8 @@ func TestJsonSamplesWithConfiguredURI(t *testing.T) { adapterstest.RunJSONBidderTest(t, "axonixtest", bidder) } -func TestJsonSamplesWithHardcodedURI(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAxonix, config.Adapter{}) +func TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderAxonix, config.Adapter{Endpoint: "{{Malformed}}"}) - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "axonixtest", bidder) + assert.Error(t, buildErr) } diff --git a/adapters/axonix/axonixtest/exemplary/banner-and-video.json b/adapters/axonix/axonixtest/exemplary/banner-and-video.json index 1755cd0ef22..04b640826dc 100644 --- a/adapters/axonix/axonixtest/exemplary/banner-and-video.json +++ b/adapters/axonix/axonixtest/exemplary/banner-and-video.json @@ -18,7 +18,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } }, @@ -32,7 +32,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -41,7 +41,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -61,7 +61,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } }, @@ -75,7 +75,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/exemplary/banner-video-native.json b/adapters/axonix/axonixtest/exemplary/banner-video-native.json index 3944eb358b9..5dd5775004a 100644 --- a/adapters/axonix/axonixtest/exemplary/banner-video-native.json +++ b/adapters/axonix/axonixtest/exemplary/banner-video-native.json @@ -18,7 +18,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } }, @@ -30,7 +30,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } }, @@ -44,7 +44,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -53,7 +53,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -73,7 +73,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } }, @@ -85,7 +85,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } }, @@ -99,7 +99,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/exemplary/simple-banner.json b/adapters/axonix/axonixtest/exemplary/simple-banner.json index 581e59b9b9e..40441a46425 100644 --- a/adapters/axonix/axonixtest/exemplary/simple-banner.json +++ b/adapters/axonix/axonixtest/exemplary/simple-banner.json @@ -18,7 +18,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -28,7 +28,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -48,7 +48,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/exemplary/simple-video.json b/adapters/axonix/axonixtest/exemplary/simple-video.json index c15d7876470..56964b13565 100644 --- a/adapters/axonix/axonixtest/exemplary/simple-video.json +++ b/adapters/axonix/axonixtest/exemplary/simple-video.json @@ -12,7 +12,7 @@ }, "ext":{ "bidder":{ - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -22,7 +22,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -36,7 +36,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/params/race/banner.json b/adapters/axonix/axonixtest/params/race/banner.json index 7217c9c394f..136be9b1517 100644 --- a/adapters/axonix/axonixtest/params/race/banner.json +++ b/adapters/axonix/axonixtest/params/race/banner.json @@ -1,3 +1,3 @@ { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } diff --git a/adapters/axonix/axonixtest/params/race/video.json b/adapters/axonix/axonixtest/params/race/video.json index 7217c9c394f..136be9b1517 100644 --- a/adapters/axonix/axonixtest/params/race/video.json +++ b/adapters/axonix/axonixtest/params/race/video.json @@ -1,3 +1,3 @@ { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } diff --git a/adapters/axonix/axonixtest/supplemental/bad-response-no-body.json b/adapters/axonix/axonixtest/supplemental/bad-response-no-body.json index f89f40f122d..a4704990ef6 100644 --- a/adapters/axonix/axonixtest/supplemental/bad-response-no-body.json +++ b/adapters/axonix/axonixtest/supplemental/bad-response-no-body.json @@ -12,7 +12,7 @@ }, "ext":{ "bidder":{ - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -22,7 +22,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -36,7 +36,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/supplemental/status-bad-request.json b/adapters/axonix/axonixtest/supplemental/status-bad-request.json index d64a855e348..7483da19834 100644 --- a/adapters/axonix/axonixtest/supplemental/status-bad-request.json +++ b/adapters/axonix/axonixtest/supplemental/status-bad-request.json @@ -12,7 +12,7 @@ }, "ext":{ "bidder":{ - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -22,7 +22,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -36,7 +36,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/supplemental/status-no-content.json b/adapters/axonix/axonixtest/supplemental/status-no-content.json index 96dd899c1fb..7d4cd79589d 100644 --- a/adapters/axonix/axonixtest/supplemental/status-no-content.json +++ b/adapters/axonix/axonixtest/supplemental/status-no-content.json @@ -12,7 +12,7 @@ }, "ext":{ "bidder":{ - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -22,7 +22,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -36,7 +36,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/supplemental/unexpected-status-code.json b/adapters/axonix/axonixtest/supplemental/unexpected-status-code.json index e7a7be7847e..fe0f7141bc8 100644 --- a/adapters/axonix/axonixtest/supplemental/unexpected-status-code.json +++ b/adapters/axonix/axonixtest/supplemental/unexpected-status-code.json @@ -12,7 +12,7 @@ }, "ext":{ "bidder":{ - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -22,7 +22,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -36,7 +36,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/supplemental/valid-extension.json b/adapters/axonix/axonixtest/supplemental/valid-extension.json index 372f24d4f76..c174d245bc8 100644 --- a/adapters/axonix/axonixtest/supplemental/valid-extension.json +++ b/adapters/axonix/axonixtest/supplemental/valid-extension.json @@ -12,7 +12,7 @@ }, "ext":{ "bidder":{ - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -22,7 +22,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "imp": [ @@ -36,7 +36,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/axonixtest/supplemental/valid-with-device.json b/adapters/axonix/axonixtest/supplemental/valid-with-device.json index 62f4ea06b5a..50d48410e8a 100644 --- a/adapters/axonix/axonixtest/supplemental/valid-with-device.json +++ b/adapters/axonix/axonixtest/supplemental/valid-with-device.json @@ -16,7 +16,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } @@ -25,7 +25,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://openrtb-us-east-1.axonix.com/supply/prebid-server/24cc9034-f861-47b8-a6a8-b7e0968c00b8", + "uri": "https://axonix.com/supply/prebid-server/supply-test", "body": { "id": "test-request-id", "device": { @@ -43,7 +43,7 @@ }, "ext": { "bidder": { - "supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8" + "supplyId": "supply-test" } } } diff --git a/adapters/axonix/params_test.go b/adapters/axonix/params_test.go index e9c0cc5b83e..22b17a862f0 100644 --- a/adapters/axonix/params_test.go +++ b/adapters/axonix/params_test.go @@ -40,7 +40,7 @@ func TestInvalidParams(t *testing.T) { } var validParams = []string{ - `{"supplyId": "24cc9034-f861-47b8-a6a8-b7e0968c00b8"}`, + `{"supplyId": "test-supply"}`, `{"supplyId": "test"}`, } diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go index a23472e8892..63baa8a4ba5 100644 --- a/adapters/inmobi/inmobi.go +++ b/adapters/inmobi/inmobi.go @@ -124,6 +124,9 @@ func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { if imp.Video != nil { mediaType = openrtb_ext.BidTypeVideo } + if imp.Native != nil { + mediaType = openrtb_ext.BidTypeNative + } break } } diff --git a/adapters/inmobi/inmobitest/exemplary/simple-app-native.json b/adapters/inmobi/inmobitest/exemplary/simple-app-native.json new file mode 100644 index 00000000000..3a5bfd38412 --- /dev/null +++ b/adapters/inmobi/inmobitest/exemplary/simple-app-native.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "app": { + "bundle": "com.example.app" + }, + "id": "req-id", + "device": { + "ifa": "9d8fe0a9-c0dd-4482-b16b-5709b00c608d", + "ip": "1.1.1.1", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + }, + "imp": [ + { + "ext": { + "bidder": { + "plc": "1618933962959" + } + }, + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "id": "imp-id" + } + ] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://api.w.inmobi.com/showad/openrtb/bidder/prebid", + "body": { + "app": { + "bundle": "com.example.app" + }, + "id": "req-id", + "device": { + "ifa": "9d8fe0a9-c0dd-4482-b16b-5709b00c608d", + "ip": "1.1.1.1", + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + }, + "imp": [ + { + "ext": { + "bidder": { + "plc": "1618933962959" + } + }, + "native": { + "request": "{\"ver\":\"1.2\",\"context\":2,\"contextsubtype\":20,\"plcmttype\":11,\"plcmtcnt\":1,\"aurlsupport\":1,\"durlsupport\":1,\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"len\":140}},{\"id\":128,\"required\":0,\"img\":{\"wmin\":836,\"hmin\":627,\"type\":3}}]}" + }, + "id": "imp-id" + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "req-id", + "seatbid": [ + { + "bid": [ + { + "ext": { + "prebid": { + "meta": { + "networkName": "inmobi" + } + } + }, + "nurl": "https://some.event.url/params", + "crid": "123456789", + "adomain": [], + "price": 2.0, + "id": "1234", + "adm": "native-json", + "impid": "imp-id" + } + ] + } + ] + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "1234", + "impid": "imp-id", + "price": 2.0, + "adm": "native-json", + "crid": "123456789", + "nurl": "https://some.event.url/params", + "ext": { + "prebid": { + "meta": { + "networkName": "inmobi" + } + } + } + }, + "type": "native" + }] + }] +} diff --git a/adapters/ix/params_test.go b/adapters/ix/params_test.go new file mode 100644 index 00000000000..9246a43a725 --- /dev/null +++ b/adapters/ix/params_test.go @@ -0,0 +1,59 @@ +package ix + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderIx, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected ix params: %s", validParam) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderIx, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"siteid":"1234"}`, + `{"siteID":"12345"}`, + `{"siteId":"123456"}`, + `{"siteid":"1234567", "size": [640,480]}`, +} + +var invalidParams = []string{ + `{"siteid":""}`, + `{"siteID":""}`, + `{"siteId":""}`, + `{"siteid":"1234", "siteID":"12345"}`, + `{"siteid":"1234", "siteId":"123456"}`, + `{"siteid":123}`, + `{"siteids":"123"}`, + `{"notaparam":"123"}`, + `{"siteid":"123", "size": [1,2,3]}`, + `null`, + `true`, + `0`, + `abc`, + `[]`, + `{}`, +} diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index c50efffc994..c84dd356a59 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -17,7 +17,7 @@ import ( "github.com/prebid/prebid-server/util/timeutil" ) -const clientVersion = "prebid_server_0.3" +const clientVersion = "prebid_server_0.4" type adMarkupType string @@ -160,24 +160,53 @@ func (adapter *adapter) makeIndividualRequests(request *openrtb2.BidRequest) ([] errors := make([]error, 0, len(imps)) for _, imp := range imps { - request.Imp = []openrtb2.Imp{imp} - if err := prepareIndividualRequest(request); err != nil { - errors = append(errors, err) - continue - } - - requestData, err := adapter.makeRequest(request) + impsByMediaType, err := splitImpressionsByMediaType(&imp) if err != nil { errors = append(errors, err) continue } - requests = append(requests, requestData) + for _, impByMediaType := range impsByMediaType { + request.Imp = []openrtb2.Imp{impByMediaType} + if err := prepareIndividualRequest(request); err != nil { + errors = append(errors, err) + continue + } + + requestData, err := adapter.makeRequest(request) + if err != nil { + errors = append(errors, err) + continue + } + + requests = append(requests, requestData) + } } return requests, errors } +func splitImpressionsByMediaType(imp *openrtb2.Imp) ([]openrtb2.Imp, error) { + if imp.Banner == nil && imp.Video == nil { + return nil, &errortypes.BadInput{Message: "Invalid MediaType. Smaato only supports Banner and Video."} + } + + imps := make([]openrtb2.Imp, 0, 2) + + if imp.Banner != nil { + impCopy := *imp + impCopy.Video = nil + imps = append(imps, impCopy) + } + + if imp.Video != nil { + imp.Banner = nil + imps = append(imps, *imp) + } + + return imps, nil +} + func (adapter *adapter) makePodRequests(request *openrtb2.BidRequest) ([]*adapters.RequestData, []error) { pods, orderedKeys, errors := groupImpressionsByPod(request.Imp) requests := make([]*adapters.RequestData, 0, len(pods)) @@ -436,7 +465,7 @@ func setImpForAdspace(imp *openrtb2.Imp) error { return nil } - return &errortypes.BadInput{Message: "Invalid MediaType. Smaato only supports Banner and Video."} + return nil } func setImpForAdBreak(imps []openrtb2.Imp) error { diff --git a/adapters/smaato/smaatotest/exemplary/multiple-impressions.json b/adapters/smaato/smaatotest/exemplary/multiple-impressions.json index e86fea8eb04..c30a9a6a39e 100644 --- a/adapters/smaato/smaatotest/exemplary/multiple-impressions.json +++ b/adapters/smaato/smaatotest/exemplary/multiple-impressions.json @@ -31,6 +31,7 @@ } ] }, + "bidfloor": 0.00123, "ext": { "bidder": { "publisherId": "1100042525", @@ -65,6 +66,7 @@ "rewarded": 0 } }, + "bidfloor": 0.00456, "ext": { "bidder": { "publisherId": "1100042526", @@ -114,6 +116,7 @@ { "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", "tagid": "130563103", + "bidfloor": 0.00123, "banner": { "h": 50, "w": 320, @@ -159,7 +162,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, @@ -208,6 +211,7 @@ { "id": "postbid_iframe", "tagid": "130563104", + "bidfloor": 0.00456, "video": { "w": 1024, "h": 768, @@ -264,7 +268,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/multiple-media-types.json b/adapters/smaato/smaatotest/exemplary/multiple-media-types.json new file mode 100644 index 00000000000..a7d97666778 --- /dev/null +++ b/adapters/smaato/smaatotest/exemplary/multiple-media-types.json @@ -0,0 +1,348 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "ext": { + "data": { + "keywords": "power tools", + "search": "drill", + "content": { + "userrating": 4 + } + } + } + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "video": { + "mimes": [ + "video/mp4", + "video/quicktime", + "video/3gpp", + "video/x-m4v" + ], + "minduration": 5, + "maxduration": 30, + "protocols": [ + 7 + ], + "w": 1024, + "h": 768, + "startdelay": 0, + "linearity": 1, + "skip": 1, + "skipmin": 5, + "api": [ + 7 + ], + "ext": { + "rewarded": 0 + } + }, + "bidfloor": 0.00123, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "bidfloor": 0.00123, + "banner": { + "h": 50, + "w": 320, + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "keywords": "power tools" + }, + "ext": { + "client": "prebid_server_0.4" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "bidfloor": 0.00123, + "video": { + "w": 1024, + "h": 768, + "ext": { + "rewarded": 0 + }, + "mimes": [ + "video/mp4", + "video/quicktime", + "video/3gpp", + "video/x-m4v" + ], + "minduration": 5, + "startdelay": 0, + "linearity": 1, + "maxduration": 30, + "skip": 1, + "protocols": [ + 7 + ], + "skipmin": 5, + "api": [ + 7 + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "keywords": "power tools" + }, + "ext": { + "client": "prebid_server_0.4" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://iurl", + "nurl": "https://nurl", + "price": 0.01, + "w": 1024, + "h": 768 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "
\"\"\"\"
", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50, + "exp": 300 + }, + "type": "banner" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://iurl", + "nurl": "https://nurl", + "price": 0.01, + "w": 1024, + "h": 768, + "exp": 300 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json index 2752fa6e6c7..cd29d93a34d 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json @@ -160,7 +160,7 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json index bc3a3c28c87..8ddc9a7273f 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json @@ -164,7 +164,7 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json index 7f81d39cd81..f0fe35ff206 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json @@ -129,7 +129,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner.json b/adapters/smaato/smaatotest/exemplary/simple-banner.json index f83e347a684..babce4f892d 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner.json @@ -31,6 +31,7 @@ } ] }, + "bidfloor": 0.00123, "ext": { "bidder": { "publisherId": "1100042525", @@ -80,6 +81,7 @@ { "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", "tagid": "130563103", + "bidfloor": 0.00123, "banner": { "h": 50, "w": 320, @@ -125,7 +127,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/video-app.json b/adapters/smaato/smaatotest/exemplary/video-app.json index 317003f52b3..fc94c2d43cb 100644 --- a/adapters/smaato/smaatotest/exemplary/video-app.json +++ b/adapters/smaato/smaatotest/exemplary/video-app.json @@ -165,7 +165,7 @@ "keywords": "keywords" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/video.json b/adapters/smaato/smaatotest/exemplary/video.json index 85699129180..205c02ad84c 100644 --- a/adapters/smaato/smaatotest/exemplary/video.json +++ b/adapters/smaato/smaatotest/exemplary/video.json @@ -29,6 +29,7 @@ "rewarded": 0 } }, + "bidfloor": 0.00123, "ext": { "bidder": { "publisherId": "1100042525", @@ -82,6 +83,7 @@ { "id": "postbid_iframe", "tagid": "130563103", + "bidfloor": 0.00123, "video": { "w": 1024, "h": 768, @@ -122,7 +124,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/adtype-header-response.json b/adapters/smaato/smaatotest/supplemental/adtype-header-response.json index 59302b6de59..14b966f9bdd 100644 --- a/adapters/smaato/smaatotest/supplemental/adtype-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/adtype-header-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/bad-adm-response.json b/adapters/smaato/smaatotest/supplemental/bad-adm-response.json index 885c077e624..efeba9ed6ae 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-adm-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-adm-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json b/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json index cfb23bbef85..b066dc1b6cb 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-adtype-header-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json b/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json index 8e41524493d..065b639509e 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-expires-header-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json b/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json index a087594325e..bfe3dbe2a2d 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-status-code-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json b/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json index 9e57c380d27..1d59e96d634 100644 --- a/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json +++ b/adapters/smaato/smaatotest/supplemental/banner-w-and-h.json @@ -107,7 +107,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/expires-header-response.json b/adapters/smaato/smaatotest/supplemental/expires-header-response.json index 90a78e626cf..be057419177 100644 --- a/adapters/smaato/smaatotest/supplemental/expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/expires-header-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/no-bid-response.json b/adapters/smaato/smaatotest/supplemental/no-bid-response.json index c8821d2d944..4f674f2a34d 100644 --- a/adapters/smaato/smaatotest/supplemental/no-bid-response.json +++ b/adapters/smaato/smaatotest/supplemental/no-bid-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json b/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json index 72f8a2e3b9d..b33fea6e7e1 100644 --- a/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json +++ b/adapters/smaato/smaatotest/supplemental/no-consent-info-request.json @@ -72,7 +72,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json b/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json index c65e0824338..abab70facbd 100644 --- a/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json +++ b/adapters/smaato/smaatotest/supplemental/outdated-expires-header-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/video/multiple-adpods.json b/adapters/smaato/smaatotest/video/multiple-adpods.json index c909dc15f25..e5023d87b28 100644 --- a/adapters/smaato/smaatotest/video/multiple-adpods.json +++ b/adapters/smaato/smaatotest/video/multiple-adpods.json @@ -234,7 +234,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, @@ -386,7 +386,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/video/single-adpod.json b/adapters/smaato/smaatotest/video/single-adpod.json index b5bc09d495c..a5f0c0590f5 100644 --- a/adapters/smaato/smaatotest/video/single-adpod.json +++ b/adapters/smaato/smaatotest/video/single-adpod.json @@ -24,6 +24,7 @@ 7 ] }, + "bidfloor": 0.00123, "ext": { "bidder": { "publisherId": "1100042525", @@ -53,6 +54,7 @@ 7 ] }, + "bidfloor": 0.00123, "ext": { "bidder": { "publisherId": "1100042525", @@ -101,6 +103,7 @@ { "id": "1_1", "tagid": "400000001", + "bidfloor": 0.00123, "video": { "w": 1024, "h": 768, @@ -129,6 +132,7 @@ { "id": "1_2", "tagid": "400000001", + "bidfloor": 0.00123, "video": { "w": 1024, "h": 768, @@ -176,7 +180,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json b/adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json index b13906ce066..08803d1894e 100644 --- a/adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json +++ b/adapters/smaato/smaatotest/videosupplemental/bad-adm-response.json @@ -176,7 +176,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json b/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json index 2e0556ff15e..75e288362c0 100644 --- a/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json +++ b/adapters/smaato/smaatotest/videosupplemental/bad-bid-ext-response.json @@ -176,7 +176,7 @@ } }, "ext": { - "client": "prebid_server_0.3" + "client": "prebid_server_0.4" } } }, diff --git a/adapters/tappx/params_test.go b/adapters/tappx/params_test.go index 3a73d4dab53..9457924875f 100644 --- a/adapters/tappx/params_test.go +++ b/adapters/tappx/params_test.go @@ -35,6 +35,11 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com"}`, `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5}`, + `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "mktag":"txmk-xxxxx-xxx-xxxx"}`, + `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcid":["123"]}`, + `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcrid":["245"]}`, + `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcrid":["245", "321"]}`, + `{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcid":["123", "654"], "bcrid":["245", "321"]}`, } var invalidParams = []string{ @@ -60,4 +65,14 @@ var invalidParams = []string{ `{"tappxkey": 1, "endpoint":"ZZ1INTERNALTEST149147915", "host":""}`, `{"tappxkey":"pub-12345-android-9876", "endpoint": 1, "host":""}`, `{"tappxkey": 1, "endpoint": 1, "host": 123}`, + `{"tappxkey": "1", "endpoint": 1}`, + `{"tappxkey": "1", "endpoint": "ZZ1INTERNALTEST149147915", "host":[]]}`, + `{"tappxkey": "1", "endpoint": 1, "host":"host"}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "mktag":1}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "mktag":[1,2]}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":""}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":"123", bcrid: ["123"]}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":["123"], bcrid: 123}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":["123"], bcrid: [123]}`, + `{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":[123], bcrid: ["123"]}`, } diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index 5970ccb6cfe..5f0710cf08a 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -18,13 +18,24 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) -const TAPPX_BIDDER_VERSION = "1.2" +const TAPPX_BIDDER_VERSION = "1.3" const TYPE_CNN = "prebid" type TappxAdapter struct { endpointTemplate template.Template } +type Bidder struct { + Tappxkey string `json:"tappxkey"` + Mktag string `json:"mktag,omitempty"` + Bcid []string `json:"bcid,omitempty"` + Bcrid []string `json:"bcrid,omitempty"` +} + +type Ext struct { + Bidder `json:"bidder"` +} + // Builder builds a new instance of the Tappx adapter for the given bidder with the given config. func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { template, err := template.New("endpointTemplate").Parse(config.Endpoint) @@ -51,7 +62,6 @@ func (a *TappxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapt Message: "Error parsing bidderExt object", }} } - var tappxExt openrtb_ext.ExtImpTappx if err := json.Unmarshal(bidderExt.Bidder, &tappxExt); err != nil { return nil, []error{&errortypes.BadInput{ @@ -59,6 +69,23 @@ func (a *TappxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapt }} } + ext := Ext{ + Bidder: Bidder{ + Tappxkey: tappxExt.TappxKey, + Mktag: tappxExt.Mktag, + Bcid: tappxExt.Bcid, + Bcrid: tappxExt.Bcrid, + }, + } + + if jsonext, err := json.Marshal(ext); err == nil { + request.Ext = jsonext + } else { + return nil, []error{&errortypes.FailedToRequestBids{ + Message: "Error marshaling tappxExt parameters", + }} + } + var test int test = int(request.Test) diff --git a/adapters/tappx/tappx_test.go b/adapters/tappx/tappx_test.go index 10e57d12132..ea7011a7bdc 100644 --- a/adapters/tappx/tappx_test.go +++ b/adapters/tappx/tappx_test.go @@ -47,7 +47,7 @@ func TestTsValue(t *testing.T) { url, err := bidderTappx.buildEndpointURL(&tappxExt, test) - match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.2`, url) + match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.3`, url) if err != nil { t.Errorf("Error while running regex validation: %s", err.Error()) return diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-impression-extra.json b/adapters/tappx/tappxtest/exemplary/single-banner-impression-extra.json new file mode 100644 index 00000000000..a6ddf2848e2 --- /dev/null +++ b/adapters/tappx/tappxtest/exemplary/single-banner-impression-extra.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "adunit-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876", + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/", + "mktag": "mktag-12345-android-9876", + "bcid": ["1","2","3"], + "bcrid": ["4","5","6"] + } + } + } + ], + "app": { + "id": "app_001", + "bundle": "com.rovio.angrybirds", + "publisher": { + "id": "2" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", + "body": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "adunit-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876", + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/", + "mktag": "mktag-12345-android-9876", + "bcid": ["1","2","3"], + "bcrid": ["4","5","6"] + } + } + } + ], + "app": { + "bundle": "com.rovio.angrybirds", + "id": "app_001", + "publisher": { + "id": "2" + } + }, + "user": { + "buyeruid": "A-38327932832" + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876", + "mktag": "mktag-12345-android-9876", + "bcid": ["1","2","3"], + "bcrid": ["4","5","6"] + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "75472df2-1cb3-4f8e-9a28-10cb95fe05a4", + "seatbid": [{ + "bid": [{ + "id": "wehM-93KGr0_0_0", + "impid": "adunit-1", + "price": 0.5, + "cid": "3706", + "crid": "19005", + "adid": "19005", + "adm": "", + "cat": ["IAB2"], + "adomain": ["test.com"], + "h": 250, + "w": 300 + }] + }], + "bidid": "wehM-93KGr0" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "wehM-93KGr0_0_0", + "impid": "adunit-1", + "price": 0.5, + "adm": "", + "adid": "19005", + "adomain": ["test.com"], + "cid": "3706", + "crid": "19005", + "w": 300, + "h": 250, + "cat": ["IAB2"] + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json b/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json index 3c3037afefb..259d51cb34f 100644 --- a/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json +++ b/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json @@ -33,7 +33,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://ZZ123456PS.ssp.tappx.com/rtb/?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://ZZ123456PS.ssp.tappx.com/rtb/?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -48,7 +48,7 @@ "bidder": { "tappxkey": "pub-12345-android-9876", "endpoint": "ZZ123456PS", - "host": "ZZ123456PS.ssp.tappx.com/rtb/" + "host": "ZZ123456PS.ssp.tappx.com/rtb/" } } } @@ -62,6 +62,11 @@ }, "user": { "buyeruid": "A-38327932832" + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-impression.json b/adapters/tappx/tappxtest/exemplary/single-banner-impression.json index 54f472d9fff..532e2b1f4a1 100644 --- a/adapters/tappx/tappxtest/exemplary/single-banner-impression.json +++ b/adapters/tappx/tappxtest/exemplary/single-banner-impression.json @@ -33,7 +33,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -62,6 +62,11 @@ }, "user": { "buyeruid": "A-38327932832" + }, + "ext":{ + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-site.json b/adapters/tappx/tappxtest/exemplary/single-banner-site.json index 58490233ede..e8858bd6ea6 100644 --- a/adapters/tappx/tappxtest/exemplary/single-banner-site.json +++ b/adapters/tappx/tappxtest/exemplary/single-banner-site.json @@ -37,7 +37,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -70,6 +70,11 @@ }, "user": { "buyeruid": "A-38327932832" + }, + "ext":{ + "bidder": { + "tappxkey": "pub-12345-site-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/exemplary/single-video-impression.json b/adapters/tappx/tappxtest/exemplary/single-video-impression.json index d6ce0554c5f..23e079258e7 100644 --- a/adapters/tappx/tappxtest/exemplary/single-video-impression.json +++ b/adapters/tappx/tappxtest/exemplary/single-video-impression.json @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -67,6 +67,11 @@ }, "user": { "buyeruid": "A-38327932832" + }, + "ext":{ + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/exemplary/single-video-site.json b/adapters/tappx/tappxtest/exemplary/single-video-site.json index f151151e776..85872b6a29e 100644 --- a/adapters/tappx/tappxtest/exemplary/single-video-site.json +++ b/adapters/tappx/tappxtest/exemplary/single-video-site.json @@ -39,7 +39,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -75,6 +75,11 @@ }, "user": { "buyeruid": "A-38327932832" + }, + "ext":{ + "bidder": { + "tappxkey": "pub-12345-site-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/supplemental/204status.json b/adapters/tappx/tappxtest/supplemental/204status.json index 1c72cc90f24..918b278e6dc 100644 --- a/adapters/tappx/tappxtest/supplemental/204status.json +++ b/adapters/tappx/tappxtest/supplemental/204status.json @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -56,6 +56,11 @@ "publisher": { "id": "2" } + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/supplemental/bidfloor.json b/adapters/tappx/tappxtest/supplemental/bidfloor.json index 093f77adfc6..3d3ced65e25 100644 --- a/adapters/tappx/tappxtest/supplemental/bidfloor.json +++ b/adapters/tappx/tappxtest/supplemental/bidfloor.json @@ -34,7 +34,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -65,6 +65,11 @@ }, "user": { "buyeruid": "A-38327932832" + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/supplemental/http-err-status.json b/adapters/tappx/tappxtest/supplemental/http-err-status.json index a80a5eaa675..f1783b3f77a 100644 --- a/adapters/tappx/tappxtest/supplemental/http-err-status.json +++ b/adapters/tappx/tappxtest/supplemental/http-err-status.json @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -56,6 +56,11 @@ "publisher": { "id": "2" } + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/adapters/tappx/tappxtest/supplemental/http-err-status2.json b/adapters/tappx/tappxtest/supplemental/http-err-status2.json index 41dcc26d653..4b855c57404 100644 --- a/adapters/tappx/tappxtest/supplemental/http-err-status2.json +++ b/adapters/tappx/tappxtest/supplemental/http-err-status2.json @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3", "body": { "id": "0000000000001", "test": 1, @@ -56,6 +56,11 @@ "publisher": { "id": "2" } + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876" + } } } }, diff --git a/config/config.go b/config/config.go index 4ecf24eba27..c5a420635d7 100644 --- a/config/config.go +++ b/config/config.go @@ -602,6 +602,7 @@ func (cfg *Configuration) setDerivedDefaults() { externalURL := cfg.ExternalURL setDefaultUsersync(cfg.Adapters, openrtb_ext.Bidder33Across, "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAcuityAds, "https://cs.admanmedia.com/sync/prebid?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dacuityads%26uid%3D%5BUID%5D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdagio, "https://mp.4dex.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadagio%26uid%3D%7B%7BUID%7D%7D%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26us_privacy%3D{{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdf, "https://cm.adform.net/cookie?redirect_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadf%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdform, "https://cm.adform.net/cookie?redirect_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadform%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") // openrtb_ext.BidderAdgeneration doesn't have a good default. @@ -850,6 +851,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.33across.endpoint", "https://ssc.33across.com/api/v1/s2s") v.SetDefault("adapters.33across.partner_id", "") v.SetDefault("adapters.acuityads.endpoint", "http://{{.Host}}.admanmedia.com/bid?token={{.AccountID}}") + v.SetDefault("adapters.adagio.endpoint", "https://mp.4dex.io/ortb2") v.SetDefault("adapters.adf.endpoint", "https://adx.adform.net/adx/openrtb") v.SetDefault("adapters.adform.endpoint", "https://adx.adform.net/adx") v.SetDefault("adapters.adgeneration.endpoint", "https://d.socdm.com/adsv/v1") @@ -877,7 +879,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.audiencenetwork.disabled", true) v.SetDefault("adapters.audiencenetwork.endpoint", "https://an.facebook.com/placementbid.ortb") v.SetDefault("adapters.avocet.disabled", true) - v.SetDefault("adapters.axonix.disabled", true) + v.SetDefault("adapters.axonix.endpoint", "https://openrtb-us-east-1.axonix.com/supply/prebid-server/{{.AccountID}}") v.SetDefault("adapters.beachfront.endpoint", "https://display.bfmio.com/prebid_display") v.SetDefault("adapters.beachfront.extra_info", "{\"video_endpoint\":\"https://reachms.bfmio.com/bid.json?exchange_id\"}") v.SetDefault("adapters.beintoo.endpoint", "https://ib.beintoo.com/um") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 02b8ac834ec..54b68441d53 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -4,6 +4,7 @@ import ( "github.com/prebid/prebid-server/adapters" ttx "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/acuityads" + "github.com/prebid/prebid-server/adapters/adagio" "github.com/prebid/prebid-server/adapters/adf" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adgeneration" @@ -130,6 +131,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { return map[openrtb_ext.BidderName]adapters.Builder{ openrtb_ext.Bidder33Across: ttx.Builder, openrtb_ext.BidderAcuityAds: acuityads.Builder, + openrtb_ext.BidderAdagio: adagio.Builder, openrtb_ext.BidderAdf: adf.Builder, openrtb_ext.BidderAdform: adform.Builder, openrtb_ext.BidderAdgeneration: adgeneration.Builder, diff --git a/go.mod b/go.mod index 7d10a5c9bca..6193e08c47c 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/blang/semver v3.5.1+incompatible - github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44 + github.com/buger/jsonparser v1.1.1 github.com/cespare/xxhash v1.0.0 // indirect github.com/chasex/glog v0.0.0-20160217080310-c62392af379c github.com/coocood/freecache v1.0.1 diff --git a/go.sum b/go.sum index df2bfb9b459..a4cab742c34 100644 --- a/go.sum +++ b/go.sum @@ -15,6 +15,8 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44 h1:y853v6rXx+zefEcjET3JuKAqvhj+FKflQijjeaSv2iA= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/cespare/xxhash v1.0.0 h1:naDmySfoNg0nKS62/ujM6e71ZgM2AoVdaqGwMG0w18A= github.com/cespare/xxhash v1.0.0/go.mod h1:fX/lfQBkSCDXZSUgv6jVIu/EVA3/JNseAX5asI4c4T4= github.com/chasex/glog v0.0.0-20160217080310-c62392af379c h1:eXqCBUHfmjbeDqcuvzjsd+bM6A+bnwo5N9FVbV6m5/s= diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index a107c65b9c8..7f61996c648 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -75,6 +75,7 @@ func IsBidderNameReserved(name string) bool { const ( Bidder33Across BidderName = "33across" BidderAcuityAds BidderName = "acuityads" + BidderAdagio BidderName = "adagio" BidderAdf BidderName = "adf" BidderAdform BidderName = "adform" BidderAdgeneration BidderName = "adgeneration" @@ -201,6 +202,7 @@ func CoreBidderNames() []BidderName { return []BidderName{ Bidder33Across, BidderAcuityAds, + BidderAdagio, BidderAdf, BidderAdform, BidderAdgeneration, diff --git a/openrtb_ext/imp_tappx.go b/openrtb_ext/imp_tappx.go index c1ca77bf632..ca8693abd9f 100644 --- a/openrtb_ext/imp_tappx.go +++ b/openrtb_ext/imp_tappx.go @@ -1,8 +1,11 @@ package openrtb_ext type ExtImpTappx struct { - Host string `json:"host"` - TappxKey string `json:"tappxkey"` - Endpoint string `json:"endpoint"` - BidFloor float64 `json:"bidfloor,omitempty"` + Host string `json:"host"` + TappxKey string `json:"tappxkey"` + Endpoint string `json:"endpoint"` + BidFloor float64 `json:"bidfloor,omitempty"` + Mktag string `json:"mktag,omitempty"` + Bcid []string `json:"bcid,omitempty"` + Bcrid []string `json:"bcrid,omitempty"` } diff --git a/static/bidder-info/adagio.yaml b/static/bidder-info/adagio.yaml new file mode 100644 index 00000000000..3661191b3a1 --- /dev/null +++ b/static/bidder-info/adagio.yaml @@ -0,0 +1,12 @@ +maintainer: + email: "dev@adagio.io" +gvlVendorID: 617 +modifyingVastXmlAllowed: false +debug: + allow: true +capabilities: + site: + mediaTypes: + - banner + - video + - native \ No newline at end of file diff --git a/static/bidder-info/inmobi.yaml b/static/bidder-info/inmobi.yaml index 634c03481de..d62a2c9239d 100644 --- a/static/bidder-info/inmobi.yaml +++ b/static/bidder-info/inmobi.yaml @@ -6,6 +6,7 @@ capabilities: mediaTypes: - banner - video + - native site: mediaTypes: - banner diff --git a/static/bidder-params/adagio.json b/static/bidder-params/adagio.json new file mode 100644 index 00000000000..955c58c73ec --- /dev/null +++ b/static/bidder-params/adagio.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Adagio Adapter Params", + "description": "A schema which validates params accepted by the Adagio adapter", + "type": "object", + "required": [ + "organizationId", + "site", + "placement" + ], + "properties": { + "organizationId": { + "type": "string", + "description": "Name to identify the organization", + "minLength": 1 + }, + "site": { + "type": "string", + "description": "Name to identify the site", + "minLength": 1 + }, + "placement": { + "type": "string", + "description": "Name to identify the placement", + "minLength": 1 + }, + "pageviewId": { + "type": "string", + "description": "Name to identify the pageview" + }, + "pagetype": { + "type": "string", + "description": "Name to identify the page type" + }, + "category": { + "type": "string", + "description": "Name to identify the category" + }, + "subcategory": { + "type": "string", + "description": "Name to identify the subcategory" + }, + "environment": { + "type": "string", + "description": "Name to identify the environment" + }, + "features": { + "type": "object", + "patternProperties": { + "^[a-zA-Z_]": { "type": "string" } + } + }, + "prebidVersion:": { + "type": "string", + "description": "Name to identify the version of Prebid.js" + }, + "debug": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "cpm": { + "type": "number" + }, + "lazyLoad": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "threshold": { + "type": "number" + }, + "rootMargin": { + "type": "string" + } + } + } + } + }, + "native": { + "type": "object", + "properties": { + "context": { + "type": "number" + }, + "plcmttype": { + "type": "number" + } + } + } + } +} diff --git a/static/bidder-params/admixer.json b/static/bidder-params/admixer.json index 886e33ff2bb..78671931561 100644 --- a/static/bidder-params/admixer.json +++ b/static/bidder-params/admixer.json @@ -8,7 +8,7 @@ "zone": { "type": "string", "description": "Zone ID.", - "pattern": "^([a-fA-F\\d\\-]{36})$" + "pattern": "^([a-fA-F\\d\\-]{32,36})$" }, "customFloor": { "type": "number", @@ -22,4 +22,4 @@ }, "required": ["zone"] -} +} \ No newline at end of file diff --git a/static/bidder-params/ix.json b/static/bidder-params/ix.json index 155cfa21892..a7a5cb7308a 100644 --- a/static/bidder-params/ix.json +++ b/static/bidder-params/ix.json @@ -4,10 +4,20 @@ "description": "A schema which validates params accepted by the Ix adapter", "type": "object", "properties": { + "siteid": { + "type": "string", + "minLength": 1, + "description": "An ID which identifies the site selling the impression, preferred." + }, "siteId": { "type": "string", "minLength": 1, - "description": "An ID which identifies the site selling the impression" + "description": "An ID which identifies the site selling the impression." + }, + "siteID": { + "type": "string", + "minLength": 1, + "description": "An ID which identifies the site selling the impression." }, "size": { "type": "array", @@ -19,5 +29,9 @@ "description": "An array of two integer containing the dimension" } }, - "required": ["siteId"] + "oneOf": [ + {"required": ["siteid"]}, + {"required": ["siteId"]}, + {"required": ["siteID"]} + ] } diff --git a/static/bidder-params/tappx.json b/static/bidder-params/tappx.json index f8feb1913e9..1cf101a44f5 100644 --- a/static/bidder-params/tappx.json +++ b/static/bidder-params/tappx.json @@ -12,6 +12,10 @@ "type": "string", "description": "An ID which identifies the adunit" }, + "mktag": { + "type": "string", + "description": "Minimum bid for this impression expressed in CPM (USD)" + }, "endpoint": { "type": "string", "description": "Endpoint provided to publisher" @@ -19,6 +23,20 @@ "bidfloor": { "type": "number", "description": "Minimum bid for this impression expressed in CPM (USD)" + }, + "bcid": { + "type": "array", + "description": "Block list of CID", + "items": { + "type": "string" + } + }, + "bcrid": { + "type": "array", + "description": "Block list of CRID", + "items": { + "type": "string" + } } }, "required": ["host","tappxkey","endpoint"] diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 674fc136527..8275869f5b2 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -8,6 +8,7 @@ import ( "github.com/golang/glog" ttx "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/acuityads" + "github.com/prebid/prebid-server/adapters/adagio" "github.com/prebid/prebid-server/adapters/adf" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernel" @@ -111,6 +112,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.Bidder33Across, ttx.New33AcrossSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAcuityAds, acuityads.NewAcuityAdsSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderAdagio, adagio.NewAdagioSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdf, adf.NewAdfSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdform, adform.NewAdformSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdkernel, adkernel.NewAdkernelSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index ec5a67e68d0..5ae3d0d5b88 100644 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -16,6 +16,7 @@ func TestNewSyncerMap(t *testing.T) { Adapters: map[string]config.Adapter{ string(openrtb_ext.Bidder33Across): syncConfig, string(openrtb_ext.BidderAcuityAds): syncConfig, + string(openrtb_ext.BidderAdagio): syncConfig, string(openrtb_ext.BidderAdf): syncConfig, string(openrtb_ext.BidderAdform): syncConfig, string(openrtb_ext.BidderAdkernel): syncConfig,