diff --git a/adapters/triplelift_native/params_test.go b/adapters/triplelift_native/params_test.go new file mode 100644 index 00000000000..163ca856e00 --- /dev/null +++ b/adapters/triplelift_native/params_test.go @@ -0,0 +1,53 @@ +package triplelift_native + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/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.BidderTripleliftNative, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected triplelift native 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.BidderTripleliftNative, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"inventoryCode":"1"}`, + `{"inventoryCode":"test"}`, + `{"inventoryCode":"test", "floor":10}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"inventoryCode":1}`, + `{"inventoryCode":""}`, + `{"inventoryCode":"1", "floor": "10"}`, +} diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 465ea32df59..57d5f2d7c2f 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -50,12 +50,6 @@ func processImp(imp *openrtb2.Imp, request *openrtb2.BidRequest) error { // get the triplelift extension var ext ExtImp var tlext openrtb_ext.ExtImpTriplelift - var siteCopy openrtb2.Site - var extData ExtImpData - - if request.Site != nil { - siteCopy = *request.Site - } if err := json.Unmarshal(imp.Ext, &ext); err != nil { return err @@ -66,32 +60,32 @@ func processImp(imp *openrtb2.Imp, request *openrtb2.BidRequest) error { if imp.Native == nil { return fmt.Errorf("no native object specified") } - if tlext.InvCode == "" { - return fmt.Errorf("no inv_code specified") - } - if ext.Data != nil { - extData = *ext.Data - } - - if extData.TagCode != "" { - if siteCopy.Publisher.Domain == "msn.com" { - imp.TagID = extData.TagCode - } else { - imp.TagID = tlext.InvCode - } + if ext.Data != nil && len(ext.Data.TagCode) > 0 && (msnInSite(request) || msnInApp(request)) { + imp.TagID = ext.Data.TagCode } else { imp.TagID = tlext.InvCode } + // floor is optional if tlext.Floor == nil { return nil } imp.BidFloor = *tlext.Floor - // no error + return nil } +// msnInApp returns whether msn.com is in request.app.publisher.domain +func msnInApp(request *openrtb2.BidRequest) bool { + return request.App != nil && request.App.Publisher != nil && request.App.Publisher.Domain == "msn.com" +} + +// msnInSite returns whether msn.com is in request.site.publisher.domain +func msnInSite(request *openrtb2.BidRequest) bool { + return request.Site != nil && request.Site.Publisher != nil && request.Site.Publisher.Domain == "msn.com" +} + // Returns the effective publisher ID func effectivePubID(pub *openrtb2.Publisher) string { if pub != nil { diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json new file mode 100644 index 00000000000..6950942f19d --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn-no-tag-code.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }], + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json new file mode 100644 index 00000000000..420cab5aff0 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/app-msn.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "bar", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/app.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/app.json new file mode 100644 index 00000000000..d1cd72947b7 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/app.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "app": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json deleted file mode 100644 index 7806a7bd6ae..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/exemplary/msn-params.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "site": { "publisher": {"id":"foo","name":"foo", "domain": "msn.com"}}, - "imp": [ - { - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "tagid": "bar", - "bidfloor": 20, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ], - "site": { - "publisher": { - "id":"foo", - "name":"foo", - "domain": "msn.com" - } - } - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ], - "expectedBidResponses": [] - } - \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json deleted file mode 100644 index f04f3eef557..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/exemplary/optional-params.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "site": { "publisher": {"id":"foo","name":"foo"}}, - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "tagid": "foo", - "bidfloor": 20, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - } - } - } - ], - "site": { - "publisher": { - "id": "foo", - "name": "foo" - } - } - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ], - "expectedBidResponses": [] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json new file mode 100644 index 00000000000..48162742a17 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn-no-tag-code.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json new file mode 100644 index 00000000000..5aaa5a1ddc2 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/site-msn.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "bar", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "msn.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/site.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/site.json new file mode 100644 index 00000000000..d273f4d411d --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/exemplary/site.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo", + "domain": "foo.com" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json b/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json deleted file mode 100644 index c97febcfea2..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/exemplary/tagcode-params.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "site": { "publisher": {"id":"foo","name":"foo", "domain": "foo.com"}}, - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "tagid": "foo", - "bidfloor": 20, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor" : 20 - }, - "data": { - "tag_code": "bar" - } - } - } - ], - "site": { - "publisher": { - "id": "foo", - "name": "foo", - "domain": "foo.com" - } - } - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ], - "expectedBidResponses": [] - } - \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json new file mode 100644 index 00000000000..56b339a1d79 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-no-publisher.json @@ -0,0 +1,25 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": {}, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json new file mode 100644 index 00000000000..ac119354c36 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/app-publisher-no-domain.json @@ -0,0 +1,60 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "id": "foo" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "app": { + "publisher": { + "id": "foo" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + }], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json new file mode 100644 index 00000000000..74ac9294783 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-allowed.json @@ -0,0 +1,122 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "baz", + "name": "foo", + "domain": "foo.com", + "ext": { + "prebid": { + "parentAccount": "foo" + } + } + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "baz", + "name": "foo", + "domain": "foo.com", + "ext": { + "prebid": { + "parentAccount": "foo" + } + } + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "id": "test-request-id", + "type": "native", + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://example.com", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + }, + "bidid": "5778926625248726496", + "cur": "USD" + }] + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json new file mode 100644 index 00000000000..d43c18cc402 --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/effective-publisher-not-allowed.json @@ -0,0 +1,36 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "baz", + "name": "foo", + "domain": "foo.com", + "ext": { + "prebid": { + "parentAccount": "faz" + } + } + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json new file mode 100644 index 00000000000..a46d0483fea --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/no-imp-ext-data.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + }, + "id": "test-request-id", + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + }, + "id": "test-request-id", + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "tagid": "invcode", + "ext": { + "bidder": { + "inventoryCode": "invcode" + } + } + }] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 302, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "triplelift_pb": { + "format": 2 + } + } + }] + }], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [{ + "value": "Unexpected status code: 302. Run with request.debug = 1 for more info", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json deleted file mode 100644 index cdeaff3961a..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "expectedMakeRequestsErrors": [ - { - "value": "Unsupported publisher for triplelift_native", - "comparison": "literal" - } - ], - "mockBidRequest": { - "id": "test-request-id", - "app": { "publisher": {"ext":{"prebid":{"parentAccount":"faz"}}, "id":"far","name":"bar"}}, - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor": 20 - } - } - } - ] - }, - "httpCalls": [ - ] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json deleted file mode 100644 index 46588f2e068..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/supplemental/notgoodstatuscode.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "mockBidRequest": { - "site": { "publisher": {"id":"foo","name":"foo"}}, - "id": "test-request-id", - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "ext": { - "bidder": { - "inventoryCode": "aa" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", - "body": { - "site": { "publisher": {"id":"foo","name":"foo"}}, - "id": "test-request-id", - "imp": [ - { - "native":{ - "request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" - }, - "id": "test-imp-id", - "tagid" : "aa", - "ext": { - "bidder": { - "inventoryCode": "aa" - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 302, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "triplelift.com" - ], - "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "triplelift_pb": { - "format": 2 - } - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 302. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json new file mode 100644 index 00000000000..62f9bdab17c --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json @@ -0,0 +1,25 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": {}, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json new file mode 100644 index 00000000000..d44ae442fab --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-publisher-no-domain.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + }, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20", + "body": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "tagid": "invcode", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "invcode", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }], + "site": { + "publisher": { + "id": "foo", + "name": "foo" + } + } + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204 + } + }], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/static/bidder-params/triplelift_native.json b/static/bidder-params/triplelift_native.json index 4fd71c722ba..4cf90ef49e7 100644 --- a/static/bidder-params/triplelift_native.json +++ b/static/bidder-params/triplelift_native.json @@ -7,6 +7,7 @@ "properties": { "inventoryCode": { "type": "string", + "minLength": 1, "description": "TripleLift inventory code for this ad unit (provided to you by your partner manager)" }, "floor" : {"description" : "the bid floor, in usd", "type": "number" }