diff --git a/adapters/unicorn/params_test.go b/adapters/unicorn/params_test.go new file mode 100644 index 00000000000..4a534208e84 --- /dev/null +++ b/adapters/unicorn/params_test.go @@ -0,0 +1,61 @@ +package unicorn + +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 schema. %v", err) + } + + for _, p := range validParams { + if err := validator.Validate(openrtb_ext.BidderUnicorn, json.RawMessage(p)); err != nil { + t.Errorf("Schema rejected valid params: %s", p) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderUnicorn, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{ + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }`, + `{ + "accountId": 199578, + "mediaId": "test_media" + }`, +} + +var invalidParams = []string{ + `{}`, + `{ + "accountId": "199578", + "publisherId": "123456", + "mediaId": 12345, + "placementId": 12345 + }`, + `{ + "publisherId": 123456, + "placementId": "test_placement" + }`, +} diff --git a/adapters/unicorn/unicorn.go b/adapters/unicorn/unicorn.go new file mode 100644 index 00000000000..52441e1a882 --- /dev/null +++ b/adapters/unicorn/unicorn.go @@ -0,0 +1,244 @@ +package unicorn + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb" + "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" +) + +type adapter struct { + endpoint string +} + +// unicornImpExt is imp ext for UNICORN +type unicornImpExt struct { + Context *unicornImpExtContext `json:"context,omitempty"` + Bidder openrtb_ext.ExtImpUnicorn `json:"bidder"` +} + +type unicornImpExtContext struct { + Data interface{} `json:"data,omitempty"` +} + +// unicornExt is ext for UNICORN +type unicornExt struct { + Prebid *openrtb_ext.ExtImpPrebid `json:"prebid,omitempty"` + AccountID int64 `json:"accountId,omitempty"` +} + +// Builder builds a new instance of the UNICORN 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 +} + +// MakeRequests makes the HTTP requests which should be made to fetch bids. +func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var extRegs openrtb_ext.ExtRegs + if request.Regs != nil { + if request.Regs.COPPA == 1 { + return nil, []error{&errortypes.BadInput{ + Message: "COPPA is not supported", + }} + } + if err := json.Unmarshal(request.Regs.Ext, &extRegs); err == nil { + if extRegs.GDPR != nil && (*extRegs.GDPR == 1) { + return nil, []error{&errortypes.BadInput{ + Message: "GDPR is not supported", + }} + } + if extRegs.USPrivacy != "" { + return nil, []error{&errortypes.BadInput{ + Message: "CCPA is not supported", + }} + } + } + } + + err := modifyImps(request) + if err != nil { + return nil, []error{err} + } + + var modifiableSource openrtb.Source + if request.Source != nil { + modifiableSource = *request.Source + } else { + modifiableSource = openrtb.Source{} + } + modifiableSource.Ext = setSourceExt() + request.Source = &modifiableSource + + request.Ext, err = setExt(request) + if err != nil { + return nil, []error{err} + } + + requestJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + Headers: getHeaders(request), + } + + return []*adapters.RequestData{requestData}, nil +} + +func getHeaders(request *openrtb.BidRequest) http.Header { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("X-Openrtb-Version", "2.5") + + if request.Device != nil { + if len(request.Device.UA) > 0 { + headers.Add("User-Agent", request.Device.UA) + } + + 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) + } + } + + return headers +} + +func modifyImps(request *openrtb.BidRequest) error { + for i := 0; i < len(request.Imp); i++ { + imp := &request.Imp[i] + + var ext unicornImpExt + err := json.Unmarshal(imp.Ext, &ext) + + if err != nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Error while decoding imp[%d].ext: %s", i, err), + } + } + + if ext.Bidder.PlacementID == "" { + ext.Bidder.PlacementID, err = getStoredRequestImpID(imp) + if err != nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Error get StoredRequestImpID from imp[%d]: %s", i, err), + } + } + } + + imp.Ext, err = json.Marshal(ext) + if err != nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Error while encoding imp[%d].ext: %s", i, err), + } + } + + secure := int8(1) + imp.Secure = &secure + imp.TagID = ext.Bidder.PlacementID + } + return nil +} + +func getStoredRequestImpID(imp *openrtb.Imp) (string, error) { + v, err := jsonparser.GetString(imp.Ext, "prebid", "storedrequest", "id") + + if err != nil { + return "", fmt.Errorf("stored request id not found: %s", err) + } + + return v, nil +} + +func setSourceExt() json.RawMessage { + return json.RawMessage(`{"stype": "prebid_server_uncn", "bidder": "unicorn"}`) +} + +func setExt(request *openrtb.BidRequest) (json.RawMessage, error) { + accountID, err := jsonparser.GetInt(request.Imp[0].Ext, "bidder", "accountId") + if err != nil { + accountID = 0 + } + var decodedExt *unicornExt + err = json.Unmarshal(request.Ext, &decodedExt) + if err != nil { + decodedExt = &unicornExt{ + Prebid: nil, + } + } + decodedExt.AccountID = accountID + + ext, err := json.Marshal(decodedExt) + if err != nil { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("Error while encoding ext, err: %s", err), + } + } + return ext, nil +} + +// MakeBids unpacks the server's response into Bids. +func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + + if responseData.StatusCode == http.StatusNoContent { + return nil, nil + } + + if responseData.StatusCode == http.StatusBadRequest { + err := &errortypes.BadInput{ + Message: "Unexpected http status code: 400", + } + return nil, []error{err} + } + + if responseData.StatusCode != http.StatusOK { + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected http status code: %d", responseData.StatusCode), + } + return nil, []error{err} + } + + var response openrtb.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur + for _, seatBid := range response.SeatBid { + for _, bid := range seatBid.Bid { + bid := bid + var bidType openrtb_ext.BidType + for _, imp := range request.Imp { + if imp.ID == bid.ImpID { + if imp.Banner != nil { + bidType = openrtb_ext.BidTypeBanner + } + } + } + b := &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + return bidResponse, nil +} diff --git a/adapters/unicorn/unicorn_test.go b/adapters/unicorn/unicorn_test.go new file mode 100644 index 00000000000..1a0d67d29f7 --- /dev/null +++ b/adapters/unicorn/unicorn_test.go @@ -0,0 +1,20 @@ +package unicorn + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderUnicorn, config.Adapter{ + Endpoint: "https://ds.uncn.jp"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "unicorntest", bidder) +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json b/adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json new file mode 100644 index 00000000000..c37c2095d48 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json @@ -0,0 +1,228 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + } + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json new file mode 100644 index 00000000000..2d38a990db3 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json @@ -0,0 +1,236 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "ip": "12.1.2.3", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "ip": "12.1.2.3", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json new file mode 100644 index 00000000000..595741a0aa1 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json @@ -0,0 +1,236 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "ipv6": "2400:2410:9120:3400:15f3:8c50:3a0:6820", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "ipv6": "2400:2410:9120:3400:15f3:8c50:3a0:6820", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json b/adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json new file mode 100644 index 00000000000..8b5423a5556 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json @@ -0,0 +1,212 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 78.3, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 78.3, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json b/adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json new file mode 100644 index 00000000000..c05d3b6f536 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json @@ -0,0 +1,231 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media" + } + } + } + ], + "cur": ["USD"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["USD"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_unicorn" + } + }, + "tagid": "test_unicorn", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "USD", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 0.783, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "USD", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 0.783, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app.json b/adapters/unicorn/unicorntest/exemplary/banner-app.json new file mode 100644 index 00000000000..b29c1e1d625 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app.json @@ -0,0 +1,232 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json b/adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json new file mode 100644 index 00000000000..0a6fb420adc --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json @@ -0,0 +1,244 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": { + "firstPartyData1": ["firstPartyData1"], + "uuid": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"] + } + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": { + "firstPartyData1": ["firstPartyData1"], + "uuid": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"] + } + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json b/adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json new file mode 100644 index 00000000000..022246382f8 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json @@ -0,0 +1,238 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": {} + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": {} + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/params/race/banner.json b/adapters/unicorn/unicorntest/params/race/banner.json new file mode 100644 index 00000000000..668983e3d19 --- /dev/null +++ b/adapters/unicorn/unicorntest/params/race/banner.json @@ -0,0 +1,6 @@ +{ + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" +} diff --git a/adapters/unicorn/unicorntest/supplemental/204.json b/adapters/unicorn/unicorntest/supplemental/204.json new file mode 100644 index 00000000000..a05864090ea --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/204.json @@ -0,0 +1,170 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} + diff --git a/adapters/unicorn/unicorntest/supplemental/400.json b/adapters/unicorn/unicorntest/supplemental/400.json new file mode 100644 index 00000000000..6578082ca19 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/400.json @@ -0,0 +1,175 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected http status code: 400", + "comparison": "literal" + } + ] +} + diff --git a/adapters/unicorn/unicorntest/supplemental/500.json b/adapters/unicorn/unicorntest/supplemental/500.json new file mode 100644 index 00000000000..c0811be4b24 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/500.json @@ -0,0 +1,175 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "status": 500, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected http status code: 500", + "comparison": "literal" + } + ] +} + diff --git a/adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json b/adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json new file mode 100644 index 00000000000..6bc396c67f1 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "at": 1, + "regs": { + "ext": { + "us_privacy": "1YNN" + } + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "CCPA is not supported", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json b/adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json new file mode 100644 index 00000000000..1c33ce2e805 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json @@ -0,0 +1,78 @@ +{ + "mockBidRequest": { + "at": 1, + "regs": { + "coppa": 1 + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "COPPA is not supported", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json b/adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json new file mode 100644 index 00000000000..3c9222d8cc2 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "at": 1, + "regs": { + "ext": { + "gdpr": 1 + } + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "GDPR is not supported", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json b/adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json new file mode 100644 index 00000000000..2e6ce79a176 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors" : [{ + "value": "Error get StoredRequestImpID from imp[0]: stored request id not found: Key path not found", + "comparison": "literal" + }] +} diff --git a/adapters/unicorn/unicorntest/supplemental/no-imp-ext.json b/adapters/unicorn/unicorntest/supplemental/no-imp-ext.json new file mode 100644 index 00000000000..bab6e8d9603 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/no-imp-ext.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "Error while decoding imp[0].ext: unexpected end of JSON input", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json b/adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json new file mode 100644 index 00000000000..d903effd466 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors" : [{ + "value": "Error get StoredRequestImpID from imp[0]: stored request id not found: Key path not found", + "comparison": "literal" + }] +} diff --git a/config/config.go b/config/config.go index d31e0630a59..2abdd117d52 100644 --- a/config/config.go +++ b/config/config.go @@ -638,6 +638,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTripleliftNative, "https://eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift_native%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTrustX, "https://x.bidswitch.net/check_uuid/"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtrustx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BBSW_UUID%7D?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUcfunnel, "https://sync.aralego.com/idsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&usprivacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ducfunnel%26uid%3DSspCookieUserId") + // openrtb_ext.BidderUnicorn doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderValueImpression, "https://rtb.valueimpression.com/usersync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvalueimpression%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") @@ -895,6 +896,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.triplelift.endpoint", "https://tlx.3lift.com/s2s/auction?sra=1&supplier_id=20") v.SetDefault("adapters.trustx.endpoint", "https://grid.bidswitch.net/sp_bid?sp=trustx") v.SetDefault("adapters.ucfunnel.endpoint", "https://pbs.aralego.com/prebid") + v.SetDefault("adapters.unicorn.endpoint", "https://ds.uncn.jp/pb/0/bid.json") v.SetDefault("adapters.unruly.endpoint", "http://targeting.unrulymedia.com/openrtb/2.2") v.SetDefault("adapters.valueimpression.endpoint", "https://rtb.valueimpression.com/endpoint") v.SetDefault("adapters.verizonmedia.disabled", true) diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index b5d1dc7eab9..8d0c0a4056c 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -90,6 +90,7 @@ import ( "github.com/prebid/prebid-server/adapters/triplelift" "github.com/prebid/prebid-server/adapters/triplelift_native" "github.com/prebid/prebid-server/adapters/ucfunnel" + "github.com/prebid/prebid-server/adapters/unicorn" "github.com/prebid/prebid-server/adapters/unruly" "github.com/prebid/prebid-server/adapters/valueimpression" "github.com/prebid/prebid-server/adapters/verizonmedia" @@ -198,6 +199,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderTripleliftNative: triplelift_native.Builder, openrtb_ext.BidderTrustX: grid.Builder, openrtb_ext.BidderUcfunnel: ucfunnel.Builder, + openrtb_ext.BidderUnicorn: unicorn.Builder, openrtb_ext.BidderUnruly: unruly.Builder, openrtb_ext.BidderValueImpression: valueimpression.Builder, openrtb_ext.BidderVerizonMedia: verizonmedia.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 20d6041f51c..600e130b167 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -164,6 +164,7 @@ const ( BidderTripleliftNative BidderName = "triplelift_native" BidderTrustX BidderName = "trustx" BidderUcfunnel BidderName = "ucfunnel" + BidderUnicorn BidderName = "unicorn" BidderUnruly BidderName = "unruly" BidderValueImpression BidderName = "valueimpression" BidderVerizonMedia BidderName = "verizonmedia" @@ -270,6 +271,7 @@ func CoreBidderNames() []BidderName { BidderTripleliftNative, BidderTrustX, BidderUcfunnel, + BidderUnicorn, BidderUnruly, BidderValueImpression, BidderVerizonMedia, diff --git a/openrtb_ext/imp_unicorn.go b/openrtb_ext/imp_unicorn.go new file mode 100644 index 00000000000..ad75414caa5 --- /dev/null +++ b/openrtb_ext/imp_unicorn.go @@ -0,0 +1,9 @@ +package openrtb_ext + +// ExtImpUnicorn defines the contract for bidrequest.imp[i].ext.unicorn +type ExtImpUnicorn struct { + PlacementID string `json:"placementId,omitempty"` + PublisherID int `json:"publisherId,omitempty"` + MediaID string `json:"mediaId"` + AccountID int `json:"accountId"` +} diff --git a/static/bidder-info/unicorn.yaml b/static/bidder-info/unicorn.yaml new file mode 100644 index 00000000000..f1b5a4e7f3e --- /dev/null +++ b/static/bidder-info/unicorn.yaml @@ -0,0 +1,6 @@ +maintainer: + email: prebid@unicorn.inc +capabilities: + app: + mediaTypes: + - banner \ No newline at end of file diff --git a/static/bidder-params/unicorn.json b/static/bidder-params/unicorn.json new file mode 100644 index 00000000000..f9c4e1677b6 --- /dev/null +++ b/static/bidder-params/unicorn.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "UNICORN Adapter Params", + "description": "A schema which validates params accepted by the UNICORN adapter", + "type": "object", + "properties": { + "placementId": { + "type": "string", + "description": "In Application, if placementId is empty, prebid server configuration id will be used as placementId." + }, + "publisherId": { + "type": "integer", + "description": "Account specific publisher id" + }, + "mediaId": { + "type": "string", + "description": "Publisher specific media id" + }, + "accountId": { + "type": "integer", + "description": "Account ID for charge request" + } + }, + "required" : ["mediaId", "accountId"] +} \ No newline at end of file diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index e70abe629ff..79530c867f7 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -118,6 +118,7 @@ func TestNewSyncerMap(t *testing.T) { openrtb_ext.BidderRevcontent: true, openrtb_ext.BidderSilverMob: true, openrtb_ext.BidderSmaato: true, + openrtb_ext.BidderUnicorn: true, openrtb_ext.BidderYeahmobi: true, }