From 8d2498e4a076596a5237bedffb22afbadeffbac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Jo=CC=88st?= Date: Thu, 19 Oct 2023 16:02:14 +0200 Subject: [PATCH 1/2] Revert "Remove Adapter: Define Media (#3132)" This reverts commit aff482fb9476391e899feffd929503b3042bb810. --- adapters/definemedia/definemedia.go | 109 +++++++ adapters/definemedia/definemedia_test.go | 21 ++ .../exemplary/sample-conative-banner.json | 270 ++++++++++++++++++ .../exemplary/sample-conative-native.json | 257 +++++++++++++++++ .../supplemental/nobid-response.json | 222 ++++++++++++++ .../supplemental/nocontent-response.json | 219 ++++++++++++++ .../supplemental/status_400.json | 224 +++++++++++++++ .../supplemental/status_418.json | 224 +++++++++++++++ .../supplemental/unmarshal-error.json | 224 +++++++++++++++ .../supplemental/unsupported-type.json | 250 ++++++++++++++++ adapters/definemedia/params_test.go | 48 ++++ exchange/adapter_builders.go | 2 + exchange/adapter_util.go | 1 - openrtb_ext/bidders.go | 2 + openrtb_ext/imp_definemedia.go | 6 + static/bidder-info/definemedia.yaml | 10 + static/bidder-params/definemedia.json | 19 ++ 17 files changed, 2107 insertions(+), 1 deletion(-) create mode 100644 adapters/definemedia/definemedia.go create mode 100644 adapters/definemedia/definemedia_test.go create mode 100644 adapters/definemedia/definemediatest/exemplary/sample-conative-banner.json create mode 100644 adapters/definemedia/definemediatest/exemplary/sample-conative-native.json create mode 100644 adapters/definemedia/definemediatest/supplemental/nobid-response.json create mode 100644 adapters/definemedia/definemediatest/supplemental/nocontent-response.json create mode 100644 adapters/definemedia/definemediatest/supplemental/status_400.json create mode 100644 adapters/definemedia/definemediatest/supplemental/status_418.json create mode 100644 adapters/definemedia/definemediatest/supplemental/unmarshal-error.json create mode 100644 adapters/definemedia/definemediatest/supplemental/unsupported-type.json create mode 100644 adapters/definemedia/params_test.go create mode 100644 openrtb_ext/imp_definemedia.go create mode 100644 static/bidder-info/definemedia.yaml create mode 100644 static/bidder-params/definemedia.json diff --git a/adapters/definemedia/definemedia.go b/adapters/definemedia/definemedia.go new file mode 100644 index 00000000000..3e014e3c16d --- /dev/null +++ b/adapters/definemedia/definemedia.go @@ -0,0 +1,109 @@ +package definemedia + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/prebid/openrtb/v19/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" +) + +type adapter struct { + endpoint string +} + +// Builder builds a new instance of the Foo adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (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 *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var errors []error + requestJSON, err := json.Marshal(request) + if err != nil { + errors = append(errors, err) + return nil, errors + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + } + + return []*adapters.RequestData{requestData}, errors + +} + +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if response.StatusCode == http.StatusNoContent { + return nil, nil + } + + if response.StatusCode == http.StatusBadRequest { + return nil, []error{&errortypes.BadInput{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), + }} + } + + if response.StatusCode != http.StatusOK { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), + }} + } + + var bidResp openrtb2.BidResponse + if err := json.Unmarshal(response.Body, &bidResp); err != nil { + return nil, []error{err} + } + + bidsCapacity := 1 + if len(bidResp.SeatBid) > 0 { + bidsCapacity = len(bidResp.SeatBid[0].Bid) + } + bidResponse := adapters.NewBidderResponseWithBidsCapacity(bidsCapacity) + var errors []error + for _, sb := range bidResp.SeatBid { + for i, bid := range sb.Bid { + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errors = append(errors, err) + continue + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &sb.Bid[i], + BidType: bidType, + }) + + } + } + + return bidResponse, errors +} + +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + if bid.Ext != nil { + var bidExt openrtb_ext.ExtBid + err := json.Unmarshal(bid.Ext, &bidExt) + if err == nil && bidExt.Prebid != nil { + if (bidExt.Prebid.Type == openrtb_ext.BidTypeBanner) || (bidExt.Prebid.Type == openrtb_ext.BidTypeNative) { + return openrtb_ext.ParseBidType(string(bidExt.Prebid.Type)) + } + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Invalid mediatype in the impression"), + } + } + } + + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Failed to parse impression \"%s\" mediatype", bid.ImpID), + } +} diff --git a/adapters/definemedia/definemedia_test.go b/adapters/definemedia/definemedia_test.go new file mode 100644 index 00000000000..3ed0cb938b8 --- /dev/null +++ b/adapters/definemedia/definemedia_test.go @@ -0,0 +1,21 @@ +package definemedia + +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.BidderDefinemedia, config.Adapter{ + Endpoint: "https://rtb.conative.network/openrtb2/auction"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "definemediatest", bidder) +} diff --git a/adapters/definemedia/definemediatest/exemplary/sample-conative-banner.json b/adapters/definemedia/definemediatest/exemplary/sample-conative-banner.json new file mode 100644 index 00000000000..a7d7e411f78 --- /dev/null +++ b/adapters/definemedia/definemediatest/exemplary/sample-conative-banner.json @@ -0,0 +1,270 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": { + "mandantId": 12 + } + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "topframe": 1, + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "topframe": 1 + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": { + "mandantId": 12 + } + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "46189656-7e2e-477d-b7f2-e05de224bb89", + "impid": "div-gpt-ad-1460505748561-0", + "price": 100, + "adm": "{banner html}", + "adomain": [ + "test.com" + ], + "crid": "test-creative-id", + "ext": { + "prebid": { + "type": "banner" + } + } + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "46189656-7e2e-477d-b7f2-e05de224bb89", + "impid": "div-gpt-ad-1460505748561-0", + "price": 100, + "adm": "{banner html}", + "crid": "test-creative-id", + "adomain": [ + "test.com" + ], + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/definemedia/definemediatest/exemplary/sample-conative-native.json b/adapters/definemedia/definemediatest/exemplary/sample-conative-native.json new file mode 100644 index 00000000000..4fe56a4c22e --- /dev/null +++ b/adapters/definemedia/definemediatest/exemplary/sample-conative-native.json @@ -0,0 +1,257 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": { + "mandantId": 12 + } + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "native": {} + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "native": { + "request": "" + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": { + "mandantId": 12 + } + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "46189656-7e2e-477d-b7f2-e05de224bb89", + "impid": "div-gpt-ad-1460505748561-0", + "price": 100, + "adm": "{\n \"ver\": \"1.1\",\n \"imptrackers\": [\"http://imptracker.com\"],\n \"jstracker\": \"\u003cscript\u003etrack()\u003c/script\u003e\",\n \"link\": {\n \"url\": \"http://i.am.a/URL\"\n },\n \"assets\": [\n {\n \"id\": 123,\n \"required\": 1,\n \"title\": {\n \"text\": \"Learn about this awesome thing\"\n }\n },\n {\n \"id\": 124,\n \"required\": 1,\n \"img\": {\n \"url\": \"http://www.myads.com/thumbnail1.png\"\n }\n },\n {\n \"id\": 128,\n \"required\": 1,\n \"img\": {\n \"url\": \"http://www.myads.com/largethumb1.png\"\n }\n },\n {\n \"id\": 126,\n \"required\": 1,\n \"data\": {\n \"value\": \"My Brand\"\n }\n },\n {\n \"id\": 127,\n \"required\": 1,\n \"data\": {\n \"value\": \"Learn all about this awesome story of someone using my product.\"\n }\n },\n {\n \"id\": 4,\n \"video\": {\n \"vasttag\": \"\u003cVAST version=\\\"2.0\\\"\u003e\u003c/VAST\u003e\"\n }\n },\n {\n \"id\": 5,\n \"link\": {\n \"url\": \"http://landing.com\",\n \"clicktrackers\": [\"http://tracker.com\"],\n \"fallback\": \"http://fallback.com\"\n }\n }\n ]\n}", + "adomain": [ + "test.com" + ], + "crid": "test-creative-id", + "ext": { + "prebid": { + "type": "native" + } + } + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "46189656-7e2e-477d-b7f2-e05de224bb89", + "impid": "div-gpt-ad-1460505748561-0", + "price": 100, + + "adm": "{\n \"ver\": \"1.1\",\n \"imptrackers\": [\"http://imptracker.com\"],\n \"jstracker\": \"\u003cscript\u003etrack()\u003c/script\u003e\",\n \"link\": {\n \"url\": \"http://i.am.a/URL\"\n },\n \"assets\": [\n {\n \"id\": 123,\n \"required\": 1,\n \"title\": {\n \"text\": \"Learn about this awesome thing\"\n }\n },\n {\n \"id\": 124,\n \"required\": 1,\n \"img\": {\n \"url\": \"http://www.myads.com/thumbnail1.png\"\n }\n },\n {\n \"id\": 128,\n \"required\": 1,\n \"img\": {\n \"url\": \"http://www.myads.com/largethumb1.png\"\n }\n },\n {\n \"id\": 126,\n \"required\": 1,\n \"data\": {\n \"value\": \"My Brand\"\n }\n },\n {\n \"id\": 127,\n \"required\": 1,\n \"data\": {\n \"value\": \"Learn all about this awesome story of someone using my product.\"\n }\n },\n {\n \"id\": 4,\n \"video\": {\n \"vasttag\": \"\u003cVAST version=\\\"2.0\\\"\u003e\u003c/VAST\u003e\"\n }\n },\n {\n \"id\": 5,\n \"link\": {\n \"url\": \"http://landing.com\",\n \"clicktrackers\": [\"http://tracker.com\"],\n \"fallback\": \"http://fallback.com\"\n }\n }\n ]\n}", + "crid": "test-creative-id", + "adomain": [ + "test.com" + ], + "ext": { + "prebid": { + "type": "native" + } + } + }, + "type": "native" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/definemedia/definemediatest/supplemental/nobid-response.json b/adapters/definemedia/definemediatest/supplemental/nobid-response.json new file mode 100644 index 00000000000..aaa942da76e --- /dev/null +++ b/adapters/definemedia/definemediatest/supplemental/nobid-response.json @@ -0,0 +1,222 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": {} + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "topframe": 1, + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "topframe": 1 + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": {} + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": null, + "cur": null + } + } + } + ], + "expectedBidResponses": [{"currency":"USD","bids":[]}] + } diff --git a/adapters/definemedia/definemediatest/supplemental/nocontent-response.json b/adapters/definemedia/definemediatest/supplemental/nocontent-response.json new file mode 100644 index 00000000000..147d2185e1f --- /dev/null +++ b/adapters/definemedia/definemediatest/supplemental/nocontent-response.json @@ -0,0 +1,219 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": {} + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "topframe": 1, + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "topframe": 1 + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": {} + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [] + } \ No newline at end of file diff --git a/adapters/definemedia/definemediatest/supplemental/status_400.json b/adapters/definemedia/definemediatest/supplemental/status_400.json new file mode 100644 index 00000000000..ec772bf8428 --- /dev/null +++ b/adapters/definemedia/definemediatest/supplemental/status_400.json @@ -0,0 +1,224 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": {} + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "topframe": 1, + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "topframe": 1 + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": {} + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } \ No newline at end of file diff --git a/adapters/definemedia/definemediatest/supplemental/status_418.json b/adapters/definemedia/definemediatest/supplemental/status_418.json new file mode 100644 index 00000000000..6e82f90476e --- /dev/null +++ b/adapters/definemedia/definemediatest/supplemental/status_418.json @@ -0,0 +1,224 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": {} + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "topframe": 1, + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "topframe": 1 + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": {} + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 418, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 418. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } \ No newline at end of file diff --git a/adapters/definemedia/definemediatest/supplemental/unmarshal-error.json b/adapters/definemedia/definemediatest/supplemental/unmarshal-error.json new file mode 100644 index 00000000000..396d6821c36 --- /dev/null +++ b/adapters/definemedia/definemediatest/supplemental/unmarshal-error.json @@ -0,0 +1,224 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": {} + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "topframe": 1, + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "topframe": 1 + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": {} + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": "fail for unmarshall" + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", + "comparison": "literal" + } + ] + } \ No newline at end of file diff --git a/adapters/definemedia/definemediatest/supplemental/unsupported-type.json b/adapters/definemedia/definemediatest/supplemental/unsupported-type.json new file mode 100644 index 00000000000..91bfbc413c1 --- /dev/null +++ b/adapters/definemedia/definemediatest/supplemental/unsupported-type.json @@ -0,0 +1,250 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9", + "prebid": { + "bidder": { + "definemedia": {} + } + } + }, + "id": "div-gpt-ad-1460505748561-0", + "video": { + "w": 300, + "h": 250, + "maxduration": 60, + "minduration": 1, + "api": [1, 2, 5, 6, 7], + "mimes": ["video/mp4"], + "placement": 4, + "protocols": [2] + } + } + ], + "site": { + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "domain": "localhost:8080", + "publisher": { + "domain": "localhost:8080", + "id": "1" + } + }, + "device": { + "w": 1098, + "h": 1169, + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "language": "de", + "sua": { + "source": 2, + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "mobile": 0, + "model": "", + "bitness": "64", + "architecture": "x86" + } + }, + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "test": 0, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1671449004622, + "targeting": { + "includewinners": true, + "includebidderkeys": false + }, + "debug": true, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + } + } + }, + "tmax": 1000 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://rtb.conative.network/openrtb2/auction", + "body": { + "id": "ceb63773-4280-45f2-a684-94cf6a3b8fcf", + "imp": [ + { + "id": "div-gpt-ad-1460505748561-0", + "video": { + "w": 300, + "h": 250, + "maxduration": 60, + "minduration": 1, + "api": [1, 2, 5, 6, 7], + "mimes": ["video/mp4"], + "placement": 4, + "protocols": [2] + }, + "ext": { + "prebid": { + "bidder": { + "definemedia": {} + } + }, + "tid": "397962d3-47a1-4634-9cb7-78597b01d9a9" + } + } + ], + "site": { + "domain": "localhost:8080", + "page": "http://localhost:8080/prebidServer_example.html?pbjs_debug=true", + "publisher": { + "id": "1", + "domain": "localhost:8080" + } + }, + "device": { + "dnt": 0, + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "sua": { + "browsers": [ + { + "brand": "Not?A_Brand", + "version": [ + "8", + "0", + "0", + "0" + ] + }, + { + "brand": "Chromium", + "version": [ + "108", + "0", + "5359", + "124" + ] + }, + { + "brand": "Google Chrome", + "version": [ + "108", + "0", + "5359", + "124" + ] + } + ], + "platform": { + "brand": "macOS", + "version": [ + "12", + "3", + "1" + ] + }, + "mobile": 0, + "architecture": "x86", + "bitness": "64", + "source": 2 + }, + "h": 1169, + "w": 1098, + "language": "de" + }, + "tmax": 1000, + "source": { + "tid": "ceb63773-4280-45f2-a684-94cf6a3b8fcf" + }, + "ext": { + "prebid": { + "auctiontimestamp": 1.671449004622e+12, + "channel": { + "name": "pbjs", + "version": "v7.28.0" + }, + "debug": true, + "targeting": { + "includebidderkeys": false, + "includewinners": true + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "46189656-7e2e-477d-b7f2-e05de224bb89", + "impid": "div-gpt-ad-1460505748561-0", + "price": 100, + "adm": "{banner html}", + "adomain": [ + "test.com" + ], + "crid": "test-creative-id", + "ext": { + "prebid": { + "type": "video" + } + } + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [{"currency":"USD","bids":[]}], + "expectedMakeBidsErrors": [ + { + "value": "Invalid mediatype in the impression", + "comparison": "literal" + } + ] +} diff --git a/adapters/definemedia/params_test.go b/adapters/definemedia/params_test.go new file mode 100644 index 00000000000..63ef5272669 --- /dev/null +++ b/adapters/definemedia/params_test.go @@ -0,0 +1,48 @@ +package definemedia + +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.BidderDefinemedia, 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.BidderDefinemedia, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{"mandantId":123}`, + `{"mandantId":123, "adslotId":456}`, +} + +var invalidParams = []string{ + `{"mandantId": "42"}`, + `{"MandantId": "42"}`, + `{"mandantId":123, "adslotId":"456"}`, + `{"adslotId":456}`, + `{"adslotId":"456"}`, + `{}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 6ab0dccfc7c..fd1a99aeffb 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -71,6 +71,7 @@ import ( "github.com/prebid/prebid-server/adapters/datablocks" "github.com/prebid/prebid-server/adapters/decenterads" "github.com/prebid/prebid-server/adapters/deepintent" + "github.com/prebid/prebid-server/adapters/definemedia" "github.com/prebid/prebid-server/adapters/dianomi" "github.com/prebid/prebid-server/adapters/dmx" "github.com/prebid/prebid-server/adapters/dxkulture" @@ -264,6 +265,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderDatablocks: datablocks.Builder, openrtb_ext.BidderDecenterAds: decenterads.Builder, openrtb_ext.BidderDeepintent: deepintent.Builder, + openrtb_ext.BidderDefinemedia: definemedia.Builder, openrtb_ext.BidderDianomi: dianomi.Builder, openrtb_ext.BidderEdge226: edge226.Builder, openrtb_ext.BidderDmx: dmx.Builder, diff --git a/exchange/adapter_util.go b/exchange/adapter_util.go index a5a232bbd93..89d58d06800 100644 --- a/exchange/adapter_util.go +++ b/exchange/adapter_util.go @@ -117,7 +117,6 @@ func GetDisabledBidderWarningMessages(infos config.BidderInfos) map[string]strin "engagebdr": `Bidder "engagebdr" is no longer available in Prebid Server. Please update your configuration.`, "ninthdecimal": `Bidder "ninthdecimal" is no longer available in Prebid Server. Please update your configuration.`, "kubient": `Bidder "kubient" is no longer available in Prebid Server. Please update your configuration.`, - "definemedia": `Bidder "definemedia" is no longer available in Prebid Server. Please update your configuration.`, "applogy": `Bidder "applogy" is no longer available in Prebid Server. Please update your configuration.`, "rhythmone": `Bidder "rhythmone" is no longer available in Prebid Server. Please update your configuration.`, "nanointeractive": `Bidder "nanointeractive" is no longer available in Prebid Server. Please update your configuration.`, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 22a915b769f..fbd5bb9f787 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -87,6 +87,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderDatablocks, BidderDecenterAds, BidderDeepintent, + BidderDefinemedia, BidderDianomi, BidderEdge226, BidderDmx, @@ -368,6 +369,7 @@ const ( BidderDatablocks BidderName = "datablocks" BidderDecenterAds BidderName = "decenterads" BidderDeepintent BidderName = "deepintent" + BidderDefinemedia BidderName = "definemedia" BidderDianomi BidderName = "dianomi" BidderEdge226 BidderName = "edge226" BidderDmx BidderName = "dmx" diff --git a/openrtb_ext/imp_definemedia.go b/openrtb_ext/imp_definemedia.go new file mode 100644 index 00000000000..aa94bf5de63 --- /dev/null +++ b/openrtb_ext/imp_definemedia.go @@ -0,0 +1,6 @@ +package openrtb_ext + +type ImpExtDefinemedia struct { + MandantID int64 `json:"mandantId"` + AdslotID int64 `json:"adslotId"` +} diff --git a/static/bidder-info/definemedia.yaml b/static/bidder-info/definemedia.yaml new file mode 100644 index 00000000000..d79c3835a58 --- /dev/null +++ b/static/bidder-info/definemedia.yaml @@ -0,0 +1,10 @@ +endpoint: "https://rtb.conative.network/openrtb2/auction" +maintainer: + email: "d.joest@definemedia.de" + gvlVendorID: 440 # GDPR vendor list ID +capabilities: + + site: + mediaTypes: + - banner + - native diff --git a/static/bidder-params/definemedia.json b/static/bidder-params/definemedia.json new file mode 100644 index 00000000000..bf5566b4c89 --- /dev/null +++ b/static/bidder-params/definemedia.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Define Media Adapter Params", + "description": "A schema which validates params accepted by the DM adapter", + "type": "object", + + "properties": { + "mandantId": { + "type": "integer", + "description": "The DEFINE-MEDIA mandant id. This is a unique identifier for your account. Please contact your account manager for more information." + }, + + "adslotId":{ + "type": "integer", + "description": "The adslot id. This is a unique identifier for your adslot and may change on subparts on a website. Please contact your account manager for more information." + } + }, + "required": ["mandantId"] + } \ No newline at end of file From 7bde7e63ae7cba9d6adc90dee231d2cf91e235fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Jo=CC=88st?= Date: Thu, 19 Oct 2023 16:08:34 +0200 Subject: [PATCH 2/2] Changed E-Mail to DEV department --- static/bidder-info/definemedia.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/definemedia.yaml b/static/bidder-info/definemedia.yaml index d79c3835a58..a7be6fb9d23 100644 --- a/static/bidder-info/definemedia.yaml +++ b/static/bidder-info/definemedia.yaml @@ -1,6 +1,6 @@ endpoint: "https://rtb.conative.network/openrtb2/auction" maintainer: - email: "d.joest@definemedia.de" + email: "development@definemedia.de" gvlVendorID: 440 # GDPR vendor list ID capabilities: