From 67b9c2500684eae07d411ebccc88ad3df3b9141d Mon Sep 17 00:00:00 2001 From: prebidtappx <77485538+prebidtappx@users.noreply.github.com> Date: Thu, 11 Feb 2021 16:51:59 +0100 Subject: [PATCH 01/91] Tappx User Syncer + Site Update (#1674) Co-authored-by: ubuntu Co-authored-by: Albert Grandes --- adapters/tappx/tappx_test.go | 6 +- .../exemplary/single-banner-impression.json | 10 +- .../exemplary/single-banner-site.json | 124 ++++++++++++++++ .../exemplary/single-video-impression.json | 10 +- .../exemplary/single-video-site.json | 136 ++++++++++++++++++ .../tappx/tappxtest/params/race/banner.json | 4 +- .../tappx/tappxtest/params/race/video.json | 4 +- .../tappxtest/supplemental/204status.json | 10 +- .../banner-impression-badhost.json | 4 +- .../banner-impression-noendpoint.json | 2 +- .../banner-impression-nohost.json | 2 +- .../supplemental/banner-impression-nokey.json | 4 +- .../tappxtest/supplemental/bidfloor.json | 10 +- .../supplemental/http-err-status.json | 10 +- .../supplemental/http-err-status2.json | 10 +- .../supplemental/wrong-imp-ext-1.json | 4 +- adapters/tappx/usersync.go | 12 ++ adapters/tappx/usersync_test.go | 35 +++++ config/config.go | 4 +- static/bidder-info/tappx.yaml | 4 + usersync/usersyncers/syncer.go | 2 + usersync/usersyncers/syncer_test.go | 2 +- 22 files changed, 361 insertions(+), 48 deletions(-) create mode 100644 adapters/tappx/tappxtest/exemplary/single-banner-site.json create mode 100644 adapters/tappx/tappxtest/exemplary/single-video-site.json create mode 100644 adapters/tappx/usersync.go create mode 100644 adapters/tappx/usersync_test.go mode change 100755 => 100644 config/config.go mode change 100755 => 100644 usersync/usersyncers/syncer.go diff --git a/adapters/tappx/tappx_test.go b/adapters/tappx/tappx_test.go index 5346b82b694..187190862ea 100644 --- a/adapters/tappx/tappx_test.go +++ b/adapters/tappx/tappx_test.go @@ -12,7 +12,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderTappx, config.Adapter{ - Endpoint: "https://{{.Host}}"}) + Endpoint: "http://{{.Host}}"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) @@ -30,7 +30,7 @@ func TestEndpointTemplateMalformed(t *testing.T) { func TestTsValue(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderTappx, config.Adapter{ - Endpoint: "https://{{.Host}}"}) + Endpoint: "http://{{.Host}}"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) @@ -47,7 +47,7 @@ func TestTsValue(t *testing.T) { url, err := bidderTappx.buildEndpointURL(&tappxExt, test) - match, err := regexp.MatchString(`https://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.1`, url) + match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.1`, url) if err != nil { t.Errorf("Error while running regex validation: %s", err.Error()) return diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-impression.json b/adapters/tappx/tappxtest/exemplary/single-banner-impression.json index 3a365db645e..4f5b792fe4f 100644 --- a/adapters/tappx/tappxtest/exemplary/single-banner-impression.json +++ b/adapters/tappx/tappxtest/exemplary/single-banner-impression.json @@ -12,8 +12,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } @@ -33,7 +33,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", "body": { "id": "0000000000001", "test": 1, @@ -47,8 +47,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-site.json b/adapters/tappx/tappxtest/exemplary/single-banner-site.json new file mode 100644 index 00000000000..ef61b0e2567 --- /dev/null +++ b/adapters/tappx/tappxtest/exemplary/single-banner-site.json @@ -0,0 +1,124 @@ +{ + "mockBidRequest": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "adunit-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-site-9876", + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" + } + } + } + ], + "site": { + "id": "102855", + "cat": [ "IAB3-1" ], + "domain": "www.tappx.com", + "page": "https://www.tappx.com/example.html ", + "publisher": { + "id": "8953", "name": "publisher.com", + "cat": [ "IAB3-1" ], + "domain": "publisher.com" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.1", + "body": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "adunit-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-site-9876", + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" + } + } + } + ], + "site": { + "id": "102855", + "cat": [ "IAB3-1" ], + "domain": "www.tappx.com", + "page": "https://www.tappx.com/example.html ", + "publisher": { + "id": "8953", "name": "publisher.com", + "cat": [ "IAB3-1" ], + "domain": "publisher.com" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "75472df2-1cb3-4f8e-9a28-10cb95fe05a4", + "seatbid": [{ + "bid": [{ + "id": "wehM-93KGr0_0_0", + "impid": "adunit-1", + "price": 0.5, + "cid": "3706", + "crid": "19005", + "adid": "19005", + "adm": "", + "cat": ["IAB2"], + "adomain": ["test.com"], + "h": 250, + "w": 300 + }] + }], + "bidid": "wehM-93KGr0" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "wehM-93KGr0_0_0", + "impid": "adunit-1", + "price": 0.5, + "adm": "", + "adid": "19005", + "adomain": ["test.com"], + "cid": "3706", + "crid": "19005", + "w": 300, + "h": 250, + "cat": ["IAB2"] + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/tappx/tappxtest/exemplary/single-video-impression.json b/adapters/tappx/tappxtest/exemplary/single-video-impression.json index 49cb3c7e568..7a469b07fb6 100644 --- a/adapters/tappx/tappxtest/exemplary/single-video-impression.json +++ b/adapters/tappx/tappxtest/exemplary/single-video-impression.json @@ -15,8 +15,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "VZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", "body": { "id": "0000000000001", "test": 1, @@ -51,8 +51,8 @@ }, "ext": { "bidder": { - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com", + "endpoint": "VZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/", "tappxkey": "pub-12345-android-9876" } } diff --git a/adapters/tappx/tappxtest/exemplary/single-video-site.json b/adapters/tappx/tappxtest/exemplary/single-video-site.json new file mode 100644 index 00000000000..9ee2f8f4187 --- /dev/null +++ b/adapters/tappx/tappxtest/exemplary/single-video-site.json @@ -0,0 +1,136 @@ +{ + "mockBidRequest": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "video-adunit-2", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-site-9876", + "endpoint": "VZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" + } + } + } + ], + "site": { + "id": "102855", + "cat": [ "IAB3-1" ], + "domain": "www.tappx.com", + "page": "https://www.tappx.com/example.html ", + "publisher": { + "id": "8953", "name": "publisher.com", + "cat": [ "IAB3-1" ], + "domain": "publisher.com" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.1", + "body": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "video-adunit-2", + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "endpoint": "VZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/", + "tappxkey": "pub-12345-site-9876" + } + } + } + ], + "site": { + "id": "102855", + "cat": [ "IAB3-1" ], + "domain": "www.tappx.com", + "page": "https://www.tappx.com/example.html ", + "publisher": { + "id": "8953", "name": "publisher.com", + "cat": [ "IAB3-1" ], + "domain": "publisher.com" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "75472df2-1cb3-4f8e-9a28-10cb95fe05a4", + "seatbid": [ + { + "bid": [ + { + "id": "bid02", + "impid": "video-adunit-2", + "price": 2.25, + "cid": "1001", + "crid": "2002", + "adid": "2002", + "adm": "", + "cat": [ + "IAB2" + ], + "adomain": [ + "video-example.com" + ] + } + ] + } + ], + "bidid": "wehM-93KGr0" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "bid02", + "impid": "video-adunit-2", + "price": 2.25, + "adm": "", + "adomain": [ + "video-example.com" + ], + "cid": "1001", + "adid": "2002", + "crid": "2002", + "cat": [ + "IAB2" + ] + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/tappx/tappxtest/params/race/banner.json b/adapters/tappx/tappxtest/params/race/banner.json index 4c2ec640ff5..9264443a5ca 100644 --- a/adapters/tappx/tappxtest/params/race/banner.json +++ b/adapters/tappx/tappxtest/params/race/banner.json @@ -1,5 +1,5 @@ { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } \ No newline at end of file diff --git a/adapters/tappx/tappxtest/params/race/video.json b/adapters/tappx/tappxtest/params/race/video.json index 4c2ec640ff5..438543f2362 100644 --- a/adapters/tappx/tappxtest/params/race/video.json +++ b/adapters/tappx/tappxtest/params/race/video.json @@ -1,5 +1,5 @@ { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "VZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } \ No newline at end of file diff --git a/adapters/tappx/tappxtest/supplemental/204status.json b/adapters/tappx/tappxtest/supplemental/204status.json index 288837b7b91..6172da59cbd 100644 --- a/adapters/tappx/tappxtest/supplemental/204status.json +++ b/adapters/tappx/tappxtest/supplemental/204status.json @@ -12,8 +12,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", "body": { "id": "0000000000001", "test": 1, @@ -44,8 +44,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/tappxtest/supplemental/banner-impression-badhost.json b/adapters/tappx/tappxtest/supplemental/banner-impression-badhost.json index c82d0e852f3..12f9c54ae02 100644 --- a/adapters/tappx/tappxtest/supplemental/banner-impression-badhost.json +++ b/adapters/tappx/tappxtest/supplemental/banner-impression-badhost.json @@ -11,7 +11,7 @@ "ext": { "bidder": { "host": "example.ho%st.tappx.com", - "endpoint": "PREBIDTEMPLATE", + "endpoint": "ZZ123456PS", "tappxkey": "pub-12345-android-9876" } } @@ -31,7 +31,7 @@ "expectedMakeRequestsErrors": [ { - "value": "Malformed URL: parse (\\\")?https://example\\.ho%st\\.tappx.com(\\\")?: invalid URL escape \\\"%st\\\"", + "value": "Malformed URL: parse (\\\")?http://example\\.ho%st\\.tappx.com(\\\")?: invalid URL escape \\\"%st\\\"", "comparison": "regex" } ] diff --git a/adapters/tappx/tappxtest/supplemental/banner-impression-noendpoint.json b/adapters/tappx/tappxtest/supplemental/banner-impression-noendpoint.json index 9a49c8b05a0..85370b4b07c 100644 --- a/adapters/tappx/tappxtest/supplemental/banner-impression-noendpoint.json +++ b/adapters/tappx/tappxtest/supplemental/banner-impression-noendpoint.json @@ -11,7 +11,7 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "host": "test.tappx.com" + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/tappxtest/supplemental/banner-impression-nohost.json b/adapters/tappx/tappxtest/supplemental/banner-impression-nohost.json index ffe0f14f949..df650dde39a 100644 --- a/adapters/tappx/tappxtest/supplemental/banner-impression-nohost.json +++ b/adapters/tappx/tappxtest/supplemental/banner-impression-nohost.json @@ -10,7 +10,7 @@ }, "ext": { "bidder": { - "endpoint": "PREBIDTEMPLATE", + "endpoint": "ZZ123456PS", "tappxkey": "pub-12345-android-9876" } } diff --git a/adapters/tappx/tappxtest/supplemental/banner-impression-nokey.json b/adapters/tappx/tappxtest/supplemental/banner-impression-nokey.json index 2bc147ec07f..4dba6d3b366 100644 --- a/adapters/tappx/tappxtest/supplemental/banner-impression-nokey.json +++ b/adapters/tappx/tappxtest/supplemental/banner-impression-nokey.json @@ -10,8 +10,8 @@ }, "ext": { "bidder": { - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/tappxtest/supplemental/bidfloor.json b/adapters/tappx/tappxtest/supplemental/bidfloor.json index 61e96a442a0..48c1b0fbfa7 100644 --- a/adapters/tappx/tappxtest/supplemental/bidfloor.json +++ b/adapters/tappx/tappxtest/supplemental/bidfloor.json @@ -12,8 +12,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com", + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/", "bidfloor": 1.5 } } @@ -34,7 +34,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", "body": { "id": "0000000000001", "test": 1, @@ -49,8 +49,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com", + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/", "bidfloor": 1.5 } } diff --git a/adapters/tappx/tappxtest/supplemental/http-err-status.json b/adapters/tappx/tappxtest/supplemental/http-err-status.json index c2db2e1eea8..045695046ff 100644 --- a/adapters/tappx/tappxtest/supplemental/http-err-status.json +++ b/adapters/tappx/tappxtest/supplemental/http-err-status.json @@ -12,8 +12,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", "body": { "id": "0000000000001", "test": 1, @@ -44,8 +44,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/tappxtest/supplemental/http-err-status2.json b/adapters/tappx/tappxtest/supplemental/http-err-status2.json index b09ee26b68e..0cb5fd4a400 100644 --- a/adapters/tappx/tappxtest/supplemental/http-err-status2.json +++ b/adapters/tappx/tappxtest/supplemental/http-err-status2.json @@ -12,8 +12,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", "body": { "id": "0000000000001", "test": 1, @@ -44,8 +44,8 @@ "ext": { "bidder": { "tappxkey": "pub-12345-android-9876", - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/tappxtest/supplemental/wrong-imp-ext-1.json b/adapters/tappx/tappxtest/supplemental/wrong-imp-ext-1.json index 1cbd3eefda1..1404204eaf1 100644 --- a/adapters/tappx/tappxtest/supplemental/wrong-imp-ext-1.json +++ b/adapters/tappx/tappxtest/supplemental/wrong-imp-ext-1.json @@ -11,8 +11,8 @@ "ext": { "bidder": { "tappxkey": 1, - "endpoint": "PREBIDTEMPLATE", - "host": "test.tappx.com" + "endpoint": "ZZ123456PS", + "host": "testing.ssp.tappx.com/rtb/v2/" } } } diff --git a/adapters/tappx/usersync.go b/adapters/tappx/usersync.go new file mode 100644 index 00000000000..7bf6b9a6094 --- /dev/null +++ b/adapters/tappx/usersync.go @@ -0,0 +1,12 @@ +package tappx + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewTappxSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("tappx", 628, temp, adapters.SyncTypeIframe) +} diff --git a/adapters/tappx/usersync_test.go b/adapters/tappx/usersync_test.go new file mode 100644 index 00000000000..65919b9f1f1 --- /dev/null +++ b/adapters/tappx/usersync_test.go @@ -0,0 +1,35 @@ +package tappx + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestTappxSyncer(t *testing.T) { + syncURL := "//testing.ssp.tappx.com/cs/usersync.php?gdpr_optin={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&type=iframe&ruid=localhost%2Fsetuid%3Fbidder%3Dtappx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7BTPPXUID%7D%7D" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewTappxSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "1", + Consent: "A", + }, + CCPA: ccpa.Policy{ + Consent: "1YNN", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "//testing.ssp.tappx.com/cs/usersync.php?gdpr_optin=1&gdpr_consent=A&us_privacy=1YNN&type=iframe&ruid=localhost%2Fsetuid%3Fbidder%3Dtappx%26gdpr%3D1%26gdpr_consent%3DA%26uid%3D%7B%7BTPPXUID%7D%7D", syncInfo.URL) + assert.Equal(t, "iframe", syncInfo.Type) + assert.EqualValues(t, 628, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go old mode 100755 new mode 100644 index ae1f62e90b4..755c8fc95c8 --- a/config/config.go +++ b/config/config.go @@ -629,7 +629,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSonobi, "https://sync.go.sonobi.com/us.gif?loc="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsonobi%26consent_string%3D{{.GDPR}}%26gdpr%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSovrn, "https://ap.lijit.com/pixel?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsovrn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSynacormedia, "https://sync.technoratimedia.com/services?srv=cs&pid=70&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsynacormedia%26uid%3D%5BUSER_ID%5D") - // openrtb_ext.BidderTappx doesn't have a good default. + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTappx, "https://ssp.api.tappx.com/cs/usersync.php?gdpr_optin={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&type=iframe&ruid="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtappx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7BTPPXUID%7D%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTelaria, "https://pbs.publishers.tremorhub.com/pubsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtelaria%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Btvid%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTriplelift, "https://eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTripleliftNative, "https://eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift_native%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") @@ -879,7 +879,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.sonobi.endpoint", "https://apex.go.sonobi.com/prebid?partnerid=71d9d3d8af") v.SetDefault("adapters.sovrn.endpoint", "http://ap.lijit.com/rtb/bid?src=prebid_server") v.SetDefault("adapters.synacormedia.endpoint", "http://{{.Host}}.technoratimedia.com/openrtb/bids/{{.Host}}") - v.SetDefault("adapters.tappx.endpoint", "https://{{.Host}}") + v.SetDefault("adapters.tappx.endpoint", "http://{{.Host}}") v.SetDefault("adapters.telaria.endpoint", "https://ads.tremorhub.com/ad/rtb/prebid") v.SetDefault("adapters.triplelift_native.disabled", true) v.SetDefault("adapters.triplelift_native.extra_info", "{\"publisher_whitelist\":[]}") diff --git a/static/bidder-info/tappx.yaml b/static/bidder-info/tappx.yaml index 4c8d1560f27..527959b75d1 100644 --- a/static/bidder-info/tappx.yaml +++ b/static/bidder-info/tappx.yaml @@ -5,3 +5,7 @@ capabilities: mediaTypes: - banner - video + site: + mediaTypes: + - banner + - video \ No newline at end of file diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go old mode 100755 new mode 100644 index c41f7c6c746..25b37fa388c --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -69,6 +69,7 @@ import ( "github.com/prebid/prebid-server/adapters/sonobi" "github.com/prebid/prebid-server/adapters/sovrn" "github.com/prebid/prebid-server/adapters/synacormedia" + "github.com/prebid/prebid-server/adapters/tappx" "github.com/prebid/prebid-server/adapters/telaria" "github.com/prebid/prebid-server/adapters/triplelift" "github.com/prebid/prebid-server/adapters/triplelift_native" @@ -156,6 +157,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderSmartRTB, smartrtb.NewSmartRTBSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderSmartyAds, smartyads.NewSmartyAdsSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderSynacormedia, synacormedia.NewSynacorMediaSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderTappx, tappx.NewTappxSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderTelaria, telaria.NewTelariaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderTriplelift, triplelift.NewTripleliftSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderTripleliftNative, triplelift_native.NewTripleliftSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 73f0e8861c5..818303b8e53 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -78,6 +78,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderSonobi): syncConfig, string(openrtb_ext.BidderSovrn): syncConfig, string(openrtb_ext.BidderSynacormedia): syncConfig, + string(openrtb_ext.BidderTappx): syncConfig, string(openrtb_ext.BidderTelaria): syncConfig, string(openrtb_ext.BidderTriplelift): syncConfig, string(openrtb_ext.BidderTripleliftNative): syncConfig, @@ -112,7 +113,6 @@ func TestNewSyncerMap(t *testing.T) { openrtb_ext.BidderRevcontent: true, openrtb_ext.BidderSilverMob: true, openrtb_ext.BidderSmaato: true, - openrtb_ext.BidderTappx: true, openrtb_ext.BidderYeahmobi: true, } From 56dfc60d99d11ce602147bcce6a120b77b564937 Mon Sep 17 00:00:00 2001 From: Jim Naumann Date: Thu, 11 Feb 2021 11:00:00 -0500 Subject: [PATCH 02/91] Beachfront Additional tests (#1679) * added place holder files for all but a couple of the intended new tests. I need to grok what those couple mean before being able to name a file. * This covers most of the suggested cases and a couple more that occured to me. I'll look at the couple that I held off on next. * added the unmarshal tests and found a couple problems to address in the process. * removed my __debug_bin. should be in gitignore. * A bit of clean up and commenting. Bumped version number. Added __debug_bin to .gitignore. This is the debugging binary created by Visual Studio Code, or at least version 1.52.1. * missed a bunch of version strings * removed IP faker * If IP is not included in an AdM request, an error is now thrown for the AdM imp instead of faking it. The AdM endpoint is the only one that requires an IP. Also, added several "no-ip" test cases. * Whent back to the fake IP solution instead of the error. Removed most of the "no-ip" test cases, leaving one. * changed ip in adm-video.json to not match the faker ip * removed a debugging comment --- .gitignore | 1 + adapters/beachfront/beachfront.go | 95 +++++++------- .../beachfronttest/exemplary/adm-video.json | 123 ++++++++++++++++++ .../beachfronttest/exemplary/banner.json | 2 +- .../adm-video-by-explicit.json} | 0 .../adm-video-no-ip.json} | 3 - .../banner-and-adm-video-by-explicit.json} | 11 +- .../banner-and-adm-video.json} | 11 +- .../banner-and-nurl-video.json | 5 +- .../supplemental/banner-bad-request-400.json | 76 +++++++++++ .../supplemental/banner-empty_array-200.json | 11 +- .../supplemental/banner-no-appid.json | 34 +++++ .../supplemental/banner-wrong-appids.json | 36 +++++ ...er_response_unmarshal_error_adm_video.json | 80 ++++++++++++ ...idder_response_unmarshal_error_banner.json | 77 +++++++++++ ...r_response_unmarshal_error_nurl_video.json | 82 ++++++++++++ .../supplemental/bidfloor-below-min.json | 96 ++++++++++++++ .../internal-server-error-500.json | 78 +++++++++++ .../beachfronttest/supplemental/no-imps.json | 16 +++ ...dm-nurl--PASS.json => six-nine-combo.json} | 23 +++- .../supplemental/two-four-combo.json | 2 +- .../supplemental/video-no-appid.json | 38 ++++++ .../supplemental/video-wrong-appids.json | 39 ++++++ 23 files changed, 877 insertions(+), 62 deletions(-) create mode 100644 adapters/beachfront/beachfronttest/exemplary/adm-video.json rename adapters/beachfront/beachfronttest/{exemplary/adm-video-by-explicit-type.json => supplemental/adm-video-by-explicit.json} (100%) rename adapters/beachfront/beachfronttest/{exemplary/adm-video-by-default.json => supplemental/adm-video-no-ip.json} (98%) rename adapters/beachfront/beachfronttest/{exemplary/banner-and-adm-video-by-explicit-type.json => supplemental/banner-and-adm-video-by-explicit.json} (95%) rename adapters/beachfront/beachfronttest/{exemplary/banner-and-adm-video-by-default.json => supplemental/banner-and-adm-video.json} (95%) rename adapters/beachfront/beachfronttest/{exemplary => supplemental}/banner-and-nurl-video.json (97%) create mode 100644 adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/banner-no-appid.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/banner-wrong-appids.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_adm_video.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_nurl_video.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/internal-server-error-500.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/no-imps.json rename adapters/beachfront/beachfronttest/supplemental/{six-nine-combo--response-order--banner-adm-nurl--PASS.json => six-nine-combo.json} (95%) create mode 100644 adapters/beachfront/beachfronttest/supplemental/video-no-appid.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/video-wrong-appids.json diff --git a/.gitignore b/.gitignore index 79076f9be84..514e217b46c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ vendor prebid-server build debug +__debug_bin # config files pbs.* diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 1f81eda03de..3a431c9cf3a 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "net/http" - "reflect" "strconv" "strings" @@ -24,12 +23,13 @@ const defaultVideoEndpoint = "https://reachms.bfmio.com/bid.json?exchange_id" const nurlVideoEndpointSuffix = "&prebidserver" const beachfrontAdapterName = "BF_PREBID_S2S" -const beachfrontAdapterVersion = "0.9.1" +const beachfrontAdapterVersion = "0.9.2" const minBidFloor = 0.01 -const DefaultVideoWidth = 300 -const DefaultVideoHeight = 250 +const defaultVideoWidth = 300 +const defaultVideoHeight = 250 +const fakeIP = "255.255.255.255" type BeachfrontAdapter struct { bannerEndpoint string @@ -249,16 +249,12 @@ func getAppId(ext openrtb_ext.ExtImpBeachfront, media openrtb_ext.BidType) (stri var appid string var error error - if fmt.Sprintf("%s", reflect.TypeOf(ext.AppId)) == "string" && - ext.AppId != "" { - + if ext.AppId != "" { appid = ext.AppId - } else if fmt.Sprintf("%s", reflect.TypeOf(ext.AppIds)) == "openrtb_ext.ExtImpBeachfrontAppIds" { - if media == openrtb_ext.BidTypeVideo && ext.AppIds.Video != "" { - appid = ext.AppIds.Video - } else if media == openrtb_ext.BidTypeBanner && ext.AppIds.Banner != "" { - appid = ext.AppIds.Banner - } + } else if media == openrtb_ext.BidTypeVideo && ext.AppIds.Video != "" { + appid = ext.AppIds.Video + } else if media == openrtb_ext.BidTypeBanner && ext.AppIds.Banner != "" { + appid = ext.AppIds.Banner } else { error = errors.New("unable to determine the appId(s) from the supplied extension") } @@ -317,7 +313,7 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e } if request.Device != nil { - bfr.IP = getIP(request.Device.IP) + bfr.IP = request.Device.IP bfr.DeviceModel = request.Device.Model bfr.DeviceOs = request.Device.OS if request.Device.DNT != nil { @@ -399,6 +395,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } appid, err := getAppId(beachfrontExt, openrtb_ext.BidTypeVideo) + bfReqs[i].AppId = appid if err != nil { // Failed to get an appid, so this request is junk. @@ -407,20 +404,25 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] continue } - bfReqs[i].AppId = appid + bfReqs[i].Request = *request + var secure int8 + + if bfReqs[i].Request.Device == nil { + bfReqs[i].Request.Device = &openrtb.Device{} + } - if beachfrontExt.VideoResponseType != "" { - bfReqs[i].VideoResponseType = beachfrontExt.VideoResponseType + if beachfrontExt.VideoResponseType == "nurl" { + bfReqs[i].VideoResponseType = "nurl" } else { bfReqs[i].VideoResponseType = "adm" - } - bfReqs[i].Request = *request - var secure int8 + if bfReqs[i].Request.Device.IP == "" { + bfReqs[i].Request.Device.IP = fakeIP + } + } if bfReqs[i].Request.Site != nil && bfReqs[i].Request.Site.Domain == "" && bfReqs[i].Request.Site.Page != "" { bfReqs[i].Request.Site.Domain = getDomain(bfReqs[i].Request.Site.Page) - secure = isSecure(bfReqs[i].Request.Site.Page) } @@ -433,7 +435,6 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] fmt.Sprintf("%s.%s", chunks[len(chunks)-(len(chunks)-1)], chunks[0]) } } - } if bfReqs[i].Request.Device != nil && bfReqs[i].Request.Device.DeviceType == 0 { @@ -454,8 +455,8 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } if imp.Video.H == 0 && imp.Video.W == 0 { - imp.Video.W = DefaultVideoWidth - imp.Video.H = DefaultVideoHeight + imp.Video.W = defaultVideoWidth + imp.Video.H = defaultVideoHeight } if len(bfReqs[i].Request.Cur) == 0 { @@ -467,9 +468,6 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] bfReqs[i].Request.Imp = make([]openrtb.Imp, 1, 1) bfReqs[i].Request.Imp[0] = imp - if bfReqs[i].Request.Device != nil && bfReqs[i].Request.Device.IP != "" { - bfReqs[i].Request.Device.IP = getIP(bfReqs[i].Request.Device.IP) - } } // Strip out any failed requests @@ -484,15 +482,24 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var bids []openrtb.Bid - var errs []error + // The case of response status == 200 and response body length == 2 below covers the case of the banner endpoint returning + // an empty JSON array ('[]'), which is functionally no content. if response.StatusCode == http.StatusNoContent || (response.StatusCode == http.StatusOK && len(response.Body) <= 2) { - return nil, nil + return nil, []error{&errortypes.BadInput{ + Message: fmt.Sprintf("no content or truncated content received from server. status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri), + }} + } + + if response.StatusCode >= http.StatusInternalServerError { + return nil, []error{&errortypes.BadInput{ + Message: fmt.Sprintf("server error status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri), + }} } - if response.StatusCode == http.StatusBadRequest { + if response.StatusCode >= http.StatusBadRequest { return nil, []error{&errortypes.BadInput{ - Message: fmt.Sprintf("bad request status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri), + Message: fmt.Sprintf("request error status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri), }} } @@ -501,6 +508,7 @@ func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern } var xtrnal openrtb.BidRequest + var errs = make([]error, 0) // For video, which uses RTB for the external request, this will unmarshal as expected. For banner, it will // only get the User struct and everything else will be nil @@ -550,18 +558,15 @@ func (a *BeachfrontAdapter) getBidType(externalRequest *adapters.RequestData) op func postprocess(response *adapters.ResponseData, xtrnal openrtb.BidRequest, uri string, id string) ([]openrtb.Bid, []error) { var beachfrontResp []beachfrontResponseSlot - var errs = make([]error, 0) var openrtbResp openrtb.BidResponse - // try it as a video - if err := json.Unmarshal(response.Body, &openrtbResp); err != nil { - errs = append(errs, err) + if err := json.Unmarshal(response.Body, &openrtbResp); err != nil || len(openrtbResp.SeatBid) == 0 { - // try it as a banner if err := json.Unmarshal(response.Body, &beachfrontResp); err != nil { - errs = append(errs, err) - return nil, errs + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprint("server response failed to unmarshal as valid rtb. Run with request.debug = 1 for more info"), + }} } else { return postprocessBanner(beachfrontResp, id) } @@ -669,18 +674,12 @@ func isSecure(page string) int8 { } -func getIP(ip string) string { - // This will only effect testing. The backend will return "" for localhost IPs, - // and seems not to know what IPv6 is, so just setting it to one that is not likely to - // be used. - if ip == "" || ip == "::1" || ip == "127.0.0.1" { - return "192.168.255.255" +func removeVideoElement(slice []beachfrontVideoRequest, s int) []beachfrontVideoRequest { + if len(slice) >= s+1 { + return append(slice[:s], slice[s+1:]...) } - return ip -} -func removeVideoElement(slice []beachfrontVideoRequest, s int) []beachfrontVideoRequest { - return append(slice[:s], slice[s+1:]...) + return []beachfrontVideoRequest{} } // Builder builds a new instance of the Beachfront adapter for the given bidder with the given config. diff --git a/adapters/beachfront/beachfronttest/exemplary/adm-video.json b/adapters/beachfront/beachfronttest/exemplary/adm-video.json new file mode 100644 index 00000000000..26b050f263d --- /dev/null +++ b/adapters/beachfront/beachfronttest/exemplary/adm-video.json @@ -0,0 +1,123 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "bidfloor": 3.01, + "appId": "videoAppId1" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "context": "instream", + "w": 300, + "h": 250 + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device":{ + "ip":"192.168.168.168" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "w": 300, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "bidfloor": 3.01, + "id": "video1", + "secure": 1 + } + ], + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device":{ + "devicetype": 2, + "ip":"192.168.168.168" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "adm-video", + "seatBid": [ + { + "bid": [ + { + "id": "5fd7c8a6ff2f1f0d42ee6427", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + } + ], + "seat": "bfio-s-1" + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "video1AdmVideo", + "impid": "video1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250, + "ext": { + "duration": 30 + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/beachfront/beachfronttest/exemplary/banner.json b/adapters/beachfront/beachfronttest/exemplary/banner.json index 1eb17286e9c..e3dcffa3d08 100644 --- a/adapters/beachfront/beachfronttest/exemplary/banner.json +++ b/adapters/beachfront/beachfronttest/exemplary/banner.json @@ -56,7 +56,7 @@ "dnt": 0, "ua": "", "adapterName": "BF_PREBID_S2S", - "adapterVersion": "0.9.1", + "adapterVersion": "0.9.2", "user": {} } }, diff --git a/adapters/beachfront/beachfronttest/exemplary/adm-video-by-explicit-type.json b/adapters/beachfront/beachfronttest/supplemental/adm-video-by-explicit.json similarity index 100% rename from adapters/beachfront/beachfronttest/exemplary/adm-video-by-explicit-type.json rename to adapters/beachfront/beachfronttest/supplemental/adm-video-by-explicit.json diff --git a/adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json b/adapters/beachfront/beachfronttest/supplemental/adm-video-no-ip.json similarity index 98% rename from adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json rename to adapters/beachfront/beachfronttest/supplemental/adm-video-no-ip.json index d3fa41a23c5..842e0f3777e 100644 --- a/adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json +++ b/adapters/beachfront/beachfronttest/supplemental/adm-video-no-ip.json @@ -22,9 +22,6 @@ ], "site": { "page": "https://some.domain.us/some/page.html" - }, - "device":{ - "ip":"255.255.255.255" } }, diff --git a/adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-explicit-type.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json similarity index 95% rename from adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-explicit-type.json rename to adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json index 3482f4ef81e..c326a33a642 100644 --- a/adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-explicit-type.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json @@ -34,6 +34,9 @@ ], "site": { "page": "https://some.domain.us/some/page.html" + }, + "device":{ + "ip":"255.255.255.255" } }, @@ -64,11 +67,11 @@ "deviceModel": "", "isMobile": 0, "ua": "", - "ip": "", + "ip": "255.255.255.255", "dnt": 0, "user": {}, "adapterName": "BF_PREBID_S2S", - "adapterVersion": "0.9.1", + "adapterVersion": "0.9.2", "requestId": "banner-and-video" } }, @@ -109,6 +112,10 @@ "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html" }, + "device": { + "devicetype": 2, + "ip": "255.255.255.255" + }, "cur": [ "USD" ] diff --git a/adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-default.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json similarity index 95% rename from adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-default.json rename to adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json index bff1b76a688..f67903d0866 100644 --- a/adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-default.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json @@ -33,6 +33,9 @@ ], "site": { "page": "https://some.domain.us/some/page.html" + }, + "device": { + "ip": "255.255.255.255" } }, @@ -63,11 +66,11 @@ "deviceModel": "", "isMobile": 0, "ua": "", - "ip": "", + "ip": "255.255.255.255", "dnt": 0, "user": {}, "adapterName": "BF_PREBID_S2S", - "adapterVersion": "0.9.1", + "adapterVersion": "0.9.2", "requestId": "banner-and-video" } }, @@ -108,6 +111,10 @@ "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html" }, + "device": { + "devicetype": 2, + "ip": "255.255.255.255" + }, "cur": [ "USD" ] diff --git a/adapters/beachfront/beachfronttest/exemplary/banner-and-nurl-video.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json similarity index 97% rename from adapters/beachfront/beachfronttest/exemplary/banner-and-nurl-video.json rename to adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json index 9db714f41a1..b950d73400b 100644 --- a/adapters/beachfront/beachfronttest/exemplary/banner-and-nurl-video.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json @@ -68,7 +68,7 @@ "dnt": 0, "user": {}, "adapterName": "BF_PREBID_S2S", - "adapterVersion": "0.9.1", + "adapterVersion": "0.9.2", "requestId": "banner-and-video" } }, @@ -110,6 +110,9 @@ "page": "https://some.domain.us/some/page.html" }, "isPrebid": true, + "device": { + "devicetype": 2 + }, "cur": [ "USD" ] diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json b/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json new file mode 100644 index 00000000000..1771f393361 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json @@ -0,0 +1,76 @@ +{ + "mockBidRequest": { + "id": "some_test_ad", + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "imp": [ + { + "bidfloor": 0.02, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "bidfloor": 5.02, + "appId": "dudAppId" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/prebid_display", + "body": { + "slots": [ + { + "slot": "", + "id": "dudAppId", + "bidfloor": 5.02, + "sizes": [ + { + "w": 300, + "h": 250 + } + ] + } + ], + "domain": "some.domain.us", + "page": "https://some.domain.us/some/page.html", + "referrer": "", + "search": "", + "secure": 1, + "requestId": "some_test_ad", + "isMobile": 0, + "ip": "", + "deviceModel": "", + "deviceOs": "", + "dnt": 0, + "ua": "", + "adapterName": "BF_PREBID_S2S", + "adapterVersion": "0.9.2", + "user": {} + } + }, + "mockResponse": { + "status": 400, + "body": "" + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "request error status code 400 from https://qa.beachrtb.com/prebid_display. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json b/adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json index c90c1215f9e..8e607f67663 100644 --- a/adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json @@ -57,7 +57,7 @@ "dnt": 0, "ua": "", "adapterName": "BF_PREBID_S2S", - "adapterVersion": "0.9.1", + "adapterVersion": "0.9.2", "user": { } } @@ -69,5 +69,12 @@ } ], - "expectedBidResponses": [] + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "no content or truncated content received from server. status code 200 from https://qa.beachrtb.com/prebid_display. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] } diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-no-appid.json b/adapters/beachfront/beachfronttest/supplemental/banner-no-appid.json new file mode 100644 index 00000000000..a53dd8ce1fc --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/banner-no-appid.json @@ -0,0 +1,34 @@ +{ + "mockBidRequest": { + "id": "some_test_ad", + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "imp": [ + { + "bidfloor": 0.02, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "bidfloor": 0.02, + "appId": "" + } + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + { + "value": "unable to determine the appId(s) from the supplied extension", + "comparison": "literal" + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-wrong-appids.json b/adapters/beachfront/beachfronttest/supplemental/banner-wrong-appids.json new file mode 100644 index 00000000000..3b582648bd5 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/banner-wrong-appids.json @@ -0,0 +1,36 @@ +{ + "mockBidRequest": { + "id": "some_test_ad", + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "imp": [ + { + "bidfloor": 0.02, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "bidfloor": 0.02, + "appIds": { + "video": "theWrongAppId" + } + } + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + { + "value": "unable to determine the appId(s) from the supplied extension", + "comparison": "literal" + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_adm_video.json b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_adm_video.json new file mode 100644 index 00000000000..51c676f5076 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_adm_video.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "bidfloor": 3.01, + "appId": "videoAppId1" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "context": "instream", + "w": 300, + "h": 250 + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device":{ + "ip":"255.255.255.255" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "w": 300, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "bidfloor": 3.01, + "id": "video1", + "secure": 1 + } + ], + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device":{ + "devicetype": 2, + "ip":"255.255.255.255" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "wrong": "very very wrong.", + "alsoWrong": "not even close to right." + } + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "server response failed to unmarshal as valid rtb. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json new file mode 100644 index 00000000000..b751f763c0d --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json @@ -0,0 +1,77 @@ +{ + "mockBidRequest": { + "id": "some_test_ad", + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "imp": [ + { + "bidfloor": 0.02, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "bidfloor": 0.02, + "appId": "bannerAppId1" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/prebid_display", + "body": { + "slots": [ + { + "slot": "", + "id": "bannerAppId1", + "bidfloor": 0.02, + "sizes": [ + { + "w": 300, + "h": 250 + } + ] + } + ], + "domain": "some.domain.us", + "page": "https://some.domain.us/some/page.html", + "referrer": "", + "search": "", + "secure": 1, + "requestId": "some_test_ad", + "isMobile": 0, + "ip": "", + "deviceModel": "", + "deviceOs": "", + "dnt": 0, + "ua": "", + "adapterName": "BF_PREBID_S2S", + "adapterVersion": "0.9.2", + "user": {} + } + }, + "mockResponse": { + "status": 200, + "body": { + "wrong": "very very wrong.", + "alsoWrong": "not even close to right." + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "server response failed to unmarshal as valid rtb. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_nurl_video.json b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_nurl_video.json new file mode 100644 index 00000000000..7990b0a1bb1 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_nurl_video.json @@ -0,0 +1,82 @@ +{ + "mockBidRequest": { + "id": "adm-video", + "imp": [ + { + "id": "video1", + "ext": { + "bidder": { + "bidfloor": 3.01, + "appId": "videoAppId1", + "videoResponseType": "nurl" + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "context": "instream", + "w": 300, + "h": 250 + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device":{ + "ip":"255.255.255.255" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1&prebidserver", + "body": { + "id": "adm-video", + "imp": [ + { + "video": { + "w": 300, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "bidfloor": 3.01, + "id": "video1", + "secure": 1 + } + ], + "isPrebid": true, + "site": { + "page": "https://some.domain.us/some/page.html", + "domain": "some.domain.us" + }, + "cur": [ + "USD" + ], + "device":{ + "devicetype": 2, + "ip":"255.255.255.255" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "wrong": "very very wrong.", + "alsoWrong": "not even close to right." + } + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "server response failed to unmarshal as valid rtb. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json b/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json new file mode 100644 index 00000000000..f5d4e8228c2 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json @@ -0,0 +1,96 @@ +{ + "mockBidRequest": { + "id": "some_test_ad", + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "bidfloor": 0.002, + "appId": "bannerAppId1" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/prebid_display", + "body": { + "slots": [ + { + "slot": "", + "id": "bannerAppId1", + "bidfloor": 0, + "sizes": [ + { + "w": 300, + "h": 250 + } + ] + } + ], + "domain": "some.domain.us", + "page": "https://some.domain.us/some/page.html", + "referrer": "", + "search": "", + "secure": 1, + "requestId": "some_test_ad", + "isMobile": 0, + "ip": "", + "deviceModel": "", + "deviceOs": "", + "dnt": 0, + "ua": "", + "adapterName": "BF_PREBID_S2S", + "adapterVersion": "0.9.2", + "user": {} + } + }, + "mockResponse": { + "status": 200, + "body": [ + { + "crid": "crid_1", + "price": 2.942808, + "w": 300, + "h": 250, + "slot": "div-gpt-ad-1460505748561-0", + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] + }, + { + "seat": "45678", + "bid": [{ + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "ttl": 300, + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + } + ] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + }, + "type": "video" + }] + } + ] +} + diff --git a/adapters/jixie/jixietest/params/race/banner.json b/adapters/jixie/jixietest/params/race/banner.json new file mode 100644 index 00000000000..a0523d34c3f --- /dev/null +++ b/adapters/jixie/jixietest/params/race/banner.json @@ -0,0 +1,4 @@ +{ + "unit": "1000008-AbCdEf123400", + "bidfloor": "0.02" +} diff --git a/adapters/jixie/jixietest/params/race/video.json b/adapters/jixie/jixietest/params/race/video.json new file mode 100644 index 00000000000..b6d11e8fc4e --- /dev/null +++ b/adapters/jixie/jixietest/params/race/video.json @@ -0,0 +1,4 @@ +{ + "unit": "1000008-AbCdEf2345", + "bidfloor": "0.03" +} diff --git a/adapters/jixie/jixietest/supplemental/add-accountid.json b/adapters/jixie/jixietest/supplemental/add-accountid.json new file mode 100644 index 00000000000..d7fe7d864a6 --- /dev/null +++ b/adapters/jixie/jixietest/supplemental/add-accountid.json @@ -0,0 +1,236 @@ +{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }, { + "w": 300, + "h": 600 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf1234", + "accountid": "accountJX1234" + } + } + }, + { + "id": "some_test_ad_id_2", + "banner": { + "format": [{ + "w": 300, + "h": 50 + }], + "w": 300, + "h": 50 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf2345", + "accountid": "accountJX1234" + } + } + }, + { + "id": "some_test_ad_id_3", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf3456", + "accountid": "accountJX1234" + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36", + "ip": "111.222.333.444" + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/today/site?param1=a¶m2=b" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.jixie.io/v2/hbsvrpost", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "111.222.333.444" + ], + "Referer": [ + "http://www.publisher.com/today/site?param1=a¶m2=b" + ], + "User-Agent": [ + "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + },{ + "w": 300, + "h": 600 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf1234", + "accountid": "accountJX1234" + } + } + }, + { + "id": "some_test_ad_id_2", + "banner": { + "format": [{ + "w": 300, + "h": 50 + }], + "w": 300, + "h": 50 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf2345", + "accountid": "accountJX1234" + } + } + }, + { + "id": "some_test_ad_id_3", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf3456", + "accountid": "accountJX1234" + } + } + }], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/today/site?param1=a¶m2=b" + }, + "device": { + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36", + "ip": "111.222.333.444" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] + }, + { + "seat": "45678", + "bid": [{ + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "ttl": 300, + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + } + ] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + }, + "type": "video" + }] + } + ] +} + \ No newline at end of file diff --git a/adapters/jixie/jixietest/supplemental/add-extraprop.json b/adapters/jixie/jixietest/supplemental/add-extraprop.json new file mode 100644 index 00000000000..85c55a3620e --- /dev/null +++ b/adapters/jixie/jixietest/supplemental/add-extraprop.json @@ -0,0 +1,233 @@ +{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }, { + "w": 300, + "h": 600 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf1234", + "jxprop1": "abc" + } + } + }, + { + "id": "some_test_ad_id_2", + "banner": { + "format": [{ + "w": 300, + "h": 50 + }], + "w": 300, + "h": 50 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf2345", + "jxprop1": "def" } + } + }, + { + "id": "some_test_ad_id_3", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf3456" + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36", + "ip": "111.222.333.444" + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/today/site?param1=a¶m2=b" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.jixie.io/v2/hbsvrpost", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "111.222.333.444" + ], + "Referer": [ + "http://www.publisher.com/today/site?param1=a¶m2=b" + ], + "User-Agent": [ + "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + },{ + "w": 300, + "h": 600 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf1234", + "jxprop1": "abc" + } + } + }, + { + "id": "some_test_ad_id_2", + "banner": { + "format": [{ + "w": 300, + "h": 50 + }], + "w": 300, + "h": 50 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf2345", + "jxprop1": "def" + } + } + }, + { + "id": "some_test_ad_id_3", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf3456" + } + } + }], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/today/site?param1=a¶m2=b" + }, + "device": { + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36", + "ip": "111.222.333.444" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] + }, + { + "seat": "45678", + "bid": [{ + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "ttl": 300, + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + } + ] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + }, + "type": "video" + }] + } + ] +} + \ No newline at end of file diff --git a/adapters/jixie/jixietest/supplemental/add-userid.json b/adapters/jixie/jixietest/supplemental/add-userid.json new file mode 100644 index 00000000000..3ed30da4676 --- /dev/null +++ b/adapters/jixie/jixietest/supplemental/add-userid.json @@ -0,0 +1,237 @@ +{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }, { + "w": 300, + "h": 600 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf1234" + } + } + }, + { + "id": "some_test_ad_id_2", + "banner": { + "format": [{ + "w": 300, + "h": 50 + }], + "w": 300, + "h": 50 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf2345" + } + } + }, + { + "id": "some_test_ad_id_3", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf3456" + } + } + } + ], + "user": { + "buyeruid": "awesome-buyeruid", + "id": "awesome-id" + }, + "device": { + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36", + "ip": "111.222.333.444" + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/today/site?param1=a¶m2=b" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.jixie.io/v2/hbsvrpost", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "111.222.333.444" + ], + "Referer": [ + "http://www.publisher.com/today/site?param1=a¶m2=b" + ], + "User-Agent": [ + "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + },{ + "w": 300, + "h": 600 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf1234" + } + } + }, + { + "id": "some_test_ad_id_2", + "banner": { + "format": [{ + "w": 300, + "h": 50 + }], + "w": 300, + "h": 50 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf2345" + } + } + }, + { + "id": "some_test_ad_id_3", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "unit": "1000008-AbCdEf3456" + } + } + }], + "user": { + "buyeruid": "awesome-buyeruid", + "id": "awesome-id" + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/today/site?param1=a¶m2=b" + }, + "device": { + "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36", + "ip": "111.222.333.444" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] + }, + { + "seat": "45678", + "bid": [{ + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "ttl": 300, + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + } + ] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "adm": " JXADSERVERDEMOin-stream 00:00:10", + "id": "some_test_ad_id_3", + "impid": "some_test_ad_id_3", + "crid": "9999999", + "w": 640, + "price": 1, + "adid": "9999999", + "h": 360 + }, + "type": "video" + }] + } + ] +} + \ No newline at end of file diff --git a/adapters/jixie/params_test.go b/adapters/jixie/params_test.go new file mode 100644 index 00000000000..4bc2e3080c1 --- /dev/null +++ b/adapters/jixie/params_test.go @@ -0,0 +1,57 @@ +package jixie + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderJixie, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected jixie 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.BidderJixie, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"unit": "1000008-AA77BB88CC" }`, + `{"unit": "1000008-AA77BB88CC", "accountid": "9988776655", "jxprop1": "somethingimportant" }`, +} + +var invalidParams = []string{ + `null`, + `nil`, + ``, + `[]`, + `true`, + `{}`, + `{"unit":12345678}`, + `{"Unit":"12345678"}`, + `{"Unit": 12345678}`, + `{"AdUnit": "1"}`, + `{"adUnit": 1}`, + `{"unit": ""}`, + `{"unit": "12345678901234567"}`, + `{"unit":"1000008-AA77BB88CC", "accountid", "jxprop1": "somethingimportant" }`, + `{"unit":"1000008-AA77BB88CC", malformed, }`, +} diff --git a/adapters/jixie/usersync.go b/adapters/jixie/usersync.go new file mode 100644 index 00000000000..8c1d5c07374 --- /dev/null +++ b/adapters/jixie/usersync.go @@ -0,0 +1,12 @@ +package jixie + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewJixieSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("jixie", 0, temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/jixie/usersync_test.go b/adapters/jixie/usersync_test.go new file mode 100644 index 00000000000..5be5e51433e --- /dev/null +++ b/adapters/jixie/usersync_test.go @@ -0,0 +1,25 @@ +package jixie + +import ( + "github.com/prebid/prebid-server/privacy" + "testing" + "text/template" + + "github.com/stretchr/testify/assert" +) + +func TestJixieSyncer(t *testing.T) { + syncURL := "https://id.jixie.io/api/sync?pid=&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Djixie%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25JXUID%25%25" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewJixieSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{}) + + assert.NoError(t, err) + assert.Equal(t, "https://id.jixie.io/api/sync?pid=&gdpr=&gdpr_consent=&us_privacy=&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Djixie%26gdpr%3D%26gdpr_consent%3D%26uid%3D%25%25JXUID%25%25", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 0, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index 0db6ca61880..952249638d6 100644 --- a/config/config.go +++ b/config/config.go @@ -605,6 +605,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderImprovedigital, "https://ad.360yield.com/server_match?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D") // openrtb_ext.BidderIx doesn't have a good default. // openrtb_ext.BidderInvibes doesn't have a good default. + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderJixie, "https://id.jixie.io/api/sync?pid=&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Djixie%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25JXUID%25%25") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderKrushmedia, "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dkrushmedia%26uid%3D%5BUID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLifestreet, "https://ads.lfstmedia.com/idsync/137062?synced=1&ttl=1s&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlifestreet%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%24visitor_cookie%24%24") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLockerDome, "https://lockerdome.com/usync/prebidserver?pid="+cfg.Adapters["lockerdome"].PlatformID+"&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7Buid%7D%7D") @@ -846,6 +847,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.improvedigital.endpoint", "http://ad.360yield.com/pbs") v.SetDefault("adapters.inmobi.endpoint", "https://api.w.inmobi.com/showad/openrtb/bidder/prebid") v.SetDefault("adapters.ix.endpoint", "http://exchange.indexww.com/pbs?p=192919") + v.SetDefault("adapters.jixie.endpoint", "https://hb.jixie.io/v2/hbsvrpost") v.SetDefault("adapters.krushmedia.endpoint", "http://ads4.krushmedia.com/?c=rtb&m=req&key={{.AccountID}}") v.SetDefault("adapters.invibes.endpoint", "https://{{.Host}}/bid/ServerBidAdContent") v.SetDefault("adapters.kidoz.endpoint", "http://prebid-adapter.kidoz.net/openrtb2/auction?src=prebid-server") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 1b3e229f413..8d318ee1232 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -50,6 +50,7 @@ import ( "github.com/prebid/prebid-server/adapters/inmobi" "github.com/prebid/prebid-server/adapters/invibes" "github.com/prebid/prebid-server/adapters/ix" + "github.com/prebid/prebid-server/adapters/jixie" "github.com/prebid/prebid-server/adapters/kidoz" "github.com/prebid/prebid-server/adapters/krushmedia" "github.com/prebid/prebid-server/adapters/kubient" @@ -155,6 +156,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderInMobi: inmobi.Builder, openrtb_ext.BidderInvibes: invibes.Builder, openrtb_ext.BidderIx: ix.Builder, + openrtb_ext.BidderJixie: jixie.Builder, openrtb_ext.BidderKidoz: kidoz.Builder, openrtb_ext.BidderKrushmedia: krushmedia.Builder, openrtb_ext.BidderKubient: kubient.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 13ff4b7ff31..1e148f0a9be 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -121,6 +121,7 @@ const ( BidderInMobi BidderName = "inmobi" BidderInvibes BidderName = "invibes" BidderIx BidderName = "ix" + BidderJixie BidderName = "jixie" BidderKidoz BidderName = "kidoz" BidderKrushmedia BidderName = "krushmedia" BidderKubient BidderName = "kubient" @@ -225,6 +226,7 @@ func CoreBidderNames() []BidderName { BidderInMobi, BidderInvibes, BidderIx, + BidderJixie, BidderKidoz, BidderKrushmedia, BidderKubient, diff --git a/openrtb_ext/imp_jixie.go b/openrtb_ext/imp_jixie.go new file mode 100644 index 00000000000..8fa0570c56b --- /dev/null +++ b/openrtb_ext/imp_jixie.go @@ -0,0 +1,8 @@ +package openrtb_ext + +type ExtImpJixie struct { + Unit string `json:"unit"` + AccountId string `json:"accountid,omitempty"` + JxProp1 string `json:"jxprop1,omitempty"` + JxProp2 string `json:"jxprop2,omitempty"` +} diff --git a/static/bidder-info/jixie.yaml b/static/bidder-info/jixie.yaml new file mode 100644 index 00000000000..ac38f313da1 --- /dev/null +++ b/static/bidder-info/jixie.yaml @@ -0,0 +1,8 @@ +maintainer: + email: contact@jixie.io +modifyingVastXmlAllowed: true +capabilities: + site: + mediaTypes: + - banner + - video diff --git a/static/bidder-params/jixie.json b/static/bidder-params/jixie.json new file mode 100644 index 00000000000..d3d294fe481 --- /dev/null +++ b/static/bidder-params/jixie.json @@ -0,0 +1,27 @@ + { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Jixie Adapter Params", + "description": "A schema which validates params accepted by the Jixie adapter", + "type": "object", + "properties": { + "unit" : { + "type": "string", + "description": "The unit code of an inventory target", + "minLength": 18 + }, + "accountid" : { + "type": "string", + "description": "The accountid of an inventory target" + }, + "jxprop1" : { + "type": "string", + "description": "jxprop1 of an inventory target" + }, + "jxprop2" : { + "type": "string", + "description": "jxprop2 of an inventory target" + } + }, + "required": ["unit"] + } + diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 1d31d7d184c..87b87115405 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -44,6 +44,7 @@ import ( "github.com/prebid/prebid-server/adapters/improvedigital" "github.com/prebid/prebid-server/adapters/invibes" "github.com/prebid/prebid-server/adapters/ix" + "github.com/prebid/prebid-server/adapters/jixie" "github.com/prebid/prebid-server/adapters/krushmedia" "github.com/prebid/prebid-server/adapters/lifestreet" "github.com/prebid/prebid-server/adapters/lockerdome" @@ -133,6 +134,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderImprovedigital, improvedigital.NewImprovedigitalSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderInvibes, invibes.NewInvibesSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderIx, ix.NewIxSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderJixie, jixie.NewJixieSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderKrushmedia, krushmedia.NewKrushmediaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLifestreet, lifestreet.NewLifestreetSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLockerDome, lockerdome.NewLockerDomeSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 8e3b05a6ab8..53a0baf4b28 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -53,6 +53,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderImprovedigital): syncConfig, string(openrtb_ext.BidderInvibes): syncConfig, string(openrtb_ext.BidderIx): syncConfig, + string(openrtb_ext.BidderJixie): syncConfig, string(openrtb_ext.BidderKrushmedia): syncConfig, string(openrtb_ext.BidderLifestreet): syncConfig, string(openrtb_ext.BidderLockerDome): syncConfig, From e0c1ac51aa6648718bd800eed25e92dd30c65042 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Thu, 25 Feb 2021 11:19:20 -0500 Subject: [PATCH 18/91] Fix Regs Nil Condition (#1723) --- adapters/adform/adform.go | 4 +- .../adformtest/supplemental/regs-ext-nil.json | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 adapters/adform/adformtest/supplemental/regs-ext-nil.json diff --git a/adapters/adform/adform.go b/adapters/adform/adform.go index e84df5b8cc7..79bac580f0b 100644 --- a/adapters/adform/adform.go +++ b/adapters/adform/adform.go @@ -453,7 +453,7 @@ func openRtbToAdformRequest(request *openrtb.BidRequest) (*adformRequest, []erro gdprApplies := "" var extRegs openrtb_ext.ExtRegs - if request.Regs != nil { + if request.Regs != nil && request.Regs.Ext != nil { if err := json.Unmarshal(request.Regs.Ext, &extRegs); err != nil { errors = append(errors, &errortypes.BadInput{ Message: err.Error(), @@ -466,7 +466,7 @@ func openRtbToAdformRequest(request *openrtb.BidRequest) (*adformRequest, []erro eids := "" consent := "" - if request.User != nil { + if request.User != nil && request.User.Ext != nil { var extUser openrtb_ext.ExtUser if err := json.Unmarshal(request.User.Ext, &extUser); err == nil { consent = extUser.Consent diff --git a/adapters/adform/adformtest/supplemental/regs-ext-nil.json b/adapters/adform/adformtest/supplemental/regs-ext-nil.json new file mode 100644 index 00000000000..377c48b0445 --- /dev/null +++ b/adapters/adform/adformtest/supplemental/regs-ext-nil.json @@ -0,0 +1,53 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": { + "mid": 12345 + } + } + }], + "regs": {} + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "https://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTEyMzQ1JnJjdXI9VVNE" + }, + "mockResponse": { + "status": 200, + "body": [{ + "response": "banner", + "banner": "", + "win_bid": 0.5, + "win_cur": "USD", + "width": 300, + "height": 250, + "deal_id": null, + "win_crid": "20078830" + }] + } + }], + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 0.5, + "adm": "", + "crid": "20078830", + "w": 300, + "h": 250 + }, + "type": "banner" + }] + }] +} \ No newline at end of file From f3893c33f84cb1e0f712e106ba287ad4bb258f8b Mon Sep 17 00:00:00 2001 From: mobfxoHB <74364234+mobfxoHB@users.noreply.github.com> Date: Thu, 25 Feb 2021 20:41:03 +0200 Subject: [PATCH 19/91] Mobfox: Add rout to adexcange (#1702) Co-authored-by: mobfox --- adapters/mobfoxpb/mobfoxpb.go | 53 ++++-- adapters/mobfoxpb/mobfoxpb_test.go | 2 +- .../exemplary/simple-banner-direct-route.json | 128 +++++++++++++++ .../exemplary/simple-banner-rtb-route.json | 128 +++++++++++++++ .../mobfoxpbtest/exemplary/simple-banner.json | 132 --------------- .../exemplary/simple-video-direct-route.json | 125 ++++++++++++++ .../exemplary/simple-video-rtb-route.json | 125 ++++++++++++++ .../mobfoxpbtest/exemplary/simple-video.json | 119 -------------- .../simple-web-banner-direct-route.json | 128 +++++++++++++++ .../simple-web-banner-rtb-route.json | 128 +++++++++++++++ .../exemplary/simple-web-banner.json | 130 --------------- .../params/race/banner-direct-route.json | 3 + .../params/race/banner-rtb-route.json | 3 + .../mobfoxpbtest/params/race/banner.json | 3 - .../params/race/video-direct-route.json | 3 + .../params/race/video-rtb-route.json | 3 + .../mobfoxpbtest/params/race/video.json | 3 - .../supplemental/bad-imp-ext.json | 69 ++++---- .../supplemental/bad_response.json | 152 +++++++++--------- .../supplemental/bad_status_code.json | 142 ++++++++-------- .../supplemental/imp_ext_empty_object.json | 63 ++++---- .../supplemental/imp_ext_string.json | 63 ++++---- .../supplemental/missmatch_bid_id.json | 109 +++++++++++++ .../mobfoxpbtest/supplemental/status-204.json | 142 ++++++++-------- .../mobfoxpbtest/supplemental/status-404.json | 152 +++++++++--------- adapters/mobfoxpb/params_test.go | 4 + config/config.go | 2 +- static/bidder-params/mobfoxpb.json | 42 +++-- 28 files changed, 1343 insertions(+), 813 deletions(-) create mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-direct-route.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-rtb-route.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-direct-route.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-rtb-route.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-direct-route.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-rtb-route.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/banner-direct-route.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/banner-rtb-route.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/video-direct-route.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/video-rtb-route.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/video.json create mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/missmatch_bid_id.json diff --git a/adapters/mobfoxpb/mobfoxpb.go b/adapters/mobfoxpb/mobfoxpb.go index 5369c082c52..6982e419cd5 100644 --- a/adapters/mobfoxpb/mobfoxpb.go +++ b/adapters/mobfoxpb/mobfoxpb.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "net/http" + "strings" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb" @@ -13,6 +14,16 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) +const ( + ROUTE_NATIVE = "o" + ROUTE_RTB = "rtb" + METHOD_NATIVE = "ortb" + METHOD_RTB = "req" + MACROS_ROUTE = "__route__" + MACROS_METHOD = "__method__" + MACROS_KEY = "__key__" +) + type adapter struct { URI string } @@ -28,21 +39,36 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters // MakeRequests create bid request for mobfoxpb demand func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var err error - var tagID string - + var route string + var method string var adapterRequests []*adapters.RequestData + requestURI := a.URI reqCopy := *request imp := request.Imp[0] - tagID, err = jsonparser.GetString(imp.Ext, "bidder", "TagID") - if err != nil { - errs = append(errs, err) + tagID, errTag := jsonparser.GetString(imp.Ext, "bidder", "TagID") + key, errKey := jsonparser.GetString(imp.Ext, "bidder", "key") + if errTag != nil && errKey != nil { + errs = append(errs, &errortypes.BadInput{ + Message: fmt.Sprintf("Invalid or non existing key and tagId, atleast one should be present"), + }) return nil, errs } - imp.TagID = tagID + + if key != "" { + route = ROUTE_RTB + method = METHOD_RTB + requestURI = strings.Replace(requestURI, MACROS_KEY, key, 1) + } else if tagID != "" { + method = METHOD_NATIVE + route = ROUTE_NATIVE + } + + requestURI = strings.Replace(requestURI, MACROS_ROUTE, route, 1) + requestURI = strings.Replace(requestURI, MACROS_METHOD, method, 1) + reqCopy.Imp = []openrtb.Imp{imp} - adapterReq, err := a.makeRequest(&reqCopy) + adapterReq, err := a.makeRequest(&reqCopy, requestURI) if err != nil { errs = append(errs, err) } @@ -52,7 +78,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return adapterRequests, errs } -func (a *adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *adapter) makeRequest(request *openrtb.BidRequest, requestURI string) (*adapters.RequestData, error) { reqJSON, err := json.Marshal(request) if err != nil { @@ -64,7 +90,7 @@ func (a *adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestDat headers.Add("Accept", "application/json") return &adapters.RequestData{ Method: "POST", - Uri: a.URI, + Uri: requestURI, Body: reqJSON, Headers: headers, }, nil @@ -98,11 +124,10 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest if err != nil { errs = append(errs, err) } else { - b := &adapters.TypedBid{ + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &bid, BidType: bidType, - } - bidResponse.Bids = append(bidResponse.Bids, b) + }) } } } @@ -126,6 +151,6 @@ func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, // This shouldnt happen. Lets handle it just incase by returning an error. return "", &errortypes.BadServerResponse{ - Message: fmt.Sprintf("Failed to find impression \"%s\" ", impID), + Message: fmt.Sprintf("Failed to find impression \"%s\"", impID), } } diff --git a/adapters/mobfoxpb/mobfoxpb_test.go b/adapters/mobfoxpb/mobfoxpb_test.go index 271d30a97af..56ad948bcde 100644 --- a/adapters/mobfoxpb/mobfoxpb_test.go +++ b/adapters/mobfoxpb/mobfoxpb_test.go @@ -10,7 +10,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderMobfoxpb, config.Adapter{ - Endpoint: "http://example.com/?c=o&m=ortb"}) + Endpoint: "http://example.com/?c=__route__&m=__method__&key=__key__"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-direct-route.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-direct-route.json new file mode 100644 index 00000000000..fb6bd260f74 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-direct-route.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "key": "6" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=6", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "key": "6" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-rtb-route.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-rtb-route.json new file mode 100644 index 00000000000..7b38008536d --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner-rtb-route.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "6" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "6" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 300, + "h": 250, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner.json deleted file mode 100644 index b1936661a71..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "6", - "ext": { - "bidder": { - "TagID": "6" - } - } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - } -}, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "6", - "ext": { - "bidder": { - "TagID": "6" - } - } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "test_bid_id", - "impid": "test-imp-id", - "price": 0.27543, - "adm": "", - "cid": "test_cid", - "crid": "test_crid", - "dealid": "test_dealid", - "w": 300, - "h": 250, - "ext": { - "prebid": { - "type": "banner" - } - } - } - ] - } - ] - } - } - } - ], - - "expectedBidResponses": [ - { - "bids":[ - { - "bid": { - "id": "test_bid_id", - "impid": "test-imp-id", - "price": 0.27543, - "adm": "", - "cid": "test_cid", - "crid": "test_crid", - "dealid": "test_dealid", - "w": 300, - "h": 250, - "ext": { - "prebid": { - "type": "banner" - } - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-direct-route.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-direct-route.json new file mode 100644 index 00000000000..a949fdb1527 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-direct-route.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "key": "7" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=7", + "body": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "key": "7" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "00:01:00", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "mobfoxpb" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "00:01:00", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "ext": { + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-rtb-route.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-rtb-route.json new file mode 100644 index 00000000000..a33f0e62fc7 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video-rtb-route.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "TagID": "7" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + }, + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "protocols": [ + 2, + 5 + ], + "w": 1024, + "h": 576 + }, + "ext": { + "bidder": { + "TagID": "7" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "00:01:00", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "mobfoxpb" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "00:01:00", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "ext": { + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video.json deleted file mode 100644 index 6cdcdc5a6cc..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - }, - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "protocols": [2, 5], - "w": 1024, - "h": 576 - }, - "ext": { - "bidder": { - "TagID": "7" - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - }, - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "protocols": [2, 5], - "w": 1024, - "h": 576 - }, - "tagid": "7", - "ext": { - "bidder": { - "TagID": "7" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "test_bid_id", - "impid": "test-imp-id", - "price": 0.27543, - "adm": "00:01:00", - "cid": "test_cid", - "crid": "test_crid", - "dealid": "test_dealid", - "ext": { - "prebid": { - "type": "video" - } - } - } - ], - "seat": "mobfoxpb" - } - ], - "cur": "USD" - } - } - } - ], - - - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "test_bid_id", - "impid": "test-imp-id", - "price": 0.27543, - "adm": "00:01:00", - "cid": "test_cid", - "crid": "test_crid", - "dealid": "test_dealid", - "ext": { - "prebid": { - "type": "video" - } - } - }, - "type": "video" - } - ] - } - ] -} diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-direct-route.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-direct-route.json new file mode 100644 index 00000000000..d8727226723 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-direct-route.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "key": "8" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=8", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "key": "8" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "mobfoxpb" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-rtb-route.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-rtb-route.json new file mode 100644 index 00000000000..adbb7173848 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner-rtb-route.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "8" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "8" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "mobfoxpb" + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner.json b/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner.json deleted file mode 100644 index bba728ac1e9..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "8", - "ext": { - "bidder": { - "TagID": "8" - } - } - } - ], - "site": { - "id": "1", - "domain": "test.com" - }, - "device": { - "ip": "123.123.123.123" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "8", - "ext": { - "bidder": { - "TagID": "8" - } - } - } - ], - "site": { - "id": "1", - "domain": "test.com" - }, - "device": { - "ip": "123.123.123.123" - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "test_bid_id", - "impid": "test-imp-id", - "price": 0.27543, - "adm": "", - "cid": "test_cid", - "crid": "test_crid", - "dealid": "test_dealid", - "w": 468, - "h": 60, - "ext": { - "prebid": { - "type": "banner" - } - } - } - ], - "seat": "mobfoxpb" - } - ], - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "test_bid_id", - "impid": "test-imp-id", - "price": 0.27543, - "adm": "", - "cid": "test_cid", - "crid": "test_crid", - "dealid": "test_dealid", - "w": 468, - "h": 60, - "ext": { - "prebid": { - "type": "banner" - } - } - }, - "type": "banner" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/banner-direct-route.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/banner-direct-route.json new file mode 100644 index 00000000000..3ffcd9bf63c --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/params/race/banner-direct-route.json @@ -0,0 +1,3 @@ +{ + "TagID": "6" +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/banner-rtb-route.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/banner-rtb-route.json new file mode 100644 index 00000000000..3ce815613d1 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/params/race/banner-rtb-route.json @@ -0,0 +1,3 @@ +{ + "key": "6" +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json deleted file mode 100644 index dbdac1ad995..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "TagID": "6" -} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/video-direct-route.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/video-direct-route.json new file mode 100644 index 00000000000..1e42cfc4a05 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/params/race/video-direct-route.json @@ -0,0 +1,3 @@ +{ + "TagID": "7" +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/video-rtb-route.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/video-rtb-route.json new file mode 100644 index 00000000000..8c4421b65ef --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/params/race/video-rtb-route.json @@ -0,0 +1,3 @@ +{ + "key": "7" +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/video.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/video.json deleted file mode 100644 index 6e2e0b3803b..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/params/race/video.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "TagID": "7" -} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad-imp-ext.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad-imp-ext.json index ac3dce598eb..6f2b95a8c54 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad-imp-ext.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad-imp-ext.json @@ -1,42 +1,41 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "mobfoxpb": { + "TagID": "6" + } + } } - ] + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" }, - "tagid": "6", - "ext": { - "mobfoxpb": { - "TagID": "6" - } + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" }, - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - } - }, - "expectedMakeRequestsErrors": [ - { - "value": "Key path not found", - "comparison": "literal" - } - ] + "expectedMakeRequestsErrors": [ + { + "value": "Invalid or non existing key and tagId, atleast one should be present", + "comparison": "literal" + } + ] } \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json index 2f834c92be7..efd1ac90d9d 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json @@ -1,87 +1,85 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "17", - "ext": { - "bidder": { - "TagID": "17" - } - } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "device": { - "ip": "123.123.123.123", - "ifa": "sdjfksdf-dfsds-dsdg-dsgg" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "17", - "ext": { - "bidder": { - "TagID": "17" + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "17" + } } - } } - ], - "app": { + ], + "app": { "id": "1", "bundle": "com.wls.testwlsapplication" - }, - "device": { + }, + "device": { "ip": "123.123.123.123", "ifa": "sdjfksdf-dfsds-dsdg-dsgg" - } } - }, - "mockResponse": { - "status": 200, - "body": "" - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", - "comparison": "literal" - } - ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "17" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + } + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "comparison": "literal" + } + ] } \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_status_code.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_status_code.json index 96d3a649109..60ee36e48e3 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_status_code.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_status_code.json @@ -1,81 +1,79 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "100000000" + } + } } - ] + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" }, - "tagid": "100000000", - "ext": { - "bidder": { - "TagID": "100000000" - } - } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" + "device": {} }, - "device": {} - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "100000000", - "ext": { - "bidder": { - "TagID": "100000000" + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "100000000" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": {} } - } + }, + "mockResponse": { + "status": 400, + "body": {} } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "device": {} } - }, - "mockResponse": { - "status": 400, - "body": {} - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] + ], + "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/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_empty_object.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_empty_object.json index cc56fa25c2c..9179916e922 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_empty_object.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_empty_object.json @@ -1,38 +1,37 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": {} } - ] + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" }, - "tagid": "6", - "ext": {} - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + } }, - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - } - }, - "expectedMakeRequestsErrors": [ - { - "value": "Key path not found", - "comparison": "literal" - } - ] + "expectedMakeRequestsErrors": [ + { + "value": "Invalid or non existing key and tagId, atleast one should be present", + "comparison": "literal" + } + ] } \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_string.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_string.json index 464c9e31e39..45c32a1aa63 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_string.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_string.json @@ -1,38 +1,37 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": "" } - ] + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" }, - "tagid": "6", - "ext": "" - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" + "device": { + "ip": "123.123.123.123", + "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" + } }, - "device": { - "ip": "123.123.123.123", - "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" - } - }, - "expectedMakeRequestsErrors": [ - { - "value": "Key path not found", - "comparison": "literal" - } - ] + "expectedMakeRequestsErrors": [ + { + "value": "Invalid or non existing key and tagId, atleast one should be present", + "comparison": "literal" + } + ] } \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/missmatch_bid_id.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/missmatch_bid_id.json new file mode 100644 index 00000000000..28a1b6c72d4 --- /dev/null +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/missmatch_bid_id.json @@ -0,0 +1,109 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "8" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "8" + } + } + } + ], + "site": { + "id": "1", + "domain": "test.com" + }, + "device": { + "ip": "123.123.123.123" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id-not", + "price": 0.27543, + "adm": "", + "cid": "test_cid", + "crid": "test_crid", + "dealid": "test_dealid", + "w": 468, + "h": 60, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "mobfoxpb" + } + ], + "cur": "USD" + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Failed to find impression \"test-imp-id-not\"", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-204.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-204.json index c1091969991..e69b248d2a1 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-204.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-204.json @@ -1,82 +1,80 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "17", - "ext": { - "bidder": { - "TagID": "17" - } - } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "device": { - "ip": "123.123.123.123", - "ifa": "sdjfksdf-dfsds-dsdg-dsgg" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "17", - "ext": { - "bidder": { - "TagID": "17" + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "17" + } } - } } - ], - "app": { + ], + "app": { "id": "1", "bundle": "com.wls.testwlsapplication" - }, - "device": { + }, + "device": { "ip": "123.123.123.123", "ifa": "sdjfksdf-dfsds-dsdg-dsgg" - } } - }, - "expectedBidResponses": [], - "mockResponse": { - "status": 204, - "body": {} - } - } - ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "17" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + } + }, + "expectedBidResponses": [], + "mockResponse": { + "status": 204, + "body": {} + } + } + ] } \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-404.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-404.json index d9ef7108017..987b9daf980 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-404.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/status-404.json @@ -1,87 +1,85 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "100000000", - "ext": { - "bidder": { - "TagID": "100000000" - } - } - } - ], - "app": { - "id": "1", - "bundle": "com.wls.testwlsapplication" - }, - "device": { - "ip": "123.123.123.123", - "ifa": "sdjfksdf-dfsds-dsdg-dsgg" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://example.com/?c=o&m=ortb", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "tagid": "100000000", - "ext": { - "bidder": { - "TagID": "100000000" + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "100000000" + } } - } } - ], - "app": { + ], + "app": { "id": "1", "bundle": "com.wls.testwlsapplication" - }, - "device": { + }, + "device": { "ip": "123.123.123.123", "ifa": "sdjfksdf-dfsds-dsdg-dsgg" - } } - }, - "mockResponse": { - "status": 404, - "body": {} - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 404. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/?c=o&m=ortb&key=__key__", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "TagID": "100000000" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + } + }, + "mockResponse": { + "status": 404, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 404. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] } \ No newline at end of file diff --git a/adapters/mobfoxpb/params_test.go b/adapters/mobfoxpb/params_test.go index 59b9ec383c8..799fdcfa61b 100644 --- a/adapters/mobfoxpb/params_test.go +++ b/adapters/mobfoxpb/params_test.go @@ -37,6 +37,7 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{"TagID": "6"}`, + `{"key": "1"}`, } var invalidParams = []string{ @@ -44,4 +45,7 @@ var invalidParams = []string{ `{"tagid": "123"}`, `{"TagID": 16}`, `{"TagID": ""}`, + `{"Key": "1"}`, + `{"key": 1}`, + `{"key":""}`, } diff --git a/config/config.go b/config/config.go index 952249638d6..4cc632d1e32 100644 --- a/config/config.go +++ b/config/config.go @@ -860,7 +860,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.mediafuse.endpoint", "http://ghb.hbmp.mediafuse.com/pbs/ortb") v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/prebid/") v.SetDefault("adapters.mobilefuse.endpoint", "http://mfx.mobilefuse.com/openrtb?pub_id={{.PublisherID}}") - v.SetDefault("adapters.mobfoxpb.endpoint", "http://bes.mobfox.com/?c=o&m=ortb") + v.SetDefault("adapters.mobfoxpb.endpoint", "http://bes.mobfox.com/?c=__route__&m=__method__&key=__key__") v.SetDefault("adapters.nanointeractive.endpoint", "https://ad.audiencemanager.de/hbs") v.SetDefault("adapters.ninthdecimal.endpoint", "http://rtb.ninthdecimal.com/xp/get?pubid={{.PublisherID}}") v.SetDefault("adapters.nobid.endpoint", "https://ads.servenobid.com/ortb_adreq?tek=pbs&ver=1") diff --git a/static/bidder-params/mobfoxpb.json b/static/bidder-params/mobfoxpb.json index 0cc7a16c026..40ce83abc8e 100644 --- a/static/bidder-params/mobfoxpb.json +++ b/static/bidder-params/mobfoxpb.json @@ -1,14 +1,30 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Mobfox Adapter Params", - "description": "A schema which validates params accepted by the Mobfox adapter", - "type": "object", - "properties": { - "TagID": { - "type": "string", - "minLength": 1, - "description": "An ID which identifies the mobfox ad tag" - } - }, - "required" : [ "TagID" ] -} + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Mobfox Adapter Params", + "description": "A schema which validates params accepted by the Mobfox adapter", + "type": "object", + "properties": { + "TagID": { + "type": "string", + "minLength": 1, + "description": "An ID which identifies the mobfox ad tag" + }, + "key": { + "type": "string", + "minLength": 1, + "description": "An ID which identifies the mobfox adexchange partner" + } + }, + "oneOf": [ + { + "required": [ + "TagID" + ] + }, + { + "required": [ + "key" + ] + } + ] +} \ No newline at end of file From dc14698e3c8a129e4a3dbbe148f45f2f81eac091 Mon Sep 17 00:00:00 2001 From: TheMediaGrid <44166371+TheMediaGrid@users.noreply.github.com> Date: Wed, 3 Mar 2021 21:15:20 +0300 Subject: [PATCH 20/91] New Adapter: TrustX (#1726) --- adapters/trustx/usersync.go | 12 ++++++++++++ adapters/trustx/usersync_test.go | 30 +++++++++++++++++++++++++++++ config/config.go | 2 ++ exchange/adapter_builders.go | 1 + openrtb_ext/bidders.go | 2 ++ static/bidder-info/trustx.yaml | 11 +++++++++++ static/bidder-params/trustx.json | 13 +++++++++++++ usersync/usersyncers/syncer.go | 2 ++ usersync/usersyncers/syncer_test.go | 1 + 9 files changed, 74 insertions(+) create mode 100644 adapters/trustx/usersync.go create mode 100644 adapters/trustx/usersync_test.go create mode 100644 static/bidder-info/trustx.yaml create mode 100644 static/bidder-params/trustx.json diff --git a/adapters/trustx/usersync.go b/adapters/trustx/usersync.go new file mode 100644 index 00000000000..a617cd716a4 --- /dev/null +++ b/adapters/trustx/usersync.go @@ -0,0 +1,12 @@ +package trustx + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewTrustXSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("trustx", 686, temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/trustx/usersync_test.go b/adapters/trustx/usersync_test.go new file mode 100644 index 00000000000..ced0d21552b --- /dev/null +++ b/adapters/trustx/usersync_test.go @@ -0,0 +1,30 @@ +package trustx + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestTrustXSyncer(t *testing.T) { + syncURL := "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewTrustXSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "0", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 686, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index 4cc632d1e32..d31e0630a59 100644 --- a/config/config.go +++ b/config/config.go @@ -636,6 +636,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTelaria, "https://pbs.publishers.tremorhub.com/pubsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtelaria%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Btvid%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTriplelift, "https://eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTripleliftNative, "https://eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift_native%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTrustX, "https://x.bidswitch.net/check_uuid/"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtrustx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BBSW_UUID%7D?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUcfunnel, "https://sync.aralego.com/idsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&usprivacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ducfunnel%26uid%3DSspCookieUserId") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderValueImpression, "https://rtb.valueimpression.com/usersync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvalueimpression%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") @@ -892,6 +893,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.triplelift_native.disabled", true) v.SetDefault("adapters.triplelift_native.extra_info", "{\"publisher_whitelist\":[]}") v.SetDefault("adapters.triplelift.endpoint", "https://tlx.3lift.com/s2s/auction?sra=1&supplier_id=20") + v.SetDefault("adapters.trustx.endpoint", "https://grid.bidswitch.net/sp_bid?sp=trustx") v.SetDefault("adapters.ucfunnel.endpoint", "https://pbs.aralego.com/prebid") v.SetDefault("adapters.unruly.endpoint", "http://targeting.unrulymedia.com/openrtb/2.2") v.SetDefault("adapters.valueimpression.endpoint", "https://rtb.valueimpression.com/endpoint") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 8d318ee1232..b5d1dc7eab9 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -196,6 +196,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderTelaria: telaria.Builder, openrtb_ext.BidderTriplelift: triplelift.Builder, openrtb_ext.BidderTripleliftNative: triplelift_native.Builder, + openrtb_ext.BidderTrustX: grid.Builder, openrtb_ext.BidderUcfunnel: ucfunnel.Builder, openrtb_ext.BidderUnruly: unruly.Builder, openrtb_ext.BidderValueImpression: valueimpression.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 1e148f0a9be..20d6041f51c 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -162,6 +162,7 @@ const ( BidderTelaria BidderName = "telaria" BidderTriplelift BidderName = "triplelift" BidderTripleliftNative BidderName = "triplelift_native" + BidderTrustX BidderName = "trustx" BidderUcfunnel BidderName = "ucfunnel" BidderUnruly BidderName = "unruly" BidderValueImpression BidderName = "valueimpression" @@ -267,6 +268,7 @@ func CoreBidderNames() []BidderName { BidderTelaria, BidderTriplelift, BidderTripleliftNative, + BidderTrustX, BidderUcfunnel, BidderUnruly, BidderValueImpression, diff --git a/static/bidder-info/trustx.yaml b/static/bidder-info/trustx.yaml new file mode 100644 index 00000000000..9ce52c1116a --- /dev/null +++ b/static/bidder-info/trustx.yaml @@ -0,0 +1,11 @@ +maintainer: + email: "grid-tech@themediagrid.com" +capabilities: + app: + mediaTypes: + - banner + - video + site: + mediaTypes: + - banner + - video diff --git a/static/bidder-params/trustx.json b/static/bidder-params/trustx.json new file mode 100644 index 00000000000..efedf9de537 --- /dev/null +++ b/static/bidder-params/trustx.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "TrustX Adapter Params", + "description": "A schema which validates params accepted by TrustX adapter", + "type": "object", + "properties": { + "uid": { + "type": "integer", + "description": "An ID which identifies this placement of the impression" + } + }, + "required": [] +} diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 87b87115405..72159ad6738 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -75,6 +75,7 @@ import ( "github.com/prebid/prebid-server/adapters/telaria" "github.com/prebid/prebid-server/adapters/triplelift" "github.com/prebid/prebid-server/adapters/triplelift_native" + "github.com/prebid/prebid-server/adapters/trustx" "github.com/prebid/prebid-server/adapters/ucfunnel" "github.com/prebid/prebid-server/adapters/unruly" "github.com/prebid/prebid-server/adapters/valueimpression" @@ -165,6 +166,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderTelaria, telaria.NewTelariaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderTriplelift, triplelift.NewTripleliftSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderTripleliftNative, triplelift_native.NewTripleliftSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderTrustX, trustx.NewTrustXSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderUcfunnel, ucfunnel.NewUcfunnelSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderUnruly, unruly.NewUnrulySyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderValueImpression, valueimpression.NewValueImpressionSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 53a0baf4b28..e70abe629ff 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -84,6 +84,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderTelaria): syncConfig, string(openrtb_ext.BidderTriplelift): syncConfig, string(openrtb_ext.BidderTripleliftNative): syncConfig, + string(openrtb_ext.BidderTrustX): syncConfig, string(openrtb_ext.BidderUcfunnel): syncConfig, string(openrtb_ext.BidderUnruly): syncConfig, string(openrtb_ext.BidderValueImpression): syncConfig, From ee2ec39d520fc12daa8e567ad93b6b9cf3d23e10 Mon Sep 17 00:00:00 2001 From: faithnh Date: Thu, 4 Mar 2021 13:07:56 +0900 Subject: [PATCH 21/91] New Adapter: UNICORN (#1719) * add bidder-info, bidder-params for UNICORN * Add adapter --- adapters/unicorn/params_test.go | 61 +++++ adapters/unicorn/unicorn.go | 244 ++++++++++++++++++ adapters/unicorn/unicorn_test.go | 20 ++ .../exemplary/banner-app-no-source.json | 228 ++++++++++++++++ .../exemplary/banner-app-with-ip.json | 236 +++++++++++++++++ .../exemplary/banner-app-with-ipv6.json | 236 +++++++++++++++++ .../exemplary/banner-app-without-ext.json | 212 +++++++++++++++ .../banner-app-without-placementid.json | 231 +++++++++++++++++ .../unicorntest/exemplary/banner-app.json | 232 +++++++++++++++++ .../exemplary/banner-app_with_fpd.json | 244 ++++++++++++++++++ .../exemplary/banner-app_with_no_fpd.json | 238 +++++++++++++++++ .../unicorntest/params/race/banner.json | 6 + .../unicorn/unicorntest/supplemental/204.json | 170 ++++++++++++ .../unicorn/unicorntest/supplemental/400.json | 175 +++++++++++++ .../unicorn/unicorntest/supplemental/500.json | 175 +++++++++++++ .../supplemental/ccpa-is-enabled.json | 80 ++++++ .../supplemental/coppa-is-enabled.json | 78 ++++++ .../supplemental/gdpr-is-enabled.json | 80 ++++++ .../supplemental/no-imp-ext-prebid.json | 67 +++++ .../unicorntest/supplemental/no-imp-ext.json | 62 +++++ .../supplemental/no-storedrequest-imp.json | 69 +++++ config/config.go | 2 + exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_unicorn.go | 9 + static/bidder-info/unicorn.yaml | 6 + static/bidder-params/unicorn.json | 25 ++ usersync/usersyncers/syncer_test.go | 1 + 28 files changed, 3191 insertions(+) create mode 100644 adapters/unicorn/params_test.go create mode 100644 adapters/unicorn/unicorn.go create mode 100644 adapters/unicorn/unicorn_test.go create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json create mode 100644 adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json create mode 100644 adapters/unicorn/unicorntest/params/race/banner.json create mode 100644 adapters/unicorn/unicorntest/supplemental/204.json create mode 100644 adapters/unicorn/unicorntest/supplemental/400.json create mode 100644 adapters/unicorn/unicorntest/supplemental/500.json create mode 100644 adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json create mode 100644 adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json create mode 100644 adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json create mode 100644 adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json create mode 100644 adapters/unicorn/unicorntest/supplemental/no-imp-ext.json create mode 100644 adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json create mode 100644 openrtb_ext/imp_unicorn.go create mode 100644 static/bidder-info/unicorn.yaml create mode 100644 static/bidder-params/unicorn.json diff --git a/adapters/unicorn/params_test.go b/adapters/unicorn/params_test.go new file mode 100644 index 00000000000..4a534208e84 --- /dev/null +++ b/adapters/unicorn/params_test.go @@ -0,0 +1,61 @@ +package unicorn + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range validParams { + if err := validator.Validate(openrtb_ext.BidderUnicorn, json.RawMessage(p)); err != nil { + t.Errorf("Schema rejected valid params: %s", p) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderUnicorn, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{ + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }`, + `{ + "accountId": 199578, + "mediaId": "test_media" + }`, +} + +var invalidParams = []string{ + `{}`, + `{ + "accountId": "199578", + "publisherId": "123456", + "mediaId": 12345, + "placementId": 12345 + }`, + `{ + "publisherId": 123456, + "placementId": "test_placement" + }`, +} diff --git a/adapters/unicorn/unicorn.go b/adapters/unicorn/unicorn.go new file mode 100644 index 00000000000..52441e1a882 --- /dev/null +++ b/adapters/unicorn/unicorn.go @@ -0,0 +1,244 @@ +package unicorn + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" +) + +type adapter struct { + endpoint string +} + +// unicornImpExt is imp ext for UNICORN +type unicornImpExt struct { + Context *unicornImpExtContext `json:"context,omitempty"` + Bidder openrtb_ext.ExtImpUnicorn `json:"bidder"` +} + +type unicornImpExtContext struct { + Data interface{} `json:"data,omitempty"` +} + +// unicornExt is ext for UNICORN +type unicornExt struct { + Prebid *openrtb_ext.ExtImpPrebid `json:"prebid,omitempty"` + AccountID int64 `json:"accountId,omitempty"` +} + +// Builder builds a new instance of the UNICORN adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +// MakeRequests makes the HTTP requests which should be made to fetch bids. +func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var extRegs openrtb_ext.ExtRegs + if request.Regs != nil { + if request.Regs.COPPA == 1 { + return nil, []error{&errortypes.BadInput{ + Message: "COPPA is not supported", + }} + } + if err := json.Unmarshal(request.Regs.Ext, &extRegs); err == nil { + if extRegs.GDPR != nil && (*extRegs.GDPR == 1) { + return nil, []error{&errortypes.BadInput{ + Message: "GDPR is not supported", + }} + } + if extRegs.USPrivacy != "" { + return nil, []error{&errortypes.BadInput{ + Message: "CCPA is not supported", + }} + } + } + } + + err := modifyImps(request) + if err != nil { + return nil, []error{err} + } + + var modifiableSource openrtb.Source + if request.Source != nil { + modifiableSource = *request.Source + } else { + modifiableSource = openrtb.Source{} + } + modifiableSource.Ext = setSourceExt() + request.Source = &modifiableSource + + request.Ext, err = setExt(request) + if err != nil { + return nil, []error{err} + } + + requestJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + Headers: getHeaders(request), + } + + return []*adapters.RequestData{requestData}, nil +} + +func getHeaders(request *openrtb.BidRequest) http.Header { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("X-Openrtb-Version", "2.5") + + if request.Device != nil { + if len(request.Device.UA) > 0 { + headers.Add("User-Agent", request.Device.UA) + } + + if len(request.Device.IPv6) > 0 { + headers.Add("X-Forwarded-For", request.Device.IPv6) + } + + if len(request.Device.IP) > 0 { + headers.Add("X-Forwarded-For", request.Device.IP) + } + } + + return headers +} + +func modifyImps(request *openrtb.BidRequest) error { + for i := 0; i < len(request.Imp); i++ { + imp := &request.Imp[i] + + var ext unicornImpExt + err := json.Unmarshal(imp.Ext, &ext) + + if err != nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Error while decoding imp[%d].ext: %s", i, err), + } + } + + if ext.Bidder.PlacementID == "" { + ext.Bidder.PlacementID, err = getStoredRequestImpID(imp) + if err != nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Error get StoredRequestImpID from imp[%d]: %s", i, err), + } + } + } + + imp.Ext, err = json.Marshal(ext) + if err != nil { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Error while encoding imp[%d].ext: %s", i, err), + } + } + + secure := int8(1) + imp.Secure = &secure + imp.TagID = ext.Bidder.PlacementID + } + return nil +} + +func getStoredRequestImpID(imp *openrtb.Imp) (string, error) { + v, err := jsonparser.GetString(imp.Ext, "prebid", "storedrequest", "id") + + if err != nil { + return "", fmt.Errorf("stored request id not found: %s", err) + } + + return v, nil +} + +func setSourceExt() json.RawMessage { + return json.RawMessage(`{"stype": "prebid_server_uncn", "bidder": "unicorn"}`) +} + +func setExt(request *openrtb.BidRequest) (json.RawMessage, error) { + accountID, err := jsonparser.GetInt(request.Imp[0].Ext, "bidder", "accountId") + if err != nil { + accountID = 0 + } + var decodedExt *unicornExt + err = json.Unmarshal(request.Ext, &decodedExt) + if err != nil { + decodedExt = &unicornExt{ + Prebid: nil, + } + } + decodedExt.AccountID = accountID + + ext, err := json.Marshal(decodedExt) + if err != nil { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("Error while encoding ext, err: %s", err), + } + } + return ext, nil +} + +// MakeBids unpacks the server's response into Bids. +func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + + if responseData.StatusCode == http.StatusNoContent { + return nil, nil + } + + if responseData.StatusCode == http.StatusBadRequest { + err := &errortypes.BadInput{ + Message: "Unexpected http status code: 400", + } + return nil, []error{err} + } + + if responseData.StatusCode != http.StatusOK { + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected http status code: %d", responseData.StatusCode), + } + return nil, []error{err} + } + + var response openrtb.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur + for _, seatBid := range response.SeatBid { + for _, bid := range seatBid.Bid { + bid := bid + var bidType openrtb_ext.BidType + for _, imp := range request.Imp { + if imp.ID == bid.ImpID { + if imp.Banner != nil { + bidType = openrtb_ext.BidTypeBanner + } + } + } + b := &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + return bidResponse, nil +} diff --git a/adapters/unicorn/unicorn_test.go b/adapters/unicorn/unicorn_test.go new file mode 100644 index 00000000000..1a0d67d29f7 --- /dev/null +++ b/adapters/unicorn/unicorn_test.go @@ -0,0 +1,20 @@ +package unicorn + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderUnicorn, config.Adapter{ + Endpoint: "https://ds.uncn.jp"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "unicorntest", bidder) +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json b/adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json new file mode 100644 index 00000000000..c37c2095d48 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-no-source.json @@ -0,0 +1,228 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + } + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json new file mode 100644 index 00000000000..2d38a990db3 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ip.json @@ -0,0 +1,236 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "ip": "12.1.2.3", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "ip": "12.1.2.3", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json new file mode 100644 index 00000000000..595741a0aa1 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-with-ipv6.json @@ -0,0 +1,236 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "ipv6": "2400:2410:9120:3400:15f3:8c50:3a0:6820", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "ipv6": "2400:2410:9120:3400:15f3:8c50:3a0:6820", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json b/adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json new file mode 100644 index 00000000000..8b5423a5556 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-without-ext.json @@ -0,0 +1,212 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 78.3, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 78.3, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json b/adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json new file mode 100644 index 00000000000..c05d3b6f536 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app-without-placementid.json @@ -0,0 +1,231 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media" + } + } + } + ], + "cur": ["USD"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["USD"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_unicorn" + } + }, + "tagid": "test_unicorn", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "USD", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 0.783, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "USD", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 0.783, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app.json b/adapters/unicorn/unicorntest/exemplary/banner-app.json new file mode 100644 index 00000000000..b29c1e1d625 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app.json @@ -0,0 +1,232 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json b/adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json new file mode 100644 index 00000000000..0a6fb420adc --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app_with_fpd.json @@ -0,0 +1,244 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": { + "firstPartyData1": ["firstPartyData1"], + "uuid": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"] + } + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": { + "firstPartyData1": ["firstPartyData1"], + "uuid": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"] + } + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json b/adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json new file mode 100644 index 00000000000..022246382f8 --- /dev/null +++ b/adapters/unicorn/unicorntest/exemplary/banner-app_with_no_fpd.json @@ -0,0 +1,238 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": {} + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + }, + "context": { + "data": {} + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "url": "https://ds.uncn.jp", + "status": 200, + "headers": { + "Content-Type": ["application/json"], + "Date": ["Thu, 04 Feb 2021 06:36:31 GMT"], + "Vary": ["Accept-Encoding"] + }, + "body": { + "bidid": "f1248280-24ec-4fbc-bdf5-6a866e7dcea4", + "cur": "JPY", + "ext": {}, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "seatbid": [ + { + "bid": [ + { + "adid": "uoNYbq1L_-123456", + "adm": "awesome domain", + "adomain": ["example.com"], + "attr": [], + "bundle": "example.com", + "cid": "7314", + "crid": "-123456", + "ext": {}, + "h": 250, + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "iurl": "https://example.com/banner.png", + "price": 73.283, + "w": 300 + } + ], + "group": 0, + "seat": "274" + } + ], + "units": 0 + } + } + } + ], + "expectedBidResponses": [ + { + "Currency": "JPY", + "bids": [ + { + "Bid": { + "id": "1", + "impid": "29D2F33E-F865-40DA-9320-16EF77935254", + "price": 73.283, + "adm": "awesome domain", + "adid": "uoNYbq1L_-123456", + "adomain": ["example.com"], + "bundle": "example.com", + "iurl": "https://example.com/banner.png", + "cid": "7314", + "crid": "-123456", + "w": 300, + "h": 250, + "ext": {} + }, + "type": "banner", + "BidType": "banner", + "BidVideo": null, + "DealPriority": 0 + } + ] + } + ] +} diff --git a/adapters/unicorn/unicorntest/params/race/banner.json b/adapters/unicorn/unicorntest/params/race/banner.json new file mode 100644 index 00000000000..668983e3d19 --- /dev/null +++ b/adapters/unicorn/unicorntest/params/race/banner.json @@ -0,0 +1,6 @@ +{ + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" +} diff --git a/adapters/unicorn/unicorntest/supplemental/204.json b/adapters/unicorn/unicorntest/supplemental/204.json new file mode 100644 index 00000000000..a05864090ea --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/204.json @@ -0,0 +1,170 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} + diff --git a/adapters/unicorn/unicorntest/supplemental/400.json b/adapters/unicorn/unicorntest/supplemental/400.json new file mode 100644 index 00000000000..6578082ca19 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/400.json @@ -0,0 +1,175 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected http status code: 400", + "comparison": "literal" + } + ] +} + diff --git a/adapters/unicorn/unicorntest/supplemental/500.json b/adapters/unicorn/unicorntest/supplemental/500.json new file mode 100644 index 00000000000..c0811be4b24 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/500.json @@ -0,0 +1,175 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + }, + "ext": { + "prebid": { + "targeting": {}, + "cache": { + "bids": {} + }, + "storedrequest": { + "id": "test" + } + } + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://ds.uncn.jp", + "body": { + "app": { + "bundle": "net.ada.test", + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "publisher": { + "id": "test" + }, + "ver": "1.9.0" + }, + "at": 1, + "cur": ["JPY"], + "device": { + "connectiontype": 1, + "ext": { + "atts": 0 + }, + "h": 568, + "ifa": "00000000-0000-0000-0000-000000000000", + "make": "Apple", + "model": "Simulator", + "os": "iOS", + "osv": "14.4", + "pxratio": 2, + "w": 320 + }, + "ext": { + "prebid": { + "bidder": null, + "is_rewarded_inventory": 0, + "storedrequest": { + "id": "test" + } + }, + "accountId": 199578 + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "imp": [ + { + "banner": { + "api": [5], + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + }, + "tagid": "test_placement", + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "source": { + "ext": { + "bidder": "unicorn", + "stype": "prebid_server_uncn" + }, + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "user": { + "gender": "O" + } + } + }, + "mockResponse": { + "status": 500, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected http status code: 500", + "comparison": "literal" + } + ] +} + diff --git a/adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json b/adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json new file mode 100644 index 00000000000..6bc396c67f1 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/ccpa-is-enabled.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "at": 1, + "regs": { + "ext": { + "us_privacy": "1YNN" + } + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "CCPA is not supported", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json b/adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json new file mode 100644 index 00000000000..1c33ce2e805 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/coppa-is-enabled.json @@ -0,0 +1,78 @@ +{ + "mockBidRequest": { + "at": 1, + "regs": { + "coppa": 1 + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "COPPA is not supported", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json b/adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json new file mode 100644 index 00000000000..3c9222d8cc2 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/gdpr-is-enabled.json @@ -0,0 +1,80 @@ +{ + "mockBidRequest": { + "at": 1, + "regs": { + "ext": { + "gdpr": 1 + } + }, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + "storedrequest": { + "id": "test_unicorn" + } + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media", + "placementId": "test_placement" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "GDPR is not supported", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json b/adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json new file mode 100644 index 00000000000..2e6ce79a176 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/no-imp-ext-prebid.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors" : [{ + "value": "Error get StoredRequestImpID from imp[0]: stored request id not found: Key path not found", + "comparison": "literal" + }] +} diff --git a/adapters/unicorn/unicorntest/supplemental/no-imp-ext.json b/adapters/unicorn/unicorntest/supplemental/no-imp-ext.json new file mode 100644 index 00000000000..bab6e8d9603 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/no-imp-ext.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1 + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "Error while decoding imp[0].ext: unexpected end of JSON input", + "comparison": "literal" + } + ] +} diff --git a/adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json b/adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json new file mode 100644 index 00000000000..d903effd466 --- /dev/null +++ b/adapters/unicorn/unicorntest/supplemental/no-storedrequest-imp.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": { + "at": 1, + "imp": [ + { + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "api": [5] + }, + "id": "29D2F33E-F865-40DA-9320-16EF77935254", + "secure": 1, + "ext": { + "prebid": { + }, + "bidder": { + "accountId": 199578, + "publisherId": 123456, + "mediaId": "test_media" + } + } + } + ], + "cur": ["JPY"], + "app": { + "publisher": { + "id": "test" + }, + "ext": { + "prebid": { + "source": "prebid-mobile", + "version": "1.9.0" + } + }, + "bundle": "net.ada.test", + "ver": "1.9.0" + }, + "id": "CFD24FB1-916F-467D-8825-34892B315DB7", + "source": { + "tid": "A4B3EA9F-FF57-4716-AC85-6CBF6A46CFBD" + }, + "device": { + "make": "Apple", + "osv": "14.4", + "connectiontype": 1, + "os": "iOS", + "w": 320, + "model": "Simulator", + "ifa": "00000000-0000-0000-0000-000000000000", + "devtime": 1612413327, + "h": 568, + "pxratio": 2, + "ext": { + "atts": 0 + } + }, + "user": { + "gender": "O" + } + }, + "expectedMakeRequestsErrors" : [{ + "value": "Error get StoredRequestImpID from imp[0]: stored request id not found: Key path not found", + "comparison": "literal" + }] +} diff --git a/config/config.go b/config/config.go index d31e0630a59..2abdd117d52 100644 --- a/config/config.go +++ b/config/config.go @@ -638,6 +638,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTripleliftNative, "https://eb2.3lift.com/getuid?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtriplelift_native%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTrustX, "https://x.bidswitch.net/check_uuid/"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtrustx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BBSW_UUID%7D?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUcfunnel, "https://sync.aralego.com/idsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&usprivacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ducfunnel%26uid%3DSspCookieUserId") + // openrtb_ext.BidderUnicorn doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderValueImpression, "https://rtb.valueimpression.com/usersync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvalueimpression%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") @@ -895,6 +896,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.triplelift.endpoint", "https://tlx.3lift.com/s2s/auction?sra=1&supplier_id=20") v.SetDefault("adapters.trustx.endpoint", "https://grid.bidswitch.net/sp_bid?sp=trustx") v.SetDefault("adapters.ucfunnel.endpoint", "https://pbs.aralego.com/prebid") + v.SetDefault("adapters.unicorn.endpoint", "https://ds.uncn.jp/pb/0/bid.json") v.SetDefault("adapters.unruly.endpoint", "http://targeting.unrulymedia.com/openrtb/2.2") v.SetDefault("adapters.valueimpression.endpoint", "https://rtb.valueimpression.com/endpoint") v.SetDefault("adapters.verizonmedia.disabled", true) diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index b5d1dc7eab9..8d0c0a4056c 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -90,6 +90,7 @@ import ( "github.com/prebid/prebid-server/adapters/triplelift" "github.com/prebid/prebid-server/adapters/triplelift_native" "github.com/prebid/prebid-server/adapters/ucfunnel" + "github.com/prebid/prebid-server/adapters/unicorn" "github.com/prebid/prebid-server/adapters/unruly" "github.com/prebid/prebid-server/adapters/valueimpression" "github.com/prebid/prebid-server/adapters/verizonmedia" @@ -198,6 +199,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderTripleliftNative: triplelift_native.Builder, openrtb_ext.BidderTrustX: grid.Builder, openrtb_ext.BidderUcfunnel: ucfunnel.Builder, + openrtb_ext.BidderUnicorn: unicorn.Builder, openrtb_ext.BidderUnruly: unruly.Builder, openrtb_ext.BidderValueImpression: valueimpression.Builder, openrtb_ext.BidderVerizonMedia: verizonmedia.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 20d6041f51c..600e130b167 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -164,6 +164,7 @@ const ( BidderTripleliftNative BidderName = "triplelift_native" BidderTrustX BidderName = "trustx" BidderUcfunnel BidderName = "ucfunnel" + BidderUnicorn BidderName = "unicorn" BidderUnruly BidderName = "unruly" BidderValueImpression BidderName = "valueimpression" BidderVerizonMedia BidderName = "verizonmedia" @@ -270,6 +271,7 @@ func CoreBidderNames() []BidderName { BidderTripleliftNative, BidderTrustX, BidderUcfunnel, + BidderUnicorn, BidderUnruly, BidderValueImpression, BidderVerizonMedia, diff --git a/openrtb_ext/imp_unicorn.go b/openrtb_ext/imp_unicorn.go new file mode 100644 index 00000000000..ad75414caa5 --- /dev/null +++ b/openrtb_ext/imp_unicorn.go @@ -0,0 +1,9 @@ +package openrtb_ext + +// ExtImpUnicorn defines the contract for bidrequest.imp[i].ext.unicorn +type ExtImpUnicorn struct { + PlacementID string `json:"placementId,omitempty"` + PublisherID int `json:"publisherId,omitempty"` + MediaID string `json:"mediaId"` + AccountID int `json:"accountId"` +} diff --git a/static/bidder-info/unicorn.yaml b/static/bidder-info/unicorn.yaml new file mode 100644 index 00000000000..f1b5a4e7f3e --- /dev/null +++ b/static/bidder-info/unicorn.yaml @@ -0,0 +1,6 @@ +maintainer: + email: prebid@unicorn.inc +capabilities: + app: + mediaTypes: + - banner \ No newline at end of file diff --git a/static/bidder-params/unicorn.json b/static/bidder-params/unicorn.json new file mode 100644 index 00000000000..f9c4e1677b6 --- /dev/null +++ b/static/bidder-params/unicorn.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "UNICORN Adapter Params", + "description": "A schema which validates params accepted by the UNICORN adapter", + "type": "object", + "properties": { + "placementId": { + "type": "string", + "description": "In Application, if placementId is empty, prebid server configuration id will be used as placementId." + }, + "publisherId": { + "type": "integer", + "description": "Account specific publisher id" + }, + "mediaId": { + "type": "string", + "description": "Publisher specific media id" + }, + "accountId": { + "type": "integer", + "description": "Account ID for charge request" + } + }, + "required" : ["mediaId", "accountId"] +} \ No newline at end of file diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index e70abe629ff..79530c867f7 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -118,6 +118,7 @@ func TestNewSyncerMap(t *testing.T) { openrtb_ext.BidderRevcontent: true, openrtb_ext.BidderSilverMob: true, openrtb_ext.BidderSmaato: true, + openrtb_ext.BidderUnicorn: true, openrtb_ext.BidderYeahmobi: true, } From 87277e14e554f185627ddd5b1d5202be69409a2a Mon Sep 17 00:00:00 2001 From: hhhjort <31041505+hhhjort@users.noreply.github.com> Date: Thu, 4 Mar 2021 14:32:48 -0500 Subject: [PATCH 22/91] Fixes GDPR bug about being overly strict on publisher restrictions (#1730) --- gdpr/impl.go | 10 ++++++---- gdpr/impl_test.go | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gdpr/impl.go b/gdpr/impl.go index 06b625da95c..5b1349ffe60 100644 --- a/gdpr/impl.go +++ b/gdpr/impl.go @@ -201,15 +201,17 @@ func (p *permissionsImpl) checkPurpose(consent tcf2.ConsentMetadata, vendor api. if consent.CheckPubRestriction(uint8(purpose), pubRestrictNotAllowed, vendorID) { return false } + + purposeAllowed := vendor.Purpose(purpose) && consent.PurposeAllowed(purpose) && consent.VendorConsent(vendorID) + legitInterest := vendor.LegitimateInterest(purpose) && consent.PurposeLITransparency(purpose) && consent.VendorLegitInterest(vendorID) + if consent.CheckPubRestriction(uint8(purpose), pubRestrictRequireConsent, vendorID) { - return vendor.PurposeStrict(purpose) && consent.PurposeAllowed(purpose) && consent.VendorConsent(vendorID) + return purposeAllowed } if consent.CheckPubRestriction(uint8(purpose), pubRestrictRequireLegitInterest, vendorID) { // Need LITransparency here - return vendor.LegitimateInterestStrict(purpose) && consent.PurposeLITransparency(purpose) && consent.VendorLegitInterest(vendorID) + return legitInterest } - purposeAllowed := vendor.Purpose(purpose) && consent.PurposeAllowed(purpose) && consent.VendorConsent(vendorID) - legitInterest := vendor.LegitimateInterest(purpose) && consent.PurposeLITransparency(purpose) && consent.VendorLegitInterest(vendorID) return purposeAllowed || legitInterest } diff --git a/gdpr/impl_test.go b/gdpr/impl_test.go index 45d2ba43ce3..737ed14a300 100644 --- a/gdpr/impl_test.go +++ b/gdpr/impl_test.go @@ -317,6 +317,12 @@ func buildTCF2VendorList34() tcf2VendorList { Purposes: []int{2, 4, 7}, SpecialPurposes: []int{1}, }, + "20": { + ID: 20, + Purposes: []int{1}, + LegIntPurposes: []int{2, 7}, + FlexiblePurposes: []int{2, 7}, + }, "32": { ID: 32, Purposes: []int{1, 2, 4, 7}, @@ -353,11 +359,13 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { openrtb_ext.BidderAppnexus: 2, openrtb_ext.BidderPubmatic: 6, openrtb_ext.BidderRubicon: 8, + openrtb_ext.BidderOpenx: 20, }, fetchVendorList: map[uint8]func(ctx context.Context, id uint16) (vendorlist.VendorList, error){ tcf1SpecVersion: nil, tcf2SpecVersion: listFetcher(map[uint16]vendorlist.VendorList{ 34: parseVendorListDataV2(t, vendorListData), + 74: parseVendorListDataV2(t, vendorListData), }), }, } @@ -389,6 +397,17 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { allowGeo: false, allowID: true, }, + { + // This requires publisher restrictions on any claimed purposes, 2-10. Vendor must declare all claimed purposes + // as flex with legit interest as primary. + // Using vendor 20 for this. + description: "OpenX vendor test, Specific purposes/LIs claimed, no geo claimed, Publisher restrictions apply", + bidder: openrtb_ext.BidderOpenx, + consent: "CPAavcCPAavcCAGABCFRBKCsAP_AAH_AAAqIHFNf_X_fb3_j-_59_9t0eY1f9_7_v-0zjgeds-8Nyd_X_L8X5mM7vB36pq4KuR4Eu3LBAQdlHOHcTUmw6IkVqTPsbk2Mr7NKJ7PEinMbe2dYGH9_n9XT_ZKY79_____7__-_____7_f__-__3_vp9V---wOJAIMBAUAgAEMAAQIFCIQAAQhiQAAAABBCIBQJIAEqgAWVwEdoIEACAxAQgQAgBBQgwCAAQAAJKAgBACwQCAAiAQAAgAEAIAAEIAILACQEAAAEAJCAAiACECAgiAAg5DAgIgCCAFABAAAuJDACAMooASBAPGQGAAKAAqACGAEwALgAjgBlgDUAHZAPsA_ACMAFLAK2AbwBMQCbAFogLYAYEAw8BkQDOQGeAM-EQHwAVABWAC4AIYAZAAywBqADZAHYAPwAgABGAClgFPANYAdUA-QCGwEOgIvASIAmwBOwCkQFyAMCAYSAw8Bk4DOQGfCQAYADgBzgN_CQTgAEAALgAoACoAGQAOAAeABAACIAFQAMIAaABqADyAIYAigBMgCqAKwAWAAuABvADmAHoAQ0AiACJgEsAS4AmgBSgC3AGGAMgAZcA1ADVAGyAO8AewA-IB9gH6AQAAjABQQClgFPAL8AYoA1gBtADcAG8AOIAegA-QCGwEOgIqAReAkQBMQCZQE2AJ2AUOApEBYoC2AFyALvAYEAwYBhIDDQGHgMiAZIAycBlwDOQGfANIAadA1gDWQoAEAYQaBIACoAKwAXABDADIAGWANQAbIA7AB-AEAAIKARgApYBT4C0ALSAawA3gB1QD5AIbAQ6Ai8BIgCbAE7AKRAXIAwIBhIDDwGMAMnAZyAzwBnwcAEAA4Bv4qA2ABQAFQAQwAmABcAEcAMsAagA7AB-AEYAKXAWgBaQDeAJBATEAmwBTYC2AFyAMCAYeAyIBnIDPAGfANyHQWQAFwAUABUADIAHAAQAAiABdADAAMYAaABqADwAH0AQwBFACZAFUAVgAsABcADEAGYAN4AcwA9ACGAERAJYAmABNACjAFKALEAW4AwwBkADKAGiANQAbIA3wB3gD2gH2AfoBGACVAFBAKeAWKAtAC0gFzALyAX4AxQBuADiQHTAdQA9ACGwEOgIiAReAkEBIgCbAE7AKHAU0AqwBYsC2ALZAXAAuQBdoC7wGEgMNAYeAxIBjADHgGSAMnAZUAywBlwDOQGfANEgaQBpIDSwGnANYAbGPABAIqAb-QgZgALAAoABkAEQALgAYgBDACYAFUALgAYgAzABvAD0AI4AWIAygBqADfAHfAPsA_ACMAFBAKGAU-AtAC0gF-AMUAdQA9ACQQEiAJsAU0AsUBaMC2ALaAXAAuQBdoDDwGJAMiAZOAzkBngDPgGiANJAaWA4AlAyAAQAAsACgAGQAOAAigBgAGIAPAAiABMACqAFwAMQAZgA2gCGgEQARIAowBSgC3AGEAMoAaoA2QB3gD8AIwAU-AtAC0gGKANwAcQA6gCHQEXgJEATYAsUBbAC7QGHgMiAZOAywBnIDPAGfANIAawA4AmACARUA38pBBAAXABQAFQAMgAcABAACKAGAAYwA0ADUAHkAQwBFACYAFIAKoAWAAuABiADMAHMAQwAiABRgClAFiALcAZQA0QBqgDZAHfAPsA_ACMAFBAKGAVsAuYBeQDaAG4APQAh0BF4CRAE2AJ2AUOApoBWwCxQFsALgAXIAu0BhoDDwGMAMiAZIAycBlwDOQGeAM-gaQBpMDWANZAbGVABAA-Ab-A.YAAAAAAAAAAA", + allowPI: true, + allowGeo: false, + allowID: true, + }, } for _, td := range testDefs { From a3cc810b3b8f704aad9f292242a0c3e81e5f7999 Mon Sep 17 00:00:00 2001 From: Aparna Rao Date: Fri, 5 Mar 2021 16:15:17 -0500 Subject: [PATCH 23/91] 33Across: Updated exchange endpoint (#1738) --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 2abdd117d52..2daba1654fb 100644 --- a/config/config.go +++ b/config/config.go @@ -797,7 +797,7 @@ func SetupViper(v *viper.Viper, filename string) { // Disabling adapters by default that require some specific config params. // If you're using one of these, make sure you check out the documentation (https://github.com/prebid/prebid-server/tree/master/docs/bidders) // for them and specify all the parameters they need for them to work correctly. - v.SetDefault("adapters.33across.endpoint", "http://ssc.33across.com/api/v1/hb") + v.SetDefault("adapters.33across.endpoint", "https://ssc.33across.com/api/v1/s2s") v.SetDefault("adapters.33across.partner_id", "") v.SetDefault("adapters.acuityads.endpoint", "http://{{.Host}}.admanmedia.com/bid?token={{.AccountID}}") v.SetDefault("adapters.adform.endpoint", "https://adx.adform.net/adx") From c15c66c4f3a8717688382ef4df3bf23ec94b4865 Mon Sep 17 00:00:00 2001 From: guiann Date: Sun, 7 Mar 2021 06:48:31 +0100 Subject: [PATCH 24/91] New Adapter: Adyoulike (#1700) Co-authored-by: Damien Dumas --- adapters/adyoulike/adyoulike.go | 137 ++++++++++++++ adapters/adyoulike/adyoulike_test.go | 22 +++ .../exemplary/multiformat-impression.json | 169 ++++++++++++++++++ .../adyouliketest/params/race/banner.json | 3 + .../adyouliketest/params/race/video.json | 3 + .../supplemental/invalid-bid-response.json | 65 +++++++ .../supplemental/status-bad-request.json | 66 +++++++ .../supplemental/status-no-content.json | 66 +++++++ .../status-service-unavailable.json | 66 +++++++ .../supplemental/status-unknown.json | 66 +++++++ adapters/adyoulike/params_test.go | 62 +++++++ adapters/adyoulike/usersync.go | 12 ++ adapters/adyoulike/usersync_test.go | 36 ++++ config/config.go | 2 + exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_adyoulike.go | 18 ++ static/bidder-info/adyoulike.yaml | 9 + static/bidder-params/adyoulike.json | 33 ++++ usersync/usersyncers/syncer.go | 2 + usersync/usersyncers/syncer_test.go | 1 + 21 files changed, 842 insertions(+) create mode 100644 adapters/adyoulike/adyoulike.go create mode 100644 adapters/adyoulike/adyoulike_test.go create mode 100644 adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json create mode 100644 adapters/adyoulike/adyouliketest/params/race/banner.json create mode 100644 adapters/adyoulike/adyouliketest/params/race/video.json create mode 100644 adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json create mode 100644 adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json create mode 100644 adapters/adyoulike/adyouliketest/supplemental/status-no-content.json create mode 100644 adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json create mode 100644 adapters/adyoulike/adyouliketest/supplemental/status-unknown.json create mode 100644 adapters/adyoulike/params_test.go create mode 100644 adapters/adyoulike/usersync.go create mode 100644 adapters/adyoulike/usersync_test.go create mode 100644 openrtb_ext/imp_adyoulike.go create mode 100644 static/bidder-info/adyoulike.yaml create mode 100644 static/bidder-params/adyoulike.json diff --git a/adapters/adyoulike/adyoulike.go b/adapters/adyoulike/adyoulike.go new file mode 100644 index 00000000000..9a137a41fef --- /dev/null +++ b/adapters/adyoulike/adyoulike.go @@ -0,0 +1,137 @@ +package adyoulike + +import ( + "encoding/json" + "errors" + "fmt" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "net/http" + + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" +) + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + return &adapter{ + endpoint: config.Endpoint, + }, nil +} + +type adapter struct { + endpoint string +} + +func (a *adapter) MakeRequests( + openRTBRequest *openrtb.BidRequest, + reqInfo *adapters.ExtraRequestInfo, +) ( + requestsToBidder []*adapters.RequestData, + errs []error, +) { + var err error + var tagID string + + reqCopy := *openRTBRequest + reqCopy.Imp = []openrtb.Imp{} + for ind, imp := range openRTBRequest.Imp { + reqCopy.Imp = append(reqCopy.Imp, imp) + + tagID, err = jsonparser.GetString(reqCopy.Imp[ind].Ext, "bidder", "placement") + if err != nil { + errs = append(errs, err) + continue + } + + reqCopy.Imp[ind].TagID = tagID + } + + openRTBRequestJSON, err := json.Marshal(reqCopy) + if err != nil { + errs = append(errs, err) + } + + if len(errs) > 0 { + return nil, errs + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("x-openrtb-version", "2.5") + + requestToBidder := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: openRTBRequestJSON, + Headers: headers, + } + requestsToBidder = append(requestsToBidder, requestToBidder) + + return requestsToBidder, errs +} + +const unexpectedStatusCodeFormat = "" + + "Unexpected status code: %d. Run with request.debug = 1 for more info" + +func (a *adapter) MakeBids( + openRTBRequest *openrtb.BidRequest, + requestToBidder *adapters.RequestData, + bidderRawResponse *adapters.ResponseData, +) ( + bidderResponse *adapters.BidderResponse, + errs []error, +) { + switch bidderRawResponse.StatusCode { + case http.StatusOK: + break + case http.StatusNoContent: + return nil, []error{errors.New("MakeBids error: No Content")} + case http.StatusBadRequest: + err := &errortypes.BadInput{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, bidderRawResponse.StatusCode), + } + return nil, []error{err} + default: + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, bidderRawResponse.StatusCode), + } + return nil, []error{err} + } + + var openRTBBidderResponse openrtb.BidResponse + if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(openRTBRequest.Imp)) + bidResponse.Currency = openRTBBidderResponse.Cur + for _, seatBid := range openRTBBidderResponse.SeatBid { + for idx := range seatBid.Bid { + b := &adapters.TypedBid{ + Bid: &seatBid.Bid[idx], + BidType: getMediaTypeForImp(seatBid.Bid[idx].ImpID, openRTBRequest.Imp), + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + return bidResponse, nil +} + +// getMediaTypeForBid determines which type of bid. +func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { + mediaType := openrtb_ext.BidTypeBanner + for _, imp := range imps { + if imp.ID == impID { + if imp.Banner == nil && imp.Video != nil { + mediaType = openrtb_ext.BidTypeVideo + } else if imp.Banner == nil && imp.Native != nil { + mediaType = openrtb_ext.BidTypeNative + } + } + } + + return mediaType +} diff --git a/adapters/adyoulike/adyoulike_test.go b/adapters/adyoulike/adyoulike_test.go new file mode 100644 index 00000000000..9ab689f3c77 --- /dev/null +++ b/adapters/adyoulike/adyoulike_test.go @@ -0,0 +1,22 @@ +package adyoulike + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +const testsBidderEndpoint = "https://localhost/bid/4" + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderAdyoulike, config.Adapter{ + Endpoint: testsBidderEndpoint}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "adyouliketest", bidder) +} diff --git a/adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json b/adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json new file mode 100644 index 00000000000..2ae99c04969 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json @@ -0,0 +1,169 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + }, + { + "id": "video-imp-id", + "video": { + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "placement": "54321" + } + } + }, + { + "id": "native-imp-id", + "native": { + "title": "required" + }, + "ext": { + "bidder": { + "placement": "123123" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + }, + { + "ext": { + "bidder": { + "placement": "54321" + } + }, + "id": "video-imp-id", + "tagid": "54321", + "video": { + "h": 480, + "mimes": null, + "w": 640 + } + }, + { + "ext": { + "bidder": { + "placement": "123123" + } + }, + "id": "native-imp-id", + "native": { + "request": "" + }, + "tagid": "123123" + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [{ + "seat": "1", + "bid": [{ + "id": "12340", + "impid": "banner-imp-id", + "price": 300, + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2Fhtml%3E", + "nurl": "http://example.com/winnoticeurl0" + }, + { + "id": "12341", + "impid": "video-imp-id", + "price": 301, + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2FVAST%3E", + "nurl": "http://example.com/winnoticeurl1" + }, + { + "id": "12342", + "impid": "native-imp-id", + "price": 302, + "adm": "{'json':'response','for':'native'}", + "nurl": "http://example.com/winnoticeurl2" + } + ] + }] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "12340", + "impid": "banner-imp-id", + "price": 300, + "nurl": "http://example.com/winnoticeurl0", + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2Fhtml%3E" + }, + "type": "banner" + }, + { + "bid": { + "id": "12341", + "impid": "video-imp-id", + "price": 301, + "nurl": "http://example.com/winnoticeurl1", + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2FVAST%3E" + }, + "type": "video" + }, + { + "bid": { + "id": "12342", + "impid": "native-imp-id", + "price": 302, + "nurl": "http://example.com/winnoticeurl2", + "adm": "{'json':'response','for':'native'}" + }, + "type": "native" + } + ] + } + ] + } diff --git a/adapters/adyoulike/adyouliketest/params/race/banner.json b/adapters/adyoulike/adyouliketest/params/race/banner.json new file mode 100644 index 00000000000..726ca878c05 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/params/race/banner.json @@ -0,0 +1,3 @@ +{ + "placement": "19f1b372c7548ec1fe734d2c9f8dc688" +} diff --git a/adapters/adyoulike/adyouliketest/params/race/video.json b/adapters/adyoulike/adyouliketest/params/race/video.json new file mode 100644 index 00000000000..d0883f5e04a --- /dev/null +++ b/adapters/adyoulike/adyouliketest/params/race/video.json @@ -0,0 +1,3 @@ +{ + "placement": "19f1b372c7548ec1fe734d2c9f8dc688" +} diff --git a/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json b/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json new file mode 100644 index 00000000000..b156dd65ae3 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json b/adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json new file mode 100644 index 00000000000..83b5f3611d8 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "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/adyoulike/adyouliketest/supplemental/status-no-content.json b/adapters/adyoulike/adyouliketest/supplemental/status-no-content.json new file mode 100644 index 00000000000..9ef51e88a41 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-no-content.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "MakeBids error: No Content", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json b/adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json new file mode 100644 index 00000000000..2b5872a16f5 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 503, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 503. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-unknown.json b/adapters/adyoulike/adyouliketest/supplemental/status-unknown.json new file mode 100644 index 00000000000..0b9ce745dd9 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-unknown.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 999, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 999. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/params_test.go b/adapters/adyoulike/params_test.go new file mode 100644 index 00000000000..b57264b3dbd --- /dev/null +++ b/adapters/adyoulike/params_test.go @@ -0,0 +1,62 @@ +package adyoulike + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +// This file actually intends to test static/bidder-params/adyoulike.json +// +// These also validate the format of the external API: request.imp[i].ext.adyoulike + +// TestValidParams makes sure that the adyoulike schema accepts all imp.ext fields which we intend to support. +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.BidderAdyoulike, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected adyoulike params: %s", validParam) + } + } +} + +// TestInvalidParams makes sure that the adyoulike schema rejects all the imp.ext fields we don't support. +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.BidderAdyoulike, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"placement":"123"}`, + `{"placement":"123","campaign":"456"}`, + `{"placement":"123","campaign":"456","track":"789"}`, + `{"placement":"123","campaign":"456","track":"789","creative":"ABC"}`, + `{"placement":"123","campaign":"456","track":"789","creative":"ABC","source":"SSP"}`, + `{"placement":"123","campaign":"456","track":"789","creative":"ABC","source":"SSP","debug":"info"}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"invalid":"123"}`, + `{"placement":123}`, + `{"placement":"123","campaign":123}`, +} diff --git a/adapters/adyoulike/usersync.go b/adapters/adyoulike/usersync.go new file mode 100644 index 00000000000..0ecc4e405dc --- /dev/null +++ b/adapters/adyoulike/usersync.go @@ -0,0 +1,12 @@ +package adyoulike + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewAdyoulikeSyncer(urlTemplate *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("adyoulike", 259, urlTemplate, adapters.SyncTypeRedirect) +} diff --git a/adapters/adyoulike/usersync_test.go b/adapters/adyoulike/usersync_test.go new file mode 100644 index 00000000000..5090acb1a14 --- /dev/null +++ b/adapters/adyoulike/usersync_test.go @@ -0,0 +1,36 @@ +package adyoulike + +import ( + "testing" + "text/template" + + "github.com/stretchr/testify/assert" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" +) + +func TestAdyoulikeSyncer(t *testing.T) { + syncURL := "//visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr_consent_string={{.GDPRConsent}}&gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewAdyoulikeSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "1", + Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw", + }, + CCPA: ccpa.Policy{ + Consent: "1-YY", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "//visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr_consent_string=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&gdpr=1&us_privacy=1-YY", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 259, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index 2daba1654fb..22ce8faf0b6 100644 --- a/config/config.go +++ b/config/config.go @@ -577,6 +577,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdman, "https://sync.admanmedia.com/pbs.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadman%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") // openrtb_ext.BidderAdOcean doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdvangelists, "https://nep.advangelists.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadvangelists%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdyoulike, "http://visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadyoulike%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BBUYER_USERID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAJA, "https://ad.as.amanad.adtdp.com/v1/sync/ssp?ssp=4&gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Daja%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25s") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAMX, "https://prebid.a-mo.net/cchain/0?gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Damx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAppnexus, "https://ib.adnxs.com/getuid?"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadnxs%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") @@ -815,6 +816,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.adtarget.endpoint", "http://ghb.console.adtarget.com.tr/pbs/ortb") v.SetDefault("adapters.adtelligent.endpoint", "http://ghb.adtelligent.com/pbs/ortb") v.SetDefault("adapters.advangelists.endpoint", "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}") + v.SetDefault("adapters.adyoulike.endpoint", "https://broker-preprod.omnitagjs.com/broker/bid?partnerId=19340f4f097d16f41f34fc0274981ca4") v.SetDefault("adapters.aja.endpoint", "https://ad.as.amanad.adtdp.com/v1/bid/4") v.SetDefault("adapters.amx.endpoint", "http://pbs.amxrtb.com/auction/openrtb") v.SetDefault("adapters.applogy.endpoint", "http://rtb.applogy.com/v1/prebid") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 8d0c0a4056c..46c967065cb 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -19,6 +19,7 @@ import ( "github.com/prebid/prebid-server/adapters/adtarget" "github.com/prebid/prebid-server/adapters/adtelligent" "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/adyoulike" "github.com/prebid/prebid-server/adapters/aja" "github.com/prebid/prebid-server/adapters/amx" "github.com/prebid/prebid-server/adapters/applogy" @@ -126,6 +127,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderAdtarget: adtarget.Builder, openrtb_ext.BidderAdtelligent: adtelligent.Builder, openrtb_ext.BidderAdvangelists: advangelists.Builder, + openrtb_ext.BidderAdyoulike: adyoulike.Builder, openrtb_ext.BidderAJA: aja.Builder, openrtb_ext.BidderAMX: amx.Builder, openrtb_ext.BidderApplogy: applogy.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 600e130b167..570701603fd 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -90,6 +90,7 @@ const ( BidderAdtarget BidderName = "adtarget" BidderAdtelligent BidderName = "adtelligent" BidderAdvangelists BidderName = "advangelists" + BidderAdyoulike BidderName = "adyoulike" BidderAJA BidderName = "aja" BidderAMX BidderName = "amx" BidderApplogy BidderName = "applogy" @@ -197,6 +198,7 @@ func CoreBidderNames() []BidderName { BidderAdtarget, BidderAdtelligent, BidderAdvangelists, + BidderAdyoulike, BidderAJA, BidderAMX, BidderApplogy, diff --git a/openrtb_ext/imp_adyoulike.go b/openrtb_ext/imp_adyoulike.go new file mode 100644 index 00000000000..67a94123734 --- /dev/null +++ b/openrtb_ext/imp_adyoulike.go @@ -0,0 +1,18 @@ +package openrtb_ext + +// ExtImpAdyoulike defines the contract for bidrequest.imp[i].ext.adyoulike +type ExtImpAdyoulike struct { + // placementId, only mandatory field + PlacementId string `json:"placement"` + + // Id of the forced campaign + Campaign string `json:"campaign"` + // Id of the forced track + Track string `json:"track"` + // Id of the forced creative + Creative string `json:"creative"` + // Context of the campaign values [SSP|AdServer] + Source string `json:"source"` + // Abitrary Id used for debug purpose + Debug string `json:"debug"` +} diff --git a/static/bidder-info/adyoulike.yaml b/static/bidder-info/adyoulike.yaml new file mode 100644 index 00000000000..3f35aa5b038 --- /dev/null +++ b/static/bidder-info/adyoulike.yaml @@ -0,0 +1,9 @@ +maintainer: + email: "core@adyoulike.com" +modifyingVastXmlAllowed: true +capabilities: + site: + mediaTypes: + - banner + - video + - native diff --git a/static/bidder-params/adyoulike.json b/static/bidder-params/adyoulike.json new file mode 100644 index 00000000000..f426a0923d7 --- /dev/null +++ b/static/bidder-params/adyoulike.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "AdYouLike Adapter Params", + "description": "A schema which validates params accepted by the AdYouLike adapter", + "type": "object", + "properties": { + "placement": { + "type": "string", + "description": "Placement Id" + }, + "campaign": { + "type": "string", + "description": "Id of a forced campaign" + }, + "track": { + "type": "string", + "description": "Id of a forced Track" + }, + "creative": { + "type": "string", + "description": "Id of a forced creative" + }, + "source": { + "type": "string", + "description": "context of the campaign" + }, + "debug": { + "type": "string", + "description": "Abitrary id used for debug purpose" + } + }, + "required": ["placement"] +} \ No newline at end of file diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 72159ad6738..7467eb261fa 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -17,6 +17,7 @@ import ( "github.com/prebid/prebid-server/adapters/adtarget" "github.com/prebid/prebid-server/adapters/adtelligent" "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/adyoulike" "github.com/prebid/prebid-server/adapters/aja" "github.com/prebid/prebid-server/adapters/amx" "github.com/prebid/prebid-server/adapters/appnexus" @@ -109,6 +110,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtarget, adtarget.NewAdtargetSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtelligent, adtelligent.NewAdtelligentSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdvangelists, advangelists.NewAdvangelistsSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderAdyoulike, adyoulike.NewAdyoulikeSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAJA, aja.NewAJASyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAMX, amx.NewAMXSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAppnexus, appnexus.NewAppnexusSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 79530c867f7..9727a2d4e22 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -26,6 +26,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderAdtarget): syncConfig, string(openrtb_ext.BidderAdtelligent): syncConfig, string(openrtb_ext.BidderAdvangelists): syncConfig, + string(openrtb_ext.BidderAdyoulike): syncConfig, string(openrtb_ext.BidderAJA): syncConfig, string(openrtb_ext.BidderAMX): syncConfig, string(openrtb_ext.BidderAppnexus): syncConfig, From 5a0251a40c6b24fc587208a1871b7ed6a1c3f49b Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Tue, 9 Mar 2021 13:42:52 -0500 Subject: [PATCH 25/91] Hoist GVL ID To Bidder Info (#1721) --- adapters/33across/usersync.go | 2 +- adapters/33across/usersync_test.go | 1 - adapters/acuityads/usersync.go | 2 +- adapters/acuityads/usersync_test.go | 1 - adapters/adform/usersync.go | 2 +- adapters/adform/usersync_test.go | 1 - adapters/adkernel/usersync.go | 4 +-- adapters/adkernel/usersync_test.go | 1 - adapters/adkernelAdn/usersync.go | 4 +-- adapters/adkernelAdn/usersync_test.go | 1 - adapters/adman/usersync.go | 2 +- adapters/adman/usersync_test.go | 1 - adapters/admixer/usersync.go | 5 ++-- adapters/admixer/usersync_test.go | 2 +- adapters/adocean/usersync.go | 2 +- adapters/adocean/usersync_test.go | 1 - adapters/adpone/usersync.go | 2 -- adapters/adpone/usersync_test.go | 1 - adapters/adtarget/usersync.go | 2 +- adapters/adtarget/usersync_test.go | 1 - adapters/adtelligent/usersync.go | 2 +- adapters/adtelligent/usersync_test.go | 1 - adapters/advangelists/usersync.go | 2 +- adapters/advangelists/usersync_test.go | 1 - adapters/adyoulike/usersync.go | 2 +- adapters/adyoulike/usersync_test.go | 1 - adapters/aja/usersync.go | 2 +- adapters/aja/usersync_test.go | 1 - adapters/amx/usersync.go | 2 +- adapters/amx/usersync_test.go | 1 - adapters/appnexus/usersync.go | 2 +- adapters/appnexus/usersync_test.go | 1 - adapters/audienceNetwork/usersync.go | 2 +- adapters/audienceNetwork/usersync_test.go | 1 - adapters/avocet/usersync.go | 2 +- adapters/avocet/usersync_test.go | 1 - adapters/beachfront/usersync.go | 3 -- adapters/beachfront/usersync_test.go | 1 - adapters/beintoo/usersync.go | 2 +- adapters/beintoo/usersync_test.go | 1 - adapters/between/usersync.go | 2 +- adapters/between/usersync_test.go | 6 ++-- adapters/brightroll/usersync.go | 2 +- adapters/brightroll/usersync_test.go | 1 - adapters/colossus/usersync.go | 2 +- adapters/colossus/usersync_test.go | 1 - adapters/connectad/usersync.go | 2 +- adapters/connectad/usersync_test.go | 1 - adapters/consumable/usersync.go | 4 --- adapters/consumable/usersync_test.go | 1 - adapters/conversant/usersync.go | 2 +- adapters/conversant/usersync_test.go | 1 - adapters/cpmstar/usersync.go | 2 +- adapters/cpmstar/usersync_test.go | 1 - adapters/datablocks/usersync.go | 4 +-- adapters/datablocks/usersync_test.go | 1 - adapters/deepintent/usersync.go | 2 +- adapters/deepintent/usersync_test.go | 1 - adapters/dmx/usersync.go | 2 +- adapters/dmx/usersync_test.go | 4 +-- adapters/emx_digital/usersync.go | 2 +- adapters/emx_digital/usersync_test.go | 1 - adapters/engagebdr/usersync.go | 5 ++-- adapters/engagebdr/usersync_test.go | 1 - adapters/eplanning/usersync.go | 2 +- adapters/eplanning/usersync_test.go | 1 - adapters/gamma/usersync.go | 2 +- adapters/gamma/usersync_test.go | 1 - adapters/gamoshi/usersync.go | 2 +- adapters/gamoshi/usersync_test.go | 1 - adapters/grid/usersync.go | 2 +- adapters/grid/usersync_test.go | 1 - adapters/gumgum/usersync.go | 2 +- adapters/gumgum/usersync_test.go | 1 - adapters/improvedigital/usersync.go | 2 +- adapters/improvedigital/usersync_test.go | 1 - adapters/invibes/usersync.go | 1 - adapters/invibes/usersync_test.go | 1 - adapters/ix/usersync.go | 2 +- adapters/ix/usersync_test.go | 1 - adapters/jixie/jixie_test.go | 3 +- adapters/jixie/usersync.go | 2 +- adapters/jixie/usersync_test.go | 3 +- adapters/krushmedia/usersync.go | 2 +- adapters/krushmedia/usersync_test.go | 1 - adapters/lifestreet/usersync.go | 2 +- adapters/lifestreet/usersync_test.go | 1 - adapters/lockerdome/usersync.go | 2 +- adapters/lockerdome/usersync_test.go | 1 - adapters/logicad/usersync.go | 2 +- adapters/logicad/usersync_test.go | 1 - adapters/lunamedia/usersync.go | 2 +- adapters/lunamedia/usersync_test.go | 1 - adapters/marsmedia/usersync.go | 2 +- adapters/marsmedia/usersync_test.go | 1 - adapters/mediafuse/usersync.go | 2 +- adapters/mediafuse/usersync_test.go | 1 - adapters/mgid/usersync.go | 2 +- adapters/mgid/usersync_test.go | 1 - adapters/nanointeractive/usersync.go | 2 +- adapters/nanointeractive/usersync_test.go | 1 - adapters/ninthdecimal/usersync.go | 2 +- adapters/ninthdecimal/usersync_test.go | 1 - adapters/nobid/usersync.go | 2 +- adapters/onetag/usersync.go | 2 +- adapters/onetag/usersync_test.go | 1 - adapters/openx/usersync.go | 2 +- adapters/openx/usersync_test.go | 1 - adapters/pubmatic/usersync.go | 2 +- adapters/pubmatic/usersync_test.go | 1 - adapters/pulsepoint/usersync.go | 2 +- adapters/pulsepoint/usersync_test.go | 1 - adapters/rhythmone/usersync.go | 2 +- adapters/rhythmone/usersync_test.go | 1 - adapters/rtbhouse/usersync.go | 2 -- adapters/rtbhouse/usersync_test.go | 1 - adapters/rubicon/usersync.go | 2 +- adapters/rubicon/usersync_test.go | 1 - adapters/sharethrough/usersync.go | 5 ++-- adapters/sharethrough/usersync_test.go | 1 - adapters/smartadserver/usersync.go | 2 +- adapters/smartadserver/usersync_test.go | 1 - adapters/smartrtb/usersync.go | 2 +- adapters/smartrtb/usersync_test.go | 1 - adapters/smartyads/usersync.go | 2 +- adapters/smartyads/usersync_test.go | 1 - adapters/somoaudience/usersync.go | 2 +- adapters/somoaudience/usersync_test.go | 1 - adapters/sonobi/usersync.go | 5 ++-- adapters/sonobi/usersync_test.go | 1 - adapters/sovrn/usersync.go | 2 +- adapters/sovrn/usersync_test.go | 1 - adapters/synacormedia/usersync.go | 2 +- adapters/synacormedia/usersync_test.go | 1 - adapters/syncer.go | 31 +++++---------------- adapters/tappx/usersync.go | 2 +- adapters/tappx/usersync_test.go | 1 - adapters/telaria/usersync.go | 2 +- adapters/telaria/usersync_test.go | 1 - adapters/triplelift/usersync.go | 2 +- adapters/triplelift/usersync_test.go | 1 - adapters/triplelift_native/usersync.go | 2 +- adapters/triplelift_native/usersync_test.go | 1 - adapters/trustx/usersync.go | 2 +- adapters/trustx/usersync_test.go | 1 - adapters/ucfunnel/usersync.go | 2 +- adapters/ucfunnel/usersync_test.go | 1 - adapters/unruly/usersync.go | 2 +- adapters/unruly/usersync_test.go | 1 - adapters/valueimpression/usersync.go | 2 +- adapters/valueimpression/usersync_test.go | 1 - adapters/verizonmedia/usersync.go | 5 ++-- adapters/verizonmedia/usersync_test.go | 1 - adapters/visx/usersync.go | 2 +- adapters/visx/usersync_test.go | 1 - adapters/vrtcal/usersync.go | 2 +- adapters/vrtcal/usersync_test.go | 1 - adapters/yieldlab/usersync.go | 2 +- adapters/yieldlab/usersync_test.go | 1 - adapters/yieldmo/usersync.go | 2 +- adapters/yieldmo/usersync_test.go | 1 - adapters/yieldone/usersync.go | 2 +- adapters/yieldone/usersync_test.go | 1 - adapters/zeroclickfraud/usersync.go | 2 +- config/bidderinfo.go | 19 +++++++++++-- config/bidderinfo_test.go | 26 +++++++++++++++-- config/test/bidder-info/someBidder.yaml | 1 + endpoints/setuid_test.go | 5 ---- router/router.go | 4 +-- static/bidder-info/33across.yaml | 1 + static/bidder-info/acuityads.yaml | 1 + static/bidder-info/adform.yaml | 1 + static/bidder-info/adkernel.yaml | 1 + static/bidder-info/adkernelAdn.yaml | 1 + static/bidder-info/adman.yaml | 1 + static/bidder-info/admixer.yaml | 1 + static/bidder-info/adocean.yaml | 1 + static/bidder-info/adpone.yaml | 1 + static/bidder-info/adtelligent.yaml | 1 + static/bidder-info/adyoulike.yaml | 1 + static/bidder-info/amx.yaml | 1 + static/bidder-info/appnexus.yaml | 1 + static/bidder-info/avocet.yaml | 1 + static/bidder-info/beachfront.yaml | 1 + static/bidder-info/beintoo.yaml | 1 + static/bidder-info/between.yaml | 1 + static/bidder-info/brightroll.yaml | 1 + static/bidder-info/connectad.yaml | 1 + static/bidder-info/consumable.yaml | 1 + static/bidder-info/conversant.yaml | 1 + static/bidder-info/deepintent.yaml | 1 + static/bidder-info/dmx.yaml | 1 + static/bidder-info/emx_digital.yaml | 1 + static/bidder-info/engagebdr.yaml | 1 + static/bidder-info/eplanning.yaml | 1 + static/bidder-info/gamoshi.yaml | 1 + static/bidder-info/grid.yaml | 1 + static/bidder-info/gumgum.yaml | 1 + static/bidder-info/improvedigital.yaml | 1 + static/bidder-info/invibes.yaml | 1 + static/bidder-info/ix.yaml | 1 + static/bidder-info/lifestreet.yaml | 1 + static/bidder-info/mediafuse.yaml | 1 + static/bidder-info/mgid.yaml | 1 + static/bidder-info/nanointeractive.yaml | 1 + static/bidder-info/nobid.yaml | 1 + static/bidder-info/onetag.yaml | 1 + static/bidder-info/openx.yaml | 1 + static/bidder-info/pubmatic.yaml | 1 + static/bidder-info/pulsepoint.yaml | 1 + static/bidder-info/rhythmone.yaml | 1 + static/bidder-info/rtbhouse.yaml | 1 + static/bidder-info/rubicon.yaml | 1 + static/bidder-info/sharethrough.yaml | 1 + static/bidder-info/smartadserver.yaml | 1 + static/bidder-info/somoaudience.yaml | 1 + static/bidder-info/sonobi.yaml | 1 + static/bidder-info/sovrn.yaml | 1 + static/bidder-info/tappx.yaml | 1 + static/bidder-info/telaria.yaml | 1 + static/bidder-info/triplelift.yaml | 1 + static/bidder-info/triplelift_native.yaml | 1 + static/bidder-info/trustx.yaml | 1 + static/bidder-info/ucfunnel.yaml | 1 + static/bidder-info/unruly.yaml | 1 + static/bidder-info/verizonmedia.yaml | 1 + static/bidder-info/visx.yaml | 1 + static/bidder-info/yieldlab.yaml | 1 + static/bidder-info/yieldmo.yaml | 1 + usersync/usersync.go | 10 ------- usersync/usersyncers/syncer_test.go | 28 ------------------- 231 files changed, 206 insertions(+), 259 deletions(-) diff --git a/adapters/33across/usersync.go b/adapters/33across/usersync.go index 7bc9ae458ae..df26f3b6325 100644 --- a/adapters/33across/usersync.go +++ b/adapters/33across/usersync.go @@ -8,5 +8,5 @@ import ( ) func New33AcrossSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("33across", 58, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("33across", temp, adapters.SyncTypeIframe) } diff --git a/adapters/33across/usersync_test.go b/adapters/33across/usersync_test.go index a9eb4e57908..e99b5965746 100644 --- a/adapters/33across/usersync_test.go +++ b/adapters/33across/usersync_test.go @@ -30,6 +30,5 @@ func Test33AcrossSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr=A&gdpr_consent=B&us_privacy=C&ru=%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 58, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/acuityads/usersync.go b/adapters/acuityads/usersync.go index 7eedf78d229..e2fc1f41961 100644 --- a/adapters/acuityads/usersync.go +++ b/adapters/acuityads/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAcuityAdsSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("acuityads", 231, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("acuityads", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/acuityads/usersync_test.go b/adapters/acuityads/usersync_test.go index 1f57cea3b66..b3ad10bdbb8 100644 --- a/adapters/acuityads/usersync_test.go +++ b/adapters/acuityads/usersync_test.go @@ -29,6 +29,5 @@ func TestAcuityAdsSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://cs.admanmedia.com/sync/prebid?gdpr=0&gdpr_consent=ANDFJDS&us_privacy=1-YY&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dacuityads%26uid%3D%5BUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 231, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adform/usersync.go b/adapters/adform/usersync.go index 32b4e3a91c1..6a237f794a6 100644 --- a/adapters/adform/usersync.go +++ b/adapters/adform/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdformSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adform", 50, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adform", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adform/usersync_test.go b/adapters/adform/usersync_test.go index 855506da2ed..f133be86583 100644 --- a/adapters/adform/usersync_test.go +++ b/adapters/adform/usersync_test.go @@ -27,6 +27,5 @@ func TestAdformSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//cm.adform.net?return_url=localhost%2Fsetuid%3Fbidder%3Dadform%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 50, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adkernel/usersync.go b/adapters/adkernel/usersync.go index 2e2ebdb9fe3..2de82a00f6e 100644 --- a/adapters/adkernel/usersync.go +++ b/adapters/adkernel/usersync.go @@ -7,8 +7,6 @@ import ( "github.com/prebid/prebid-server/usersync" ) -const adkernelGDPRVendorID = uint16(14) - func NewAdkernelSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adkernel", 14, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adkernel", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adkernel/usersync_test.go b/adapters/adkernel/usersync_test.go index aeacf00b7f0..2ff81668d41 100644 --- a/adapters/adkernel/usersync_test.go +++ b/adapters/adkernel/usersync_test.go @@ -30,6 +30,5 @@ func TestAdkernelAdnSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://sync.adkernel.com/user-sync?t=image&gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, adkernelGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adkernelAdn/usersync.go b/adapters/adkernelAdn/usersync.go index 0bedac38e46..5a890e1565b 100644 --- a/adapters/adkernelAdn/usersync.go +++ b/adapters/adkernelAdn/usersync.go @@ -7,8 +7,6 @@ import ( "github.com/prebid/prebid-server/usersync" ) -const adkernelGDPRVendorID = uint16(14) - func NewAdkernelAdnSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adkernelAdn", 14, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adkernelAdn", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adkernelAdn/usersync_test.go b/adapters/adkernelAdn/usersync_test.go index 92d688e6117..17cf97ce779 100644 --- a/adapters/adkernelAdn/usersync_test.go +++ b/adapters/adkernelAdn/usersync_test.go @@ -30,6 +30,5 @@ func TestAdkernelAdnSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://tag.adkernel.com/syncr?gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, adkernelGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adman/usersync.go b/adapters/adman/usersync.go index aae6afcdfcd..2cb62fe7824 100644 --- a/adapters/adman/usersync.go +++ b/adapters/adman/usersync.go @@ -9,5 +9,5 @@ import ( // NewAdmanSyncer returns adman syncer func NewAdmanSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adman", 149, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adman", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adman/usersync_test.go b/adapters/adman/usersync_test.go index 25da77db7ed..d0dc90c8c5d 100644 --- a/adapters/adman/usersync_test.go +++ b/adapters/adman/usersync_test.go @@ -30,6 +30,5 @@ func TestAdmanSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://sync.admanmedia.com/pbs.gif?gdpr=0&gdpr_consent=ANDFJDS&us_privacy=1-YY&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dadman%26uid%3D%5BUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 149, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/admixer/usersync.go b/adapters/admixer/usersync.go index 0a7f50ab79a..89e162dff32 100644 --- a/adapters/admixer/usersync.go +++ b/adapters/admixer/usersync.go @@ -1,11 +1,12 @@ package admixer import ( + "text/template" + "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/usersync" - "text/template" ) func NewAdmixerSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("admixer", 511, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("admixer", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/admixer/usersync_test.go b/adapters/admixer/usersync_test.go index 79f023a236c..6acc48453fb 100644 --- a/adapters/admixer/usersync_test.go +++ b/adapters/admixer/usersync_test.go @@ -30,6 +30,6 @@ func TestAdmixerSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "http://anyHost/anyPath", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 511, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adocean/usersync.go b/adapters/adocean/usersync.go index 650e517a578..b189f822b46 100644 --- a/adapters/adocean/usersync.go +++ b/adapters/adocean/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdOceanSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adocean", 328, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adocean", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adocean/usersync_test.go b/adapters/adocean/usersync_test.go index 9ca81b98cb4..5257017adfa 100644 --- a/adapters/adocean/usersync_test.go +++ b/adapters/adocean/usersync_test.go @@ -30,5 +30,4 @@ func TestAdOceanSyncer(t *testing.T) { syncInfo.URL, ) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 328, syncer.GDPRVendorID()) } diff --git a/adapters/adpone/usersync.go b/adapters/adpone/usersync.go index 67d4c998275..38dec19bb72 100644 --- a/adapters/adpone/usersync.go +++ b/adapters/adpone/usersync.go @@ -7,13 +7,11 @@ import ( "github.com/prebid/prebid-server/usersync" ) -const adponeGDPRVendorID = uint16(799) const adponeFamilyName = "adpone" func NewadponeSyncer(urlTemplate *template.Template) usersync.Usersyncer { return adapters.NewSyncer( adponeFamilyName, - adponeGDPRVendorID, urlTemplate, adapters.SyncTypeRedirect, ) diff --git a/adapters/adpone/usersync_test.go b/adapters/adpone/usersync_test.go index 87b4e9ae440..e744de5eb91 100644 --- a/adapters/adpone/usersync_test.go +++ b/adapters/adpone/usersync_test.go @@ -20,5 +20,4 @@ func TestAdponeSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://usersync.adpone.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dadtelligent%26gdpr%3D%26gdpr_consent%3D%26uid%3D%7Buid%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, adponeGDPRVendorID, syncer.GDPRVendorID()) } diff --git a/adapters/adtarget/usersync.go b/adapters/adtarget/usersync.go index 20bced25c72..d720f110d89 100644 --- a/adapters/adtarget/usersync.go +++ b/adapters/adtarget/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdtargetSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adtarget", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adtarget", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adtarget/usersync_test.go b/adapters/adtarget/usersync_test.go index ddba9e7a720..ea6146ceec8 100644 --- a/adapters/adtarget/usersync_test.go +++ b/adapters/adtarget/usersync_test.go @@ -33,6 +33,5 @@ func TestAdtargetSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.console.adtarget.com.tr/csync?t=p&ep=0&gdpr=0&gdpr_consent=123&us_privacy=1-YY&redir=localhost%2Fsetuid%3Fbidder%3Dadtarget%26gdpr%3D0%26gdpr_consent%3D123%26uid%3D%7Buid%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adtelligent/usersync.go b/adapters/adtelligent/usersync.go index 087b5bdd22d..613c8e294f0 100644 --- a/adapters/adtelligent/usersync.go +++ b/adapters/adtelligent/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdtelligentSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adtelligent", 410, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adtelligent", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/adtelligent/usersync_test.go b/adapters/adtelligent/usersync_test.go index fa157d226c5..2430f377bd4 100644 --- a/adapters/adtelligent/usersync_test.go +++ b/adapters/adtelligent/usersync_test.go @@ -25,6 +25,5 @@ func TestAdtelligentSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.adtelligent.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dadtelligent%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7Buid%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 410, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/advangelists/usersync.go b/adapters/advangelists/usersync.go index 10c46d18a22..83930774773 100644 --- a/adapters/advangelists/usersync.go +++ b/adapters/advangelists/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdvangelistsSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("advangelists", 0, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("advangelists", temp, adapters.SyncTypeIframe) } diff --git a/adapters/advangelists/usersync_test.go b/adapters/advangelists/usersync_test.go index 2167d49fb05..04ee7968d87 100644 --- a/adapters/advangelists/usersync_test.go +++ b/adapters/advangelists/usersync_test.go @@ -26,6 +26,5 @@ func TestAdvangelistsSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://nep.advangelists.com/xp/user-sync?acctid={aid}&&redirect=localhost/setuid?bidder=advangelists&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&uid=$UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adyoulike/usersync.go b/adapters/adyoulike/usersync.go index 0ecc4e405dc..ffea6f69a27 100644 --- a/adapters/adyoulike/usersync.go +++ b/adapters/adyoulike/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdyoulikeSyncer(urlTemplate *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adyoulike", 259, urlTemplate, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adyoulike", urlTemplate, adapters.SyncTypeRedirect) } diff --git a/adapters/adyoulike/usersync_test.go b/adapters/adyoulike/usersync_test.go index 5090acb1a14..72def4cf9b0 100644 --- a/adapters/adyoulike/usersync_test.go +++ b/adapters/adyoulike/usersync_test.go @@ -31,6 +31,5 @@ func TestAdyoulikeSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr_consent_string=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&gdpr=1&us_privacy=1-YY", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 259, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/aja/usersync.go b/adapters/aja/usersync.go index c54405dbbd1..6a9fad74e32 100644 --- a/adapters/aja/usersync.go +++ b/adapters/aja/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAJASyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("aja", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("aja", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/aja/usersync_test.go b/adapters/aja/usersync_test.go index 4b6c90ef141..dabd5e190b9 100644 --- a/adapters/aja/usersync_test.go +++ b/adapters/aja/usersync_test.go @@ -31,6 +31,5 @@ func TestAJASyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ad.as.amanad.adtdp.com/v1/sync/ssp?ssp=4&gdpr=1&us_privacy=C&redir=localhost/setuid?bidder=aja&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&uid=%s", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/amx/usersync.go b/adapters/amx/usersync.go index 28e6ac0ed79..17ad04d5cfb 100644 --- a/adapters/amx/usersync.go +++ b/adapters/amx/usersync.go @@ -9,5 +9,5 @@ import ( // NewAMXSyncer produces an AMX RTB usersyncer func NewAMXSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("amx", 737, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("amx", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/amx/usersync_test.go b/adapters/amx/usersync_test.go index 20a47c33b69..b6b6e6babe8 100644 --- a/adapters/amx/usersync_test.go +++ b/adapters/amx/usersync_test.go @@ -18,6 +18,5 @@ func TestAMXSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "http://pbs.amxrtb.com/cchain/0?gdpr=&gdpr_consent=&cb=localhost%2Fsetuid%3Fbidder%3Damx%26uid%3D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 737, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/appnexus/usersync.go b/adapters/appnexus/usersync.go index 22f46f1e723..d29f0e3cb6b 100644 --- a/adapters/appnexus/usersync.go +++ b/adapters/appnexus/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAppnexusSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adnxs", 32, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adnxs", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/appnexus/usersync_test.go b/adapters/appnexus/usersync_test.go index 24b9eede9d6..d01e5704e28 100644 --- a/adapters/appnexus/usersync_test.go +++ b/adapters/appnexus/usersync_test.go @@ -20,6 +20,5 @@ func TestAppNexusSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ib.adnxs.com/getuid?https%3A%2F%2Fprebid.adnxs.com%2Fpbs%2Fv1%2Fsetuid%3Fbidder%3Dadnxs%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 32, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/audienceNetwork/usersync.go b/adapters/audienceNetwork/usersync.go index 45c1281d0ae..4dd0b68ccff 100644 --- a/adapters/audienceNetwork/usersync.go +++ b/adapters/audienceNetwork/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewFacebookSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("audienceNetwork", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("audienceNetwork", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/audienceNetwork/usersync_test.go b/adapters/audienceNetwork/usersync_test.go index c3836e4f154..591ea74f7ba 100644 --- a/adapters/audienceNetwork/usersync_test.go +++ b/adapters/audienceNetwork/usersync_test.go @@ -20,6 +20,5 @@ func TestFacebookSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://www.facebook.com/audiencenetwork/idsync/?partner=partnerId&callback=localhost%2Fsetuid%3Fbidder%3DaudienceNetwork%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/avocet/usersync.go b/adapters/avocet/usersync.go index f1075ab3c52..0cfa055ae86 100644 --- a/adapters/avocet/usersync.go +++ b/adapters/avocet/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAvocetSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("avocet", 63, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("avocet", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/avocet/usersync_test.go b/adapters/avocet/usersync_test.go index 3df39b77fce..bd4cd4145a2 100644 --- a/adapters/avocet/usersync_test.go +++ b/adapters/avocet/usersync_test.go @@ -30,6 +30,5 @@ func TestAvocetSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ads.avct.cloud/getuid?&gdpr=1&gdpr_consent=ConsentString&us_privacy=PrivacyString&url=%2Fsetuid%3Fbidder%3Davocet%26gdpr%3D1%26gdpr_consent%3DConsentString%26uid%3D%7B%7BUUID%7D%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 63, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/beachfront/usersync.go b/adapters/beachfront/usersync.go index a6502331bee..72466b59478 100644 --- a/adapters/beachfront/usersync.go +++ b/adapters/beachfront/usersync.go @@ -7,12 +7,9 @@ import ( "github.com/prebid/prebid-server/usersync" ) -var VENDOR_ID uint16 = 335 - func NewBeachfrontSyncer(temp *template.Template) usersync.Usersyncer { return adapters.NewSyncer( "beachfront", - VENDOR_ID, temp, adapters.SyncTypeIframe) } diff --git a/adapters/beachfront/usersync_test.go b/adapters/beachfront/usersync_test.go index db4d825eb5a..edb52bd4f53 100644 --- a/adapters/beachfront/usersync_test.go +++ b/adapters/beachfront/usersync_test.go @@ -30,6 +30,5 @@ func TestBeachfrontSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://sync.bfmio.com/sync_s2s?gdpr=A&us_privacy=C&url=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Dbeachfront%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%5Bio_cid%5D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, uint16(335), syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/beintoo/usersync.go b/adapters/beintoo/usersync.go index a225a2b15da..fb60c6ab0a7 100644 --- a/adapters/beintoo/usersync.go +++ b/adapters/beintoo/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewBeintooSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("Beintoo", 618, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("Beintoo", temp, adapters.SyncTypeIframe) } diff --git a/adapters/beintoo/usersync_test.go b/adapters/beintoo/usersync_test.go index 880d6a84cee..65d92e6d58f 100644 --- a/adapters/beintoo/usersync_test.go +++ b/adapters/beintoo/usersync_test.go @@ -30,6 +30,5 @@ func TestBeintooSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ib.beintoo.com/um?ssp=pbs&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&redirect=localhost%2Fsetuid%3Fbidder%3Dbeintoo%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 618, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/between/usersync.go b/adapters/between/usersync.go index a34521fe438..142282730a3 100644 --- a/adapters/between/usersync.go +++ b/adapters/between/usersync.go @@ -9,5 +9,5 @@ import ( // NewBetweenSyncer returns "between" syncer func NewBetweenSyncer(template *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("between", 724, template, adapters.SyncTypeRedirect) + return adapters.NewSyncer("between", template, adapters.SyncTypeRedirect) } diff --git a/adapters/between/usersync_test.go b/adapters/between/usersync_test.go index 6470a9c441c..c54f473b209 100644 --- a/adapters/between/usersync_test.go +++ b/adapters/between/usersync_test.go @@ -1,10 +1,11 @@ package between import ( - "github.com/prebid/prebid-server/privacy" - "github.com/stretchr/testify/assert" "testing" "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/stretchr/testify/assert" ) func TestNewBetweenSyncerSyncer(t *testing.T) { @@ -19,6 +20,5 @@ func TestNewBetweenSyncerSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ads.betweendigital.com/match?bidder_id=pbs&gdpr=&gdpr_consent=&us_privacy=&callback_url=localhost:8080%2Fsetuid%3Fbidder%3Dbetween%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24%7BUSER_ID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 724, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/brightroll/usersync.go b/adapters/brightroll/usersync.go index b33cc5a2943..099303fdd01 100644 --- a/adapters/brightroll/usersync.go +++ b/adapters/brightroll/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewBrightrollSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("brightroll", 25, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("brightroll", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/brightroll/usersync_test.go b/adapters/brightroll/usersync_test.go index a5d47e35e56..fac17b0a9ae 100644 --- a/adapters/brightroll/usersync_test.go +++ b/adapters/brightroll/usersync_test.go @@ -20,6 +20,5 @@ func TestBrightrollSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "http://test-bh.ybp.yahoo.com/sync/appnexuspbs?gdpr=&euconsent=&us_privacy=&url=localhost%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 25, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/colossus/usersync.go b/adapters/colossus/usersync.go index a4e82ee3bde..bb25b187352 100644 --- a/adapters/colossus/usersync.go +++ b/adapters/colossus/usersync.go @@ -9,5 +9,5 @@ import ( // NewColossusSyncer returns colossus syncer func NewColossusSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("colossus", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("colossus", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/colossus/usersync_test.go b/adapters/colossus/usersync_test.go index 52eb6389b1c..4cb3a4bbbdf 100644 --- a/adapters/colossus/usersync_test.go +++ b/adapters/colossus/usersync_test.go @@ -30,6 +30,5 @@ func TestColossusSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://sync.colossusssp.com/pbs.gif?gdpr=0&gdpr_consent=A&us_privacy=1-YY&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dcolossus%26uid%3D%5BUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/connectad/usersync.go b/adapters/connectad/usersync.go index 5661cb5d9d8..bae96656bce 100644 --- a/adapters/connectad/usersync.go +++ b/adapters/connectad/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewConnectAdSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("connectad", 138, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("connectad", temp, adapters.SyncTypeIframe) } diff --git a/adapters/connectad/usersync_test.go b/adapters/connectad/usersync_test.go index c4b4962b9f6..81b0dc47e33 100644 --- a/adapters/connectad/usersync_test.go +++ b/adapters/connectad/usersync_test.go @@ -30,6 +30,5 @@ func TestConnectAdSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://cdn.connectad.io/connectmyusers.php?gdpr=1&consent=fakeconsent&us_privacy=fake&cb=localhost%2Fsetuid%3Fbidder%3Dconnectad%26gdpr%3D1%26gdpr_consent%3Dfakeconsent%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 138, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/consumable/usersync.go b/adapters/consumable/usersync.go index 0e0938c7b39..0cb25ca9864 100644 --- a/adapters/consumable/usersync.go +++ b/adapters/consumable/usersync.go @@ -7,13 +7,9 @@ import ( "github.com/prebid/prebid-server/usersync" ) -var VENDOR_ID uint16 = 591 - func NewConsumableSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer( "consumable", - VENDOR_ID, temp, adapters.SyncTypeRedirect) } diff --git a/adapters/consumable/usersync_test.go b/adapters/consumable/usersync_test.go index ef71c0b18c7..0af868a0a62 100644 --- a/adapters/consumable/usersync_test.go +++ b/adapters/consumable/usersync_test.go @@ -30,6 +30,5 @@ func TestConsumableSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//e.serverbid.com/udb/9969/match?gdpr=A&euconsent=B&us_privacy=C&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D", u.URL) assert.Equal(t, "redirect", u.Type) - assert.Equal(t, uint16(591), syncer.GDPRVendorID()) assert.Equal(t, false, u.SupportCORS) } diff --git a/adapters/conversant/usersync.go b/adapters/conversant/usersync.go index c2676df6620..a38631f282c 100644 --- a/adapters/conversant/usersync.go +++ b/adapters/conversant/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewConversantSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("conversant", 24, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("conversant", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/conversant/usersync_test.go b/adapters/conversant/usersync_test.go index 16affbd1d32..62ab732c443 100644 --- a/adapters/conversant/usersync_test.go +++ b/adapters/conversant/usersync_test.go @@ -25,6 +25,5 @@ func TestConversantSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "usersync?rurl=localhost%2Fsetuid%3Fbidder%3Dconversant%26gdpr%3D0%26gdpr_consent%3D%26uid%3D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 24, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/cpmstar/usersync.go b/adapters/cpmstar/usersync.go index 9c864e24ce3..d3086f65b24 100644 --- a/adapters/cpmstar/usersync.go +++ b/adapters/cpmstar/usersync.go @@ -9,5 +9,5 @@ import ( //NewCpmstarSyncer : func NewCpmstarSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("cpmstar", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("cpmstar", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/cpmstar/usersync_test.go b/adapters/cpmstar/usersync_test.go index dae55e6302e..9bae7062b1c 100644 --- a/adapters/cpmstar/usersync_test.go +++ b/adapters/cpmstar/usersync_test.go @@ -20,6 +20,5 @@ func TestCpmstarSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://server.cpmstar.com/usersync.aspx?gdpr=&gdpr_consent=&us_privacy=&redirectUri=http%3A%2F%2Flocalhost:8000%2Fsetuid%3Fbidder%3Dcpmstar%26gdpr%3D%26gdpr_consent%3D%26us_privacy%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/datablocks/usersync.go b/adapters/datablocks/usersync.go index 2b47b259e39..2c69963ae74 100644 --- a/adapters/datablocks/usersync.go +++ b/adapters/datablocks/usersync.go @@ -7,8 +7,6 @@ import ( "github.com/prebid/prebid-server/usersync" ) -const datablocksGDPRVendorID = uint16(0) - func NewDatablocksSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("datablocks", datablocksGDPRVendorID, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("datablocks", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/datablocks/usersync_test.go b/adapters/datablocks/usersync_test.go index a7518e9b226..d6ee580408a 100644 --- a/adapters/datablocks/usersync_test.go +++ b/adapters/datablocks/usersync_test.go @@ -30,6 +30,5 @@ func TestDatablocksSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&r=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%24%7Buid%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, datablocksGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/deepintent/usersync.go b/adapters/deepintent/usersync.go index 9e803df6d9d..7a17f5336d5 100644 --- a/adapters/deepintent/usersync.go +++ b/adapters/deepintent/usersync.go @@ -9,5 +9,5 @@ import ( // NewDeepintentSyncer returns deepintent syncer func NewDeepintentSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("deepintent", 541, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("deepintent", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/deepintent/usersync_test.go b/adapters/deepintent/usersync_test.go index 06a221ca2fd..6709a838100 100644 --- a/adapters/deepintent/usersync_test.go +++ b/adapters/deepintent/usersync_test.go @@ -30,6 +30,5 @@ func TestDeepintentSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://match.deepintent.com/usersync/136?id=unk&gdpr=A&us_privacy=C&url=https%3A%2F%2Flocalhost%3A8888%2Fsetuid%3Fbidder%3Ddeepintent%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%5Bio_cid%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, uint16(541), syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/dmx/usersync.go b/adapters/dmx/usersync.go index 98e56234fa6..07fedf1c124 100644 --- a/adapters/dmx/usersync.go +++ b/adapters/dmx/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewDmxSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("dmx", 144, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("dmx", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/dmx/usersync_test.go b/adapters/dmx/usersync_test.go index e4e3c7d8e55..a316af04cfb 100644 --- a/adapters/dmx/usersync_test.go +++ b/adapters/dmx/usersync_test.go @@ -1,10 +1,11 @@ package dmx import ( - "github.com/prebid/prebid-server/privacy" "testing" "text/template" + "github.com/prebid/prebid-server/privacy" + "github.com/stretchr/testify/assert" ) @@ -15,6 +16,5 @@ func TestDmxSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://dmx.districtm.io/s/v1/img/s/10007", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 144, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/emx_digital/usersync.go b/adapters/emx_digital/usersync.go index a453955b22e..2d3011e0d69 100644 --- a/adapters/emx_digital/usersync.go +++ b/adapters/emx_digital/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewEMXDigitalSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("emx_digital", 183, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("emx_digital", temp, adapters.SyncTypeIframe) } diff --git a/adapters/emx_digital/usersync_test.go b/adapters/emx_digital/usersync_test.go index 59d66d87808..7aaf133512f 100644 --- a/adapters/emx_digital/usersync_test.go +++ b/adapters/emx_digital/usersync_test.go @@ -30,6 +30,5 @@ func TestEMXDigitalSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://cs.emxdgt.com/um?ssp=pbs&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&redirect=localhost%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 183, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/engagebdr/usersync.go b/adapters/engagebdr/usersync.go index ae4047aa89c..205097b07be 100644 --- a/adapters/engagebdr/usersync.go +++ b/adapters/engagebdr/usersync.go @@ -1,11 +1,12 @@ package engagebdr import ( + "text/template" + "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/usersync" - "text/template" ) func NewEngageBDRSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("engagebdr", 62, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("engagebdr", temp, adapters.SyncTypeIframe) } diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go index 3a6c179addf..5cee3abe35c 100644 --- a/adapters/engagebdr/usersync_test.go +++ b/adapters/engagebdr/usersync_test.go @@ -30,6 +30,5 @@ func TestEngageBDRSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://match.bnmla.com/usersync/s2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&r=localhost%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 62, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/eplanning/usersync.go b/adapters/eplanning/usersync.go index faa7fa82a19..6e8abf5de27 100644 --- a/adapters/eplanning/usersync.go +++ b/adapters/eplanning/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewEPlanningSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("eplanning", 90, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("eplanning", temp, adapters.SyncTypeIframe) } diff --git a/adapters/eplanning/usersync_test.go b/adapters/eplanning/usersync_test.go index 85770689024..922ab4e20ce 100644 --- a/adapters/eplanning/usersync_test.go +++ b/adapters/eplanning/usersync_test.go @@ -20,6 +20,5 @@ func TestEPlanningSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ads.us.e-planning.net/uspd/1/?du=https%3A%2F%2Fads.us.e-planning.net%2Fgetuid%2F1%2F5a1ad71d2d53a0f5%3Flocalhost%2Fsetuid%3Fbidder%3Deplanning%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 90, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/gamma/usersync.go b/adapters/gamma/usersync.go index f19c522cebc..4e4412a1efd 100644 --- a/adapters/gamma/usersync.go +++ b/adapters/gamma/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewGammaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("gamma", 0, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("gamma", temp, adapters.SyncTypeIframe) } diff --git a/adapters/gamma/usersync_test.go b/adapters/gamma/usersync_test.go index 4278f9abd36..7636e05a6ef 100644 --- a/adapters/gamma/usersync_test.go +++ b/adapters/gamma/usersync_test.go @@ -25,6 +25,5 @@ func TestGammaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//hb.gammaplatform.com/sync?gdpr=0&gdpr_consent=&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dgamma%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/gamoshi/usersync.go b/adapters/gamoshi/usersync.go index 6b7c43dd6a2..9d6cdd0e518 100644 --- a/adapters/gamoshi/usersync.go +++ b/adapters/gamoshi/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewGamoshiSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("gamoshi", 644, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("gamoshi", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/gamoshi/usersync_test.go b/adapters/gamoshi/usersync_test.go index 43dc88a4953..0465365f5e3 100644 --- a/adapters/gamoshi/usersync_test.go +++ b/adapters/gamoshi/usersync_test.go @@ -25,6 +25,5 @@ func TestGamoshiSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://rtb.gamoshi.io/user_sync_prebid?gdpr=&consent=&us_privacy=anyValue&rurl=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dgamoshi%26gdpr%3D%7B%7B.GDPR%7D%7D%26gdpr_consent%3D%7B%7B.GDPRConsent%7D%7D%26uid%3D%5Bgusr%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 644, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/grid/usersync.go b/adapters/grid/usersync.go index afdc5db763c..31788ea3f06 100644 --- a/adapters/grid/usersync.go +++ b/adapters/grid/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewGridSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("grid", 686, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("grid", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/grid/usersync_test.go b/adapters/grid/usersync_test.go index 99730b5deb4..2d7f3fc6a4f 100644 --- a/adapters/grid/usersync_test.go +++ b/adapters/grid/usersync_test.go @@ -25,6 +25,5 @@ func TestGridSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 686, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/gumgum/usersync.go b/adapters/gumgum/usersync.go index 5d29c7dceb2..defef87dad9 100644 --- a/adapters/gumgum/usersync.go +++ b/adapters/gumgum/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewGumGumSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("gumgum", 61, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("gumgum", temp, adapters.SyncTypeIframe) } diff --git a/adapters/gumgum/usersync_test.go b/adapters/gumgum/usersync_test.go index 9c6dc420600..9b7c7aa4578 100644 --- a/adapters/gumgum/usersync_test.go +++ b/adapters/gumgum/usersync_test.go @@ -30,6 +30,5 @@ func TestGumGumSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://rtb.gumgum.com/usync/prbds2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 61, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/improvedigital/usersync.go b/adapters/improvedigital/usersync.go index 72c3ddafd49..a58b97c3864 100644 --- a/adapters/improvedigital/usersync.go +++ b/adapters/improvedigital/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewImprovedigitalSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("improvedigital", 253, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("improvedigital", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/improvedigital/usersync_test.go b/adapters/improvedigital/usersync_test.go index 35ea89cf894..9892e0cc703 100644 --- a/adapters/improvedigital/usersync_test.go +++ b/adapters/improvedigital/usersync_test.go @@ -30,6 +30,5 @@ func TestImprovedigitalSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ad.360yield.com/server_match?gdpr=A&gdpr_consent=B&us_privacy=C&r=%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%7BPUB_USER_ID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 253, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/invibes/usersync.go b/adapters/invibes/usersync.go index 468e604c1a6..e6922444d44 100644 --- a/adapters/invibes/usersync.go +++ b/adapters/invibes/usersync.go @@ -10,7 +10,6 @@ import ( func NewInvibesSyncer(urlTemplate *template.Template) usersync.Usersyncer { return adapters.NewSyncer( "invibes", - 436, urlTemplate, adapters.SyncTypeIframe, ) diff --git a/adapters/invibes/usersync_test.go b/adapters/invibes/usersync_test.go index 3f715f6bdfe..492886228fd 100644 --- a/adapters/invibes/usersync_test.go +++ b/adapters/invibes/usersync_test.go @@ -26,7 +26,6 @@ func TestInvibesSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "http://localhost:56479/home/getLid?gdpr=1&gdpr_consent=abc&us_privacy=&redirectUri=test.com%2Fsetuid%3Fbidder%3Dinvibes%26gdpr%3D1%26gdpr_consent%3Dabc%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 436, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/ix/usersync.go b/adapters/ix/usersync.go index 6f3558949e0..621fa17945a 100644 --- a/adapters/ix/usersync.go +++ b/adapters/ix/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewIxSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("ix", 10, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("ix", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/ix/usersync_test.go b/adapters/ix/usersync_test.go index 10f91da1abe..3288b1ae443 100644 --- a/adapters/ix/usersync_test.go +++ b/adapters/ix/usersync_test.go @@ -20,6 +20,5 @@ func TestIxSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ssum-sec.casalemedia.com/usermatchredir?s=184932&cb=localhost%2Fsetuid%3Fbidder%3Dix%26gdpr%3D%26gdpr_consent%3D%26uid%3D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 10, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/jixie/jixie_test.go b/adapters/jixie/jixie_test.go index 968fb4fdc9c..289dd241f23 100644 --- a/adapters/jixie/jixie_test.go +++ b/adapters/jixie/jixie_test.go @@ -1,10 +1,11 @@ package jixie import ( + "testing" + "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" - "testing" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/jixie/usersync.go b/adapters/jixie/usersync.go index 8c1d5c07374..137d78f2859 100644 --- a/adapters/jixie/usersync.go +++ b/adapters/jixie/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewJixieSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("jixie", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("jixie", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/jixie/usersync_test.go b/adapters/jixie/usersync_test.go index 5be5e51433e..575482435ff 100644 --- a/adapters/jixie/usersync_test.go +++ b/adapters/jixie/usersync_test.go @@ -1,10 +1,10 @@ package jixie import ( - "github.com/prebid/prebid-server/privacy" "testing" "text/template" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) @@ -20,6 +20,5 @@ func TestJixieSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://id.jixie.io/api/sync?pid=&gdpr=&gdpr_consent=&us_privacy=&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Djixie%26gdpr%3D%26gdpr_consent%3D%26uid%3D%25%25JXUID%25%25", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/krushmedia/usersync.go b/adapters/krushmedia/usersync.go index 5dc1471fb9f..860cb2204e9 100644 --- a/adapters/krushmedia/usersync.go +++ b/adapters/krushmedia/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewKrushmediaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("krushmedia", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("krushmedia", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/krushmedia/usersync_test.go b/adapters/krushmedia/usersync_test.go index b58f2f1bc4e..765b0faa18b 100644 --- a/adapters/krushmedia/usersync_test.go +++ b/adapters/krushmedia/usersync_test.go @@ -29,6 +29,5 @@ func TestKrushmediaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr=0&gdpr_consent=allGdpr&us_privacy=1-YY&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dkrushmedia%26uid%3D%5BUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/lifestreet/usersync.go b/adapters/lifestreet/usersync.go index 15ffde4db74..f5300ebaa90 100644 --- a/adapters/lifestreet/usersync.go +++ b/adapters/lifestreet/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewLifestreetSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("lifestreet", 67, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("lifestreet", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/lifestreet/usersync_test.go b/adapters/lifestreet/usersync_test.go index 8fee09358e8..e41217fe10f 100644 --- a/adapters/lifestreet/usersync_test.go +++ b/adapters/lifestreet/usersync_test.go @@ -25,6 +25,5 @@ func TestLifestreetSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ads.lfstmedia.com/idsync/137062?synced=1&ttl=1s&rurl=localhost%2Fsetuid%3Fbidder%3Dlifestreet%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24%24visitor_cookie%24%24", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 67, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/lockerdome/usersync.go b/adapters/lockerdome/usersync.go index fb01f8e2d99..d5cce16804a 100644 --- a/adapters/lockerdome/usersync.go +++ b/adapters/lockerdome/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewLockerDomeSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("lockerdome", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("lockerdome", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/lockerdome/usersync_test.go b/adapters/lockerdome/usersync_test.go index b5dea2261b6..3a2bd7f325b 100644 --- a/adapters/lockerdome/usersync_test.go +++ b/adapters/lockerdome/usersync_test.go @@ -20,6 +20,5 @@ func TestLockerDomeSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://lockerdome.com/usync/prebidserver?pid=&gdpr=&gdpr_consent=&us_privacy=&redirect=https%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dlockerdome%26gdpr%3D%26gdpr_consent%3D%26uid%3D%7B%7Buid%7D%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/logicad/usersync.go b/adapters/logicad/usersync.go index d26a197b0a1..e685cc985fc 100644 --- a/adapters/logicad/usersync.go +++ b/adapters/logicad/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewLogicadSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("logicad", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("logicad", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/logicad/usersync_test.go b/adapters/logicad/usersync_test.go index 89d6207d348..e8b10c665fe 100644 --- a/adapters/logicad/usersync_test.go +++ b/adapters/logicad/usersync_test.go @@ -26,6 +26,5 @@ func TestLogicadSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://localhost/cookiesender?r=true&gdpr=1&gdpr_consent=A&ru=localhost%2Fsetuid%3Fbidder%3Dlogicad%26gdpr%3D1%26gdpr_consent%3DA%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/lunamedia/usersync.go b/adapters/lunamedia/usersync.go index 7ad54e384a1..39c9a808040 100644 --- a/adapters/lunamedia/usersync.go +++ b/adapters/lunamedia/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewLunaMediaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("lunamedia", 0, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("lunamedia", temp, adapters.SyncTypeIframe) } diff --git a/adapters/lunamedia/usersync_test.go b/adapters/lunamedia/usersync_test.go index c9fe2032d2c..24cd740d600 100644 --- a/adapters/lunamedia/usersync_test.go +++ b/adapters/lunamedia/usersync_test.go @@ -26,6 +26,5 @@ func TestLunaMediaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://api.lunamedia.io/xp/user-sync?acctid={aid}&&redirect=localhost/setuid?bidder=lunamedia&gdpr=1&gdpr_consent=A&uid=$UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/marsmedia/usersync.go b/adapters/marsmedia/usersync.go index 50996f325ac..4ac76d1f5f2 100644 --- a/adapters/marsmedia/usersync.go +++ b/adapters/marsmedia/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewMarsmediaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("marsmedia", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("marsmedia", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/marsmedia/usersync_test.go b/adapters/marsmedia/usersync_test.go index f019c014516..975af65fcf5 100644 --- a/adapters/marsmedia/usersync_test.go +++ b/adapters/marsmedia/usersync_test.go @@ -30,7 +30,6 @@ func TestMarsmediaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://dmp.rtbsrv.com/dmp/profiles/cm?p_id=179&gdpr=A&gdpr_consent=B&us_privacy=C&redirect=localhost:8000%2Fsetuid%3Fbidder%3Dmarsmedia%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24%7BUUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/mediafuse/usersync.go b/adapters/mediafuse/usersync.go index 5381bf3606d..b91a6b5052c 100644 --- a/adapters/mediafuse/usersync.go +++ b/adapters/mediafuse/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewMediafuseSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("mediafuse", 411, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("mediafuse", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/mediafuse/usersync_test.go b/adapters/mediafuse/usersync_test.go index 30b5b535b12..e3dfa06831d 100644 --- a/adapters/mediafuse/usersync_test.go +++ b/adapters/mediafuse/usersync_test.go @@ -25,6 +25,5 @@ func TestMediafuseSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.hbmp.mediafuse.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dmediafuse%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7Buid%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 411, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/mgid/usersync.go b/adapters/mgid/usersync.go index fbdb95f01fc..94cf12e119d 100644 --- a/adapters/mgid/usersync.go +++ b/adapters/mgid/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewMgidSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("mgid", 358, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("mgid", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/mgid/usersync_test.go b/adapters/mgid/usersync_test.go index 2ce634eeac2..3fa5a151bd8 100644 --- a/adapters/mgid/usersync_test.go +++ b/adapters/mgid/usersync_test.go @@ -25,6 +25,5 @@ func TestMgidSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://cm.mgid.com/m?cdsp=363893&adu=https%3A//external.com%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7Bmuidn%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 358, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/nanointeractive/usersync.go b/adapters/nanointeractive/usersync.go index e6227436fb2..6bd9cd1f036 100644 --- a/adapters/nanointeractive/usersync.go +++ b/adapters/nanointeractive/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewNanoInteractiveSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("nanointeractive", 72, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("nanointeractive", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/nanointeractive/usersync_test.go b/adapters/nanointeractive/usersync_test.go index fa78664928f..4d816ab7384 100644 --- a/adapters/nanointeractive/usersync_test.go +++ b/adapters/nanointeractive/usersync_test.go @@ -31,6 +31,5 @@ func TestNewNanoInteractiveSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ad.audiencemanager.de/hbs/cookie_sync?gdpr=1&consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&redirectUri=http%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dnanointeractive%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 72, userSync.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/ninthdecimal/usersync.go b/adapters/ninthdecimal/usersync.go index 7a8d029cfa9..a01fdb636e3 100755 --- a/adapters/ninthdecimal/usersync.go +++ b/adapters/ninthdecimal/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewNinthDecimalSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("ninthdecimal", 0, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("ninthdecimal", temp, adapters.SyncTypeIframe) } diff --git a/adapters/ninthdecimal/usersync_test.go b/adapters/ninthdecimal/usersync_test.go index ee121434f29..e722a2b6e69 100755 --- a/adapters/ninthdecimal/usersync_test.go +++ b/adapters/ninthdecimal/usersync_test.go @@ -26,6 +26,5 @@ func TestNinthDecimalSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://rtb.ninthdecimal.com/xp/user-sync?acctid={aid}&&redirect=localhost/setuid?bidder=ninthdecimal&gdpr=1&gdpr_consent=A&uid=$UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/nobid/usersync.go b/adapters/nobid/usersync.go index c21413f59e7..442075648ce 100644 --- a/adapters/nobid/usersync.go +++ b/adapters/nobid/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewNoBidSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("nobid", 816, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("nobid", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/onetag/usersync.go b/adapters/onetag/usersync.go index f36b82a853c..9a2b700dd3d 100644 --- a/adapters/onetag/usersync.go +++ b/adapters/onetag/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSyncer(template *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("onetag", 241, template, adapters.SyncTypeIframe) + return adapters.NewSyncer("onetag", template, adapters.SyncTypeIframe) } diff --git a/adapters/onetag/usersync_test.go b/adapters/onetag/usersync_test.go index 31892e6d9c8..21f4837d5e1 100644 --- a/adapters/onetag/usersync_test.go +++ b/adapters/onetag/usersync_test.go @@ -20,5 +20,4 @@ func TestOneTagSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://onetag-sys.com/usync/?redir=", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 241, syncer.GDPRVendorID()) } diff --git a/adapters/openx/usersync.go b/adapters/openx/usersync.go index bb4b328ce62..875b60fbd10 100644 --- a/adapters/openx/usersync.go +++ b/adapters/openx/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewOpenxSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("openx", 69, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("openx", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/openx/usersync_test.go b/adapters/openx/usersync_test.go index cdbb7da8b95..14ec38be118 100644 --- a/adapters/openx/usersync_test.go +++ b/adapters/openx/usersync_test.go @@ -20,6 +20,5 @@ func TestOpenxSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://rtb.openx.net/sync/prebid?gdpr=&gdpr_consent=&r=localhost%2Fsetuid%3Fbidder%3Dopenx%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 69, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/pubmatic/usersync.go b/adapters/pubmatic/usersync.go index 7b4d8e86b50..822f13cea3d 100644 --- a/adapters/pubmatic/usersync.go +++ b/adapters/pubmatic/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewPubmaticSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("pubmatic", 76, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("pubmatic", temp, adapters.SyncTypeIframe) } diff --git a/adapters/pubmatic/usersync_test.go b/adapters/pubmatic/usersync_test.go index d6cd9f78af7..0f4d2e857d3 100644 --- a/adapters/pubmatic/usersync_test.go +++ b/adapters/pubmatic/usersync_test.go @@ -30,6 +30,5 @@ func TestPubmaticSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ads.pubmatic.com/AdServer/js/user_sync.html?gdpr=A&gdpr_consent=B&us_privacy=C&predirect=localhost%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 76, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/pulsepoint/usersync.go b/adapters/pulsepoint/usersync.go index 58de835be28..1b6903f9f02 100644 --- a/adapters/pulsepoint/usersync.go +++ b/adapters/pulsepoint/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewPulsepointSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("pulsepoint", 81, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("pulsepoint", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/pulsepoint/usersync_test.go b/adapters/pulsepoint/usersync_test.go index e1680fd22ba..7cfea57cb91 100644 --- a/adapters/pulsepoint/usersync_test.go +++ b/adapters/pulsepoint/usersync_test.go @@ -20,6 +20,5 @@ func TestPulsepointSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//bh.contextweb.com/rtset?pid=561205&ev=1&rurl=http%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dpulsepoint%26gdpr%3D%26gdpr_consent%3D%26uid%3D%25%25VGUID%25%25", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 81, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/rhythmone/usersync.go b/adapters/rhythmone/usersync.go index 0f7db388e5c..990fcb065f6 100644 --- a/adapters/rhythmone/usersync.go +++ b/adapters/rhythmone/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewRhythmoneSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("rhythmone", 36, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("rhythmone", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/rhythmone/usersync_test.go b/adapters/rhythmone/usersync_test.go index 85ecba2a8ab..97920fb4980 100644 --- a/adapters/rhythmone/usersync_test.go +++ b/adapters/rhythmone/usersync_test.go @@ -30,6 +30,5 @@ func TestRhythmoneSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://sync.1rx.io/usersync2/rmphb?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&us_privacy=1NYN&redir=localhost%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D%5BRX_UUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 36, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/rtbhouse/usersync.go b/adapters/rtbhouse/usersync.go index 3e38d67e593..baa0b994373 100644 --- a/adapters/rtbhouse/usersync.go +++ b/adapters/rtbhouse/usersync.go @@ -7,13 +7,11 @@ import ( "github.com/prebid/prebid-server/usersync" ) -const rtbHouseGDPRVendorID = uint16(16) const rtbHouseFamilyName = "rtbhouse" func NewRTBHouseSyncer(urlTemplate *template.Template) usersync.Usersyncer { return adapters.NewSyncer( rtbHouseFamilyName, - rtbHouseGDPRVendorID, urlTemplate, adapters.SyncTypeRedirect, ) diff --git a/adapters/rtbhouse/usersync_test.go b/adapters/rtbhouse/usersync_test.go index bb139f7a2e5..a7cb2590f90 100644 --- a/adapters/rtbhouse/usersync_test.go +++ b/adapters/rtbhouse/usersync_test.go @@ -25,6 +25,5 @@ func TestRTBHouseSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://creativecdn.com/cm-notify?pi=prebidsrvtst&gdpr=0&gdpr_consent=", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, rtbHouseGDPRVendorID, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/rubicon/usersync.go b/adapters/rubicon/usersync.go index 08d98825a1e..a4ab464a73f 100644 --- a/adapters/rubicon/usersync.go +++ b/adapters/rubicon/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewRubiconSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("rubicon", 52, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("rubicon", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/rubicon/usersync_test.go b/adapters/rubicon/usersync_test.go index 646ebff2dc4..eca4056206e 100644 --- a/adapters/rubicon/usersync_test.go +++ b/adapters/rubicon/usersync_test.go @@ -25,7 +25,6 @@ func TestRubiconSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://pixel.rubiconproject.com/exchange/sync.php?p=prebid&gdpr=0&gdpr_consent=", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 52, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) assert.Equal(t, "rubicon", syncer.FamilyName()) } diff --git a/adapters/sharethrough/usersync.go b/adapters/sharethrough/usersync.go index a951fcd6a0a..f76f41ca83e 100644 --- a/adapters/sharethrough/usersync.go +++ b/adapters/sharethrough/usersync.go @@ -1,11 +1,12 @@ package sharethrough import ( + "text/template" + "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/usersync" - "text/template" ) func NewSharethroughSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("sharethrough", 80, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("sharethrough", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/sharethrough/usersync_test.go b/adapters/sharethrough/usersync_test.go index 4802329554e..00b3c427fb8 100644 --- a/adapters/sharethrough/usersync_test.go +++ b/adapters/sharethrough/usersync_test.go @@ -25,7 +25,6 @@ func TestSharethroughSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://match.sharethrough.com?gdpr=0&gdpr_consent=", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 80, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) assert.Equal(t, "sharethrough", syncer.FamilyName()) } diff --git a/adapters/smartadserver/usersync.go b/adapters/smartadserver/usersync.go index 95b305ff227..f7199965441 100644 --- a/adapters/smartadserver/usersync.go +++ b/adapters/smartadserver/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSmartadserverSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("smartadserver", 45, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("smartadserver", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/smartadserver/usersync_test.go b/adapters/smartadserver/usersync_test.go index c4e6660693f..319ce5b58a6 100644 --- a/adapters/smartadserver/usersync_test.go +++ b/adapters/smartadserver/usersync_test.go @@ -30,6 +30,5 @@ func TestSmartadserverSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ssbsync.smartadserver.com/getuid?gdpr=1&gdpr_consent=COyASAoOyASAoAfAAAENAfCAAAAAAAAAAAAAAAAAAAAA&us_privacy=1YNN&url=localhost%2Fsetuid%3Fbidder%3Dsmartadserver%26gdpr%3D1%26gdpr_consent%3DCOyASAoOyASAoAfAAAENAfCAAAAAAAAAAAAAAAAAAAAA%26uid%3D%5Bsas_uid%5D%22", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 45, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/smartrtb/usersync.go b/adapters/smartrtb/usersync.go index 2f7b1dc3339..74ef0e9960b 100644 --- a/adapters/smartrtb/usersync.go +++ b/adapters/smartrtb/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSmartRTBSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("smartrtb", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("smartrtb", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/smartrtb/usersync_test.go b/adapters/smartrtb/usersync_test.go index ae3ae5dc007..68a8452a316 100644 --- a/adapters/smartrtb/usersync_test.go +++ b/adapters/smartrtb/usersync_test.go @@ -15,6 +15,5 @@ func TestSmartRTBSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "http://market-east.smrtb.com/sync/all?nid=smartrtb&gdpr=&gdpr_consent=&url=localhost%2Fsetuid%3Fbidder%smartrtb%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/smartyads/usersync.go b/adapters/smartyads/usersync.go index 839621e9927..9075aa9bcd7 100644 --- a/adapters/smartyads/usersync.go +++ b/adapters/smartyads/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSmartyAdsSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("smartyads", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("smartyads", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/smartyads/usersync_test.go b/adapters/smartyads/usersync_test.go index ed7fc07b594..4f94591c634 100644 --- a/adapters/smartyads/usersync_test.go +++ b/adapters/smartyads/usersync_test.go @@ -29,6 +29,5 @@ func TestSmartyAdsSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://as.ck-ie.com/prebid.gif?gdpr=0&gdpr_consent=ANDFJDS&us_privacy=1-YY&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dsmartyads%26uid%3D%5BUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/somoaudience/usersync.go b/adapters/somoaudience/usersync.go index e1e7e2ef21d..5d1ddd71bc6 100644 --- a/adapters/somoaudience/usersync.go +++ b/adapters/somoaudience/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSomoaudienceSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("somoaudience", 341, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("somoaudience", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/somoaudience/usersync_test.go b/adapters/somoaudience/usersync_test.go index 86460506d68..2367a5674dd 100644 --- a/adapters/somoaudience/usersync_test.go +++ b/adapters/somoaudience/usersync_test.go @@ -20,6 +20,5 @@ func TestSomoaudienceSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//publisher-east.mobileadtrading.com/usersync?ru=localhost%2Fsetuid%3Fbidder%3Dsomoaudience%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24%7BUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 341, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/sonobi/usersync.go b/adapters/sonobi/usersync.go index 6986d0fd8a1..6fedd8bfa05 100644 --- a/adapters/sonobi/usersync.go +++ b/adapters/sonobi/usersync.go @@ -1,11 +1,12 @@ package sonobi import ( + "text/template" + "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/usersync" - "text/template" ) func NewSonobiSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("sonobi", 104, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("sonobi", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/sonobi/usersync_test.go b/adapters/sonobi/usersync_test.go index bfe5859e5d1..995c3757ba4 100644 --- a/adapters/sonobi/usersync_test.go +++ b/adapters/sonobi/usersync_test.go @@ -25,6 +25,5 @@ func TestSonobiSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.go.sonobi.com/us.gif?loc=external.com%2Fsetuid%3Fbidder%3Dsonobi%26consent_string%3D0%26gdpr%3D%26uid%3D%5BUID%5D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 104, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/sovrn/usersync.go b/adapters/sovrn/usersync.go index b4de623718a..225f2888196 100644 --- a/adapters/sovrn/usersync.go +++ b/adapters/sovrn/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSovrnSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("sovrn", 13, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("sovrn", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/sovrn/usersync_test.go b/adapters/sovrn/usersync_test.go index 4a4dfd9d1b9..6c35ecdb05d 100644 --- a/adapters/sovrn/usersync_test.go +++ b/adapters/sovrn/usersync_test.go @@ -25,6 +25,5 @@ func TestSovrnSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ap.lijit.com/pixel?redir=external.com%2Fsetuid%3Fbidder%3Dsovrn%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 13, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/synacormedia/usersync.go b/adapters/synacormedia/usersync.go index 988c1b9ef6a..c7fa5c42aea 100644 --- a/adapters/synacormedia/usersync.go +++ b/adapters/synacormedia/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewSynacorMediaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("synacormedia", 0, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("synacormedia", temp, adapters.SyncTypeIframe) } diff --git a/adapters/synacormedia/usersync_test.go b/adapters/synacormedia/usersync_test.go index 538efb30c73..ce45353c7e5 100644 --- a/adapters/synacormedia/usersync_test.go +++ b/adapters/synacormedia/usersync_test.go @@ -20,6 +20,5 @@ func TestSynacormediaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.technoratimedia.com/services?srv=cs&pid=70&cb=localhost%2Fsetuid%3Fbidder%3Dsynacormedia%26uid%3D%5BUSER_ID%5D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/syncer.go b/adapters/syncer.go index 122bcc7ed38..b9752b50ce1 100644 --- a/adapters/syncer.go +++ b/adapters/syncer.go @@ -4,34 +4,21 @@ import ( "text/template" "github.com/prebid/prebid-server/macros" - "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/privacy" "github.com/prebid/prebid-server/usersync" ) -func GDPRAwareSyncerIDs(syncers map[openrtb_ext.BidderName]usersync.Usersyncer) map[openrtb_ext.BidderName]uint16 { - gdprAwareSyncers := make(map[openrtb_ext.BidderName]uint16, len(syncers)) - for bidderName, syncer := range syncers { - if syncer.GDPRVendorID() != 0 { - gdprAwareSyncers[bidderName] = syncer.GDPRVendorID() - } - } - return gdprAwareSyncers -} - type Syncer struct { - familyName string - gdprVendorID uint16 - urlTemplate *template.Template - syncType SyncType + familyName string + syncType SyncType + urlTemplate *template.Template } -func NewSyncer(familyName string, vendorID uint16, urlTemplate *template.Template, syncType SyncType) *Syncer { +func NewSyncer(familyName string, urlTemplate *template.Template, syncType SyncType) *Syncer { return &Syncer{ - familyName: familyName, - gdprVendorID: vendorID, - urlTemplate: urlTemplate, - syncType: syncType, + familyName: familyName, + urlTemplate: urlTemplate, + syncType: syncType, } } @@ -62,7 +49,3 @@ func (s *Syncer) GetUsersyncInfo(privacyPolicies privacy.Policies) (*usersync.Us func (s *Syncer) FamilyName() string { return s.familyName } - -func (s *Syncer) GDPRVendorID() uint16 { - return s.gdprVendorID -} diff --git a/adapters/tappx/usersync.go b/adapters/tappx/usersync.go index 7bf6b9a6094..01477c35363 100644 --- a/adapters/tappx/usersync.go +++ b/adapters/tappx/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTappxSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("tappx", 628, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("tappx", temp, adapters.SyncTypeIframe) } diff --git a/adapters/tappx/usersync_test.go b/adapters/tappx/usersync_test.go index 65919b9f1f1..992a35de9a8 100644 --- a/adapters/tappx/usersync_test.go +++ b/adapters/tappx/usersync_test.go @@ -30,6 +30,5 @@ func TestTappxSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//testing.ssp.tappx.com/cs/usersync.php?gdpr_optin=1&gdpr_consent=A&us_privacy=1YNN&type=iframe&ruid=localhost%2Fsetuid%3Fbidder%3Dtappx%26gdpr%3D1%26gdpr_consent%3DA%26uid%3D%7B%7BTPPXUID%7D%7D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 628, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/telaria/usersync.go b/adapters/telaria/usersync.go index e3f76f6e9b4..76be62026f8 100644 --- a/adapters/telaria/usersync.go +++ b/adapters/telaria/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTelariaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("telaria", 202, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("telaria", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/telaria/usersync_test.go b/adapters/telaria/usersync_test.go index 4896b253d2f..f019ed5ceaf 100644 --- a/adapters/telaria/usersync_test.go +++ b/adapters/telaria/usersync_test.go @@ -26,7 +26,6 @@ func TestTelariaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://pbs.publishers.tremorhub.com/pubsync?gdpr=0&gdpr_consent=", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 202, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) assert.Equal(t, "telaria", syncer.FamilyName()) diff --git a/adapters/triplelift/usersync.go b/adapters/triplelift/usersync.go index 5cb524bea11..4a47615bd29 100644 --- a/adapters/triplelift/usersync.go +++ b/adapters/triplelift/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("triplelift", 28, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("triplelift", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/triplelift/usersync_test.go b/adapters/triplelift/usersync_test.go index 1731b22dffb..012e33a4d0a 100644 --- a/adapters/triplelift/usersync_test.go +++ b/adapters/triplelift/usersync_test.go @@ -20,6 +20,5 @@ func TestTripleliftSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//eb2.3lift.com/getuid?gdpr=&cmp_cs=&us_privacy=&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 28, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/triplelift_native/usersync.go b/adapters/triplelift_native/usersync.go index b7587b77950..2a07740a761 100644 --- a/adapters/triplelift_native/usersync.go +++ b/adapters/triplelift_native/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("triplelift", 28, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("triplelift", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/triplelift_native/usersync_test.go b/adapters/triplelift_native/usersync_test.go index df0757edc9f..7fd878b7f92 100644 --- a/adapters/triplelift_native/usersync_test.go +++ b/adapters/triplelift_native/usersync_test.go @@ -20,6 +20,5 @@ func TestTripleliftSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//eb2.3lift.com/getuid?gdpr=&cmp_cs=&us_privacy=&redir=https%3A%2F%2Feb2.3lift.com%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 28, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/trustx/usersync.go b/adapters/trustx/usersync.go index a617cd716a4..a738e8e9b79 100644 --- a/adapters/trustx/usersync.go +++ b/adapters/trustx/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTrustXSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("trustx", 686, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("trustx", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/trustx/usersync_test.go b/adapters/trustx/usersync_test.go index ced0d21552b..ba371bc2061 100644 --- a/adapters/trustx/usersync_test.go +++ b/adapters/trustx/usersync_test.go @@ -25,6 +25,5 @@ func TestTrustXSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 686, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/ucfunnel/usersync.go b/adapters/ucfunnel/usersync.go index 92eba0d73e0..0ae9948dd77 100644 --- a/adapters/ucfunnel/usersync.go +++ b/adapters/ucfunnel/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewUcfunnelSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("ucfunnel", 607, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("ucfunnel", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/ucfunnel/usersync_test.go b/adapters/ucfunnel/usersync_test.go index 45320b8cac1..204de978150 100644 --- a/adapters/ucfunnel/usersync_test.go +++ b/adapters/ucfunnel/usersync_test.go @@ -25,6 +25,5 @@ func TestUcfunnelSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.aralego.com/idsync?gdpr=0&redirect=externalURL.com%2Fsetuid%3Fbidder%3Ducfunnel%26uid%3DSspCookieUserId", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 607, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/unruly/usersync.go b/adapters/unruly/usersync.go index c90052a475f..5dc60c859bb 100644 --- a/adapters/unruly/usersync.go +++ b/adapters/unruly/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewUnrulySyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("unruly", 162, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("unruly", temp, adapters.SyncTypeIframe) } diff --git a/adapters/unruly/usersync_test.go b/adapters/unruly/usersync_test.go index 2f0e07d813a..f0702cebd34 100644 --- a/adapters/unruly/usersync_test.go +++ b/adapters/unruly/usersync_test.go @@ -30,6 +30,5 @@ func TestUnrulySyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr=A&consent=B&us_privacy=C&rurl=%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) - assert.EqualValues(t, 162, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/valueimpression/usersync.go b/adapters/valueimpression/usersync.go index 34addbc0e75..08490a5ed3e 100644 --- a/adapters/valueimpression/usersync.go +++ b/adapters/valueimpression/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewValueImpressionSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("valueimpression", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("valueimpression", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/valueimpression/usersync_test.go b/adapters/valueimpression/usersync_test.go index ffb3f372bd7..7b3a13c5dd6 100644 --- a/adapters/valueimpression/usersync_test.go +++ b/adapters/valueimpression/usersync_test.go @@ -30,6 +30,5 @@ func TestValueImpressionSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://rtb.valueimpression.com/usersync?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redirectUri=http%3A%2F%2Flocalhost:8000%2Fsetuid%3Fbidder%3Dvalueimpression%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/verizonmedia/usersync.go b/adapters/verizonmedia/usersync.go index 31fb12a2064..2c7354d1146 100644 --- a/adapters/verizonmedia/usersync.go +++ b/adapters/verizonmedia/usersync.go @@ -1,11 +1,12 @@ package verizonmedia import ( + "text/template" + "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/usersync" - "text/template" ) func NewVerizonMediaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("verizonmedia", 25, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("verizonmedia", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/verizonmedia/usersync_test.go b/adapters/verizonmedia/usersync_test.go index ad77ef0e6cb..9dd1ae70c25 100644 --- a/adapters/verizonmedia/usersync_test.go +++ b/adapters/verizonmedia/usersync_test.go @@ -19,5 +19,4 @@ func TestVerizonMediaSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 25, syncer.GDPRVendorID()) } diff --git a/adapters/visx/usersync.go b/adapters/visx/usersync.go index fe1f5a42a10..dc143570ab9 100644 --- a/adapters/visx/usersync.go +++ b/adapters/visx/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewVisxSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("visx", 154, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("visx", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/visx/usersync_test.go b/adapters/visx/usersync_test.go index b410cda6061..ec4cf82b04b 100644 --- a/adapters/visx/usersync_test.go +++ b/adapters/visx/usersync_test.go @@ -30,6 +30,5 @@ func TestVisxSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://t.visx.net/s2s_sync?gdpr=A&gdpr_consent=B&us_privacy=C&redir=%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24%7BUUID%7D", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 154, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/vrtcal/usersync.go b/adapters/vrtcal/usersync.go index 04e52955033..8a6ddc0ca26 100644 --- a/adapters/vrtcal/usersync.go +++ b/adapters/vrtcal/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewVrtcalSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("vrtcal", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("vrtcal", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/vrtcal/usersync_test.go b/adapters/vrtcal/usersync_test.go index 26e5838dbe3..7f8ca220a96 100644 --- a/adapters/vrtcal/usersync_test.go +++ b/adapters/vrtcal/usersync_test.go @@ -25,7 +25,6 @@ func TestVrtcalSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "http://usync-prebid.vrtcal.com/s?gdpr=0&gdpr_consent=", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) assert.Equal(t, "vrtcal", syncer.FamilyName()) } diff --git a/adapters/yieldlab/usersync.go b/adapters/yieldlab/usersync.go index 3ee9a3fdfb5..90507e31161 100644 --- a/adapters/yieldlab/usersync.go +++ b/adapters/yieldlab/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewYieldlabSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("yieldlab", 70, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("yieldlab", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/yieldlab/usersync_test.go b/adapters/yieldlab/usersync_test.go index 3892c16bf05..eabd46f6dce 100644 --- a/adapters/yieldlab/usersync_test.go +++ b/adapters/yieldlab/usersync_test.go @@ -21,6 +21,5 @@ func TestYieldlabSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "https://ad.yieldlab.net/mr?t=2&pid=9140838&gdpr=0&gdpr_consent=&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dyieldlab%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%25%25YL_UID%25%25", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 70, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/yieldmo/usersync.go b/adapters/yieldmo/usersync.go index 041e7e8f073..d06caa90c0b 100644 --- a/adapters/yieldmo/usersync.go +++ b/adapters/yieldmo/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewYieldmoSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("yieldmo", 173, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("yieldmo", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/yieldmo/usersync_test.go b/adapters/yieldmo/usersync_test.go index 598710ec742..5d12c63e4aa 100644 --- a/adapters/yieldmo/usersync_test.go +++ b/adapters/yieldmo/usersync_test.go @@ -25,6 +25,5 @@ func TestYieldmoSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//ads.yieldmo.com/pbsync?gdpr=0&gdpr_consent=&us_privacy=&redirectUri=http%3A%2F%2Flocalhost%2F%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 173, syncer.GDPRVendorID()) assert.False(t, syncInfo.SupportCORS) } diff --git a/adapters/yieldone/usersync.go b/adapters/yieldone/usersync.go index bc9d1b3235b..4d5d8283a68 100644 --- a/adapters/yieldone/usersync.go +++ b/adapters/yieldone/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewYieldoneSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("yieldone", 0, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("yieldone", temp, adapters.SyncTypeRedirect) } diff --git a/adapters/yieldone/usersync_test.go b/adapters/yieldone/usersync_test.go index 902f3b66b34..c4d0fee92dd 100644 --- a/adapters/yieldone/usersync_test.go +++ b/adapters/yieldone/usersync_test.go @@ -25,6 +25,5 @@ func TestYieldoneSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//not_localhost/synclocalhost%2Fsetuid%3Fbidder%3Dyieldone%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%24UID", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) - assert.EqualValues(t, 0, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/zeroclickfraud/usersync.go b/adapters/zeroclickfraud/usersync.go index 833524e4b3e..41c589818ca 100644 --- a/adapters/zeroclickfraud/usersync.go +++ b/adapters/zeroclickfraud/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewZeroClickFraudSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("zeroclickfraud", 0, temp, adapters.SyncTypeIframe) + return adapters.NewSyncer("zeroclickfraud", temp, adapters.SyncTypeIframe) } diff --git a/config/bidderinfo.go b/config/bidderinfo.go index 4af8a97cd32..9eff288f64f 100644 --- a/config/bidderinfo.go +++ b/config/bidderinfo.go @@ -19,6 +19,7 @@ type BidderInfo struct { Capabilities *CapabilitiesInfo `yaml:"capabilities"` ModifyingVastXmlAllowed bool `yaml:"modifyingVastXmlAllowed"` Debug *DebugInfo `yaml:"debug,omitempty"` + GVLVendorID uint16 `yaml:"gvlVendorID,omitempty"` } // MaintainerInfo is the support email address for a bidder. @@ -43,13 +44,13 @@ type DebugInfo struct { } // LoadBidderInfoFromDisk parses all static/bidder-info/{bidder}.yaml files from the file system. -func LoadBidderInfoFromDisk(path string, adapterConfigs map[string]Adapter, bidders []string) (map[string]BidderInfo, error) { +func LoadBidderInfoFromDisk(path string, adapterConfigs map[string]Adapter, bidders []string) (BidderInfos, error) { reader := infoReaderFromDisk{path} return loadBidderInfo(reader, adapterConfigs, bidders) } -func loadBidderInfo(r infoReader, adapterConfigs map[string]Adapter, bidders []string) (map[string]BidderInfo, error) { - infos := map[string]BidderInfo{} +func loadBidderInfo(r infoReader, adapterConfigs map[string]Adapter, bidders []string) (BidderInfos, error) { + infos := BidderInfos{} for _, bidder := range bidders { data, err := r.Read(bidder) @@ -86,3 +87,15 @@ func (r infoReaderFromDisk) Read(bidder string) ([]byte, error) { path := fmt.Sprintf("%v/%v.yaml", r.path, bidder) return ioutil.ReadFile(path) } + +// ToGVLVendorIDMap transforms a BidderInfos object to a map of bidder names to GVL id. Disabled +// bidders are omitted from the result. +func (infos BidderInfos) ToGVLVendorIDMap() map[openrtb_ext.BidderName]uint16 { + m := make(map[openrtb_ext.BidderName]uint16, len(infos)) + for name, info := range infos { + if info.Enabled && info.GVLVendorID != 0 { + m[openrtb_ext.BidderName(name)] = info.GVLVendorID + } + } + return m +} diff --git a/config/bidderinfo_test.go b/config/bidderinfo_test.go index 2d9d53ec369..62a0b853abd 100644 --- a/config/bidderinfo_test.go +++ b/config/bidderinfo_test.go @@ -13,6 +13,7 @@ const testInfoFilesPath = "./test/bidder-info" const testYAML = ` maintainer: email: "some-email@domain.com" +gvlVendorID: 42 capabilities: app: mediaTypes: @@ -36,12 +37,13 @@ func TestLoadBidderInfoFromDisk(t *testing.T) { t.Fatal(err) } - expected := map[string]BidderInfo{ + expected := BidderInfos{ bidder: { Enabled: true, Maintainer: &MaintainerInfo{ Email: "some-email@domain.com", }, + GVLVendorID: 42, Capabilities: &CapabilitiesInfo{ App: &PlatformInfo{ MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeNative}, @@ -63,7 +65,7 @@ func TestLoadBidderInfo(t *testing.T) { givenConfigs map[string]Adapter givenContent string givenError error - expectedInfo map[string]BidderInfo + expectedInfo BidderInfos expectedError string }{ { @@ -76,6 +78,7 @@ func TestLoadBidderInfo(t *testing.T) { Maintainer: &MaintainerInfo{ Email: "some-email@domain.com", }, + GVLVendorID: 42, Capabilities: &CapabilitiesInfo{ App: &PlatformInfo{ MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeNative}, @@ -97,6 +100,7 @@ func TestLoadBidderInfo(t *testing.T) { Maintainer: &MaintainerInfo{ Email: "some-email@domain.com", }, + GVLVendorID: 42, Capabilities: &CapabilitiesInfo{ App: &PlatformInfo{ MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeNative}, @@ -118,6 +122,7 @@ func TestLoadBidderInfo(t *testing.T) { Maintainer: &MaintainerInfo{ Email: "some-email@domain.com", }, + GVLVendorID: 42, Capabilities: &CapabilitiesInfo{ App: &PlatformInfo{ MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeNative}, @@ -139,6 +144,7 @@ func TestLoadBidderInfo(t *testing.T) { Maintainer: &MaintainerInfo{ Email: "some-email@domain.com", }, + GVLVendorID: 42, Capabilities: &CapabilitiesInfo{ App: &PlatformInfo{ MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner, openrtb_ext.BidTypeNative}, @@ -186,3 +192,19 @@ type fakeInfoReader struct { func (r fakeInfoReader) Read(bidder string) ([]byte, error) { return []byte(r.content), r.err } + +func TestToGVLVendorIDMap(t *testing.T) { + givenBidderInfos := BidderInfos{ + "bidderA": BidderInfo{Enabled: true, GVLVendorID: 0}, + "bidderB": BidderInfo{Enabled: true, GVLVendorID: 100}, + "bidderC": BidderInfo{Enabled: false, GVLVendorID: 0}, + "bidderD": BidderInfo{Enabled: false, GVLVendorID: 200}, + } + + expectedGVLVendorIDMap := map[openrtb_ext.BidderName]uint16{ + "bidderB": 100, + } + + result := givenBidderInfos.ToGVLVendorIDMap() + assert.Equal(t, expectedGVLVendorIDMap, result) +} diff --git a/config/test/bidder-info/someBidder.yaml b/config/test/bidder-info/someBidder.yaml index b5216f0fe46..232b73d0aac 100644 --- a/config/test/bidder-info/someBidder.yaml +++ b/config/test/bidder-info/someBidder.yaml @@ -1,5 +1,6 @@ maintainer: email: "some-email@domain.com" +gvlVendorID: 42 capabilities: app: mediaTypes: diff --git a/endpoints/setuid_test.go b/endpoints/setuid_test.go index fc98608ef9f..87c98f23ad1 100644 --- a/endpoints/setuid_test.go +++ b/endpoints/setuid_test.go @@ -462,8 +462,3 @@ func (s fakeSyncer) FamilyName() string { func (s fakeSyncer) GetUsersyncInfo(privacyPolicies privacy.Policies) (*usersync.UsersyncInfo, error) { return nil, nil } - -// GDPRVendorID implements the Usersyncer interface with a no-op. -func (s fakeSyncer) GDPRVendorID() uint16 { - return 0 -} diff --git a/router/router.go b/router/router.go index 7a088bbfc68..0920f1d61b6 100644 --- a/router/router.go +++ b/router/router.go @@ -217,7 +217,6 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R // Metrics engine r.MetricsEngine = metricsConf.NewMetricsEngine(cfg, legacyBidderList) db, shutdown, fetcher, ampFetcher, accounts, categoriesFetcher, videoFetcher := storedRequestsConf.NewStoredRequests(cfg, r.MetricsEngine, generalHttpClient, r.Router) - // todo(zachbadgett): better shutdown r.Shutdown = shutdown if err := loadDataCache(cfg, db); err != nil { @@ -246,7 +245,8 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R } syncers := usersyncers.NewSyncerMap(cfg) - gdprPerms := gdpr.NewPermissions(context.Background(), cfg.GDPR, adapters.GDPRAwareSyncerIDs(syncers), generalHttpClient) + gvlVendorIDs := bidderInfos.ToGVLVendorIDMap() + gdprPerms := gdpr.NewPermissions(context.Background(), cfg.GDPR, gvlVendorIDs, generalHttpClient) exchanges = newExchangeMap(cfg) cacheClient := pbc.NewClient(cacheHttpClient, &cfg.CacheURL, &cfg.ExtCacheURL, r.MetricsEngine) diff --git a/static/bidder-info/33across.yaml b/static/bidder-info/33across.yaml index e3eea765556..044cfe140b2 100644 --- a/static/bidder-info/33across.yaml +++ b/static/bidder-info/33across.yaml @@ -1,5 +1,6 @@ maintainer: email: "headerbidding@33across.com" +gvlVendorID: 58 capabilities: site: mediaTypes: diff --git a/static/bidder-info/acuityads.yaml b/static/bidder-info/acuityads.yaml index 9da1446d918..9539e36b91e 100644 --- a/static/bidder-info/acuityads.yaml +++ b/static/bidder-info/acuityads.yaml @@ -1,5 +1,6 @@ maintainer: email: "integrations@acuityads.com" +gvlVendorID: 231 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adform.yaml b/static/bidder-info/adform.yaml index 4dce10b9af8..461714ac44d 100644 --- a/static/bidder-info/adform.yaml +++ b/static/bidder-info/adform.yaml @@ -1,5 +1,6 @@ maintainer: email: "scope.sspp@adform.com" +gvlVendorID: 50 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adkernel.yaml b/static/bidder-info/adkernel.yaml index 26f8c322ddc..a78b3cde498 100644 --- a/static/bidder-info/adkernel.yaml +++ b/static/bidder-info/adkernel.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid-dev@adkernel.com" +gvlVendorID: 14 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adkernelAdn.yaml b/static/bidder-info/adkernelAdn.yaml index fd47367db7c..1f54f8e5a8f 100644 --- a/static/bidder-info/adkernelAdn.yaml +++ b/static/bidder-info/adkernelAdn.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid-dev@adkernel.com" +gvlVendorID: 14 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adman.yaml b/static/bidder-info/adman.yaml index 932ef2e4242..2db7c07584c 100644 --- a/static/bidder-info/adman.yaml +++ b/static/bidder-info/adman.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@admanmedia.com" +gvlVendorID: 149 capabilities: app: mediaTypes: diff --git a/static/bidder-info/admixer.yaml b/static/bidder-info/admixer.yaml index 64ad2024058..9faf0eb3a3e 100644 --- a/static/bidder-info/admixer.yaml +++ b/static/bidder-info/admixer.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@admixer.net" +gvlVendorID: 511 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adocean.yaml b/static/bidder-info/adocean.yaml index 2f31fe92eaf..b3a23718a5a 100644 --- a/static/bidder-info/adocean.yaml +++ b/static/bidder-info/adocean.yaml @@ -1,5 +1,6 @@ maintainer: email: "aoteam@gemius.com" +gvlVendorID: 328 capabilities: site: mediaTypes: diff --git a/static/bidder-info/adpone.yaml b/static/bidder-info/adpone.yaml index 969983a12f6..7c5b473770b 100644 --- a/static/bidder-info/adpone.yaml +++ b/static/bidder-info/adpone.yaml @@ -1,5 +1,6 @@ maintainer: email: "tech@adpone.com" +gvlVendorID: 799 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adtelligent.yaml b/static/bidder-info/adtelligent.yaml index 7a20d52b266..30f55ea912e 100644 --- a/static/bidder-info/adtelligent.yaml +++ b/static/bidder-info/adtelligent.yaml @@ -1,5 +1,6 @@ maintainer: email: "hb@adtelligent.com" +gvlVendorID: 410 capabilities: app: mediaTypes: diff --git a/static/bidder-info/adyoulike.yaml b/static/bidder-info/adyoulike.yaml index 3f35aa5b038..d9b23d6c1a1 100644 --- a/static/bidder-info/adyoulike.yaml +++ b/static/bidder-info/adyoulike.yaml @@ -1,5 +1,6 @@ maintainer: email: "core@adyoulike.com" +gvlVendorID: 259 modifyingVastXmlAllowed: true capabilities: site: diff --git a/static/bidder-info/amx.yaml b/static/bidder-info/amx.yaml index 3e20d2095f6..f9fdfbb4a41 100644 --- a/static/bidder-info/amx.yaml +++ b/static/bidder-info/amx.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@amxrtb.com" +gvlVendorID: 737 capabilities: site: mediaTypes: diff --git a/static/bidder-info/appnexus.yaml b/static/bidder-info/appnexus.yaml index f1e7ca23cfb..f2f4a1266df 100644 --- a/static/bidder-info/appnexus.yaml +++ b/static/bidder-info/appnexus.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid-server@xandr.com" +gvlVendorID: 32 capabilities: app: mediaTypes: diff --git a/static/bidder-info/avocet.yaml b/static/bidder-info/avocet.yaml index ea98982d69c..42147c96ebf 100644 --- a/static/bidder-info/avocet.yaml +++ b/static/bidder-info/avocet.yaml @@ -1,5 +1,6 @@ maintainer: email: "developers@avocet.io" +gvlVendorID: 63 capabilities: app: mediaTypes: diff --git a/static/bidder-info/beachfront.yaml b/static/bidder-info/beachfront.yaml index 335545ff1ee..06991698090 100644 --- a/static/bidder-info/beachfront.yaml +++ b/static/bidder-info/beachfront.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@beachfront.com" +gvlVendorID: 335 capabilities: app: mediaTypes: diff --git a/static/bidder-info/beintoo.yaml b/static/bidder-info/beintoo.yaml index fcca29220cf..905d89a44c4 100644 --- a/static/bidder-info/beintoo.yaml +++ b/static/bidder-info/beintoo.yaml @@ -1,5 +1,6 @@ maintainer: email: "adops@beintoo.com" +gvlVendorID: 618 capabilities: site: mediaTypes: diff --git a/static/bidder-info/between.yaml b/static/bidder-info/between.yaml index d317d275c59..71bd8ba6256 100644 --- a/static/bidder-info/between.yaml +++ b/static/bidder-info/between.yaml @@ -1,5 +1,6 @@ maintainer: email: "buying@betweenx.com" +gvlVendorID: 724 capabilities: site: mediaTypes: diff --git a/static/bidder-info/brightroll.yaml b/static/bidder-info/brightroll.yaml index f913be6da8c..a2ea0c74b77 100644 --- a/static/bidder-info/brightroll.yaml +++ b/static/bidder-info/brightroll.yaml @@ -1,5 +1,6 @@ maintainer: email: "dsp-supply-prebid@verizonmedia.com" +gvlVendorID: 25 capabilities: app: mediaTypes: diff --git a/static/bidder-info/connectad.yaml b/static/bidder-info/connectad.yaml index 1b3e593d78d..fa0ae4520fc 100644 --- a/static/bidder-info/connectad.yaml +++ b/static/bidder-info/connectad.yaml @@ -1,5 +1,6 @@ maintainer: email: "support@connectad.io" +gvlVendorID: 138 capabilities: app: mediaTypes: diff --git a/static/bidder-info/consumable.yaml b/static/bidder-info/consumable.yaml index f12ab2b4016..e9b5f72623c 100644 --- a/static/bidder-info/consumable.yaml +++ b/static/bidder-info/consumable.yaml @@ -1,5 +1,6 @@ maintainer: email: "naffis@consumable.com" +gvlVendorID: 591 capabilities: app: mediaTypes: diff --git a/static/bidder-info/conversant.yaml b/static/bidder-info/conversant.yaml index 017f0e0c57e..aa3d3822802 100644 --- a/static/bidder-info/conversant.yaml +++ b/static/bidder-info/conversant.yaml @@ -1,5 +1,6 @@ maintainer: email: "CNVR_PublisherIntegration@conversantmedia.com" +gvlVendorID: 24 capabilities: app: mediaTypes: diff --git a/static/bidder-info/deepintent.yaml b/static/bidder-info/deepintent.yaml index 490e161c8d2..a8f17a55d6f 100644 --- a/static/bidder-info/deepintent.yaml +++ b/static/bidder-info/deepintent.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebiddev@deepintent.com" +gvlVendorID: 541 capabilities: app: mediaTypes: diff --git a/static/bidder-info/dmx.yaml b/static/bidder-info/dmx.yaml index 3ecb452f7f6..d29d699daeb 100644 --- a/static/bidder-info/dmx.yaml +++ b/static/bidder-info/dmx.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@districtm.net" +gvlVendorID: 144 capabilities: site: mediaTypes: diff --git a/static/bidder-info/emx_digital.yaml b/static/bidder-info/emx_digital.yaml index 49a068093eb..ec0d090fb4c 100644 --- a/static/bidder-info/emx_digital.yaml +++ b/static/bidder-info/emx_digital.yaml @@ -1,5 +1,6 @@ maintainer: email: "adops@emxdigital.com" +gvlVendorID: 183 capabilities: site: mediaTypes: diff --git a/static/bidder-info/engagebdr.yaml b/static/bidder-info/engagebdr.yaml index 57c359e451d..fd08367acc7 100644 --- a/static/bidder-info/engagebdr.yaml +++ b/static/bidder-info/engagebdr.yaml @@ -1,5 +1,6 @@ maintainer: email: "tech@engagebdr.com" +gvlVendorID: 62 capabilities: app: mediaTypes: diff --git a/static/bidder-info/eplanning.yaml b/static/bidder-info/eplanning.yaml index 907523d3eb3..ab0b7609dbb 100644 --- a/static/bidder-info/eplanning.yaml +++ b/static/bidder-info/eplanning.yaml @@ -1,5 +1,6 @@ maintainer: email: "producto@e-planning.net" +gvlVendorID: 90 capabilities: app: mediaTypes: diff --git a/static/bidder-info/gamoshi.yaml b/static/bidder-info/gamoshi.yaml index c3ed3ff10e4..0cfd495762f 100644 --- a/static/bidder-info/gamoshi.yaml +++ b/static/bidder-info/gamoshi.yaml @@ -1,5 +1,6 @@ maintainer: email: "dev@gamoshi.com" +gvlVendorID: 644 capabilities: app: mediaTypes: diff --git a/static/bidder-info/grid.yaml b/static/bidder-info/grid.yaml index 325421a2c05..31c7b7320e3 100644 --- a/static/bidder-info/grid.yaml +++ b/static/bidder-info/grid.yaml @@ -1,5 +1,6 @@ maintainer: email: "grid-tech@themediagrid.com" +gvlVendorID: 686 capabilities: app: mediaTypes: diff --git a/static/bidder-info/gumgum.yaml b/static/bidder-info/gumgum.yaml index 6ba563b4c1c..bfefe63ab40 100644 --- a/static/bidder-info/gumgum.yaml +++ b/static/bidder-info/gumgum.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@gumgum.com" +gvlVendorID: 61 capabilities: site: mediaTypes: diff --git a/static/bidder-info/improvedigital.yaml b/static/bidder-info/improvedigital.yaml index 7983cbc1a61..6c31d26826a 100644 --- a/static/bidder-info/improvedigital.yaml +++ b/static/bidder-info/improvedigital.yaml @@ -1,5 +1,6 @@ maintainer: email: "hb@azerion.com" +gvlVendorID: 253 capabilities: app: mediaTypes: diff --git a/static/bidder-info/invibes.yaml b/static/bidder-info/invibes.yaml index 1432529787e..45184fb9f65 100644 --- a/static/bidder-info/invibes.yaml +++ b/static/bidder-info/invibes.yaml @@ -1,5 +1,6 @@ maintainer: email: "system_operations@invibes.com" +gvlVendorID: 436 capabilities: site: mediaTypes: diff --git a/static/bidder-info/ix.yaml b/static/bidder-info/ix.yaml index 2f00ceb952f..1e89c72e5bb 100644 --- a/static/bidder-info/ix.yaml +++ b/static/bidder-info/ix.yaml @@ -1,5 +1,6 @@ maintainer: email: "pdu-supply-prebid@indexexchange.com" +gvlVendorID: 10 capabilities: app: mediaTypes: diff --git a/static/bidder-info/lifestreet.yaml b/static/bidder-info/lifestreet.yaml index 139d55990b9..34dc4eca2d9 100644 --- a/static/bidder-info/lifestreet.yaml +++ b/static/bidder-info/lifestreet.yaml @@ -1,5 +1,6 @@ maintainer: email: "mobile.tech@lifestreet.com" +gvlVendorID: 67 capabilities: app: mediaTypes: diff --git a/static/bidder-info/mediafuse.yaml b/static/bidder-info/mediafuse.yaml index 112f67fe556..98611402905 100644 --- a/static/bidder-info/mediafuse.yaml +++ b/static/bidder-info/mediafuse.yaml @@ -1,5 +1,6 @@ maintainer: email: "support@mediafuse.com" +gvlVendorID: 411 capabilities: app: mediaTypes: diff --git a/static/bidder-info/mgid.yaml b/static/bidder-info/mgid.yaml index f8ba6db60b1..bddb8b8598e 100644 --- a/static/bidder-info/mgid.yaml +++ b/static/bidder-info/mgid.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@mgid.com" +gvlVendorID: 358 capabilities: app: mediaTypes: diff --git a/static/bidder-info/nanointeractive.yaml b/static/bidder-info/nanointeractive.yaml index 244e7602950..d199e9e8ff5 100644 --- a/static/bidder-info/nanointeractive.yaml +++ b/static/bidder-info/nanointeractive.yaml @@ -1,5 +1,6 @@ maintainer: email: "development@nanointeractive.com" +gvlVendorID: 72 capabilities: app: mediaTypes: diff --git a/static/bidder-info/nobid.yaml b/static/bidder-info/nobid.yaml index 51a55de46bc..89f2a28abcd 100644 --- a/static/bidder-info/nobid.yaml +++ b/static/bidder-info/nobid.yaml @@ -1,5 +1,6 @@ maintainer: email: "developers@nobid.io" +gvlVendorID: 816 capabilities: site: mediaTypes: diff --git a/static/bidder-info/onetag.yaml b/static/bidder-info/onetag.yaml index fedaabf9949..697ef04d5a1 100644 --- a/static/bidder-info/onetag.yaml +++ b/static/bidder-info/onetag.yaml @@ -1,5 +1,6 @@ maintainer: email: devops@onetag.com +gvlVendorID: 241 capabilities: app: mediaTypes: diff --git a/static/bidder-info/openx.yaml b/static/bidder-info/openx.yaml index 96ef8616c96..709f3db0147 100644 --- a/static/bidder-info/openx.yaml +++ b/static/bidder-info/openx.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@openx.com" +gvlVendorID: 69 capabilities: app: mediaTypes: diff --git a/static/bidder-info/pubmatic.yaml b/static/bidder-info/pubmatic.yaml index 4009d439352..45c0418af8a 100644 --- a/static/bidder-info/pubmatic.yaml +++ b/static/bidder-info/pubmatic.yaml @@ -1,5 +1,6 @@ maintainer: email: "header-bidding@pubmatic.com" +gvlVendorID: 76 capabilities: app: mediaTypes: diff --git a/static/bidder-info/pulsepoint.yaml b/static/bidder-info/pulsepoint.yaml index 056a0bf3d7c..bda03efd99c 100644 --- a/static/bidder-info/pulsepoint.yaml +++ b/static/bidder-info/pulsepoint.yaml @@ -1,5 +1,6 @@ maintainer: email: "ExchangeTeam@pulsepoint.com" +gvlVendorID: 81 capabilities: app: mediaTypes: diff --git a/static/bidder-info/rhythmone.yaml b/static/bidder-info/rhythmone.yaml index 89da6cfea35..852344db3e3 100644 --- a/static/bidder-info/rhythmone.yaml +++ b/static/bidder-info/rhythmone.yaml @@ -1,5 +1,6 @@ maintainer: email: "support@rhythmone.com" +gvlVendorID: 36 capabilities: app: mediaTypes: diff --git a/static/bidder-info/rtbhouse.yaml b/static/bidder-info/rtbhouse.yaml index f15af6ca2e1..12744fdc75e 100644 --- a/static/bidder-info/rtbhouse.yaml +++ b/static/bidder-info/rtbhouse.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@rtbhouse.com" +gvlVendorID: 16 capabilities: site: mediaTypes: diff --git a/static/bidder-info/rubicon.yaml b/static/bidder-info/rubicon.yaml index 40848e3ec25..0f19ddb9627 100644 --- a/static/bidder-info/rubicon.yaml +++ b/static/bidder-info/rubicon.yaml @@ -1,5 +1,6 @@ maintainer: email: "header-bidding@rubiconproject.com" +gvlVendorID: 52 capabilities: app: mediaTypes: diff --git a/static/bidder-info/sharethrough.yaml b/static/bidder-info/sharethrough.yaml index 09530be508c..45dceb94d22 100644 --- a/static/bidder-info/sharethrough.yaml +++ b/static/bidder-info/sharethrough.yaml @@ -1,5 +1,6 @@ maintainer: email: "pubgrowth.engineering@sharethrough.com" +gvlVendorID: 80 capabilities: app: mediaTypes: diff --git a/static/bidder-info/smartadserver.yaml b/static/bidder-info/smartadserver.yaml index 626b7dac00d..f22c7149ff7 100644 --- a/static/bidder-info/smartadserver.yaml +++ b/static/bidder-info/smartadserver.yaml @@ -1,5 +1,6 @@ maintainer: email: "support@smartadserver.com" +gvlVendorID: 45 capabilities: app: mediaTypes: diff --git a/static/bidder-info/somoaudience.yaml b/static/bidder-info/somoaudience.yaml index 17156c18039..83b64e5c58e 100644 --- a/static/bidder-info/somoaudience.yaml +++ b/static/bidder-info/somoaudience.yaml @@ -1,5 +1,6 @@ maintainer: email: "publishers@somoaudience.com" +gvlVendorID: 341 capabilities: app: mediaTypes: diff --git a/static/bidder-info/sonobi.yaml b/static/bidder-info/sonobi.yaml index 6d39319a9f5..22a0a158306 100644 --- a/static/bidder-info/sonobi.yaml +++ b/static/bidder-info/sonobi.yaml @@ -1,5 +1,6 @@ maintainer: email: "apex.prebid@sonobi.com" +gvlVendorID: 104 capabilities: site: mediaTypes: diff --git a/static/bidder-info/sovrn.yaml b/static/bidder-info/sovrn.yaml index c62d61df8d8..4c6251bdf57 100644 --- a/static/bidder-info/sovrn.yaml +++ b/static/bidder-info/sovrn.yaml @@ -1,5 +1,6 @@ maintainer: email: "sovrnoss@sovrn.com" +gvlVendorID: 13 capabilities: app: mediaTypes: diff --git a/static/bidder-info/tappx.yaml b/static/bidder-info/tappx.yaml index 527959b75d1..eb655aa6a0c 100644 --- a/static/bidder-info/tappx.yaml +++ b/static/bidder-info/tappx.yaml @@ -1,5 +1,6 @@ maintainer: email: "tappx@tappx.com" +gvlVendorID: 628 capabilities: app: mediaTypes: diff --git a/static/bidder-info/telaria.yaml b/static/bidder-info/telaria.yaml index 43e8707a17b..736fb9720b3 100644 --- a/static/bidder-info/telaria.yaml +++ b/static/bidder-info/telaria.yaml @@ -1,5 +1,6 @@ maintainer: email: "github@telaria.com" +gvlVendorID: 202 capabilities: app: mediaTypes: diff --git a/static/bidder-info/triplelift.yaml b/static/bidder-info/triplelift.yaml index 2b9ff8d5675..fe0ad8b2203 100644 --- a/static/bidder-info/triplelift.yaml +++ b/static/bidder-info/triplelift.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@triplelift.com" +gvlVendorID: 28 capabilities: app: mediaTypes: diff --git a/static/bidder-info/triplelift_native.yaml b/static/bidder-info/triplelift_native.yaml index abe91659935..40d9be8f294 100644 --- a/static/bidder-info/triplelift_native.yaml +++ b/static/bidder-info/triplelift_native.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@triplelift.com" +gvlVendorID: 28 capabilities: app: mediaTypes: diff --git a/static/bidder-info/trustx.yaml b/static/bidder-info/trustx.yaml index 9ce52c1116a..6cfdd9fa465 100644 --- a/static/bidder-info/trustx.yaml +++ b/static/bidder-info/trustx.yaml @@ -1,5 +1,6 @@ maintainer: email: "grid-tech@themediagrid.com" +gvlVendorID: 686 capabilities: app: mediaTypes: diff --git a/static/bidder-info/ucfunnel.yaml b/static/bidder-info/ucfunnel.yaml index 288b0b3f1b8..e6be68a0261 100644 --- a/static/bidder-info/ucfunnel.yaml +++ b/static/bidder-info/ucfunnel.yaml @@ -1,5 +1,6 @@ maintainer: email: "support@ucfunnel.com" +gvlVendorID: 607 capabilities: app: mediaTypes: diff --git a/static/bidder-info/unruly.yaml b/static/bidder-info/unruly.yaml index 01ed3774118..e31ea600b3e 100644 --- a/static/bidder-info/unruly.yaml +++ b/static/bidder-info/unruly.yaml @@ -1,5 +1,6 @@ maintainer: email: "adspaces@unrulygroup.com" +gvlVendorID: 162 capabilities: site: mediaTypes: diff --git a/static/bidder-info/verizonmedia.yaml b/static/bidder-info/verizonmedia.yaml index c00f2158d4b..0b4642fcb6a 100644 --- a/static/bidder-info/verizonmedia.yaml +++ b/static/bidder-info/verizonmedia.yaml @@ -1,5 +1,6 @@ maintainer: email: "dsp-supply-prebid@verizonmedia.com" +gvlVendorID: 25 capabilities: app: mediaTypes: diff --git a/static/bidder-info/visx.yaml b/static/bidder-info/visx.yaml index b6a16e4c2d0..789ce478bea 100644 --- a/static/bidder-info/visx.yaml +++ b/static/bidder-info/visx.yaml @@ -1,5 +1,6 @@ maintainer: email: "supply.partners@yoc.com" +gvlVendorID: 154 capabilities: site: mediaTypes: diff --git a/static/bidder-info/yieldlab.yaml b/static/bidder-info/yieldlab.yaml index 654e6c749cb..3030d8a1d42 100644 --- a/static/bidder-info/yieldlab.yaml +++ b/static/bidder-info/yieldlab.yaml @@ -1,5 +1,6 @@ maintainer: email: "solutions@yieldlab.de" +gvlVendorID: 70 capabilities: site: mediaTypes: diff --git a/static/bidder-info/yieldmo.yaml b/static/bidder-info/yieldmo.yaml index 64cda519acd..b1385acbebc 100644 --- a/static/bidder-info/yieldmo.yaml +++ b/static/bidder-info/yieldmo.yaml @@ -1,5 +1,6 @@ maintainer: email: "prebid@yieldmo.com" +gvlVendorID: 173 capabilities: app: mediaTypes: diff --git a/usersync/usersync.go b/usersync/usersync.go index 236acbe73a3..dffc1832f01 100644 --- a/usersync/usersync.go +++ b/usersync/usersync.go @@ -14,16 +14,6 @@ type Usersyncer interface { // TODO #362: when the appnexus usersyncer is consistent, delete this and use the key // of NewSyncerMap() here instead. FamilyName() string - - // GDPRVendorID returns the ID in the IAB Global Vendor List which refers to this Bidder. - // - // The Global Vendor list can be found here: https://vendor-list.consensu.org/vendorlist.json - // Bidders can register for the list here: https://register.consensu.org/ - // - // If you're not on the list, this should return 0. If cookie sync requests have GDPR consent info, - // or the Prebid Server host company configures its deploy to be "cautious" when no GDPR info exists - // in the request, it will _not_ sync user IDs with you. - GDPRVendorID() uint16 } type UsersyncInfo struct { diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 9727a2d4e22..5b2e80463ac 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -136,31 +136,3 @@ func TestNewSyncerMap(t *testing.T) { } } } - -// Bidders may have an ID on the IAB-maintained global vendor list. -// This makes sure that we don't have conflicting IDs among Bidders in our project, -// since that's almost certainly a bug. -func TestVendorIDUniqueness(t *testing.T) { - cfg := &config.Configuration{} - syncers := NewSyncerMap(cfg) - - idMap := make(map[uint16]openrtb_ext.BidderName, len(syncers)) - for name, syncer := range syncers { - id := syncer.GDPRVendorID() - if id == 0 { - continue - } - - if oldName, ok := idMap[id]; ok { - t.Errorf("GDPR VendorList ID %d used by both %s and %s. These must be unique.", id, oldName, name) - } - idMap[id] = name - } -} - -func assertStringsMatch(t *testing.T, expected string, actual string) { - t.Helper() - if expected != actual { - t.Errorf("Expected %s, got %s", expected, actual) - } -} From 49d84cc77b808b336e55374e775583470801e17a Mon Sep 17 00:00:00 2001 From: Jozef Bartek <31618107+jbartek25@users.noreply.github.com> Date: Thu, 11 Mar 2021 02:49:42 +0100 Subject: [PATCH 26/91] Improve Digital adapter: add support for native ads (#1746) --- adapters/improvedigital/improvedigital.go | 4 + .../improvedigitaltest/exemplary/native.json | 161 ++++++++++++++++++ .../params/race/native.json | 12 ++ .../supplemental/native.json | 64 ------- static/bidder-info/improvedigital.yaml | 2 + 5 files changed, 179 insertions(+), 64 deletions(-) create mode 100644 adapters/improvedigital/improvedigitaltest/exemplary/native.json create mode 100644 adapters/improvedigital/improvedigitaltest/params/race/native.json delete mode 100644 adapters/improvedigital/improvedigitaltest/supplemental/native.json diff --git a/adapters/improvedigital/improvedigital.go b/adapters/improvedigital/improvedigital.go index 0d5c043ef60..b1cc3640714 100644 --- a/adapters/improvedigital/improvedigital.go +++ b/adapters/improvedigital/improvedigital.go @@ -114,6 +114,10 @@ func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, return openrtb_ext.BidTypeVideo, nil } + if imp.Native != nil { + return openrtb_ext.BidTypeNative, nil + } + return "", &errortypes.BadServerResponse{ Message: fmt.Sprintf("Unknown impression type for ID: \"%s\"", impID), } diff --git a/adapters/improvedigital/improvedigitaltest/exemplary/native.json b/adapters/improvedigital/improvedigitaltest/exemplary/native.json new file mode 100644 index 00000000000..3309b35a753 --- /dev/null +++ b/adapters/improvedigital/improvedigitaltest/exemplary/native.json @@ -0,0 +1,161 @@ +{ + "mockBidRequest": { + "id": "26f14780-8ef8-4f41-b70c-c4d062237df6", + "source": { + "tid": "26f14780-8ef8-4f41-b70c-c4d062237df6", + "ext": { + "schain": { + "ver": "1.0", + "complete": 1, + "nodes": [ + { "asi": "example.com", "hp": 1, "sid": "1234abc" } + ] + } + } + }, + "tmax": 1000, + "imp": [ + { + "id": "native", + "ext": { "improvedigital": { "placementId": 1234 } }, + "native": { + "request": "{\"context\":1,\"plcmttype\":1,\"eventtrackers\":[{\"event\":1,\"methods\":[1]}],\"assets\":[{\"required\":1,\"title\":{\"len\":80}},{\"required\":1,\"data\":{\"type\":2}},{\"required\":0,\"data\":{\"type\":12}},{\"required\":0,\"img\":{\"type\":3,\"wmin\":300,\"hmin\":225,\"ext\":{\"aspectratios\":[\"4:3\"]}}},{\"required\":0,\"img\":{\"type\":1,\"w\":128,\"h\":128}},{\"required\":0,\"data\":{\"type\":3}},{\"required\":0,\"data\":{\"type\":6}}]}", + "ver": "1.2" + } + } + ], + "ext": { + "prebid": { + "targeting": { + "includewinners": true, + "includebidderkeys": false + } + } + }, + "site": { + "publisher": { "id": "pubid" }, + "page": "example.com" + }, + "device": { "w": 1581, "h": 922, "ip": "1.1.1.1" }, + "regs": { "ext": { "gdpr": 0 } }, + "user": { + "ext": { + "consent": "XYZ" + } + } + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "http://localhost/pbs", + "body": { + "id": "26f14780-8ef8-4f41-b70c-c4d062237df6", + "imp": [ + { + "id": "native", + "native": { + "request": "{\"context\":1,\"plcmttype\":1,\"eventtrackers\":[{\"event\":1,\"methods\":[1]}],\"assets\":[{\"required\":1,\"title\":{\"len\":80}},{\"required\":1,\"data\":{\"type\":2}},{\"required\":0,\"data\":{\"type\":12}},{\"required\":0,\"img\":{\"type\":3,\"wmin\":300,\"hmin\":225,\"ext\":{\"aspectratios\":[\"4:3\"]}}},{\"required\":0,\"img\":{\"type\":1,\"w\":128,\"h\":128}},{\"required\":0,\"data\":{\"type\":3}},{\"required\":0,\"data\":{\"type\":6}}]}", + "ver": "1.2" + }, + "ext": { "improvedigital": { "placementId": 1234 } } + } + ], + "site": { + "page": "example.com", + "publisher": { "id": "pubid" } + }, + "device": { + "ip": "1.1.1.1", + "h": 922, + "w": 1581 + }, + "user": { + "ext": { + "consent": "XYZ" + } + }, + "tmax": 1000, + "source": { + "tid": "26f14780-8ef8-4f41-b70c-c4d062237df6", + "ext": { + "schain": { + "ver": "1.0", + "complete": 1, + "nodes": [ + { + "asi": "example.com", + "hp": 1, + "sid": "1234abc" + } + ] + } + } + }, + "regs": { "ext": { "gdpr": 0 } }, + "ext": { + "prebid": { + "targeting": { + "includewinners": true, + "includebidderkeys": false + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "26f14780-8ef8-4f41-b70c-c4d062237df6", + "cur": "USD", + "seatbid": [ + { + "bid": [ + { + "ext": { + "improvedigital": { + "brand_name": "AdvertiserABC", + "bidder_id": 301 + } + }, + "crid": "14065", + "id": "d4f04449-ba04-4d7c-bb34-dc0fc5240f59", + "price": 0.01, + "adm": "{\"assets\":[{\"title\":{\"text\":\"Luxury Mars Cruises\"},\"id\":1},{\"id\":2,\"data\":{\"type\":2,\"value\":\"Visit the planet in a luxury spaceship.\"}},{\"id\":3,\"data\":{\"type\":12,\"value\":\"Book today\"}},{\"id\":4,\"img\":{\"h\":250,\"type\":3,\"url\":\"http://hb.improvedigital.com/creatives/display/300x250.jpg\",\"w\":300}},{\"id\":6,\"data\":{\"type\":3,\"value\":\"3.8\"}},{\"id\":7,\"data\":{\"type\":6,\"value\":\"FREE\"}}],\"link\":{\"clicktrackers\":[\"http://localhost.localdomain/click/\"],\"url\":\"http://www.iponweb.com/careers/\"}}", + "adomain": ["example.com"], + "impid": "native", + "cid": "25076" + } + ], + "seat": "improvedigital" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "d4f04449-ba04-4d7c-bb34-dc0fc5240f59", + "impid": "native", + "price": 0.01, + "adm": "{\"assets\":[{\"title\":{\"text\":\"Luxury Mars Cruises\"},\"id\":1},{\"id\":2,\"data\":{\"type\":2,\"value\":\"Visit the planet in a luxury spaceship.\"}},{\"id\":3,\"data\":{\"type\":12,\"value\":\"Book today\"}},{\"id\":4,\"img\":{\"h\":250,\"type\":3,\"url\":\"http://hb.improvedigital.com/creatives/display/300x250.jpg\",\"w\":300}},{\"id\":6,\"data\":{\"type\":3,\"value\":\"3.8\"}},{\"id\":7,\"data\":{\"type\":6,\"value\":\"FREE\"}}],\"link\":{\"clicktrackers\":[\"http://localhost.localdomain/click/\"],\"url\":\"http://www.iponweb.com/careers/\"}}", + "adomain": ["example.com"], + "cid": "25076", + "crid": "14065", + "ext": { + "improvedigital": { + "brand_name": "AdvertiserABC", + "bidder_id": 301 + } + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/improvedigital/improvedigitaltest/params/race/native.json b/adapters/improvedigital/improvedigitaltest/params/race/native.json new file mode 100644 index 00000000000..0de1d580215 --- /dev/null +++ b/adapters/improvedigital/improvedigitaltest/params/race/native.json @@ -0,0 +1,12 @@ +{ + "placementId": 123, + "publisherId": 321, + "placementKey": "uniq_name", + "size": { + "w": 100, + "h": 100 + }, + "keyValues": { + "testKey1": ["testValueA", "testValueB"] + } +} diff --git a/adapters/improvedigital/improvedigitaltest/supplemental/native.json b/adapters/improvedigital/improvedigitaltest/supplemental/native.json deleted file mode 100644 index 3090700a275..00000000000 --- a/adapters/improvedigital/improvedigitaltest/supplemental/native.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [{ - "id": "test-imp-id", - "native": { - "ver": "1.1" - }, - "ext": { - "bidder": { - "placementId": 13245 - } - } - }] - }, - "httpCalls": [{ - "expectedRequest": { - "uri": "http://localhost/pbs", - "body": { - "id": "test-request-id", - "imp": [{ - "id": "test-imp-id", - "native": { - "request": "", - "ver": "1.1" - }, - "ext": { - "bidder": { - "placementId": 13245 - } - } - }] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [{ - "seat": "improvedigital", - "bid": [{ - "id": "randomid", - "impid": "test-imp-id", - "price": 0.500000, - "adid": "12345678", - "adm": "some-test-native", - "cid": "987", - "crid": "12345678", - "h": 250, - "w": 300 - }] - }], - "cur": "USD" - } - } - }], - - "expectedMakeBidsErrors": [ - { - "value": "Unknown impression type for ID: \"test-imp-id\"", - "comparison": "literal" - } - ] -} diff --git a/static/bidder-info/improvedigital.yaml b/static/bidder-info/improvedigital.yaml index 6c31d26826a..f7fea4a8402 100644 --- a/static/bidder-info/improvedigital.yaml +++ b/static/bidder-info/improvedigital.yaml @@ -6,7 +6,9 @@ capabilities: mediaTypes: - banner - video + - native site: mediaTypes: - banner - video + - native From 849a311070759dc0180234313c9a9b6eb56a5fda Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Thu, 11 Mar 2021 10:04:56 -0500 Subject: [PATCH 27/91] Add Support For SkAdN + Refactor Split Imps (#1741) --- endpoints/openrtb2/auction.go | 33 +- .../valid-whole/exemplary/skadn.json | 48 +++ ...ata-imp-ext-multiple-prebid-bidders.json } | 2 - ...stpartydata-imp-ext-one-prebid-bidder.json | 1 - exchange/utils.go | 153 ++++---- exchange/utils_test.go | 364 ++++++++++++++++++ openrtb_ext/bidders.go | 2 +- openrtb_ext/device.go | 3 + openrtb_ext/request.go | 9 +- 9 files changed, 505 insertions(+), 110 deletions(-) create mode 100644 endpoints/openrtb2/sample-requests/valid-whole/exemplary/skadn.json rename exchange/exchangetest/{firstpartydata-imp-ext-multiple-prebid-bidders.json => firstpartydata-imp-ext-multiple-prebid-bidders.json } (98%) diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index 290b06cb7b2..e4567bbcd29 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -830,19 +830,15 @@ func (deps *endpointDeps) validateImpExt(imp *openrtb.Imp, aliases map[string]st return []error{err} } - // Also accept bidder exts within imp[...].ext.prebid.bidder - // NOTE: This is not part of the official API yet, so we are not expecting clients - // to migrate from imp[...].ext.${BIDDER} to imp[...].ext.prebid.bidder.${BIDDER} - // at this time - // https://github.com/prebid/prebid-server/pull/846#issuecomment-476352224 - if rawPrebidExt, ok := bidderExts[openrtb_ext.PrebidExtKey]; ok { - var prebidExt openrtb_ext.ExtImpPrebid - if err := json.Unmarshal(rawPrebidExt, &prebidExt); err == nil && prebidExt.Bidder != nil { - for bidder, ext := range prebidExt.Bidder { + // Prefer bidder params from request.imp.ext.prebid.bidder.BIDDER over request.imp.ext.BIDDER + // to avoid confusion beteween prebid specific adapter config and other ext protocols. + if extPrebidJSON, ok := bidderExts[openrtb_ext.PrebidExtKey]; ok { + var extPrebid openrtb_ext.ExtImpPrebid + if err := json.Unmarshal(extPrebidJSON, &extPrebid); err == nil && extPrebid.Bidder != nil { + for bidder, ext := range extPrebid.Bidder { if ext == nil { continue } - bidderExts[bidder] = ext } } @@ -893,13 +889,18 @@ func (deps *endpointDeps) validateImpExt(imp *openrtb.Imp, aliases map[string]st return errL } +// isBidderToValidate determines if the bidder name in request.imp[].prebid should be validated. func isBidderToValidate(bidder string) bool { - // PrebidExtKey is a special case for the prebid config section and is not considered a bidder. - - // FirstPartyDataContextExtKey is a special case for the first party data context section - // and is not considered a bidder. - - return bidder != openrtb_ext.PrebidExtKey && bidder != openrtb_ext.FirstPartyDataContextExtKey + switch openrtb_ext.BidderName(bidder) { + case openrtb_ext.BidderReservedContext: + return false + case openrtb_ext.BidderReservedPrebid: + return false + case openrtb_ext.BidderReservedSKAdN: + return false + default: + return true + } } func (deps *endpointDeps) parseBidExt(ext json.RawMessage) (*openrtb_ext.ExtRequest, error) { diff --git a/endpoints/openrtb2/sample-requests/valid-whole/exemplary/skadn.json b/endpoints/openrtb2/sample-requests/valid-whole/exemplary/skadn.json new file mode 100644 index 00000000000..e238f3c07c7 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/valid-whole/exemplary/skadn.json @@ -0,0 +1,48 @@ +{ + "description": "The imp.ext.skadn field is valid for Apple's SKAdNetwork and should be exempt from bidder name validation.", + + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "some-imp-id", + "banner": { + "format": [{ + "w": 600, + "h": 500 + }, { + "w": 300, + "h": 600 + }] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12883451 + } + } + }, + "skadn": { + "anyMember": "anyValue" + } + } + }] + }, + "expectedBidResponse": { + "id": "some-request-id", + "seatbid": [{ + "bid": [{ + "id": "appnexus-bid", + "impid": "", + "price": 0 + }], + "seat": "appnexus-bids" + }], + "bidid": "test bid id", + "nbr": 0 + }, + "expectedReturnCode": 200 +} \ No newline at end of file diff --git a/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json b/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json similarity index 98% rename from exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json rename to exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json index d62afccf426..37654c454bc 100644 --- a/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json +++ b/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json @@ -61,7 +61,6 @@ "bidder": { "placementId": 1 }, - "prebid": {}, "context": { "data": { "keywords": "prebid server example" @@ -112,7 +111,6 @@ "siteId": 2, "zoneId": 3 }, - "prebid": {}, "context": { "data": { "keywords": "prebid server example" diff --git a/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json b/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json index 1610b9ea47e..c931b0b9ee3 100644 --- a/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json +++ b/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json @@ -56,7 +56,6 @@ "bidder": { "placementId": 1 }, - "prebid": {}, "context": { "data": { "keywords": "prebid server example" diff --git a/exchange/utils.go b/exchange/utils.go index 8d4c0facd3b..4ca02149453 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -59,8 +59,9 @@ func cleanOpenRTBRequests(ctx context.Context, usersyncIfAmbiguous bool, privacyConfig config.Privacy) (bidderRequests []BidderRequest, privacyLabels metrics.PrivacyLabels, errs []error) { - impsByBidder, errs := splitImps(req.BidRequest.Imp) - if len(errs) > 0 { + impsByBidder, err := splitImps(req.BidRequest.Imp) + if err != nil { + errs = []error{err} return } @@ -327,106 +328,99 @@ func extractBuyerUIDs(user *openrtb.User) (map[string]string, error) { // The "imp.ext" value of the rubicon Imp will only contain the "prebid" values, and "rubicon" value at the "bidder" key. // // The goal here is so that Bidders only get Imps and Imp.Ext values which are intended for them. -func splitImps(imps []openrtb.Imp) (map[string][]openrtb.Imp, []error) { - impExts, err := parseImpExts(imps) - if err != nil { - return nil, []error{err} - } +func splitImps(imps []openrtb.Imp) (map[string][]openrtb.Imp, error) { + bidderImps := make(map[string][]openrtb.Imp) - splitImps := make(map[string][]openrtb.Imp, len(imps)) - var errList []error + for i, imp := range imps { + var impExt map[string]json.RawMessage + if err := json.Unmarshal(imp.Ext, &impExt); err != nil { + return nil, fmt.Errorf("invalid json for imp[%d]: %v", i, err) + } - for i := 0; i < len(imps); i++ { - imp := imps[i] - impExt := impExts[i] + var impExtPrebid map[string]json.RawMessage + if impExtPrebidJSON, exists := impExt[openrtb_ext.PrebidExtKey]; exists { + // validation already performed by impExt unmarshal. no error is possible here, proven by tests. + json.Unmarshal(impExtPrebidJSON, &impExtPrebid) + } - var firstPartyDataContext json.RawMessage - if context, exists := impExt[openrtb_ext.FirstPartyDataContextExtKey]; exists { - firstPartyDataContext = context + var impExtPrebidBidder map[string]json.RawMessage + if impExtPrebidBidderJSON, exists := impExtPrebid[openrtb_ext.PrebidExtBidderKey]; exists { + // validation already performed by impExt unmarshal. no error is possible here, proven by tests. + json.Unmarshal(impExtPrebidBidderJSON, &impExtPrebidBidder) } - rawPrebidExt, ok := impExt[openrtb_ext.PrebidExtKey] + sanitizedImpExt, err := createSanitizedImpExt(impExt, impExtPrebid) + if err != nil { + return nil, fmt.Errorf("unable to remove other bidder fields for imp[%d]: %v", i, err) + } - if ok { - var prebidExt openrtb_ext.ExtImpPrebid + for bidder, bidderExt := range extractBidderExts(impExt, impExtPrebidBidder) { + impCopy := imp - if err := json.Unmarshal(rawPrebidExt, &prebidExt); err == nil && prebidExt.Bidder != nil { - if errs := sanitizedImpCopy(&imp, prebidExt.Bidder, rawPrebidExt, firstPartyDataContext, &splitImps); errs != nil { - errList = append(errList, errs...) - } + sanitizedImpExt[openrtb_ext.PrebidExtBidderKey] = bidderExt - continue + impExtJSON, err := json.Marshal(sanitizedImpExt) + if err != nil { + return nil, fmt.Errorf("unable to remove other bidder fields for imp[%d]: cannot marshal ext: %v", i, err) } - } + impCopy.Ext = impExtJSON - if errs := sanitizedImpCopy(&imp, impExt, rawPrebidExt, firstPartyDataContext, &splitImps); errs != nil { - errList = append(errList, errs...) + bidderImps[bidder] = append(bidderImps[bidder], impCopy) } } - return splitImps, nil + return bidderImps, nil } -// sanitizedImpCopy returns a copy of imp with its ext filtered so that only "prebid", "context", and bidder params exist. -// It will not mutate the input imp. -// This function will write the new imps to the output map passed in -func sanitizedImpCopy(imp *openrtb.Imp, - bidderExts map[string]json.RawMessage, - rawPrebidExt json.RawMessage, - firstPartyDataContext json.RawMessage, - out *map[string][]openrtb.Imp) []error { - - var prebidExt map[string]json.RawMessage - var errs []error - - if err := json.Unmarshal(rawPrebidExt, &prebidExt); err == nil { - // Remove the entire bidder field. We will already have the content we need in bidderExts. We - // don't want to include other demand partners' bidder params in the sanitized imp. - if _, hasBidderField := prebidExt["bidder"]; hasBidderField { - delete(prebidExt, "bidder") +func createSanitizedImpExt(impExt, impExtPrebid map[string]json.RawMessage) (map[string]json.RawMessage, error) { + sanitizedImpExt := make(map[string]json.RawMessage, 3) - var err error - if rawPrebidExt, err = json.Marshal(prebidExt); err != nil { - errs = append(errs, err) - } + delete(impExtPrebid, openrtb_ext.PrebidExtBidderKey) + if len(impExtPrebid) > 0 { + if impExtPrebidJSON, err := json.Marshal(impExtPrebid); err == nil { + sanitizedImpExt[openrtb_ext.PrebidExtKey] = impExtPrebidJSON + } else { + return nil, fmt.Errorf("cannot marshal ext.prebid: %v", err) } } - for bidder, ext := range bidderExts { - if bidder == openrtb_ext.PrebidExtKey || bidder == openrtb_ext.FirstPartyDataContextExtKey { - continue - } + if v, exists := impExt[openrtb_ext.FirstPartyDataContextExtKey]; exists { + sanitizedImpExt[openrtb_ext.FirstPartyDataContextExtKey] = v + } - impCopy := *imp - newExt := make(map[string]json.RawMessage, 3) + if v, exists := impExt[openrtb_ext.SKAdNExtKey]; exists { + sanitizedImpExt[openrtb_ext.SKAdNExtKey] = v + } - newExt["bidder"] = ext + return sanitizedImpExt, nil +} - if rawPrebidExt != nil { - newExt[openrtb_ext.PrebidExtKey] = rawPrebidExt - } +func extractBidderExts(impExt, impExtPrebidBidders map[string]json.RawMessage) map[string]json.RawMessage { + bidderExts := make(map[string]json.RawMessage) - if len(firstPartyDataContext) > 0 { - newExt[openrtb_ext.FirstPartyDataContextExtKey] = firstPartyDataContext - } + // prefer imp.ext.prebid.bidder.BIDDER + for bidder, bidderExt := range impExtPrebidBidders { + bidderExts[bidder] = bidderExt + } - rawExt, err := json.Marshal(newExt) - if err != nil { - errs = append(errs, err) + // fallback to imp.BIDDER + for bidder, bidderExt := range impExt { + if isSpecialField(bidder) { continue } - impCopy.Ext = rawExt - - otherImps, _ := (*out)[bidder] - (*out)[bidder] = append(otherImps, impCopy) + if _, exists := bidderExts[bidder]; !exists { + bidderExts[bidder] = bidderExt + } } - if len(errs) > 0 { - return errs - } + return bidderExts +} - return nil +func isSpecialField(bidder string) bool { + return bidder == openrtb_ext.FirstPartyDataContextExtKey || + bidder == openrtb_ext.SKAdNExtKey || + bidder == openrtb_ext.PrebidExtKey } // prepareUser changes req.User so that it's ready for the given bidder. @@ -564,21 +558,6 @@ func resolveBidder(bidder string, aliases map[string]string) openrtb_ext.BidderN return openrtb_ext.BidderName(bidder) } -// parseImpExts does a partial-unmarshal of the imp[].Ext field. -// The keys in the returned map are expected to be "prebid", "context", CoreBidderNames, or Aliases for this request. -func parseImpExts(imps []openrtb.Imp) ([]map[string]json.RawMessage, error) { - exts := make([]map[string]json.RawMessage, len(imps)) - // Loop over every impression in the request - for i := 0; i < len(imps); i++ { - // Unpack each set of extensions found in the Imp array - err := json.Unmarshal(imps[i].Ext, &exts[i]) - if err != nil { - return nil, fmt.Errorf("Error unpacking extensions for Imp[%d]: %s", i, err.Error()) - } - } - return exts, nil -} - // parseAliases parses the aliases from the BidRequest func parseAliases(orig *openrtb.BidRequest) (map[string]string, []error) { var aliases map[string]string diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 0407b3c5e0e..f089d70523b 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -55,6 +55,370 @@ func assertReq(t *testing.T, bidderRequests []BidderRequest, } } +func TestSplitImps(t *testing.T) { + testCases := []struct { + description string + givenImps []openrtb.Imp + expectedImps map[string][]openrtb.Imp + expectedError string + }{ + { + description: "Nil", + givenImps: nil, + expectedImps: map[string][]openrtb.Imp{}, + expectedError: "", + }, + { + description: "Empty", + givenImps: []openrtb.Imp{}, + expectedImps: map[string][]openrtb.Imp{}, + expectedError: "", + }, + { + description: "1 Imp, 1 Bidder", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1ParamA":"imp1ValueA"}}}}`)}, + }, + expectedImps: map[string][]openrtb.Imp{ + "bidderA": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamA":"imp1ValueA"}}`)}, + }, + }, + expectedError: "", + }, + { + description: "1 Imp, 2 Bidders", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1ParamA":"imp1ValueA"},"bidderB":{"imp1ParamB":"imp1ValueB"}}}}`)}, + }, + expectedImps: map[string][]openrtb.Imp{ + "bidderA": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamA":"imp1ValueA"}}`)}, + }, + "bidderB": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamB":"imp1ValueB"}}`)}, + }, + }, + expectedError: "", + }, + { + description: "2 Imps, 1 Bidders Each", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1ParamA":"imp1ValueA"}}}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp2ParamA":"imp2ValueA"}}}}`)}, + }, + expectedImps: map[string][]openrtb.Imp{ + "bidderA": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamA":"imp1ValueA"}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2ParamA":"imp2ValueA"}}`)}, + }, + }, + expectedError: "", + }, + { + description: "2 Imps, 2 Bidders Each", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1paramA":"imp1valueA"},"bidderB":{"imp1paramB":"imp1valueB"}}}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp2paramA":"imp2valueA"},"bidderB":{"imp2paramB":"imp2valueB"}}}}`)}, + }, + expectedImps: map[string][]openrtb.Imp{ + "bidderA": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramA":"imp1valueA"}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramA":"imp2valueA"}}`)}, + }, + "bidderB": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramB":"imp1valueB"}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramB":"imp2valueB"}}`)}, + }, + }, + expectedError: "", + }, + { + // This is a "happy path" integration test. Functionality is covered in detail by TestCreateSanitizedImpExt. + description: "Other Fields - 2 Imps, 2 Bidders Each", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1paramA":"imp1valueA"},"bidderB":{"imp1paramB":"imp1valueB"}}},"skadn":"imp1SkAdN"}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp2paramA":"imp2valueA"},"bidderB":{"imp2paramB":"imp2valueB"}}},"skadn":"imp2SkAdN"}`)}, + }, + expectedImps: map[string][]openrtb.Imp{ + "bidderA": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramA":"imp1valueA"},"skadn":"imp1SkAdN"}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramA":"imp2valueA"},"skadn":"imp2SkAdN"}`)}, + }, + "bidderB": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramB":"imp1valueB"},"skadn":"imp1SkAdN"}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramB":"imp2valueB"},"skadn":"imp2SkAdN"}`)}, + }, + }, + expectedError: "", + }, + { + // This is a "happy path" integration test. Functionality is covered in detail by TestExtractBidderExts. + description: "Legacy imp.ext.BIDDER - 2 Imps, 2 Bidders Each", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"bidderA":{"imp1paramA":"imp1valueA"},"bidderB":{"imp1paramB":"imp1valueB"}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidderA":{"imp2paramA":"imp2valueA"},"bidderB":{"imp2paramB":"imp2valueB"}}`)}, + }, + expectedImps: map[string][]openrtb.Imp{ + "bidderA": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramA":"imp1valueA"}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramA":"imp2valueA"}}`)}, + }, + "bidderB": { + {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramB":"imp1valueB"}}`)}, + {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramB":"imp2valueB"}}`)}, + }, + }, + expectedError: "", + }, + { + description: "Malformed imp.ext", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`malformed`)}, + }, + expectedError: "invalid json for imp[0]: invalid character 'm' looking for beginning of value", + }, + { + description: "Malformed imp.ext.prebid", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid": malformed}`)}, + }, + expectedError: "invalid json for imp[0]: invalid character 'm' looking for beginning of value", + }, + { + description: "Malformed imp.ext.prebid.bidder", + givenImps: []openrtb.Imp{ + {ID: "imp1", Ext: json.RawMessage(`{"prebid": {"bidder": malformed}}`)}, + }, + expectedError: "invalid json for imp[0]: invalid character 'm' looking for beginning of value", + }, + } + + for _, test := range testCases { + imps, err := splitImps(test.givenImps) + + if test.expectedError == "" { + assert.NoError(t, err, test.description+":err") + } else { + assert.EqualError(t, err, test.expectedError, test.description+":err") + } + + assert.Equal(t, test.expectedImps, imps, test.description+":imps") + } +} + +func TestCreateSanitizedImpExt(t *testing.T) { + testCases := []struct { + description string + givenImpExt map[string]json.RawMessage + givenImpExtPrebid map[string]json.RawMessage + expected map[string]json.RawMessage + expectedError string + }{ + { + description: "Nil", + givenImpExt: nil, + givenImpExtPrebid: nil, + expected: map[string]json.RawMessage{}, + expectedError: "", + }, + { + description: "Empty", + givenImpExt: map[string]json.RawMessage{}, + givenImpExtPrebid: map[string]json.RawMessage{}, + expected: map[string]json.RawMessage{}, + expectedError: "", + }, + { + description: "imp.ext.prebid - Bidders Only", + givenImpExt: map[string]json.RawMessage{ + "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + givenImpExtPrebid: map[string]json.RawMessage{ + "bidder": json.RawMessage(`"anyBidder"`), + }, + expected: map[string]json.RawMessage{ + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + expectedError: "", + }, + { + description: "imp.ext.prebid - Bidders + Other Values", + givenImpExt: map[string]json.RawMessage{ + "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + givenImpExtPrebid: map[string]json.RawMessage{ + "bidder": json.RawMessage(`"anyBidder"`), + "someOther": json.RawMessage(`"value"`), + }, + expected: map[string]json.RawMessage{ + "prebid": json.RawMessage(`{"someOther":"value"}`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + expectedError: "", + }, + { + description: "imp.ext", + givenImpExt: map[string]json.RawMessage{ + "anyBidder": json.RawMessage(`"anyBidderValues"`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + givenImpExtPrebid: map[string]json.RawMessage{}, + expected: map[string]json.RawMessage{ + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + expectedError: "", + }, + { + description: "imp.ext + imp.ext.prebid - Prebid Bidders Only", + givenImpExt: map[string]json.RawMessage{ + "anyBidder": json.RawMessage(`"anyBidderValues"`), + "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + givenImpExtPrebid: map[string]json.RawMessage{ + "bidder": json.RawMessage(`"anyBidder"`), + }, + expected: map[string]json.RawMessage{ + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + expectedError: "", + }, + { + description: "imp.ext + imp.ext.prebid - Prebid Bidders + Other Values", + givenImpExt: map[string]json.RawMessage{ + "anyBidder": json.RawMessage(`"anyBidderValues"`), + "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + givenImpExtPrebid: map[string]json.RawMessage{ + "bidder": json.RawMessage(`"anyBidder"`), + "someOther": json.RawMessage(`"value"`), + }, + expected: map[string]json.RawMessage{ + "prebid": json.RawMessage(`{"someOther":"value"}`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + expectedError: "", + }, + { + description: "Marshal Error - imp.ext.prebid", + givenImpExt: map[string]json.RawMessage{ + "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "context": json.RawMessage(`"anyContext"`), + "skadn": json.RawMessage(`"anySKAdNetwork"`), + }, + givenImpExtPrebid: map[string]json.RawMessage{ + "malformed": json.RawMessage(`json`), // String value without quotes. + }, + expected: nil, + expectedError: "cannot marshal ext.prebid: json: error calling MarshalJSON for type json.RawMessage: invalid character 'j' looking for beginning of value", + }, + } + + for _, test := range testCases { + result, err := createSanitizedImpExt(test.givenImpExt, test.givenImpExtPrebid) + + if test.expectedError == "" { + assert.NoError(t, err, test.description+":err") + } else { + assert.EqualError(t, err, test.expectedError, test.description+":err") + } + + assert.Equal(t, test.expected, result, test.description) + } +} + +func TestExtractBidderExts(t *testing.T) { + bidderAJSON := json.RawMessage(`{"paramA":"valueA"}}`) + bidderBJSON := json.RawMessage(`{"paramB":"valueB"}}`) + + testCases := []struct { + description string + givenImpExt map[string]json.RawMessage + givenImpExtPrebidBidders map[string]json.RawMessage + expected map[string]json.RawMessage + }{ + { + description: "Nil", + givenImpExt: nil, + givenImpExtPrebidBidders: nil, + expected: map[string]json.RawMessage{}, + }, + { + description: "Empty", + givenImpExt: map[string]json.RawMessage{}, + givenImpExtPrebidBidders: map[string]json.RawMessage{}, + expected: map[string]json.RawMessage{}, + }, + { + description: "One - imp.ext.BIDDER", + givenImpExt: map[string]json.RawMessage{"bidderA": bidderAJSON}, + givenImpExtPrebidBidders: map[string]json.RawMessage{}, + expected: map[string]json.RawMessage{"bidderA": bidderAJSON}, + }, + { + description: "Many - imp.ext.BIDDER", + givenImpExt: map[string]json.RawMessage{"bidderA": bidderAJSON, "bidderB": bidderBJSON}, + givenImpExtPrebidBidders: map[string]json.RawMessage{}, + expected: map[string]json.RawMessage{"bidderA": bidderAJSON, "bidderB": bidderBJSON}, + }, + { + description: "Special Names Ignored - imp.ext.BIDDER", + givenImpExt: map[string]json.RawMessage{"prebid": json.RawMessage(`{"prebid":"value1"}}`), "context": json.RawMessage(`{"firstPartyData":"value2"}}`), "skadn": json.RawMessage(`{"skAdNetwork":"value3"}}`)}, + givenImpExtPrebidBidders: map[string]json.RawMessage{}, + expected: map[string]json.RawMessage{}, + }, + { + description: "One - imp.ext.prebid.bidder.BIDDER", + givenImpExt: map[string]json.RawMessage{}, + givenImpExtPrebidBidders: map[string]json.RawMessage{"bidderA": bidderAJSON}, + expected: map[string]json.RawMessage{"bidderA": bidderAJSON}, + }, + { + description: "Many - imp.ext.prebid.bidder.BIDDER", + givenImpExt: map[string]json.RawMessage{}, + givenImpExtPrebidBidders: map[string]json.RawMessage{"bidderA": bidderAJSON, "bidderB": bidderBJSON}, + expected: map[string]json.RawMessage{"bidderA": bidderAJSON, "bidderB": bidderBJSON}, + }, + { + description: "Special Names Not Treated Differently - imp.ext.prebid.bidder.BIDDER", + givenImpExt: map[string]json.RawMessage{}, + givenImpExtPrebidBidders: map[string]json.RawMessage{"prebid": json.RawMessage(`{"prebid":"value1"}}`), "context": json.RawMessage(`{"firstPartyData":"value2"}}`), "skadn": json.RawMessage(`{"skAdNetwork":"value3"}}`)}, + expected: map[string]json.RawMessage{"prebid": json.RawMessage(`{"prebid":"value1"}}`), "context": json.RawMessage(`{"firstPartyData":"value2"}}`), "skadn": json.RawMessage(`{"skAdNetwork":"value3"}}`)}, + }, + { + description: "Mixed - Both - imp.ext.BIDDER + imp.ext.prebid.bidder.BIDDER", + givenImpExt: map[string]json.RawMessage{"bidderA": bidderAJSON}, + givenImpExtPrebidBidders: map[string]json.RawMessage{"bidderB": bidderBJSON}, + expected: map[string]json.RawMessage{"bidderA": bidderAJSON, "bidderB": bidderBJSON}, + }, + { + description: "Mixed - Overwrites - imp.ext.BIDDER + imp.ext.prebid.bidder.BIDDER", + givenImpExt: map[string]json.RawMessage{"bidderA": json.RawMessage(`{"shouldBe":"Ignored"}}`)}, + givenImpExtPrebidBidders: map[string]json.RawMessage{"bidderA": bidderAJSON}, + expected: map[string]json.RawMessage{"bidderA": bidderAJSON}, + }, + } + + for _, test := range testCases { + result := extractBidderExts(test.givenImpExt, test.givenImpExtPrebidBidders) + assert.Equal(t, test.expected, result, test.description) + } +} + func TestCleanOpenRTBRequests(t *testing.T) { testCases := []struct { req AuctionRequest diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 570701603fd..e03c234b257 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -35,7 +35,7 @@ const ( BidderReservedData BidderName = "data" // Reserved for first party data. BidderReservedGeneral BidderName = "general" // Reserved for non-bidder specific messages when using a map keyed on the bidder name. BidderReservedPrebid BidderName = "prebid" // Reserved for Prebid Server configuration. - BidderReservedSKAdN BidderName = "skadn" // Reserved for SKAdNetwork OpenRTB extension. + BidderReservedSKAdN BidderName = "skadn" // Reserved for Apple's SKAdNetwork OpenRTB extension. ) // IsBidderNameReserved returns true if the specified name is a case insensitive match for a reserved bidder name. diff --git a/openrtb_ext/device.go b/openrtb_ext/device.go index eb4655117ca..cc06f3806cf 100644 --- a/openrtb_ext/device.go +++ b/openrtb_ext/device.go @@ -12,6 +12,9 @@ import ( // PrebidExtKey represents the prebid extension key used in requests const PrebidExtKey = "prebid" +// PrebidExtBidderKey represents the field name within request.imp.ext.prebid reserved for bidder params. +const PrebidExtBidderKey = "bidder" + // ExtDevice defines the contract for bidrequest.device.ext type ExtDevice struct { // Attribute: diff --git a/openrtb_ext/request.go b/openrtb_ext/request.go index 124e050ac5c..b2bb25e7401 100644 --- a/openrtb_ext/request.go +++ b/openrtb_ext/request.go @@ -5,9 +5,12 @@ import ( "errors" ) -// FirstPartyDataContextExtKey defines the field name within bidrequest.ext reserved -// for first party data support. -const FirstPartyDataContextExtKey string = "context" +// FirstPartyDataContextExtKey defines the field name within request.ext reserved for first party data. +const FirstPartyDataContextExtKey = "context" + +// SKAdNExtKey defines the field name within request.ext reserved for Apple's SKAdNetwork. +const SKAdNExtKey = "skadn" + const MaxDecimalFigures int = 15 // ExtRequest defines the contract for bidrequest.ext From e53fd87999409dde31c67a0260da21993daa992e Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Thu, 11 Mar 2021 14:08:03 -0500 Subject: [PATCH 28/91] No Longer Move bid.ext To bid.ext.bidder (#1742) * No Longer Move bid.ext To bid.ext.bidder * Remove Similar Behavior From seatbid.ext * Avoid Second Bid Copy * Removed Unused seatbid.ext --- adapters/rhythmone/rhythmone.go | 6 +- exchange/bidder.go | 4 - exchange/bidder_test.go | 4 - exchange/exchange.go | 85 +++++++++--------- exchange/exchange_test.go | 26 +++--- .../bid-ext-prebid-collision.json | 90 +++++++++++++++++++ exchange/exchangetest/bid-ext.json | 87 ++++++++++++++++++ exchange/seatbid.go | 8 -- openrtb_ext/bid.go | 4 +- 9 files changed, 236 insertions(+), 78 deletions(-) create mode 100644 exchange/exchangetest/bid-ext-prebid-collision.json create mode 100644 exchange/exchangetest/bid-ext.json delete mode 100644 exchange/seatbid.go diff --git a/adapters/rhythmone/rhythmone.go b/adapters/rhythmone/rhythmone.go index 7dd94a494c8..a507e778550 100644 --- a/adapters/rhythmone/rhythmone.go +++ b/adapters/rhythmone/rhythmone.go @@ -132,9 +132,9 @@ func (a *RhythmoneAdapter) preProcess(req *openrtb.BidRequest, errors []error) ( errors = append(errors, err) return nil, "", errors } - bidderExtCopy := openrtb_ext.ExtBid{ - Bidder: rhythmoneExtCopy, - } + bidderExtCopy := struct { + Bidder json.RawMessage `json:"bidder,omitempty"` + }{rhythmoneExtCopy} impExtCopy, err := json.Marshal(&bidderExtCopy) if err != nil { errors = append(errors, err) diff --git a/exchange/bidder.go b/exchange/bidder.go index f916e205ace..6df5fafb5f6 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -83,10 +83,6 @@ type pbsOrtbSeatBid struct { // httpCalls is the list of debugging info. It should only be populated if the request.test == 1. // This will become response.ext.debug.httpcalls.{bidder} on the final Response. httpCalls []*openrtb_ext.ExtHttpCall - // ext contains the extension for this seatbid. - // if len(bids) > 0, this will become response.seatbid[i].ext.{bidder} on the final OpenRTB response. - // if len(bids) == 0, this will be ignored because the OpenRTB spec doesn't allow a SeatBid with 0 Bids. - ext json.RawMessage } // adaptBidder converts an adapters.Bidder into an exchange.adaptedBidder. diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index b829ddd787c..dbf8a022255 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -135,10 +135,6 @@ func TestSingleBidder(t *testing.T) { if len(seatBid.httpCalls) != test.httpCallsLen { t.Errorf("The bidder shouldn't log HttpCalls when request.test == 0. Found %d", len(seatBid.httpCalls)) } - - if len(seatBid.ext) != 0 { - t.Errorf("The bidder shouldn't define any seatBid.ext. Got %s", string(seatBid.ext)) - } } } diff --git a/exchange/exchange.go b/exchange/exchange.go index b4fa3a614f6..45081c16e71 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -788,25 +788,9 @@ func (e *exchange) makeExtBidResponse(adapterBids map[openrtb_ext.BidderName]*pb // Return an openrtb seatBid for a bidder // BuildBidResponse is responsible for ensuring nil bid seatbids are not included func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.BidderName, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, returnCreative bool) *openrtb.SeatBid { - seatBid := new(openrtb.SeatBid) - seatBid.Seat = adapter.String() - // Prebid cannot support roadblocking - seatBid.Group = 0 - - if len(adapterBid.ext) > 0 { - sbExt := ExtSeatBid{ - Bidder: adapterBid.ext, - } - - ext, err := json.Marshal(sbExt) - if err != nil { - extError := openrtb_ext.ExtBidderError{ - Code: errortypes.ReadCode(err), - Message: fmt.Sprintf("Error writing SeatBid.Ext: %s", err.Error()), - } - adapterExtra[adapter].Errors = append(adapterExtra[adapter].Errors, extError) - } - seatBid.Ext = ext + seatBid := &openrtb.SeatBid{ + Seat: adapter.String(), + Group: 0, // Prebid cannot support roadblocking } var errList []error @@ -818,39 +802,54 @@ func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.B return seatBid } -// Create the Bid array inside of SeatBid -func (e *exchange) makeBid(Bids []*pbsOrtbBid, auc *auction, returnCreative bool) ([]openrtb.Bid, []error) { - bids := make([]openrtb.Bid, 0, len(Bids)) - errList := make([]error, 0, 1) - for _, thisBid := range Bids { - bidExt := &openrtb_ext.ExtBid{ - Bidder: thisBid.bid.Ext, - Prebid: &openrtb_ext.ExtBidPrebid{ - Targeting: thisBid.bidTargets, - Type: thisBid.bidType, - Video: thisBid.bidVideo, - Events: thisBid.bidEvents, - DealPriority: thisBid.dealPriority, - DealTierSatisfied: thisBid.dealTierSatisfied, - }, +func (e *exchange) makeBid(bids []*pbsOrtbBid, auc *auction, returnCreative bool) ([]openrtb.Bid, []error) { + result := make([]openrtb.Bid, 0, len(bids)) + errs := make([]error, 0, 1) + + for _, bid := range bids { + bidExtPrebid := &openrtb_ext.ExtBidPrebid{ + DealPriority: bid.dealPriority, + DealTierSatisfied: bid.dealTierSatisfied, + Events: bid.bidEvents, + Targeting: bid.bidTargets, + Type: bid.bidType, + Video: bid.bidVideo, } - if cacheInfo, found := e.getBidCacheInfo(thisBid, auc); found { - bidExt.Prebid.Cache = &openrtb_ext.ExtBidPrebidCache{ + + if cacheInfo, found := e.getBidCacheInfo(bid, auc); found { + bidExtPrebid.Cache = &openrtb_ext.ExtBidPrebidCache{ Bids: &cacheInfo, } } - ext, err := json.Marshal(bidExt) - if err != nil { - errList = append(errList, err) + + if bidExtJSON, err := makeBidExtJSON(bid.bid.Ext, bidExtPrebid); err != nil { + errs = append(errs, err) } else { - bids = append(bids, *thisBid.bid) - bids[len(bids)-1].Ext = ext + result = append(result, *bid.bid) + resultBid := &result[len(result)-1] + resultBid.Ext = bidExtJSON if !returnCreative { - bids[len(bids)-1].AdM = "" + resultBid.AdM = "" } } } - return bids, errList + return result, errs +} + +func makeBidExtJSON(ext json.RawMessage, prebid *openrtb_ext.ExtBidPrebid) (json.RawMessage, error) { + // no existing bid.ext. generate a bid.ext with just our prebid section populated. + if len(ext) == 0 { + bidExt := &openrtb_ext.ExtBid{Prebid: prebid} + return json.Marshal(bidExt) + } + + // update existing bid.ext with our prebid section. if bid.ext.prebid already exists, it will be overwritten. + var extMap map[string]interface{} + if err := json.Unmarshal(ext, &extMap); err != nil { + return nil, err + } + extMap[openrtb_ext.PrebidExtKey] = prebid + return json.Marshal(extMap) } // If bid got cached inside `(a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, bidRequest *openrtb.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string)`, diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 7507ecef89d..f615d412c71 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -1823,7 +1823,7 @@ func TestCategoryMapping(t *testing.T) { &bid1_4, } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} bidderName1 := openrtb_ext.BidderName("appnexus") adapterBids[bidderName1] = &seatBid @@ -1878,7 +1878,7 @@ func TestCategoryMappingNoIncludeBrandCategory(t *testing.T) { &bid1_4, } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} bidderName1 := openrtb_ext.BidderName("appnexus") adapterBids[bidderName1] = &seatBid @@ -1930,7 +1930,7 @@ func TestCategoryMappingTranslateCategoriesNil(t *testing.T) { &bid1_3, } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} bidderName1 := openrtb_ext.BidderName("appnexus") adapterBids[bidderName1] = &seatBid @@ -2012,7 +2012,7 @@ func TestCategoryMappingTranslateCategoriesFalse(t *testing.T) { &bid1_3, } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} bidderName1 := openrtb_ext.BidderName("appnexus") adapterBids[bidderName1] = &seatBid @@ -2082,7 +2082,7 @@ func TestCategoryDedupe(t *testing.T) { &bid1_5, } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} bidderName1 := openrtb_ext.BidderName("appnexus") adapterBids[bidderName1] = &seatBid @@ -2162,7 +2162,7 @@ func TestNoCategoryDedupe(t *testing.T) { &bid1_5, } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} bidderName1 := openrtb_ext.BidderName("appnexus") adapterBids[bidderName1] = &seatBid @@ -2223,10 +2223,10 @@ func TestCategoryMappingBidderName(t *testing.T) { &bid1_2, } - seatBid1 := pbsOrtbSeatBid{innerBids1, "USD", nil, nil} + seatBid1 := pbsOrtbSeatBid{bids: innerBids1, currency: "USD"} bidderName1 := openrtb_ext.BidderName("bidder1") - seatBid2 := pbsOrtbSeatBid{innerBids2, "USD", nil, nil} + seatBid2 := pbsOrtbSeatBid{bids: innerBids2, currency: "USD"} bidderName2 := openrtb_ext.BidderName("bidder2") adapterBids[bidderName1] = &seatBid1 @@ -2277,10 +2277,10 @@ func TestCategoryMappingBidderNameNoCategories(t *testing.T) { &bid1_2, } - seatBid1 := pbsOrtbSeatBid{innerBids1, "USD", nil, nil} + seatBid1 := pbsOrtbSeatBid{bids: innerBids1, currency: "USD"} bidderName1 := openrtb_ext.BidderName("bidder1") - seatBid2 := pbsOrtbSeatBid{innerBids2, "USD", nil, nil} + seatBid2 := pbsOrtbSeatBid{bids: innerBids2, currency: "USD"} bidderName2 := openrtb_ext.BidderName("bidder2") adapterBids[bidderName1] = &seatBid1 @@ -2384,7 +2384,7 @@ func TestBidRejectionErrors(t *testing.T) { innerBids = append(innerBids, ¤tBid) } - seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} + seatBid := pbsOrtbSeatBid{bids: innerBids, currency: "USD"} adapterBids[bidderName] = &seatBid @@ -2442,10 +2442,10 @@ func TestCategoryMappingTwoBiddersOneBidEachNoCategorySamePrice(t *testing.T) { for i := 1; i < 10; i++ { adapterBids := make(map[openrtb_ext.BidderName]*pbsOrtbSeatBid) - seatBidApn1 := pbsOrtbSeatBid{innerBidsApn1, "USD", nil, nil} + seatBidApn1 := pbsOrtbSeatBid{bids: innerBidsApn1, currency: "USD"} bidderNameApn1 := openrtb_ext.BidderName("appnexus1") - seatBidApn2 := pbsOrtbSeatBid{innerBidsApn2, "USD", nil, nil} + seatBidApn2 := pbsOrtbSeatBid{bids: innerBidsApn2, currency: "USD"} bidderNameApn2 := openrtb_ext.BidderName("appnexus2") adapterBids[bidderNameApn1] = &seatBidApn1 diff --git a/exchange/exchangetest/bid-ext-prebid-collision.json b/exchange/exchangetest/bid-ext-prebid-collision.json new file mode 100644 index 00000000000..054671ce8d2 --- /dev/null +++ b/exchange/exchangetest/bid-ext-prebid-collision.json @@ -0,0 +1,90 @@ +{ + "description": "Verifies bid.ext values are left alone from the adapter, except for overwriting bid.ext.prebid if the adapter ext includes a collision.", + + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "my-imp-id", + "video": { + "mimes": ["video/mp4"] + }, + "ext": { + "appnexus": { + "placementId": 1 + } + } + }] + } + }, + "outgoingRequests": { + "appnexus": { + "expectRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "my-imp-id", + "video": { + "mimes": ["video/mp4"] + }, + "ext": { + "bidder": { + "placementId": 1 + } + } + }] + }, + "bidAdjustment": 1.0 + }, + "mockResponse": { + "pbsSeatBid": { + "pbsBids": [{ + "ortbBid": { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "ext": { + "someField": "someValue", + "prebid": { + "willBeOverwritten": "by core logic" + } + } + }, + "bidType": "video" + }] + } + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [{ + "seat": "appnexus", + "bid": [{ + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "ext": { + "someField": "someValue", + "prebid": { + "type": "video" + } + } + }] + }] + } + } +} \ No newline at end of file diff --git a/exchange/exchangetest/bid-ext.json b/exchange/exchangetest/bid-ext.json new file mode 100644 index 00000000000..8211ac88eac --- /dev/null +++ b/exchange/exchangetest/bid-ext.json @@ -0,0 +1,87 @@ +{ + "description": "Verifies bid.ext values are left alone from the adapter, except for adding in bid.ext.prebid.", + + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "my-imp-id", + "video": { + "mimes": ["video/mp4"] + }, + "ext": { + "appnexus": { + "placementId": 1 + } + } + }] + } + }, + "outgoingRequests": { + "appnexus": { + "expectRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "my-imp-id", + "video": { + "mimes": ["video/mp4"] + }, + "ext": { + "bidder": { + "placementId": 1 + } + } + }] + }, + "bidAdjustment": 1.0 + }, + "mockResponse": { + "pbsSeatBid": { + "pbsBids": [{ + "ortbBid": { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "ext": { + "someField": "someValue" + } + }, + "bidType": "video" + }] + } + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [{ + "seat": "appnexus", + "bid": [{ + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "ext": { + "someField": "someValue", + "prebid": { + "type": "video" + } + } + }] + }] + } + } +} \ No newline at end of file diff --git a/exchange/seatbid.go b/exchange/seatbid.go deleted file mode 100644 index b675127410e..00000000000 --- a/exchange/seatbid.go +++ /dev/null @@ -1,8 +0,0 @@ -package exchange - -import "encoding/json" - -// ExtSeatBid defines the contract for bidresponse.seatbid.ext -type ExtSeatBid struct { - Bidder json.RawMessage `json:"bidder,omitempty"` -} diff --git a/openrtb_ext/bid.go b/openrtb_ext/bid.go index 8f4d7a094bb..7d787cf83a6 100644 --- a/openrtb_ext/bid.go +++ b/openrtb_ext/bid.go @@ -1,14 +1,12 @@ package openrtb_ext import ( - "encoding/json" "fmt" ) // ExtBid defines the contract for bidresponse.seatbid.bid[i].ext type ExtBid struct { - Prebid *ExtBidPrebid `json:"prebid,omitempty"` - Bidder json.RawMessage `json:"bidder,omitempty"` + Prebid *ExtBidPrebid `json:"prebid,omitempty"` } // ExtBidPrebid defines the contract for bidresponse.seatbid.bid[i].ext.prebid From 549d4b20288c07fe3b36bcea5e2e7174a3cf82a3 Mon Sep 17 00:00:00 2001 From: agilfix Date: Tue, 16 Mar 2021 13:13:51 -0400 Subject: [PATCH 29/91] Typo fix: adyoulike bidder param debug description (#1755) --- static/bidder-params/adyoulike.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/bidder-params/adyoulike.json b/static/bidder-params/adyoulike.json index f426a0923d7..448de344739 100644 --- a/static/bidder-params/adyoulike.json +++ b/static/bidder-params/adyoulike.json @@ -26,8 +26,8 @@ }, "debug": { "type": "string", - "description": "Abitrary id used for debug purpose" + "description": "Arbitrary id used for debug purpose" } }, "required": ["placement"] -} \ No newline at end of file +} From 5b1a9195d1db4635250b071546df30c636abbd8d Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Wed, 17 Mar 2021 08:57:41 -0400 Subject: [PATCH 30/91] Aliases: Better Error Message For Disabled Bidder (#1751) --- endpoints/openrtb2/auction.go | 13 +++++++++---- endpoints/openrtb2/auction_test.go | 8 ++++---- .../sample-requests/disabled/bad/bad-alias.json | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index e4567bbcd29..35230315763 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -915,12 +915,17 @@ func (deps *endpointDeps) parseBidExt(ext json.RawMessage) (*openrtb_ext.ExtRequ } func (deps *endpointDeps) validateAliases(aliases map[string]string) error { - for thisAlias, coreBidder := range aliases { + for alias, coreBidder := range aliases { + if _, isCoreBidderDisabled := deps.disabledBidders[coreBidder]; isCoreBidderDisabled { + return fmt.Errorf("request.ext.prebid.aliases.%s refers to disabled bidder: %s", alias, coreBidder) + } + if _, isCoreBidder := deps.bidderMap[coreBidder]; !isCoreBidder { - return fmt.Errorf("request.ext.prebid.aliases.%s refers to unknown bidder: %s", thisAlias, coreBidder) + return fmt.Errorf("request.ext.prebid.aliases.%s refers to unknown bidder: %s", alias, coreBidder) } - if thisAlias == coreBidder { - return fmt.Errorf("request.ext.prebid.aliases.%s defines a no-op alias. Choose a different alias, or remove this entry.", thisAlias) + + if alias == coreBidder { + return fmt.Errorf("request.ext.prebid.aliases.%s defines a no-op alias. Choose a different alias, or remove this entry.", alias) } } return nil diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index 768e60593a1..892b0579ec4 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -48,7 +48,7 @@ type testConfigValues struct { AliasJSON string `json:"aliases"` BlacklistedAccounts []string `json:"blacklistedAccts"` BlacklistedApps []string `json:"blacklistedApps"` - AdapterList []string `json:"disabledAdapters"` + DisabledAdapters []string `json:"disabledAdapters"` } func TestJsonSampleRequests(t *testing.T) { @@ -229,9 +229,9 @@ func (tc *testConfigValues) getBlackListedAccountMap() map[string]bool { func (tc *testConfigValues) getAdaptersConfigMap() map[string]config.Adapter { var adaptersConfig map[string]config.Adapter - if len(tc.AdapterList) > 0 { - adaptersConfig = make(map[string]config.Adapter, len(tc.AdapterList)) - for _, adapterName := range tc.AdapterList { + if len(tc.DisabledAdapters) > 0 { + adaptersConfig = make(map[string]config.Adapter, len(tc.DisabledAdapters)) + for _, adapterName := range tc.DisabledAdapters { adaptersConfig[adapterName] = config.Adapter{Disabled: true} } } diff --git a/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json b/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json index f4379dc09a2..862393081e2 100644 --- a/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json +++ b/endpoints/openrtb2/sample-requests/disabled/bad/bad-alias.json @@ -1,7 +1,7 @@ { "description": "Request comes with an alias to a disabled bidder, we should throw error", "config": { - "disabledAdapters": ["appnexus", "rubicon"] + "disabledAdapters": ["appnexus"] }, "mockBidRequest": { "id": "some-request-id", @@ -32,5 +32,5 @@ } }, "expectedReturnCode": 400, - "expectedErrorMessage": "Invalid request: request.ext.prebid.aliases.test1 refers to unknown bidder: appnexus\n" + "expectedErrorMessage": "Invalid request: request.ext.prebid.aliases.test1 refers to disabled bidder: appnexus\n" } From fc87d1dbcf274889beca5140dcac427a974c1046 Mon Sep 17 00:00:00 2001 From: Jim Naumann Date: Wed, 17 Mar 2021 18:17:51 -0400 Subject: [PATCH 31/91] beachfront: Changes to support real 204 (#1737) --- adapters/adapterstest/test_json.go | 19 +- adapters/beachfront/beachfront.go | 20 +- .../beachfronttest/exemplary/adm-video.json | 1 + .../beachfronttest/exemplary/banner.json | 1 + .../supplemental/banner-204-with-body.json | 79 ++++++++ ...r-empty_array-200.json => banner-204.json} | 12 +- .../banner-and-adm-video-by-explicit.json | 1 + ...video-expected-204-response-on-banner.json | 171 ++++++++++++++++++ .../supplemental/banner-and-adm-video.json | 1 + .../supplemental/banner-and-nurl-video.json | 1 + .../supplemental/banner-bad-request-400.json | 1 + ...idder_response_unmarshal_error_banner.json | 1 + .../supplemental/bidfloor-below-min.json | 1 + .../supplemental/six-nine-combo.json | 1 + .../supplemental/two-four-combo.json | 1 + 15 files changed, 290 insertions(+), 21 deletions(-) create mode 100644 adapters/beachfront/beachfronttest/supplemental/banner-204-with-body.json rename adapters/beachfront/beachfronttest/supplemental/{banner-empty_array-200.json => banner-204.json} (81%) create mode 100644 adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-expected-204-response-on-banner.json diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index a25a4f1905a..1e3178ed23d 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -123,7 +123,7 @@ func runSpec(t *testing.T, filename string, spec *testSpec, bidder adapters.Bidd diffErrorLists(t, fmt.Sprintf("%s: MakeBids", filename), bidsErrs, spec.MakeBidsErrors) for i := 0; i < len(spec.BidResponses); i++ { - diffBidLists(t, filename, bidResponses[i].Bids, spec.BidResponses[i].Bids) + diffBidLists(t, filename, bidResponses[i], spec.BidResponses[i].Bids) } } @@ -227,9 +227,24 @@ func diffErrorLists(t *testing.T, description string, actual []error, expected [ } } -func diffBidLists(t *testing.T, filename string, actual []*adapters.TypedBid, expected []expectedBid) { +func diffBidLists(t *testing.T, filename string, response *adapters.BidderResponse, expected []expectedBid) { t.Helper() + if (response == nil || len(response.Bids) == 0) != (len(expected) == 0) { + if len(expected) == 0 { + t.Fatalf("%s: expectedBidResponses indicated a nil response, but mockResponses supplied a non-nil response", filename) + } + + t.Fatalf("%s: mockResponses included unexpected nil or empty response", filename) + } + + // Expected nil response - give diffBids something to work with. + if response == nil { + response = new(adapters.BidderResponse) + } + + actual := response.Bids + if len(actual) != len(expected) { t.Fatalf("%s: MakeBids returned wrong bid count. Expected %d, got %d", filename, len(expected), len(actual)) } diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 3a431c9cf3a..58554577c87 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -76,6 +76,7 @@ type beachfrontBannerRequest struct { AdapterVersion string `json:"adapterVersion"` IP string `json:"ip"` RequestID string `json:"requestId"` + Real204 bool `json:"real204"` } type beachfrontSlot struct { @@ -367,6 +368,7 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e if request.Imp[0].Secure != nil { bfr.Secure = *request.Imp[0].Secure } + bfr.Real204 = true return bfr, errs } @@ -465,7 +467,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } bfReqs[i].Request.Imp = nil - bfReqs[i].Request.Imp = make([]openrtb.Imp, 1, 1) + bfReqs[i].Request.Imp = make([]openrtb.Imp, 1) bfReqs[i].Request.Imp[0] = imp } @@ -481,18 +483,12 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { - var bids []openrtb.Bid - - // The case of response status == 200 and response body length == 2 below covers the case of the banner endpoint returning - // an empty JSON array ('[]'), which is functionally no content. - if response.StatusCode == http.StatusNoContent || (response.StatusCode == http.StatusOK && len(response.Body) <= 2) { - return nil, []error{&errortypes.BadInput{ - Message: fmt.Sprintf("no content or truncated content received from server. status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri), - }} + if response.StatusCode == http.StatusNoContent { + return nil, nil } if response.StatusCode >= http.StatusInternalServerError { - return nil, []error{&errortypes.BadInput{ + return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("server error status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri), }} } @@ -507,8 +503,9 @@ func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return nil, []error{fmt.Errorf("unexpected status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri)} } - var xtrnal openrtb.BidRequest + var bids []openrtb.Bid var errs = make([]error, 0) + var xtrnal openrtb.BidRequest // For video, which uses RTB for the external request, this will unmarshal as expected. For banner, it will // only get the User struct and everything else will be nil @@ -524,6 +521,7 @@ func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern var dur beachfrontVideoBidExtension bidResponse := adapters.NewBidderResponseWithBidsCapacity(BidCapacity) + for i := 0; i < len(bids); i++ { // If we unmarshal without an error, this is an AdM video diff --git a/adapters/beachfront/beachfronttest/exemplary/adm-video.json b/adapters/beachfront/beachfronttest/exemplary/adm-video.json index 26b050f263d..edde1301dcc 100644 --- a/adapters/beachfront/beachfronttest/exemplary/adm-video.json +++ b/adapters/beachfront/beachfronttest/exemplary/adm-video.json @@ -96,6 +96,7 @@ "expectedBidResponses": [ { + "currency": "USD", "bids": [ { "bid": { diff --git a/adapters/beachfront/beachfronttest/exemplary/banner.json b/adapters/beachfront/beachfronttest/exemplary/banner.json index e3dcffa3d08..1a8e830521d 100644 --- a/adapters/beachfront/beachfronttest/exemplary/banner.json +++ b/adapters/beachfront/beachfronttest/exemplary/banner.json @@ -45,6 +45,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-204-with-body.json b/adapters/beachfront/beachfronttest/supplemental/banner-204-with-body.json new file mode 100644 index 00000000000..edba490e814 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/banner-204-with-body.json @@ -0,0 +1,79 @@ +{ + "mockBidRequest": { + "id": "some_test_ad", + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "imp": [ + { + "id": "dudImp", + "bidfloor": 0.02, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "bidfloor": 0.02, + "appId": "dudAppId1" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/prebid_display", + "body": { + "slots": [ + { + "slot": "dudImp", + "id": "dudAppId1", + "bidfloor": 0.02, + "sizes": [ + { + "w": 300, + "h": 250 + } + ] + } + ], + "domain": "some.domain.us", + "page": "https://some.domain.us/some/page.html", + "real204": true, + "referrer": "", + "search": "", + "secure": 1, + "requestId": "some_test_ad", + "isMobile": 0, + "ip": "", + "deviceModel": "", + "deviceOs": "", + "dnt": 0, + "ua": "", + "adapterName": "BF_PREBID_S2S", + "adapterVersion": "0.9.2", + "user": { + } + } + }, + "mockResponse": { + "status": 204, + "body": [ + { + "something": "where nothing should be" + } + ] + } + } + ], + + "expectedBidResponses": [] +} + diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json b/adapters/beachfront/beachfronttest/supplemental/banner-204.json similarity index 81% rename from adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json rename to adapters/beachfront/beachfronttest/supplemental/banner-204.json index 8e607f67663..69aa0b882a9 100644 --- a/adapters/beachfront/beachfronttest/supplemental/banner-empty_array-200.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-204.json @@ -46,6 +46,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, @@ -63,18 +64,13 @@ } }, "mockResponse": { - "status": 200, - "body": [] + "status": 204, + "body": "" } } ], - "expectedBidResponses": [], + "expectedBidResponses": [ - "expectedMakeBidsErrors": [ - { - "value": "no content or truncated content received from server. status code 200 from https://qa.beachrtb.com/prebid_display. Run with request.debug = 1 for more info", - "comparison": "literal" - } ] } diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json index c326a33a642..b060efe6f03 100644 --- a/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-by-explicit.json @@ -60,6 +60,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-expected-204-response-on-banner.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-expected-204-response-on-banner.json new file mode 100644 index 00000000000..240994bb370 --- /dev/null +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video-expected-204-response-on-banner.json @@ -0,0 +1,171 @@ +{ + "mockBidRequest": { + "id": "banner-and-video", + "imp": [ + { + "id": "mix1", + "ext": { + "bidder": { + "bidfloor": 0.41, + "appIds": { + "banner": "bannerAppId1", + "video": "videoAppId1" + } + } + }, + "video": { + "mimes": [ + "video/mp4" + ], + "context": "instream", + "w": 300, + "h": 250 + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "site": { + "page": "https://some.domain.us/some/page.html" + }, + "device":{ + "ip":"255.255.255.255" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/prebid_display", + "body": { + "slots": [ + { + "slot": "mix1", + "id": "bannerAppId1", + "bidfloor": 0.41, + "sizes": [ + { + "w": 300, + "h": 250 + } + ] + } + ], + "domain": "some.domain.us", + "page": "https://some.domain.us/some/page.html", + "real204": true, + "referrer": "", + "search": "", + "secure": 1, + "deviceOs": "", + "deviceModel": "", + "isMobile": 0, + "ua": "", + "ip": "255.255.255.255", + "dnt": 0, + "user": {}, + "adapterName": "BF_PREBID_S2S", + "adapterVersion": "0.9.2", + "requestId": "banner-and-video" + } + }, + "mockResponse": { + "status": 204, + "body": "" + } + }, + { + "expectedRequest": { + "uri": "https://qa.beachrtb.com/bid.json?exchange_id=videoAppId1", + "body": { + "id": "banner-and-video", + "imp": [ + { + "video": { + "w": 300, + "h": 250, + "mimes": [ + "video/mp4" + ] + }, + "bidfloor": 0.41, + "secure": 1, + "id": "mix1" + } + ], + "site": { + "domain": "some.domain.us", + "page": "https://some.domain.us/some/page.html" + }, + "device": { + "devicetype": 2, + "ip": "255.255.255.255" + }, + "cur": [ + "USD" + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "61b87329-8790-47b7-90dd-c53ae7ce1723", + "seatbid": [ + { + "bid": [ + { + "id": "5d839458f73decdc1572b7f6", + "impid": "mix1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250 + } + ], + "seat": "bfb-io-s1" + } + ], + "bidid": "5d839458f73decdc1572b7f6", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + {"bids":[]}, + { + "bids": [ + { + "bid": { + "id": "mix1AdmVideo", + "impid": "mix1", + "price": 20, + "adm": "http://example.com/vast.xml", + "adid": "1088", + "adomain": [ + "beachfront.io" + ], + "cid": "277", + "crid": "532", + "w": 300, + "h": 250 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json index f67903d0866..18e8ca7a1bf 100644 --- a/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-adm-video.json @@ -59,6 +59,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json b/adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json index b950d73400b..2ef8ca585e1 100644 --- a/adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-and-nurl-video.json @@ -57,6 +57,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json b/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json index 1771f393361..35926b3c943 100644 --- a/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json +++ b/adapters/beachfront/beachfronttest/supplemental/banner-bad-request-400.json @@ -45,6 +45,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json index b751f763c0d..e7869d36d6d 100644 --- a/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json +++ b/adapters/beachfront/beachfronttest/supplemental/bidder_response_unmarshal_error_banner.json @@ -44,6 +44,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json b/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json index f5d4e8228c2..7ebe6cf4aa0 100644 --- a/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json +++ b/adapters/beachfront/beachfronttest/supplemental/bidfloor-below-min.json @@ -44,6 +44,7 @@ ], "domain": "some.domain.us", "page": "https://some.domain.us/some/page.html", + "real204": true, "referrer": "", "search": "", "secure": 1, diff --git a/adapters/beachfront/beachfronttest/supplemental/six-nine-combo.json b/adapters/beachfront/beachfronttest/supplemental/six-nine-combo.json index 4c009ff08da..9a8ca7343e4 100644 --- a/adapters/beachfront/beachfronttest/supplemental/six-nine-combo.json +++ b/adapters/beachfront/beachfronttest/supplemental/six-nine-combo.json @@ -189,6 +189,7 @@ ], "domain": "example.com", "page": "http://example.com/whatever/something.html", + "real204": true, "referrer": "", "search": "", "secure": 0, diff --git a/adapters/beachfront/beachfronttest/supplemental/two-four-combo.json b/adapters/beachfront/beachfronttest/supplemental/two-four-combo.json index d48962e6641..ac1ca19f6d3 100644 --- a/adapters/beachfront/beachfronttest/supplemental/two-four-combo.json +++ b/adapters/beachfront/beachfronttest/supplemental/two-four-combo.json @@ -97,6 +97,7 @@ ], "domain":"example.com", "page":"http://example.com/whatever/something.html", + "real204": true, "referrer":"", "search":"", "secure":0, From bdf1e7b3e13bdf87d3282bf74472fc66504537d5 Mon Sep 17 00:00:00 2001 From: guscarreon Date: Thu, 18 Mar 2021 12:16:14 -0400 Subject: [PATCH 32/91] Fix race condition in 33across.go (#1757) Co-authored-by: Gus Carreon --- adapters/33across/33across.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index b9655faab7f..a48c18e9f58 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -228,7 +228,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque } func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, error) { - videoCopy := video + videoCopy := *video if videoCopy.W == 0 || videoCopy.H == 0 || videoCopy.Protocols == nil || @@ -252,7 +252,7 @@ func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, err } } - return videoCopy, nil + return &videoCopy, nil } func getBidType(ext bidExt) openrtb_ext.BidType { From f7df258f061788ef7e72529115aa5fd554fa9f16 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Thu, 18 Mar 2021 12:31:01 -0400 Subject: [PATCH 33/91] Revert "Fix race condition in 33across.go (#1757)" (#1763) This reverts commit bdf1e7b3e13bdf87d3282bf74472fc66504537d5. --- adapters/33across/33across.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index a48c18e9f58..b9655faab7f 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -228,7 +228,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque } func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, error) { - videoCopy := *video + videoCopy := video if videoCopy.W == 0 || videoCopy.H == 0 || videoCopy.Protocols == nil || @@ -252,7 +252,7 @@ func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, err } } - return &videoCopy, nil + return videoCopy, nil } func getBidType(ext bidExt) openrtb_ext.BidType { From eb6c0e65902c2c3c074dd03c6cbe5f70f37a7c74 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Thu, 18 Mar 2021 14:11:42 -0400 Subject: [PATCH 34/91] Replace TravisCI With GitHub Actions (#1754) * Initial Commit * Finished Configuration * Remove TravisCI * Remove TravisCI * Fix Go Version Badge * Correct Fix For Go Version Badge * Removed Custom Config File Name --- .github/release-drafter.yml | 9 +++++++++ .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ .travis.yml | 30 ------------------------------ README.md | 3 ++- docs/developers/automated-tests.md | 2 +- docs/developers/contributing.md | 2 +- main.go | 2 +- 7 files changed, 40 insertions(+), 34 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000000..720e2f043f0 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,9 @@ +change-template: '* $TITLE (#$NUMBER)' +template: | + ## Changes + + $CHANGES + + ## Contributors + + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..fb9b6592308 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + release: + name: Create Release + if: github.event.base_ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - name: Get Version + id: get_version + run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + + - name: Create & Publish Release + uses: release-drafter/release-drafter@v5.12.1 + with: + name: ${{ steps.get_version.outputs.version }} + tag: ${{ steps.get_version.outputs.version }} + version: ${{ steps.get_version.outputs.version }} + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 97d8cea4d0d..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: go - -go: - - '1.14.2' - - '1.15' - -go_import_path: github.com/prebid/prebid-server - -env: -- GO111MODULE=on - -script: - - "./validate.sh --nofmt --cov --race 10" - -before_deploy: - - go get github.com/mitchellh/gox - - gox -os="linux" -arch="386" -output="{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X main.Rev=`git rev-parse --short HEAD`" -verbose ./...; - -deploy: - provider: releases - skip_cleanup: true - api_key: - secure: TSJcbIpg2zTJuzUXwv0Un5DPztDTeIKQ2BuuO9KiWYY3Td/nKn0flTYE6B5O6iVqE96HKyj2j0W51rhnRTNDReRZv76L+YXLTJOTQEEQY/A+7XaUXRT0KIbr1EHaeU+4uPJe/8YXxq+nFNeqOjj+LY457WbvnQTIbraAmCgi4yNq4JR+J9BoCELkX0SnU7oq+brq9tJNL3V+7EHIVH6ZLa1lWOrapMnbrVils8gwzWR8XpbdaI+Sn30AGOFKZ0WE2ojZkZb8oZxyX0HKarIiykfZUUzRhlXlTJ0D81QOdc5AtPNR/2dqUXsUE8mRav9R3AJM2BCS2pnP29orCRQU/kxS/mRfx2oZhkr+OHPsNbJcGNSbqNKlM13bX2nL1ZJsJ6xL0VrkBFYlI01SWR12CT9DhZSqTmGPNEkt3fdzwuYtkJNfthb9e9obscnmJEHPSiZRv9dv/stP5LVJJHfFdrzM4+Qo3MCxLNOhmc+p93gsZPeuDGDlx8Tqv1KpN7sp0glbmOwyFAwbCVh5can/JPIAKsQi9VRyZAJvn+7sqqZCExN4TvFArq7pe0LjIVHUQZP9g/vS8HobQnPutmGxf8HqzVVEBnjMsXuiY4cVRecXVRM7crfJjLGr2e9ywIkUZMSD+bRkbRUZ0QQQPvWtcgRw5JmLKG9jDklj8BDkON8= - file: - - prebid-server_linux_386 - on: - repo: prebid/prebid-server - tags: true - branch: - - master diff --git a/README.md b/README.md index 32bf4575c94..a619533ea74 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -[![Build Status](https://travis-ci.org/prebid/prebid-server.svg?branch=master)](https://travis-ci.org/prebid/prebid-server) +[![Build](https://img.shields.io/github/workflow/status/prebid/prebid-server/Validate/master?style=flat-square)](https://github.com/prebid/prebid-server/actions/workflows/validate.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/prebid/prebid-server?style=flat-square)](https://goreportcard.com/report/github.com/prebid/prebid-server) +![Go Version](https://img.shields.io/github/go-mod/go-version/prebid/prebid-server?style=flat-square) # Prebid Server diff --git a/docs/developers/automated-tests.md b/docs/developers/automated-tests.md index 0dff9b04212..6814fba385c 100644 --- a/docs/developers/automated-tests.md +++ b/docs/developers/automated-tests.md @@ -1,6 +1,6 @@ # Automated Tests -This project uses [TravisCI](https://travis-ci.org/) to make sure that every PR passes automated tests. +This project uses GitHub Actions to make sure that every PR passes automated tests. To reproduce these tests locally, use: ``` diff --git a/docs/developers/contributing.md b/docs/developers/contributing.md index 2dafa67fb2e..2a6a574ed14 100644 --- a/docs/developers/contributing.md +++ b/docs/developers/contributing.md @@ -40,7 +40,7 @@ those updates must be submitted in the same Pull Request as the code changes. When you're ready, [submit a Pull Request](https://help.github.com/articles/creating-a-pull-request/) against the `master` branch of [our GitHub repository](https://github.com/prebid/prebid-server/compare). -Pull Requests will be vetted through [Travis CI](https://travis-ci.com/). +Pull Requests will be vetted through GitHub Actions. To reproduce these same tests locally, do: ```bash diff --git a/main.go b/main.go index 2ae75a2e8cb..ebeabf29df8 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ import ( // Rev holds binary revision string // Set manually at build time using: // go build -ldflags "-X main.Rev=`git rev-parse --short HEAD`" -// Populated automatically at build / release time via .travis.yml +// Populated automatically at build / releases // `gox -os="linux" -arch="386" -output="{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X main.Rev=`git rev-parse --short HEAD`" -verbose ./...;` // See issue #559 var Rev string From a04d5e1824bc6c3766f12939945313d4c6746635 Mon Sep 17 00:00:00 2001 From: Veronika Solovei Date: Thu, 18 Mar 2021 11:44:01 -0700 Subject: [PATCH 35/91] Debug warnings (#1724) Co-authored-by: Veronika Solovei --- endpoints/openrtb2/amp_auction.go | 20 +- endpoints/openrtb2/amp_auction_test.go | 202 ++++++++++-------- endpoints/openrtb2/auction.go | 8 +- endpoints/openrtb2/auction_test.go | 53 ++++- .../supplementary/us-privacy-invalid.json | 52 +++++ errortypes/code.go | 2 + errortypes/errortypes.go | 22 +- exchange/bidder.go | 14 +- exchange/bidder_test.go | 7 +- exchange/exchange.go | 62 ++++-- exchange/exchange_test.go | 130 +++++++---- exchange/utils_test.go | 5 +- openrtb_ext/response.go | 7 +- privacy/ccpa/parsedpolicy.go | 5 +- 14 files changed, 410 insertions(+), 179 deletions(-) create mode 100644 endpoints/openrtb2/sample-requests/valid-whole/supplementary/us-privacy-invalid.json diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index 8cc8e9bd454..1f3d622b80d 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -35,10 +35,10 @@ import ( const defaultAmpRequestTimeoutMillis = 900 type AmpResponse struct { - Targeting map[string]string `json:"targeting"` - Debug *openrtb_ext.ExtResponseDebug `json:"debug,omitempty"` - Errors map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError `json:"errors,omitempty"` - Warnings map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError `json:"warnings,omitempty"` + Targeting map[string]string `json:"targeting"` + Debug *openrtb_ext.ExtResponseDebug `json:"debug,omitempty"` + Errors map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage `json:"errors,omitempty"` + Warnings map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage `json:"warnings,omitempty"` } // NewAmpEndpoint modifies the OpenRTB endpoint to handle AMP requests. This will basically modify the parsing @@ -239,9 +239,12 @@ func (deps *endpointDeps) AmpAuction(w http.ResponseWriter, r *http.Request, _ h ao.Errors = append(ao.Errors, fmt.Errorf("AMP response: failed to unpack OpenRTB response.ext, debug info cannot be forwarded: %v", eRErr)) } - warnings := make(map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError) + warnings := extResponse.Warnings + if warnings == nil { + warnings = make(map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage) + } for _, v := range errortypes.WarningOnly(errL) { - bidderErr := openrtb_ext.ExtBidderError{ + bidderErr := openrtb_ext.ExtBidderMessage{ Code: errortypes.ReadCode(v), Message: v.Error(), } @@ -528,8 +531,9 @@ func readPolicy(consent string) (privacy.PolicyWriter, error) { return ccpa.ConsentWriter{consent}, nil } - return privacy.NilPolicyWriter{}, &errortypes.InvalidPrivacyConsent{ - Message: fmt.Sprintf("Consent '%s' is not recognized as either CCPA or GDPR TCF.", consent), + return privacy.NilPolicyWriter{}, &errortypes.Warning{ + Message: fmt.Sprintf("Consent '%s' is not recognized as either CCPA or GDPR TCF.", consent), + WarningCode: errortypes.InvalidPrivacyConsentWarningCode, } } diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index 08461d40da3..77e76613c29 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -395,103 +395,119 @@ func TestCCPAConsent(t *testing.T) { } } -func TestNoConsent(t *testing.T) { - // Build Request - bid, err := getTestBidRequest(true, nil, true, nil) - if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) +func TestConsentWarnings(t *testing.T) { + type inputTest struct { + regs *openrtb_ext.ExtRegs + invalidConsentURL bool + expectedWarnings map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage } + invalidConsent := "invalid" - // Simulated Stored Request Backend - stored := map[string]json.RawMessage{"1": json.RawMessage(bid)} + bidderWarning := openrtb_ext.ExtBidderMessage{ + Code: 10003, + Message: "debug turned off for bidder", + } + invalidCCPAWarning := openrtb_ext.ExtBidderMessage{ + Code: 10001, + Message: "Consent '" + invalidConsent + "' is not recognized as either CCPA or GDPR TCF.", + } + invalidConsentWarning := openrtb_ext.ExtBidderMessage{ + Code: 10001, + Message: "CCPA consent is invalid and will be ignored. (request.regs.ext.us_privacy must contain 4 characters)", + } - // Build Exchange Endpoint - mockExchange := &mockAmpExchange{} - endpoint, _ := NewAmpEndpoint( - mockExchange, - newParamsValidator(t), - &mockAmpStoredReqFetcher{stored}, - empty_fetcher.EmptyFetcher{}, - &config.Configuration{MaxRequestSize: maxSize}, - newTestMetrics(), - analyticsConf.NewPBSAnalytics(&config.Analytics{}), - map[string]string{}, - []byte{}, - openrtb_ext.BuildBidderMap(), - ) + testData := []inputTest{ + { + regs: nil, + invalidConsentURL: false, + expectedWarnings: nil, + }, + { + regs: nil, + invalidConsentURL: true, + expectedWarnings: map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage{openrtb_ext.BidderReservedGeneral: {invalidCCPAWarning}}, + }, + { + regs: &openrtb_ext.ExtRegs{USPrivacy: "invalid"}, + invalidConsentURL: true, + expectedWarnings: map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage{ + openrtb_ext.BidderReservedGeneral: {invalidCCPAWarning, invalidConsentWarning}, + openrtb_ext.BidderName("appnexus"): {bidderWarning}, + }, + }, + { + regs: &openrtb_ext.ExtRegs{USPrivacy: "1NYN"}, + invalidConsentURL: false, + expectedWarnings: map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage{openrtb_ext.BidderName("appnexus"): {bidderWarning}}, + }, + } - // Invoke Endpoint - request := httptest.NewRequest("GET", "/openrtb2/auction/amp?tag_id=1", nil) - responseRecorder := httptest.NewRecorder() - endpoint(responseRecorder, request, nil) + for _, testCase := range testData { - // Parse Response - var response AmpResponse - if err := json.Unmarshal(responseRecorder.Body.Bytes(), &response); err != nil { - t.Fatalf("Error unmarshalling response: %s", err.Error()) - } + bid, err := getTestBidRequest(true, nil, testCase.regs == nil, testCase.regs) + if err != nil { + t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + } - // Assert Result - result := mockExchange.lastRequest - assert.NotNil(t, result, "lastRequest") - assert.Nil(t, result.User, "lastRequest.User") - assert.Nil(t, result.Regs, "lastRequest.Regs") - assert.Equal(t, expectedErrorsFromHoldAuction, response.Errors) - assert.Empty(t, response.Warnings) -} + // Simulated Stored Request Backend + stored := map[string]json.RawMessage{"1": json.RawMessage(bid)} -func TestInvalidConsent(t *testing.T) { - // Build Request - bid, err := getTestBidRequest(true, nil, true, nil) - if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) - } + // Build Exchange Endpoint + var mockExchange exchange.Exchange + if testCase.regs != nil { + mockExchange = &mockAmpExchangeWarnings{} + } else { + mockExchange = &mockAmpExchange{} + } + endpoint, _ := NewAmpEndpoint( + mockExchange, + newParamsValidator(t), + &mockAmpStoredReqFetcher{stored}, + empty_fetcher.EmptyFetcher{}, + &config.Configuration{MaxRequestSize: maxSize}, + newTestMetrics(), + analyticsConf.NewPBSAnalytics(&config.Analytics{}), + map[string]string{}, + []byte{}, + openrtb_ext.BuildBidderMap(), + ) - // Simulated Stored Request Backend - stored := map[string]json.RawMessage{"1": json.RawMessage(bid)} + // Invoke Endpoint + var request *http.Request - // Build Exchange Endpoint - mockExchange := &mockAmpExchange{} - endpoint, _ := NewAmpEndpoint( - mockExchange, - newParamsValidator(t), - &mockAmpStoredReqFetcher{stored}, - empty_fetcher.EmptyFetcher{}, - &config.Configuration{MaxRequestSize: maxSize}, - newTestMetrics(), - analyticsConf.NewPBSAnalytics(&config.Analytics{}), - map[string]string{}, - []byte{}, - openrtb_ext.BuildBidderMap(), - ) + if testCase.invalidConsentURL { + request = httptest.NewRequest("GET", "/openrtb2/auction/amp?tag_id=1&consent_string="+invalidConsent, nil) - // Invoke Endpoint - invalidConsent := "invalid" - request := httptest.NewRequest("GET", "/openrtb2/auction/amp?tag_id=1&consent_string="+invalidConsent, nil) - responseRecorder := httptest.NewRecorder() - endpoint(responseRecorder, request, nil) + } else { + request = httptest.NewRequest("GET", "/openrtb2/auction/amp?tag_id=1", nil) + } - // Parse Response - var response AmpResponse - if err := json.Unmarshal(responseRecorder.Body.Bytes(), &response); err != nil { - t.Fatalf("Error unmarshalling response: %s", err.Error()) - } + responseRecorder := httptest.NewRecorder() + endpoint(responseRecorder, request, nil) - // Assert Result - expectedWarnings := map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError{ - openrtb_ext.BidderReservedGeneral: { - { - Code: 10001, - Message: "Consent '" + invalidConsent + "' is not recognized as either CCPA or GDPR TCF.", - }, - }, + // Parse Response + var response AmpResponse + if err := json.Unmarshal(responseRecorder.Body.Bytes(), &response); err != nil { + t.Fatalf("Error unmarshalling response: %s", err.Error()) + } + + // Assert Result + if testCase.regs == nil { + result := mockExchange.(*mockAmpExchange).lastRequest + assert.NotNil(t, result, "lastRequest") + assert.Nil(t, result.User, "lastRequest.User") + assert.Nil(t, result.Regs, "lastRequest.Regs") + assert.Equal(t, expectedErrorsFromHoldAuction, response.Errors) + if testCase.invalidConsentURL { + assert.Equal(t, testCase.expectedWarnings, response.Warnings) + } else { + assert.Empty(t, response.Warnings) + } + + } else { + assert.Equal(t, testCase.expectedWarnings, response.Warnings) + } } - result := mockExchange.lastRequest - assert.NotNil(t, result, "lastRequest") - assert.Nil(t, result.User, "lastRequest.User") - assert.Nil(t, result.Regs, "lastRequest.Regs") - assert.Equal(t, expectedErrorsFromHoldAuction, response.Errors) - assert.Equal(t, expectedWarnings, response.Warnings) } func TestNewAndLegacyConsentBothProvided(t *testing.T) { @@ -929,7 +945,7 @@ type mockAmpExchange struct { lastRequest *openrtb.BidRequest } -var expectedErrorsFromHoldAuction map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError = map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError{ +var expectedErrorsFromHoldAuction map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage = map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage{ openrtb_ext.BidderName("openx"): { { Code: 1, @@ -962,6 +978,21 @@ func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq return response, nil } +type mockAmpExchangeWarnings struct{} + +func (m *mockAmpExchangeWarnings) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { + response := &openrtb.BidResponse{ + SeatBid: []openrtb.SeatBid{{ + Bid: []openrtb.Bid{{ + AdM: "", + Ext: json.RawMessage(`{ "prebid": {"targeting": { "hb_pb": "1.20", "hb_appnexus_pb": "1.20", "hb_cache_id": "some_id"}}}`), + }}, + }}, + Ext: json.RawMessage(`{ "warnings": {"appnexus": [{"code": 10003, "message": "debug turned off for bidder"}] }}`), + } + return response, nil +} + func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, regsExt *openrtb_ext.ExtRegs) ([]byte, error) { var width uint64 = 300 var height uint64 = 300 @@ -1025,7 +1056,6 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, Ext: regsExtData, } } - return json.Marshal(bidRequest) } diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index 35230315763..d26623da348 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -139,6 +139,7 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http if errortypes.ContainsFatalError(errL) && writeError(errL, w, &labels) { return } + warnings := errortypes.WarningOnly(errL) ctx := context.Background() @@ -179,6 +180,7 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http RequestType: labels.RType, StartTime: start, LegacyLabels: labels, + Warnings: warnings, } response, err := deps.ex.HoldAuction(ctx, auctionRequest, nil) @@ -363,8 +365,10 @@ func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error { if ccpaPolicy, err := ccpa.ReadFromRequest(req); err != nil { return append(errL, err) } else if _, err := ccpaPolicy.Parse(exchange.GetValidBidders(aliases)); err != nil { - if _, invalidConsent := err.(*errortypes.InvalidPrivacyConsent); invalidConsent { - errL = append(errL, &errortypes.InvalidPrivacyConsent{Message: fmt.Sprintf("CCPA consent is invalid and will be ignored. (%v)", err)}) + if _, invalidConsent := err.(*errortypes.Warning); invalidConsent { + errL = append(errL, &errortypes.Warning{ + Message: fmt.Sprintf("CCPA consent is invalid and will be ignored. (%v)", err), + WarningCode: errortypes.InvalidPrivacyConsentWarningCode}) consentWriter := ccpa.ConsentWriter{Consent: ""} if err := consentWriter.Write(req); err != nil { return append(errL, fmt.Errorf("Unable to remove invalid CCPA consent from the request. (%v)", err)) diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index 892b0579ec4..19c58f05ae0 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -1505,7 +1505,9 @@ func TestCCPAInvalid(t *testing.T) { errL := deps.validateRequest(&req) - expectedWarning := errortypes.InvalidPrivacyConsent{Message: "CCPA consent is invalid and will be ignored. (request.regs.ext.us_privacy must contain 4 characters)"} + expectedWarning := errortypes.Warning{ + Message: "CCPA consent is invalid and will be ignored. (request.regs.ext.us_privacy must contain 4 characters)", + WarningCode: errortypes.InvalidPrivacyConsentWarningCode} assert.ElementsMatch(t, errL, []error{&expectedWarning}) assert.Empty(t, req.Regs.Ext, "Invalid Consent Removed From Request") @@ -2104,6 +2106,55 @@ func TestIOS14EndToEnd(t *testing.T) { assert.Equal(t, &lmtOne, result.Device.Lmt) } +func TestAuctionWarnings(t *testing.T) { + reqBody := validRequest(t, "us-privacy-invalid.json") + deps := &endpointDeps{ + &warningsCheckExchange{}, + newParamsValidator(t), + &mockStoredReqFetcher{}, + empty_fetcher.EmptyFetcher{}, + empty_fetcher.EmptyFetcher{}, + &config.Configuration{MaxRequestSize: int64(len(reqBody))}, + newTestMetrics(), + analyticsConf.NewPBSAnalytics(&config.Analytics{}), + map[string]string{}, + false, + []byte{}, + openrtb_ext.BuildBidderMap(), + nil, + nil, + hardcodedResponseIPValidator{response: true}, + } + + req := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(reqBody)) + recorder := httptest.NewRecorder() + + deps.Auction(recorder, req, nil) + + if recorder.Code != http.StatusOK { + t.Errorf("Endpoint should return a 200") + } + warnings := deps.ex.(*warningsCheckExchange).auctionRequest.Warnings + if !assert.Len(t, warnings, 1, "One warning should be returned from exchange") { + t.FailNow() + } + actualWarning := warnings[0].(*errortypes.Warning) + expectedMessage := "CCPA consent is invalid and will be ignored. (request.regs.ext.us_privacy must contain 4 characters)" + assert.Equal(t, expectedMessage, actualWarning.Message, "Warning message is incorrect") + + assert.Equal(t, errortypes.InvalidPrivacyConsentWarningCode, actualWarning.WarningCode, "Warning code is incorrect") +} + +// warningsCheckExchange is a well-behaved exchange which stores all incoming warnings. +type warningsCheckExchange struct { + auctionRequest exchange.AuctionRequest +} + +func (e *warningsCheckExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { + e.auctionRequest = r + return nil, nil +} + // nobidExchange is a well-behaved exchange which always bids "no bid". type nobidExchange struct { gotRequest *openrtb.BidRequest diff --git a/endpoints/openrtb2/sample-requests/valid-whole/supplementary/us-privacy-invalid.json b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/us-privacy-invalid.json new file mode 100644 index 00000000000..2ccdfb7ccdc --- /dev/null +++ b/endpoints/openrtb2/sample-requests/valid-whole/supplementary/us-privacy-invalid.json @@ -0,0 +1,52 @@ +{ + "description": "Well formed amp request with invalid CCPA consent value", + "mockBidRequest": { + "id": "b9c97a4b-cbc4-483d-b2c4-58a19ed5cfc5", + "site": { + "page": "prebid.org", + "publisher": { + "id": "a3de7af2-a86a-4043-a77b-c7e86744155e" + } + }, + "source": { + "tid": "b9c97a4b-cbc4-483d-b2c4-58a19ed5cfc5" + }, + "tmax": 1000, + "imp": [ + { + "id": "/19968336/header-bid-tag-0", + "ext": { + "appnexus": { + "placementId": 12883451 + } + }, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 300 + } + ] + } + } + ], + "regs": { + "ext": { + "us_privacy": "{invalid}" + } + }, + "user": { + "ext": {} + } + }, + "expectedBidResponse": { + "id":"b9c97a4b-cbc4-483d-b2c4-58a19ed5cfc5", + "bidid":"test bid id", + "nbr":0 + }, + "expectedReturnCode": 200 +} diff --git a/errortypes/code.go b/errortypes/code.go index 80a5eb45542..2749b978006 100644 --- a/errortypes/code.go +++ b/errortypes/code.go @@ -17,6 +17,8 @@ const ( const ( UnknownWarningCode = 10999 InvalidPrivacyConsentWarningCode = iota + 10000 + AccountLevelDebugDisabledWarningCode + BidderLevelDebugDisabledWarningCode ) // Coder provides an error or warning code with severity. diff --git a/errortypes/errortypes.go b/errortypes/errortypes.go index c953f9b7e08..1fed2d7da6e 100644 --- a/errortypes/errortypes.go +++ b/errortypes/errortypes.go @@ -167,7 +167,8 @@ func (err *BidderTemporarilyDisabled) Severity() Severity { // Warning is a generic non-fatal error. type Warning struct { - Message string + Message string + WarningCode int } func (err *Warning) Error() string { @@ -175,26 +176,9 @@ func (err *Warning) Error() string { } func (err *Warning) Code() int { - return UnknownWarningCode + return err.WarningCode } func (err *Warning) Severity() Severity { return SeverityWarning } - -// InvalidPrivacyConsent is a warning for when the privacy consent string is invalid and is ignored. -type InvalidPrivacyConsent struct { - Message string -} - -func (err *InvalidPrivacyConsent) Error() string { - return err.Message -} - -func (err *InvalidPrivacyConsent) Code() int { - return InvalidPrivacyConsentWarningCode -} - -func (err *InvalidPrivacyConsent) Severity() Severity { - return SeverityWarning -} diff --git a/exchange/bidder.go b/exchange/bidder.go index 6df5fafb5f6..b0818dfdbe3 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -164,9 +164,17 @@ func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb.Bi // - debugContextKey (url param) in true // - account debug is allowed // - bidder debug is allowed - if accountDebugAllowed && bidder.config.DebugInfo.Allow { - if debugInfo := ctx.Value(DebugContextKey); debugInfo != nil && debugInfo.(bool) { - seatBid.httpCalls = append(seatBid.httpCalls, makeExt(httpInfo)) + if debugInfo := ctx.Value(DebugContextKey); debugInfo != nil && debugInfo.(bool) { + if accountDebugAllowed { + if bidder.config.DebugInfo.Allow { + seatBid.httpCalls = append(seatBid.httpCalls, makeExt(httpInfo)) + } else { + debugDisabledWarning := errortypes.Warning{ + WarningCode: errortypes.BidderLevelDebugDisabledWarningCode, + Message: "debug turned off for bidder", + } + errs = append(errs, &debugDisabledWarning) + } } } diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index dbf8a022255..e4eb7b9574e 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -20,6 +20,7 @@ import ( "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/metrics" metricsConfig "github.com/prebid/prebid-server/metrics/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -109,9 +110,13 @@ func TestSingleBidder(t *testing.T) { } // Make sure the returned values are what we expect - if len(errs) != 0 { + if len(errortypes.FatalOnly(errs)) != 0 { t.Errorf("bidder.Bid returned %d errors. Expected 0", len(errs)) } + + if !test.debugInfo.Allow && len(errortypes.WarningOnly(errs)) != 1 { + t.Errorf("bidder.Bid returned %d warnings. Expected 1", len(errs)) + } if len(seatBid.bids) != len(mockBidderResponse.Bids) { t.Fatalf("Expected %d bids. Got %d", len(mockBidderResponse.Bids), len(seatBid.bids)) } diff --git a/exchange/exchange.go b/exchange/exchange.go index 45081c16e71..d8ac60ba46a 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -66,7 +66,8 @@ type exchange struct { // Container to pass out response ext data from the GetAllBids goroutines back into the main thread type seatResponseExtra struct { ResponseTimeMillis int - Errors []openrtb_ext.ExtBidderError + Errors []openrtb_ext.ExtBidderMessage + Warnings []openrtb_ext.ExtBidderMessage // httpCalls is the list of debugging info. It should only be populated if the request.test == 1. // This will become response.ext.debug.httpcalls.{bidder} on the final Response. HttpCalls []*openrtb_ext.ExtHttpCall @@ -106,6 +107,7 @@ type AuctionRequest struct { UserSyncs IdFetcher RequestType metrics.RequestType StartTime time.Time + Warnings []error // LegacyLabels is included here for temporary compatability with cleanOpenRTBRequests // in HoldAuction until we get to factoring it away. Do not use for anything new. @@ -138,9 +140,9 @@ func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog * debugLog = &DebugLog{Enabled: false} } - debugInfo := getDebugInfo(r.BidRequest, requestExt) + requestDebugInfo := getDebugInfo(r.BidRequest, requestExt) - debugInfo = debugInfo && r.Account.DebugAllow + debugInfo := requestDebugInfo && r.Account.DebugAllow debugLog.Enabled = debugLog.Enabled && r.Account.DebugAllow if debugInfo { @@ -236,6 +238,22 @@ func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog * } } + if !r.Account.DebugAllow && requestDebugInfo { + accountDebugDisabledWarning := openrtb_ext.ExtBidderMessage{ + Code: errortypes.AccountLevelDebugDisabledWarningCode, + Message: "debug turned off for account", + } + bidResponseExt.Warnings[openrtb_ext.BidderReservedGeneral] = append(bidResponseExt.Warnings[openrtb_ext.BidderReservedGeneral], accountDebugDisabledWarning) + } + + for _, warning := range r.Warnings { + generalWarning := openrtb_ext.ExtBidderMessage{ + Code: errortypes.ReadCode(warning), + Message: warning.Error(), + } + bidResponseExt.Warnings[openrtb_ext.BidderReservedGeneral] = append(bidResponseExt.Warnings[openrtb_ext.BidderReservedGeneral], generalWarning) + } + // Build the response return e.buildBidResponse(ctx, liveAdapters, adapterBids, r.BidRequest, adapterExtra, auc, bidResponseExt, cacheInstructions.returnCreative, errs) } @@ -397,11 +415,11 @@ func (e *exchange) getAllBids( // Timing statistics e.me.RecordAdapterTime(bidderRequest.BidderLabels, time.Since(start)) - serr := errsToBidderErrors(err) bidderRequest.BidderLabels.AdapterBids = bidsToMetric(brw.adapterBids) bidderRequest.BidderLabels.AdapterErrors = errorsToMetric(err) // Append any bid validation errors to the error list - ae.Errors = serr + ae.Errors = errsToBidderErrors(err) + ae.Warnings = errsToBidderWarnings(err) brw.adapterExtra = ae if bids != nil { for _, bid := range bids.bids { @@ -494,13 +512,29 @@ func errorsToMetric(errs []error) map[metrics.AdapterError]struct{} { return ret } -func errsToBidderErrors(errs []error) []openrtb_ext.ExtBidderError { - serr := make([]openrtb_ext.ExtBidderError, len(errs)) - for i := 0; i < len(errs); i++ { - serr[i].Code = errortypes.ReadCode(errs[i]) - serr[i].Message = errs[i].Error() +func errsToBidderErrors(errs []error) []openrtb_ext.ExtBidderMessage { + sErr := make([]openrtb_ext.ExtBidderMessage, 0) + for _, err := range errortypes.FatalOnly(errs) { + newErr := openrtb_ext.ExtBidderMessage{ + Code: errortypes.ReadCode(err), + Message: err.Error(), + } + sErr = append(sErr, newErr) } - return serr + + return sErr +} + +func errsToBidderWarnings(errs []error) []openrtb_ext.ExtBidderMessage { + sWarn := make([]openrtb_ext.ExtBidderMessage, 0) + for _, warn := range errortypes.WarningOnly(errs) { + newErr := openrtb_ext.ExtBidderMessage{ + Code: errortypes.ReadCode(warn), + Message: warn.Error(), + } + sWarn = append(sWarn, newErr) + } + return sWarn } // This piece takes all the bids supplied by the adapters and crafts an openRTB response to send back to the requester @@ -749,7 +783,8 @@ func getPrimaryAdServer(adServerId int) (string, error) { func (e *exchange) makeExtBidResponse(adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, r AuctionRequest, debugInfo bool, errList []error) *openrtb_ext.ExtBidResponse { req := r.BidRequest bidResponseExt := &openrtb_ext.ExtBidResponse{ - Errors: make(map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError, len(adapterBids)), + Errors: make(map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage, len(adapterBids)), + Warnings: make(map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage, len(adapterBids)), ResponseTimeMillis: make(map[openrtb_ext.BidderName]int, len(adapterBids)), RequestTimeoutMillis: req.TMax, } @@ -771,6 +806,9 @@ func (e *exchange) makeExtBidResponse(adapterBids map[openrtb_ext.BidderName]*pb if debugInfo && len(responseExtra.HttpCalls) > 0 { bidResponseExt.Debug.HttpCalls[bidderName] = responseExtra.HttpCalls } + if len(responseExtra.Warnings) > 0 { + bidResponseExt.Warnings[bidderName] = responseExtra.Warnings + } // Only make an entry for bidder errors if the bidder reported any. if len(responseExtra.Errors) > 0 { bidResponseExt.Errors[bidderName] = responseExtra.Errors diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index f615d412c71..3eaa625f74f 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/prebid/prebid-server/errortypes" "io/ioutil" "net/http" "net/http/httptest" @@ -141,7 +142,7 @@ func TestCharacterEscape(t *testing.T) { adapterExtra := make(map[openrtb_ext.BidderName]*seatResponseExtra, 1) adapterExtra["appnexus"] = &seatResponseExtra{ ResponseTimeMillis: 5, - Errors: []openrtb_ext.ExtBidderError{{Code: 999, Message: "Post ib.adnxs.com/openrtb2?query1&query2: unsupported protocol scheme \"\""}}, + Errors: []openrtb_ext.ExtBidderMessage{{Code: 999, Message: "Post ib.adnxs.com/openrtb2?query1&query2: unsupported protocol scheme \"\""}}, } var errList []error @@ -180,59 +181,68 @@ func TestDebugBehaviour(t *testing.T) { } type aTest struct { - desc string - in inTest - out outTest - debugData debugData + desc string + in inTest + out outTest + debugData debugData + generateWarnings bool } testCases := []aTest{ { - desc: "test flag equals zero, ext debug flag false, no debug info expected", - in: inTest{test: 0, debug: false}, - out: outTest{debugInfoIncluded: false}, - debugData: debugData{true, true}, + desc: "test flag equals zero, ext debug flag false, no debug info expected", + in: inTest{test: 0, debug: false}, + out: outTest{debugInfoIncluded: false}, + debugData: debugData{true, true}, + generateWarnings: false, }, { - desc: "test flag equals zero, ext debug flag true, debug info expected", - in: inTest{test: 0, debug: true}, - out: outTest{debugInfoIncluded: true}, - debugData: debugData{true, true}, + desc: "test flag equals zero, ext debug flag true, debug info expected", + in: inTest{test: 0, debug: true}, + out: outTest{debugInfoIncluded: true}, + debugData: debugData{true, true}, + generateWarnings: false, }, { - desc: "test flag equals 1, ext debug flag false, debug info expected", - in: inTest{test: 1, debug: false}, - out: outTest{debugInfoIncluded: true}, - debugData: debugData{true, true}, + desc: "test flag equals 1, ext debug flag false, debug info expected", + in: inTest{test: 1, debug: false}, + out: outTest{debugInfoIncluded: true}, + debugData: debugData{true, true}, + generateWarnings: false, }, { - desc: "test flag equals 1, ext debug flag true, debug info expected", - in: inTest{test: 1, debug: true}, - out: outTest{debugInfoIncluded: true}, - debugData: debugData{true, true}, + desc: "test flag equals 1, ext debug flag true, debug info expected", + in: inTest{test: 1, debug: true}, + out: outTest{debugInfoIncluded: true}, + debugData: debugData{true, true}, + generateWarnings: false, }, { - desc: "test flag not equal to 0 nor 1, ext debug flag false, no debug info expected", - in: inTest{test: 2, debug: false}, - out: outTest{debugInfoIncluded: false}, - debugData: debugData{true, true}, + desc: "test flag not equal to 0 nor 1, ext debug flag false, no debug info expected", + in: inTest{test: 2, debug: false}, + out: outTest{debugInfoIncluded: false}, + debugData: debugData{true, true}, + generateWarnings: false, }, { - desc: "test flag not equal to 0 nor 1, ext debug flag true, debug info expected", - in: inTest{test: -1, debug: true}, - out: outTest{debugInfoIncluded: true}, - debugData: debugData{true, true}, + desc: "test flag not equal to 0 nor 1, ext debug flag true, debug info expected", + in: inTest{test: -1, debug: true}, + out: outTest{debugInfoIncluded: true}, + debugData: debugData{true, true}, + generateWarnings: true, }, { - desc: "test account level debug disabled", - in: inTest{test: -1, debug: true}, - out: outTest{debugInfoIncluded: false}, - debugData: debugData{true, false}, + desc: "test account level debug disabled", + in: inTest{test: -1, debug: true}, + out: outTest{debugInfoIncluded: false}, + debugData: debugData{true, false}, + generateWarnings: true, }, { - desc: "test bidder level debug disabled", - in: inTest{test: -1, debug: true}, - out: outTest{debugInfoIncluded: false}, - debugData: debugData{false, true}, + desc: "test bidder level debug disabled", + in: inTest{test: -1, debug: true}, + out: outTest{debugInfoIncluded: false}, + debugData: debugData{false, true}, + generateWarnings: true, }, } @@ -243,9 +253,9 @@ func TestDebugBehaviour(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(noBidServer)) defer server.Close() - categoriesFetcher, error := newCategoryFetcher("./test/category-mapping") - if error != nil { - t.Errorf("Failed to create a category Fetcher: %v", error) + categoriesFetcher, err := newCategoryFetcher("./test/category-mapping") + if err != nil { + t.Errorf("Failed to create a category Fetcher: %v", err) } bidRequest := &openrtb.BidRequest{ @@ -305,6 +315,13 @@ func TestDebugBehaviour(t *testing.T) { UserSyncs: &emptyUsersync{}, StartTime: time.Now(), } + if test.generateWarnings { + var errL []error + errL = append(errL, &errortypes.Warning{ + Message: fmt.Sprintf("CCPA consent test warning."), + WarningCode: errortypes.InvalidPrivacyConsentWarningCode}) + auctionRequest.Warnings = errL + } // Run test outBidResponse, err := e.HoldAuction(ctx, auctionRequest, nil) @@ -339,6 +356,35 @@ func TestDebugBehaviour(t *testing.T) { } else { assert.Nil(t, actualExt.Debug, "%s. ext.debug.httpcalls array should not be empty", "With bidder level debug disable option http calls should be empty") } + + if test.out.debugInfoIncluded && !test.debugData.accountLevelDebugAllowed { + assert.Len(t, actualExt.Warnings, 1, "warnings should have one warning") + assert.NotNil(t, actualExt.Warnings["general"], "general warning should be present") + assert.Equal(t, "debug turned off for account", actualExt.Warnings["general"][0].Message, "account debug disabled message should be present") + } + + if !test.out.debugInfoIncluded && test.in.debug && test.debugData.accountLevelDebugAllowed { + if test.generateWarnings { + assert.Len(t, actualExt.Warnings, 2, "warnings should have one warning") + } else { + assert.Len(t, actualExt.Warnings, 1, "warnings should have one warning") + } + assert.NotNil(t, actualExt.Warnings["appnexus"], "bidder warning should be present") + assert.Equal(t, "debug turned off for bidder", actualExt.Warnings["appnexus"][0].Message, "account debug disabled message should be present") + } + + if test.generateWarnings { + assert.NotNil(t, actualExt.Warnings["general"], "general warning should be present") + CCPAWarningPresent := false + for _, warn := range actualExt.Warnings["general"] { + if warn.Code == errortypes.InvalidPrivacyConsentWarningCode { + CCPAWarningPresent = true + break + } + } + assert.True(t, CCPAWarningPresent, "CCPA Warning should be present") + } + } } @@ -393,7 +439,7 @@ func TestTwoBiddersDebugDisabledAndEnabled(t *testing.T) { e.currencyConverter = currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) e.categoriesFetcher = categoriesFetcher - debugLog := DebugLog{} + debugLog := DebugLog{Enabled: true} for _, testCase := range testCases { bidRequest := &openrtb.BidRequest{ @@ -762,7 +808,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { adapterExtra := map[openrtb_ext.BidderName]*seatResponseExtra{ bidderName: { ResponseTimeMillis: 5, - Errors: []openrtb_ext.ExtBidderError{ + Errors: []openrtb_ext.ExtBidderMessage{ { Code: 999, Message: "Post ib.adnxs.com/openrtb2?query1&query2: unsupported protocol scheme \"\"", diff --git a/exchange/utils_test.go b/exchange/utils_test.go index f089d70523b..1945aee1b98 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -637,7 +637,10 @@ func TestCleanOpenRTBRequestsCCPAErrors(t *testing.T) { description: "Invalid Consent", reqExt: json.RawMessage(`{"prebid":{"nosale":["*"]}}`), reqRegsExt: json.RawMessage(`{"us_privacy":"malformed"}`), - expectError: &errortypes.InvalidPrivacyConsent{"request.regs.ext.us_privacy must contain 4 characters"}, + expectError: &errortypes.Warning{ + Message: "request.regs.ext.us_privacy must contain 4 characters", + WarningCode: errortypes.InvalidPrivacyConsentWarningCode, + }, }, { description: "Invalid No Sale Bidders", diff --git a/openrtb_ext/response.go b/openrtb_ext/response.go index 02370d19376..d517704f44d 100644 --- a/openrtb_ext/response.go +++ b/openrtb_ext/response.go @@ -8,7 +8,8 @@ import ( type ExtBidResponse struct { Debug *ExtResponseDebug `json:"debug,omitempty"` // Errors defines the contract for bidresponse.ext.errors - Errors map[BidderName][]ExtBidderError `json:"errors,omitempty"` + Errors map[BidderName][]ExtBidderMessage `json:"errors,omitempty"` + Warnings map[BidderName][]ExtBidderMessage `json:"warnings,omitempty"` // ResponseTimeMillis defines the contract for bidresponse.ext.responsetimemillis ResponseTimeMillis map[BidderName]int `json:"responsetimemillis,omitempty"` // RequestTimeoutMillis returns the timeout used in the auction. @@ -47,8 +48,8 @@ type ExtUserSync struct { Type UserSyncType `json:"type"` } -// ExtBidderError defines an error object to be returned, consiting of a machine readable error code, and a human readable error message string. -type ExtBidderError struct { +// ExtBidderMessage defines an error object to be returned, consiting of a machine readable error code, and a human readable error message string. +type ExtBidderMessage struct { Code int `json:"code"` Message string `json:"message"` } diff --git a/privacy/ccpa/parsedpolicy.go b/privacy/ccpa/parsedpolicy.go index 3c934e67822..7b9c2d1fa7c 100644 --- a/privacy/ccpa/parsedpolicy.go +++ b/privacy/ccpa/parsedpolicy.go @@ -43,7 +43,10 @@ func (p Policy) Parse(validBidders map[string]struct{}) (ParsedPolicy, error) { consentOptOut, err := parseConsent(p.Consent) if err != nil { msg := fmt.Sprintf("request.regs.ext.us_privacy %s", err.Error()) - return ParsedPolicy{}, &errortypes.InvalidPrivacyConsent{Message: msg} + return ParsedPolicy{}, &errortypes.Warning{ + Message: msg, + WarningCode: errortypes.InvalidPrivacyConsentWarningCode, + } } noSaleForAllBidders, noSaleSpecificBidders, err := parseNoSaleBidders(p.NoSaleBidders, validBidders) From c675c188374754129c3bf133303b35507fcc3b4c Mon Sep 17 00:00:00 2001 From: Serhii Nahornyi Date: Fri, 19 Mar 2021 23:47:51 +0200 Subject: [PATCH 36/91] Rubicon: Support sending segments to XAPI (#1752) Co-authored-by: Serhii Nahornyi --- adapters/rubicon/rubicon.go | 46 ++++++++ .../rubicontest/exemplary/simple-video.json | 109 +++++++++++++++++- 2 files changed, 152 insertions(+), 3 deletions(-) diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index 91211a61d4e..32bf971cb6b 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -93,6 +93,10 @@ type rubiconExtUserTpID struct { UID string `json:"uid"` } +type rubiconUserDataExt struct { + TaxonomyName string `json:"taxonomyname"` +} + type rubiconUserExt struct { Consent string `json:"consent,omitempty"` DigiTrust *openrtb_ext.ExtUserDigiTrust `json:"digitrust"` @@ -752,6 +756,11 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap userCopy := *request.User userExtRP := rubiconUserExt{RP: rubiconUserExtRP{Target: rubiconExt.Visitor}} + if err := updateUserExtWithIabAttribute(&userExtRP, userCopy.Data); err != nil { + errs = append(errs, err) + continue + } + if request.User.Ext != nil { var userExt *openrtb_ext.ExtUser if err = json.Unmarshal(userCopy.Ext, &userExt); err != nil { @@ -886,6 +895,43 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return requestData, errs } +func updateUserExtWithIabAttribute(userExtRP *rubiconUserExt, data []openrtb.Data) error { + var segmentIdsToCopy = make([]string, 0) + + for _, dataRecord := range data { + if dataRecord.Ext != nil { + var dataExtObject rubiconUserDataExt + err := json.Unmarshal(dataRecord.Ext, &dataExtObject) + if err != nil { + continue + } + if strings.EqualFold(dataExtObject.TaxonomyName, "iab") { + for _, segment := range dataRecord.Segment { + segmentIdsToCopy = append(segmentIdsToCopy, segment.ID) + } + } + } + } + + userExtRPTarget := make(map[string]interface{}) + + if userExtRP.RP.Target != nil { + if err := json.Unmarshal(userExtRP.RP.Target, &userExtRPTarget); err != nil { + return &errortypes.BadInput{Message: err.Error()} + } + } + + userExtRPTarget["iab"] = segmentIdsToCopy + + if target, err := json.Marshal(&userExtRPTarget); err != nil { + return &errortypes.BadInput{Message: err.Error()} + } else { + userExtRP.RP.Target = target + } + + return nil +} + func getTpIdsAndSegments(eids []openrtb_ext.ExtUserEid) (mappedRubiconUidsParam, []error) { rubiconUidsParam := mappedRubiconUidsParam{ tpIds: make([]rubiconExtUserTpID, 0), diff --git a/adapters/rubicon/rubicontest/exemplary/simple-video.json b/adapters/rubicon/rubicontest/exemplary/simple-video.json index 76c64ff95ec..b85c28def44 100644 --- a/adapters/rubicon/rubicontest/exemplary/simple-video.json +++ b/adapters/rubicon/rubicontest/exemplary/simple-video.json @@ -9,6 +9,52 @@ "id": "1", "bundle": "com.wls.testwlsapplication" }, + "user": { + "data": [ + { + "ext": { + "taxonomyname": "iab" + }, + "segment": [ + { + "id": "idToCopy" + } + ] + }, + { + "ext": { + "taxonomyname": "someValue" + }, + "segment": [ + { + "id": "shouldNotBeCopied" + } + ] + }, + { + "ext": { + "taxonomyname": "IaB" + }, + "segment": [ + { + "id": "idToCopy2" + } + ] + }, + { + "ext": { + "taxonomyname": [ + "wrong iab type" + ] + }, + "segment": [ + { + "id": "shouldNotBeCopied2" + } + ] + } + ] + }, "imp": [ { "id": "test-imp-id", @@ -30,8 +76,8 @@ "video": { }, "accountId": 1001, - "siteId":113932, - "zoneId":535510 + "siteId": 113932, + "zoneId": 535510 } } } @@ -52,6 +98,63 @@ "ip": "123.123.123.123", "ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx" }, + "user": { + "data": [ + { + "ext": { + "taxonomyname": "iab" + }, + "segment": [ + { + "id": "idToCopy" + } + ] + }, + { + "ext": { + "taxonomyname": "someValue" + }, + "segment": [ + { + "id": "shouldNotBeCopied" + } + ] + }, + { + "ext": { + "taxonomyname": "IaB" + }, + "segment": [ + { + "id": "idToCopy2" + } + ] + }, + { + "ext": { + "taxonomyname": [ + "wrong iab type" + ] + }, + "segment": [ + { + "id": "shouldNotBeCopied2" + } + ] + } + ], + "ext": { + "digitrust": null, + "rp": { + "target": { + "iab": [ + "idToCopy", + "idToCopy2" + ] + } + } + } + }, "app": { "id": "1", "ext": { @@ -91,7 +194,7 @@ }, "ext": { "rp": { - "track":{ + "track": { "mint": "", "mint_version": "" }, From ca53bd59e7399251518f692cbc7c00a987dc83d4 Mon Sep 17 00:00:00 2001 From: guscarreon Date: Mon, 22 Mar 2021 07:51:40 -0400 Subject: [PATCH 37/91] validateNativeContextTypes function test cases (#1743) --- ...ext-type-content-incompatible-subtype.json | 25 +++++++++++ ...ext-type-product-incompatible-subtype.json | 27 ++++++++++++ ...text-type-social-incompatible-subtype.json | 27 ++++++++++++ .../contextsubtype-greater-than-max.json | 26 ++++++++++++ .../contextsubtype-invalid.json | 4 +- .../context-product-compatible-subtype.json | 41 +++++++++++++++++++ .../context-social-compatible-subtype.json | 41 +++++++++++++++++++ 7 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 endpoints/openrtb2/sample-requests/invalid-native/context-type-content-incompatible-subtype.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-native/context-type-product-incompatible-subtype.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-native/context-type-social-incompatible-subtype.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-greater-than-max.json create mode 100644 endpoints/openrtb2/sample-requests/valid-native/context-product-compatible-subtype.json create mode 100644 endpoints/openrtb2/sample-requests/valid-native/context-social-compatible-subtype.json diff --git a/endpoints/openrtb2/sample-requests/invalid-native/context-type-content-incompatible-subtype.json b/endpoints/openrtb2/sample-requests/invalid-native/context-type-content-incompatible-subtype.json new file mode 100644 index 00000000000..4297aa7596b --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-native/context-type-content-incompatible-subtype.json @@ -0,0 +1,25 @@ +{ + "description": "Native bid request. Context type content (1) is incompatible with 'social' subcontext types (20~29). Return error", + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "some.page.com" + }, + "tmax": 500, + "imp": [ + { + "id": "some-imp", + "native": { + "request": "{\"context\":1,\"contextsubtype\":21,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + } + ] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request" +} diff --git a/endpoints/openrtb2/sample-requests/invalid-native/context-type-product-incompatible-subtype.json b/endpoints/openrtb2/sample-requests/invalid-native/context-type-product-incompatible-subtype.json new file mode 100644 index 00000000000..3193833658b --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-native/context-type-product-incompatible-subtype.json @@ -0,0 +1,27 @@ +{ + "description": "Native bid request. Context type product (3) is incompatible with 'social' subcontext types (10~19). Return error", + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "some.page.com" + }, + "tmax": 500, + "imp": [ + { + "id": "some-imp", + "native": { + "request": "{\"context\":3,\"contextsubtype\":11,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + } + ] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request" +} + + diff --git a/endpoints/openrtb2/sample-requests/invalid-native/context-type-social-incompatible-subtype.json b/endpoints/openrtb2/sample-requests/invalid-native/context-type-social-incompatible-subtype.json new file mode 100644 index 00000000000..4ecbf4498fb --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-native/context-type-social-incompatible-subtype.json @@ -0,0 +1,27 @@ +{ + "description": "Native bid request. Context type social (2) is incompatible with 'product' subcontext types (30~39). Return error", + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "some.page.com" + }, + "tmax": 500, + "imp": [ + { + "id": "some-imp", + "native": { + "request": "{\"context\":2,\"contextsubtype\":31,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + } + ] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request" +} + + diff --git a/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-greater-than-max.json b/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-greater-than-max.json new file mode 100644 index 00000000000..9b422380edf --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-greater-than-max.json @@ -0,0 +1,26 @@ +{ + "description": "Native bid request comes with a subcontext type greater than 500. Return error", + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "some.page.com" + }, + "tmax": 500, + "imp": [ + { + "id": "some-imp", + "native": { + "request": "{\"context\":1,\"contextsubtype\":550,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + } + ] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request" +} + diff --git a/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-invalid.json b/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-invalid.json index 395e7034b0c..cdf4ef0c075 100644 --- a/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-invalid.json +++ b/endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-invalid.json @@ -1,5 +1,5 @@ { - "description": "Bid request with invalid contextsubtype value inside the native.request field in its only imp element", + "description": "Native bid request comes with a contextsubtype greater than 32, 'ContextSubTypeProductReview'", "mockBidRequest": { "id": "req-id", "site": { @@ -10,7 +10,7 @@ { "id": "some-imp", "native": { - "request": "{\"context\":1,\"contextsubtype\":21,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + "request": "{\"context\":1,\"contextsubtype\":41,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" }, "ext": { "appnexus": { diff --git a/endpoints/openrtb2/sample-requests/valid-native/context-product-compatible-subtype.json b/endpoints/openrtb2/sample-requests/valid-native/context-product-compatible-subtype.json new file mode 100644 index 00000000000..dbf7b9c5e0d --- /dev/null +++ b/endpoints/openrtb2/sample-requests/valid-native/context-product-compatible-subtype.json @@ -0,0 +1,41 @@ +{ + "description": "Native bid request comes with a context type product (3) and compatible subcontext type", + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "some.page.com" + }, + "tmax": 500, + "imp": [ + { + "id": "some-imp", + "native": { + "request": "{\"context\":3,\"contextsubtype\":31,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + } + ] + }, + "expectedBidResponse": { + "id": "req-id", + "bidid": "test bid id", + "nbr": 0, + "seatbid": [ + { + "bid": [ + { + "id": "appnexus-bid", + "impid": "", + "price": 0 + } + ], + "seat": "appnexus-bids" + } + ] + }, + "expectedReturnCode": 200 +} diff --git a/endpoints/openrtb2/sample-requests/valid-native/context-social-compatible-subtype.json b/endpoints/openrtb2/sample-requests/valid-native/context-social-compatible-subtype.json new file mode 100644 index 00000000000..41fb833d770 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/valid-native/context-social-compatible-subtype.json @@ -0,0 +1,41 @@ +{ + "description": "Native bid request comes with a context type social (2) and compatible subcontext type", + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "some.page.com" + }, + "tmax": 500, + "imp": [ + { + "id": "some-imp", + "native": { + "request": "{\"context\":2,\"contextsubtype\":21,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}" + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + } + ] + }, + "expectedBidResponse": { + "id": "req-id", + "bidid": "test bid id", + "nbr": 0, + "seatbid": [ + { + "bid": [ + { + "id": "appnexus-bid", + "impid": "", + "price": 0 + } + ], + "seat": "appnexus-bids" + } + ] + }, + "expectedReturnCode": 200 +} From 7c8148e0367334eccef1855c9533697f37b27fb4 Mon Sep 17 00:00:00 2001 From: guscarreon Date: Mon, 22 Mar 2021 13:08:17 -0400 Subject: [PATCH 38/91] Applogy: Fix Shared Memory Overwriting (#1758) --- adapters/applogy/applogy.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go index ebac02833ee..fe5fdc17933 100644 --- a/adapters/applogy/applogy.go +++ b/adapters/applogy/applogy.go @@ -25,7 +25,7 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E result := make([]*adapters.RequestData, 0, len(impressions)) errs := make([]error, 0, len(impressions)) - for i, impression := range impressions { + for _, impression := range impressions { if impression.Banner == nil && impression.Video == nil && impression.Native == nil { errs = append(errs, &errortypes.BadInput{ Message: "Applogy only supports banner, video or native ads", @@ -33,17 +33,17 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E continue } if impression.Banner != nil { - banner := impression.Banner - if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { - if len(banner.Format) == 0 { + if impression.Banner.W == nil || impression.Banner.H == nil || *impression.Banner.W == 0 || *impression.Banner.H == 0 { + if len(impression.Banner.Format) == 0 { errs = append(errs, &errortypes.BadInput{ Message: "banner size information missing", }) continue } - format := banner.Format[0] - banner.W = &format.W - banner.H = &format.H + banner := *impression.Banner + banner.W = openrtb.Uint64Ptr(banner.Format[0].W) + banner.H = openrtb.Uint64Ptr(banner.Format[0].H) + impression.Banner = &banner } } if len(impression.Ext) == 0 { @@ -70,7 +70,7 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E errs = append(errs, errors.New("Applogy token required")) continue } - request.Imp = impressions[i : i+1] + request.Imp = []openrtb.Imp{impression} body, err := json.Marshal(request) if err != nil { errs = append(errs, err) From 07aabefc800806c78cae3565e8e38bf6815df9fe Mon Sep 17 00:00:00 2001 From: guscarreon Date: Mon, 22 Mar 2021 13:09:24 -0400 Subject: [PATCH 39/91] Pubmatic: Fix Shared Memory Overwriting (#1759) --- adapters/pubmatic/pubmatic.go | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index 2dfba673734..be3ebb313f3 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -418,8 +418,7 @@ func validateAdSlot(adslot string, imp *openrtb.Imp) error { //In case of video, size could be derived from the player size if imp.Banner != nil { - imp.Banner.H = openrtb.Uint64Ptr(uint64(height)) - imp.Banner.W = openrtb.Uint64Ptr(uint64(width)) + imp.Banner = assignBannerHeightAndWidth(imp.Banner, uint64(height), uint64(width)) } } else { return errors.New(fmt.Sprintf("Invalid adSlot %v", adSlotStr)) @@ -428,25 +427,25 @@ func validateAdSlot(adslot string, imp *openrtb.Imp) error { return nil } -func assignBannerSize(banner *openrtb.Banner) error { - if banner == nil { - return nil - } - +func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { if banner.W != nil && banner.H != nil { - return nil + return banner, nil } if len(banner.Format) == 0 { - return errors.New(fmt.Sprintf("No sizes provided for Banner %v", banner.Format)) + return nil, errors.New(fmt.Sprintf("No sizes provided for Banner %v", banner.Format)) } - banner.W = new(uint64) - *banner.W = banner.Format[0].W - banner.H = new(uint64) - *banner.H = banner.Format[0].H + return assignBannerHeightAndWidth(banner, banner.Format[0].H, banner.Format[0].H), nil +} - return nil +func assignBannerHeightAndWidth(banner *openrtb.Banner, h uint64, w uint64) *openrtb.Banner { + bannerCopy := *banner + + bannerCopy.W = openrtb.Uint64Ptr(w) + bannerCopy.H = openrtb.Uint64Ptr(h) + + return &bannerCopy } // parseImpressionObject parse the imp to get it ready to send to pubmatic @@ -489,9 +488,11 @@ func parseImpressionObject(imp *openrtb.Imp, wrapExt *string, pubID *string) err } if imp.Banner != nil { - if err := assignBannerSize(imp.Banner); err != nil { + bannerCopy, err := assignBannerSize(imp.Banner) + if err != nil { return err } + imp.Banner = bannerCopy } if pubmaticExt.Keywords != nil && len(pubmaticExt.Keywords) != 0 { From 2f1a0e044d5bffc490383356e491bc54daf87ec9 Mon Sep 17 00:00:00 2001 From: guscarreon Date: Mon, 22 Mar 2021 16:27:18 -0400 Subject: [PATCH 40/91] Beachfront: Fix Shared Memory Overwriting (#1762) * Fix race condition in Beachfront adapter * Removed nil check and simplified --- adapters/beachfront/beachfront.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 58554577c87..09dd9e93929 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -409,8 +409,11 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] bfReqs[i].Request = *request var secure int8 + var deviceCopy openrtb.Device if bfReqs[i].Request.Device == nil { - bfReqs[i].Request.Device = &openrtb.Device{} + deviceCopy = openrtb.Device{} + } else { + deviceCopy = *bfReqs[i].Request.Device } if beachfrontExt.VideoResponseType == "nurl" { @@ -418,13 +421,15 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } else { bfReqs[i].VideoResponseType = "adm" - if bfReqs[i].Request.Device.IP == "" { - bfReqs[i].Request.Device.IP = fakeIP + if deviceCopy.IP == "" { + deviceCopy.IP = fakeIP } } if bfReqs[i].Request.Site != nil && bfReqs[i].Request.Site.Domain == "" && bfReqs[i].Request.Site.Page != "" { - bfReqs[i].Request.Site.Domain = getDomain(bfReqs[i].Request.Site.Page) + siteCopy := *bfReqs[i].Request.Site + siteCopy.Domain = getDomain(bfReqs[i].Request.Site.Page) + bfReqs[i].Request.Site = &siteCopy secure = isSecure(bfReqs[i].Request.Site.Page) } @@ -439,10 +444,11 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } } - if bfReqs[i].Request.Device != nil && bfReqs[i].Request.Device.DeviceType == 0 { + if deviceCopy.DeviceType == 0 { // More fine graned deviceType methods will be added in the future - bfReqs[i].Request.Device.DeviceType = fallBackDeviceType(request) + deviceCopy.DeviceType = fallBackDeviceType(request) } + bfReqs[i].Request.Device = &deviceCopy imp := request.Imp[i] From 080843b96b21a69b3e1dc45a7988e557dfe8ca06 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Mon, 22 Mar 2021 23:37:52 -0400 Subject: [PATCH 41/91] FPD: Allow imp.ext.data To Passthrough To Adapters (#1765) --- endpoints/openrtb2/auction.go | 2 ++ ...=> valid-fpd-allowed-with-ext-bidder.json} | 33 +++++++++---------- ...valid-fpd-allowed-with-prebid-bidder.json} | 33 +++++++++---------- ...rstpartydata-imp-ext-multiple-bidders.json | 15 +++++++-- ...data-imp-ext-multiple-prebid-bidders.json | 15 +++++++-- .../firstpartydata-imp-ext-one-bidder.json | 10 ++++-- ...stpartydata-imp-ext-one-prebid-bidder.json | 10 ++++-- exchange/utils.go | 5 +++ exchange/utils_test.go | 11 +++++++ openrtb_ext/request.go | 5 ++- 10 files changed, 94 insertions(+), 45 deletions(-) rename endpoints/openrtb2/sample-requests/first-party-data/{valid-context-allowed-with-ext-bidder.json => valid-fpd-allowed-with-ext-bidder.json} (64%) rename endpoints/openrtb2/sample-requests/first-party-data/{valid-context-allowed-with-prebid-bidder.json => valid-fpd-allowed-with-prebid-bidder.json} (67%) diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index d26623da348..70d8e72629e 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -898,6 +898,8 @@ func isBidderToValidate(bidder string) bool { switch openrtb_ext.BidderName(bidder) { case openrtb_ext.BidderReservedContext: return false + case openrtb_ext.BidderReservedData: + return false case openrtb_ext.BidderReservedPrebid: return false case openrtb_ext.BidderReservedSKAdN: diff --git a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json b/endpoints/openrtb2/sample-requests/first-party-data/valid-fpd-allowed-with-ext-bidder.json similarity index 64% rename from endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json rename to endpoints/openrtb2/sample-requests/first-party-data/valid-fpd-allowed-with-ext-bidder.json index 74dede0857f..c36ae0cd41d 100644 --- a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json +++ b/endpoints/openrtb2/sample-requests/first-party-data/valid-fpd-allowed-with-ext-bidder.json @@ -21,30 +21,29 @@ "appnexus": { "placementId": 12883451 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } }] }, "expectedBidResponse": { - "id":"some-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "appnexus-bid", - "impid": "", - "price": 0 - } - ], - "seat": "appnexus-bids" - } - ], - "bidid":"test bid id", - "nbr":0 + "id": "some-request-id", + "seatbid": [{ + "bid": [{ + "id": "appnexus-bid", + "impid": "", + "price": 0 + }], + "seat": "appnexus-bids" + }], + "bidid": "test bid id", + "nbr": 0 }, "expectedReturnCode": 200 -} +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json b/endpoints/openrtb2/sample-requests/first-party-data/valid-fpd-allowed-with-prebid-bidder.json similarity index 67% rename from endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json rename to endpoints/openrtb2/sample-requests/first-party-data/valid-fpd-allowed-with-prebid-bidder.json index 41461813c40..ad6298db39a 100644 --- a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json +++ b/endpoints/openrtb2/sample-requests/first-party-data/valid-fpd-allowed-with-prebid-bidder.json @@ -25,30 +25,29 @@ } } }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } }] }, "expectedBidResponse": { - "id":"some-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "appnexus-bid", - "impid": "", - "price": 0 - } - ], - "seat": "appnexus-bids" - } - ], - "bidid":"test bid id", - "nbr":0 + "id": "some-request-id", + "seatbid": [{ + "bid": [{ + "id": "appnexus-bid", + "impid": "", + "price": 0 + }], + "seat": "appnexus-bids" + }], + "bidid": "test bid id", + "nbr": 0 }, "expectedReturnCode": 200 -} +} \ No newline at end of file diff --git a/exchange/exchangetest/firstpartydata-imp-ext-multiple-bidders.json b/exchange/exchangetest/firstpartydata-imp-ext-multiple-bidders.json index 8004c3c2646..df0e4e33ea5 100644 --- a/exchange/exchangetest/firstpartydata-imp-ext-multiple-bidders.json +++ b/exchange/exchangetest/firstpartydata-imp-ext-multiple-bidders.json @@ -25,9 +25,12 @@ "siteId": 2, "zoneId": 3 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } @@ -57,9 +60,12 @@ "bidder": { "placementId": 1 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } @@ -107,9 +113,12 @@ "siteId": 2, "zoneId": 3 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } diff --git a/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json b/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json index 37654c454bc..ea4a980c63f 100644 --- a/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json +++ b/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json @@ -29,9 +29,12 @@ } } }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } @@ -61,9 +64,12 @@ "bidder": { "placementId": 1 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } @@ -111,9 +117,12 @@ "siteId": 2, "zoneId": 3 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } diff --git a/exchange/exchangetest/firstpartydata-imp-ext-one-bidder.json b/exchange/exchangetest/firstpartydata-imp-ext-one-bidder.json index 6f0bab9529c..7e2c4b9a16d 100644 --- a/exchange/exchangetest/firstpartydata-imp-ext-one-bidder.json +++ b/exchange/exchangetest/firstpartydata-imp-ext-one-bidder.json @@ -20,9 +20,12 @@ "appnexus": { "placementId": 1 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } @@ -52,9 +55,12 @@ "bidder": { "placementId": 1 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } diff --git a/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json b/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json index c931b0b9ee3..f1977426591 100644 --- a/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json +++ b/exchange/exchangetest/firstpartydata-imp-ext-one-prebid-bidder.json @@ -24,9 +24,12 @@ } } }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } @@ -56,9 +59,12 @@ "bidder": { "placementId": 1 }, + "data": { + "keywords": "prebid server example" + }, "context": { "data": { - "keywords": "prebid server example" + "keywords": "another prebid server example" } } } diff --git a/exchange/utils.go b/exchange/utils.go index 4ca02149453..0d9d0e3ced8 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -384,6 +384,10 @@ func createSanitizedImpExt(impExt, impExtPrebid map[string]json.RawMessage) (map } } + if v, exists := impExt[openrtb_ext.FirstPartyDataExtKey]; exists { + sanitizedImpExt[openrtb_ext.FirstPartyDataExtKey] = v + } + if v, exists := impExt[openrtb_ext.FirstPartyDataContextExtKey]; exists { sanitizedImpExt[openrtb_ext.FirstPartyDataContextExtKey] = v } @@ -419,6 +423,7 @@ func extractBidderExts(impExt, impExtPrebidBidders map[string]json.RawMessage) m func isSpecialField(bidder string) bool { return bidder == openrtb_ext.FirstPartyDataContextExtKey || + bidder == openrtb_ext.FirstPartyDataExtKey || bidder == openrtb_ext.SKAdNExtKey || bidder == openrtb_ext.PrebidExtKey } diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 1945aee1b98..f8603f18f4f 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -233,6 +233,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { description: "imp.ext.prebid - Bidders Only", givenImpExt: map[string]json.RawMessage{ "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -240,6 +241,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { "bidder": json.RawMessage(`"anyBidder"`), }, expected: map[string]json.RawMessage{ + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -249,6 +251,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { description: "imp.ext.prebid - Bidders + Other Values", givenImpExt: map[string]json.RawMessage{ "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -258,6 +261,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { }, expected: map[string]json.RawMessage{ "prebid": json.RawMessage(`{"someOther":"value"}`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -267,11 +271,13 @@ func TestCreateSanitizedImpExt(t *testing.T) { description: "imp.ext", givenImpExt: map[string]json.RawMessage{ "anyBidder": json.RawMessage(`"anyBidderValues"`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, givenImpExtPrebid: map[string]json.RawMessage{}, expected: map[string]json.RawMessage{ + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -282,6 +288,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { givenImpExt: map[string]json.RawMessage{ "anyBidder": json.RawMessage(`"anyBidderValues"`), "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -289,6 +296,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { "bidder": json.RawMessage(`"anyBidder"`), }, expected: map[string]json.RawMessage{ + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -299,6 +307,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { givenImpExt: map[string]json.RawMessage{ "anyBidder": json.RawMessage(`"anyBidderValues"`), "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -308,6 +317,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { }, expected: map[string]json.RawMessage{ "prebid": json.RawMessage(`{"someOther":"value"}`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, @@ -317,6 +327,7 @@ func TestCreateSanitizedImpExt(t *testing.T) { description: "Marshal Error - imp.ext.prebid", givenImpExt: map[string]json.RawMessage{ "prebid": json.RawMessage(`"ignoredInFavorOfSeparatelyUnmarshalledImpExtPrebid"`), + "data": json.RawMessage(`"anyData"`), "context": json.RawMessage(`"anyContext"`), "skadn": json.RawMessage(`"anySKAdNetwork"`), }, diff --git a/openrtb_ext/request.go b/openrtb_ext/request.go index b2bb25e7401..f673c737eab 100644 --- a/openrtb_ext/request.go +++ b/openrtb_ext/request.go @@ -5,7 +5,10 @@ import ( "errors" ) -// FirstPartyDataContextExtKey defines the field name within request.ext reserved for first party data. +// FirstPartyDataExtKey defines a field name within request.ext and request.imp.ext reserved for first party data. +const FirstPartyDataExtKey = "data" + +// FirstPartyDataContextExtKey defines a field name within request.ext and request.imp.ext reserved for first party data. const FirstPartyDataContextExtKey = "context" // SKAdNExtKey defines the field name within request.ext reserved for Apple's SKAdNetwork. From 8760bae5d8760409a5ab0d4c397acf92dfb89705 Mon Sep 17 00:00:00 2001 From: el-chuck Date: Tue, 23 Mar 2021 17:27:02 +0100 Subject: [PATCH 42/91] Smaato: Add support for app (#1767) Co-authored-by: Bernhard Pickenbrock --- adapters/smaato/smaato.go | 10 +- .../exemplary/simple-banner-app.json | 225 +++++++++++++++++ .../simple-banner-richMedia-app.json | 229 +++++++++++++++++ .../exemplary/simple-banner-richMedia.json | 2 +- .../smaatotest/exemplary/simple-banner.json | 2 +- .../smaatotest/exemplary/video-app.json | 230 ++++++++++++++++++ .../smaato/smaatotest/exemplary/video.json | 2 +- .../supplemental/bad-adm-response.json | 2 +- .../bad-imp-banner-format-req.json | 2 +- .../supplemental/no-consent-info.json | 2 +- .../supplemental/status-code-204.json | 139 +++++++++++ .../supplemental/status-code-400.json | 144 +++++++++++ 12 files changed, 982 insertions(+), 7 deletions(-) create mode 100644 adapters/smaato/smaatotest/exemplary/simple-banner-app.json create mode 100644 adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json create mode 100644 adapters/smaato/smaatotest/exemplary/video-app.json create mode 100644 adapters/smaato/smaatotest/supplemental/status-code-204.json create mode 100644 adapters/smaato/smaatotest/supplemental/status-code-400.json diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 1d5b29ab2c0..29b4a5848bc 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -14,7 +14,7 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) -const clientVersion = "prebid_server_0.1" +const clientVersion = "prebid_server_0.2" type adMarkupType string @@ -81,6 +81,7 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt i-- } } + if request.Site != nil { siteCopy := *request.Site siteCopy.Publisher = &openrtb.Publisher{ID: publisherID} @@ -98,6 +99,13 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt request.Site = &siteCopy } + if request.App != nil { + appCopy := *request.App + appCopy.Publisher = &openrtb.Publisher{ID: publisherID} + + request.App = &appCopy + } + if request.User != nil && request.User.Ext != nil { var userExt userExt var userExtRaw map[string]json.RawMessage diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json new file mode 100644 index 00000000000..8194f568c28 --- /dev/null +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-app.json @@ -0,0 +1,225 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "app": { + "id": "app-id", + "name": "app-name", + "bundle": "app-bundle", + "storeurl": "app-storeurl", + "cat": [ + "IAB3-1" + ], + "ver": "app-version", + "paid": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "banner": { + "h": 50, + "w": 320, + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "app": { + "publisher": { + "id": "1100042525" + }, + "id": "app-id", + "name": "app-name", + "bundle": "app-bundle", + "storeurl": "app-storeurl", + "cat": [ + "IAB3-1" + ], + "ver": "app-version", + "paid": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "ext": { + "client": "prebid_server_0.2" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "{\"image\":{\"img\":{\"url\":\"//prebid-test.smaatolabs.net/img/320x50.jpg\",\"w\":350,\"h\":50,\"ctaurl\":\"//prebid-test.smaatolabs.net/track/ctaurl/1\"},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "
\"\"\"\"
", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json new file mode 100644 index 00000000000..46722c4ff71 --- /dev/null +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia-app.json @@ -0,0 +1,229 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "app": { + "id": "app-id", + "name": "app-name", + "bundle": "app-bundle", + "storeurl": "app-storeurl", + "cat": [ + "IAB3-1" + ], + "ver": "app-version", + "paid": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "banner": { + "h": 50, + "w": 320, + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "gender": "M", + "keywords": "a,b", + "yob": 1984, + "ext": { + "consent": "gdprConsentString" + } + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "app": { + "publisher": { + "id": "1100042525" + }, + "id": "app-id", + "name": "app-name", + "bundle": "app-bundle", + "storeurl": "app-storeurl", + "cat": [ + "IAB3-1" + ], + "ver": "app-version", + "paid": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "ext": { + "client": "prebid_server_0.2" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "{\"richmedia\":{\"mediadata\":{\"content\":\"
hello
\", \"w\":350,\"h\":50},\"impressiontrackers\":[\"//prebid-test.smaatolabs.net/track/imp/1\",\"//prebid-test.smaatolabs.net/track/imp/2\"],\"clicktrackers\":[\"//prebid-test.smaatolabs.net/track/click/1\",\"//prebid-test.smaatolabs.net/track/click/2\"]}}", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "
hello
\"\"\"\"
", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://bidstalkcreatives.s3.amazonaws.com/1x1.png", + "nurl": "https://ets-eu-west-1.track.smaato.net/v1/view?sessionId=e4e17adb-9599-42b1-bb5f-a1f1b3bee572&adSourceId=6906aae8-7f74-4edd-9a4f-f49379a3cadd&originalRequestTime=1552310449698&expires=1552311350698&winurl=ama8JbpJVpFWxvEja5viE3cLXFu58qRI8dGUh23xtsOn3N2-5UU0IwkgNEmR82pI37fcMXejL5IWTNAoW6Cnsjf-Dxl_vx2dUqMrVEevX-Vdx2VVnf-D5f73gZhvi4t36iPL8Dsw4aACekoLvVOV7-eXDjz7GHy60QFqcwKf5g2AlKPOInyZ6vJg_fn4qA9argvCRgwVybXE9Ndm2W0v8La4uFYWpJBOUveDDUrSQfzal7RsYvLb_OyaMlPHdrd_bwA9qqZWuyJXd-L9lxr7RQ%3D%3D%7CMw3kt91KJR0Uy5L-oNztAg%3D%3D&dpid=4XVofb_lH-__hr2JNGhKfg%3D%3D%7Cr9ciCU1cx3zmHXihItKO0g%3D%3D", + "price": 0.01, + "w": 350, + "h": 50 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json index 7b662e8813a..1018dbc39ac 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner-richMedia.json @@ -129,7 +129,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.1" + "client": "prebid_server_0.2" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/simple-banner.json b/adapters/smaato/smaatotest/exemplary/simple-banner.json index a50fd9289e3..0ba4050a143 100644 --- a/adapters/smaato/smaatotest/exemplary/simple-banner.json +++ b/adapters/smaato/smaatotest/exemplary/simple-banner.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.1" + "client": "prebid_server_0.2" } } }, diff --git a/adapters/smaato/smaatotest/exemplary/video-app.json b/adapters/smaato/smaatotest/exemplary/video-app.json new file mode 100644 index 00000000000..bf939eb078a --- /dev/null +++ b/adapters/smaato/smaatotest/exemplary/video-app.json @@ -0,0 +1,230 @@ +{ + "mockBidRequest": { + "id": "447a0a1d-389d-4730-a418-3777e95de7bd", + "imp": [ + { + "id": "postbid_iframe", + "video": { + "mimes": [ + "video/mp4", + "video/quicktime", + "video/3gpp", + "video/x-m4v" + ], + "minduration": 5, + "maxduration": 30, + "protocols": [ + 7 + ], + "w": 1024, + "h": 768, + "startdelay": 0, + "linearity": 1, + "skip": 1, + "skipmin": 5, + "api": [ + 7 + ], + "ext": { + "rewarded": 0 + } + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "app": { + "id": "app-id", + "name": "app-name", + "bundle": "app-bundle", + "storeurl": "app-storeurl", + "cat": [ + "IAB3-1" + ], + "ver": "app-version", + "paid": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "device": { + "ua": "test-user-agent" + }, + "user": { + "ext": { + "data": {} + } + }, + "ext": { + "prebid": { + "auctiontimestamp": 1598262728811, + "targeting": { + "includewinners": true, + "includebidderkeys": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "447a0a1d-389d-4730-a418-3777e95de7bd", + "imp": [ + { + "id": "postbid_iframe", + "tagid": "130563103", + "video": { + "w": 1024, + "h": 768, + "ext": { + "rewarded": 0 + }, + "mimes": [ + "video/mp4", + "video/quicktime", + "video/3gpp", + "video/x-m4v" + ], + "minduration": 5, + "startdelay": 0, + "linearity": 1, + "maxduration": 30, + "skip": 1, + "protocols": [ + 7 + ], + "skipmin": 5, + "api": [ + 7 + ] + } + } + ], + "user": { + "ext": { + } + }, + "device": { + "ua": "test-user-agent" + }, + "app": { + "publisher": { + "id": "1100042525" + }, + "id": "app-id", + "name": "app-name", + "bundle": "app-bundle", + "storeurl": "app-storeurl", + "cat": [ + "IAB3-1" + ], + "ver": "app-version", + "paid": 1, + "content": { + "id": "content-id", + "title": "content-title", + "series": "content-series", + "genre": "content-genre", + "producer": { + "id": "producer-id", + "name": "producer-name" + }, + "cat": [ + "IAB8-6" + ], + "livestream": 1, + "language": "en" + }, + "keywords": "keywords" + }, + "ext": { + "client": "prebid_server_0.2" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5ebea288-f13a-4754-be6d-4ade66c68877", + "seatbid": [ + { + "seat": "CM6523", + "bid": [ + { + "adm": "", + "adomain": [ + "smaato.com" + ], + "bidderName": "smaato", + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://iurl", + "nurl": "https://nurl", + "price": 0.01, + "w": 1024, + "h": 768 + } + ] + } + ], + "bidid": "04db8629-179d-4bcd-acce-e54722969006", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "adm": "", + "adomain": [ + "smaato.com" + ], + "cid": "CM6523", + "crid": "CR69381", + "id": "6906aae8-7f74-4edd-9a4f-f49379a3cadd", + "impid": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "iurl": "https://iurl", + "nurl": "https://nurl", + "price": 0.01, + "w": 1024, + "h": 768 + }, + "type": "video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/smaato/smaatotest/exemplary/video.json b/adapters/smaato/smaatotest/exemplary/video.json index f2896d3d9d8..bad3825bb62 100644 --- a/adapters/smaato/smaatotest/exemplary/video.json +++ b/adapters/smaato/smaatotest/exemplary/video.json @@ -122,7 +122,7 @@ } }, "ext": { - "client": "prebid_server_0.1" + "client": "prebid_server_0.2" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/bad-adm-response.json b/adapters/smaato/smaatotest/supplemental/bad-adm-response.json index 1fce58f0dfe..db724565d52 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-adm-response.json +++ b/adapters/smaato/smaatotest/supplemental/bad-adm-response.json @@ -125,7 +125,7 @@ "keywords": "power tools" }, "ext": { - "client": "prebid_server_0.1" + "client": "prebid_server_0.2" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/bad-imp-banner-format-req.json b/adapters/smaato/smaatotest/supplemental/bad-imp-banner-format-req.json index b9560f0f9ca..768b4ef9d2c 100644 --- a/adapters/smaato/smaatotest/supplemental/bad-imp-banner-format-req.json +++ b/adapters/smaato/smaatotest/supplemental/bad-imp-banner-format-req.json @@ -40,7 +40,7 @@ } }, "ext": { - "client": "prebid_server_0.1" + "client": "prebid_server_0.2" } } } diff --git a/adapters/smaato/smaatotest/supplemental/no-consent-info.json b/adapters/smaato/smaatotest/supplemental/no-consent-info.json index 9e0ccfdcdde..b9a4294b00b 100644 --- a/adapters/smaato/smaatotest/supplemental/no-consent-info.json +++ b/adapters/smaato/smaatotest/supplemental/no-consent-info.json @@ -72,7 +72,7 @@ } }, "ext": { - "client": "prebid_server_0.1" + "client": "prebid_server_0.2" } } }, diff --git a/adapters/smaato/smaatotest/supplemental/status-code-204.json b/adapters/smaato/smaatotest/supplemental/status-code-204.json new file mode 100644 index 00000000000..b409597f986 --- /dev/null +++ b/adapters/smaato/smaatotest/supplemental/status-code-204.json @@ -0,0 +1,139 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "ext": { + "data": { + "keywords": "power tools", + "search": "drill", + "content": { + "userrating": 4 + } + } + } + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "banner": { + "h": 50, + "w": 320, + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "keywords": "power tools" + }, + "ext": { + "client": "prebid_server_0.2" + } + } + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/smaato/smaatotest/supplemental/status-code-400.json b/adapters/smaato/smaatotest/supplemental/status-code-400.json new file mode 100644 index 00000000000..fc84c93e269 --- /dev/null +++ b/adapters/smaato/smaatotest/supplemental/status-code-400.json @@ -0,0 +1,144 @@ +{ + "mockBidRequest": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "ext": { + "data": { + "keywords": "power tools", + "search": "drill", + "content": { + "userrating": 4 + } + } + } + }, + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "1100042525", + "adspaceId": "130563103" + } + } + } + ], + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "user": { + "ext": { + "consent": "gdprConsentString", + "data": { + "keywords": "a,b", + "gender": "M", + "yob": 1984, + "geo": { + "country": "ca" + } + } + } + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "uri": "https://prebid/bidder", + "body": { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "imp": [ + { + "id": "1C86242D-9535-47D6-9576-7B1FE87F282C", + "tagid": "130563103", + "banner": { + "h": 50, + "w": 320, + "format": [ + { + "w": 320, + "h": 50 + }, + { + "w": 320, + "h": 250 + } + ] + } + } + ], + "user": { + "ext": { + "consent": "gdprConsentString" + }, + "gender": "M", + "keywords": "a,b", + "yob": 1984 + }, + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "regs": { + "coppa": 1, + "ext": { + "gdpr": 1, + "us_privacy": "uspConsentString" + } + }, + "site": { + "publisher": { + "id": "1100042525" + }, + "page": "http://localhost:3000/server.html?pbjs_debug=true&endpoint=http://localhost:3000/bidder", + "keywords": "power tools" + }, + "ext": { + "client": "prebid_server_0.2" + } + } + }, + "mockResponse": { + "status": 400 + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file From bea52c642e6f4a314d36df383ddd60f3493170b1 Mon Sep 17 00:00:00 2001 From: Gena Date: Tue, 23 Mar 2021 18:45:23 +0200 Subject: [PATCH 43/91] Update sync types (#1770) --- adapters/adtarget/usersync.go | 2 +- adapters/adtarget/usersync_test.go | 2 +- adapters/adtelligent/usersync.go | 2 +- adapters/adtelligent/usersync_test.go | 2 +- adapters/mediafuse/usersync.go | 2 +- adapters/mediafuse/usersync_test.go | 2 +- config/config.go | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/adapters/adtarget/usersync.go b/adapters/adtarget/usersync.go index d720f110d89..088de8fb2ad 100644 --- a/adapters/adtarget/usersync.go +++ b/adapters/adtarget/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdtargetSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adtarget", temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adtarget", temp, adapters.SyncTypeIframe) } diff --git a/adapters/adtarget/usersync_test.go b/adapters/adtarget/usersync_test.go index ea6146ceec8..e66b7b8377b 100644 --- a/adapters/adtarget/usersync_test.go +++ b/adapters/adtarget/usersync_test.go @@ -32,6 +32,6 @@ func TestAdtargetSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.console.adtarget.com.tr/csync?t=p&ep=0&gdpr=0&gdpr_consent=123&us_privacy=1-YY&redir=localhost%2Fsetuid%3Fbidder%3Dadtarget%26gdpr%3D0%26gdpr_consent%3D123%26uid%3D%7Buid%7D", syncInfo.URL) - assert.Equal(t, "redirect", syncInfo.Type) + assert.Equal(t, "iframe", syncInfo.Type) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/adtelligent/usersync.go b/adapters/adtelligent/usersync.go index 613c8e294f0..9198b30fe6f 100644 --- a/adapters/adtelligent/usersync.go +++ b/adapters/adtelligent/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewAdtelligentSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("adtelligent", temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("adtelligent", temp, adapters.SyncTypeIframe) } diff --git a/adapters/adtelligent/usersync_test.go b/adapters/adtelligent/usersync_test.go index 2430f377bd4..2ca0ddfc135 100644 --- a/adapters/adtelligent/usersync_test.go +++ b/adapters/adtelligent/usersync_test.go @@ -24,6 +24,6 @@ func TestAdtelligentSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.adtelligent.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dadtelligent%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7Buid%7D", syncInfo.URL) - assert.Equal(t, "redirect", syncInfo.Type) + assert.Equal(t, "iframe", syncInfo.Type) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/adapters/mediafuse/usersync.go b/adapters/mediafuse/usersync.go index b91a6b5052c..d482ad774bd 100644 --- a/adapters/mediafuse/usersync.go +++ b/adapters/mediafuse/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewMediafuseSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("mediafuse", temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("mediafuse", temp, adapters.SyncTypeIframe) } diff --git a/adapters/mediafuse/usersync_test.go b/adapters/mediafuse/usersync_test.go index e3dfa06831d..95045689a87 100644 --- a/adapters/mediafuse/usersync_test.go +++ b/adapters/mediafuse/usersync_test.go @@ -24,6 +24,6 @@ func TestMediafuseSyncer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "//sync.hbmp.mediafuse.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dmediafuse%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7Buid%7D", syncInfo.URL) - assert.Equal(t, "redirect", syncInfo.Type) + assert.Equal(t, "iframe", syncInfo.Type) assert.Equal(t, false, syncInfo.SupportCORS) } diff --git a/config/config.go b/config/config.go index 22ce8faf0b6..bc15a947c7e 100644 --- a/config/config.go +++ b/config/config.go @@ -571,8 +571,8 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernel, "https://sync.adkernel.com/user-sync?t=image&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadkernel%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernelAdn, "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdpone, "https://usersync.adpone.com/csync?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadpone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdtarget, "https://sync.console.adtarget.com.tr/csync?t=p&ep=0&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadtarget%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdtelligent, "https://sync.adtelligent.com/csync?t=p&ep=0&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadtelligent%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") + // openrtb_ext.BidderAdtarget doesn't have a good default. + // openrtb_ext.BidderAdtelligent doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdmixer, "https://inv-nets.admixer.net/adxcm.aspx?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=1&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadmixer%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%24visitor_cookie%24%24") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdman, "https://sync.admanmedia.com/pbs.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadman%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") // openrtb_ext.BidderAdOcean doesn't have a good default. @@ -613,7 +613,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLogicad, "https://cr-p31.ladsp.jp/cookiesender/31?r=true&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlogicad%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLunaMedia, "https://api.lunamedia.io/xp/user-sync?redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlunamedia%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMarsmedia, "https://dmp.rtbsrv.com/dmp/profiles/cm?p_id=179&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmarsmedia%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMediafuse, "https://sync.hbmp.mediafuse.com/csync?t=p&ep=0&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmediafuse%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") + // openrtb_ext.BidderMediafuse doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderNanoInteractive, "https://ad.audiencemanager.de/hbs/cookie_sync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dnanointeractive%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderNinthDecimal, "https://rtb.ninthdecimal.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dninthdecimal%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") From b9d28e7e39a7539ffb14b2a6299921d7c0d5c89d Mon Sep 17 00:00:00 2001 From: guscarreon Date: Wed, 24 Mar 2021 12:06:26 -0400 Subject: [PATCH 44/91] 33across: Fix Shared Memory Overwriting (#1764) This reverts commit f7df258f061788ef7e72529115aa5fd554fa9f16. --- adapters/33across/33across.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index b9655faab7f..a48c18e9f58 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -228,7 +228,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque } func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, error) { - videoCopy := video + videoCopy := *video if videoCopy.W == 0 || videoCopy.H == 0 || videoCopy.Protocols == nil || @@ -252,7 +252,7 @@ func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, err } } - return videoCopy, nil + return &videoCopy, nil } func getBidType(ext bidExt) openrtb_ext.BidType { From ef32c8b092b88fc217e2b3dc79d4040a49b1823f Mon Sep 17 00:00:00 2001 From: guscarreon Date: Thu, 25 Mar 2021 12:59:26 -0400 Subject: [PATCH 45/91] Fix race condition in Yeahmobi adapter (#1761) Co-authored-by: Gus Carreon --- adapters/yeahmobi/yeahmobi.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adapters/yeahmobi/yeahmobi.go b/adapters/yeahmobi/yeahmobi.go index c62f5bc032f..d603397b09f 100644 --- a/adapters/yeahmobi/yeahmobi.go +++ b/adapters/yeahmobi/yeahmobi.go @@ -95,7 +95,9 @@ func transform(request *openrtb.BidRequest) { continue } - request.Imp[i].Native.Request = string(nativeReqByte) + nativeCopy := *request.Imp[i].Native + nativeCopy.Request = string(nativeReqByte) + request.Imp[i].Native = &nativeCopy } } } From bcfe9f2a92a8896182b689c77a6e2ad6b90cab0c Mon Sep 17 00:00:00 2001 From: guscarreon Date: Thu, 25 Mar 2021 13:16:48 -0400 Subject: [PATCH 46/91] Pubnative: Fix Shared Memory Overwriting (#1760) --- adapters/pubnative/pubnative.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/adapters/pubnative/pubnative.go b/adapters/pubnative/pubnative.go index 7d393f8ade9..9144d6ddaae 100644 --- a/adapters/pubnative/pubnative.go +++ b/adapters/pubnative/pubnative.go @@ -94,29 +94,35 @@ func convertImpression(imp *openrtb.Imp) error { } } if imp.Banner != nil { - err := convertBanner(imp.Banner) + bannerCopy, err := convertBanner(imp.Banner) if err != nil { return err } + imp.Banner = bannerCopy } return nil } // make sure that banner has openrtb 2.3-compatible size information -func convertBanner(banner *openrtb.Banner) error { +func convertBanner(banner *openrtb.Banner) (*openrtb.Banner, error) { if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { if len(banner.Format) > 0 { f := banner.Format[0] - banner.W = &f.W - banner.H = &f.H + + bannerCopy := *banner + + bannerCopy.W = openrtb.Uint64Ptr(f.W) + bannerCopy.H = openrtb.Uint64Ptr(f.H) + + return &bannerCopy, nil } else { - return &errortypes.BadInput{ + return nil, &errortypes.BadInput{ Message: "Size information missing for banner", } } } - return nil + return banner, nil } func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { From 6a3a8b8a44d0d3b6c34e93280d37f657af4803ad Mon Sep 17 00:00:00 2001 From: bretg Date: Thu, 25 Mar 2021 16:59:40 -0400 Subject: [PATCH 47/91] Add request for registration (#1780) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a619533ea74..83ac89a9807 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ For more information, see: - [Prebid Server Overview](https://docs.prebid.org/prebid-server/overview/prebid-server-overview.html) - [Current Bidders](http://prebid.org/dev-docs/pbs-bidders.html) +Please consider [registering your Prebid Server](https://docs.prebid.org/prebid-server/hosting/pbs-hosting.html#optional-registration) to get on the mailing list for updates, etc. + ## Installation First install [Go](https://golang.org/doc/install) version 1.14 or newer. From 192f55ba67c211d31d363cea85c406f3c47a6f99 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Fri, 26 Mar 2021 13:19:25 -0400 Subject: [PATCH 48/91] Update OpenRTB Library (#1733) --- adapters/33across/33across.go | 20 +- adapters/acuityads/acuityads.go | 14 +- adapters/adapterstest/adapter_test_util.go | 10 +- adapters/adapterstest/test_json.go | 6 +- adapters/adform/adform.go | 31 +- adapters/adform/adform_test.go | 64 ++-- adapters/adgeneration/adgeneration.go | 24 +- adapters/adgeneration/adgeneration_test.go | 70 ++-- adapters/adhese/adhese.go | 30 +- adapters/adhese/utils.go | 16 +- adapters/adkernel/adkernel.go | 34 +- adapters/adkernelAdn/adkernelAdn.go | 34 +- adapters/adman/adman.go | 14 +- .../admantest/supplemental/bad_response.json | 2 +- adapters/admixer/admixer.go | 16 +- adapters/adocean/adocean.go | 28 +- adapters/adoppler/adoppler.go | 12 +- .../supplemental/invalid-response.json | 2 +- adapters/adot/adot.go | 13 +- adapters/adot/adot_test.go | 13 +- .../supplemental/unmarshal_error.json | 2 +- adapters/adpone/adpone.go | 8 +- .../adponetest/supplemental/bad_response.json | 2 +- adapters/adprime/adprime.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/adtarget/adtarget.go | 12 +- adapters/adtelligent/adtelligent.go | 12 +- adapters/advangelists/advangelists.go | 32 +- adapters/adyoulike/adyoulike.go | 12 +- .../supplemental/invalid-bid-response.json | 2 +- adapters/aja/aja.go | 12 +- adapters/amx/amx.go | 14 +- adapters/amx/amx_test.go | 48 +-- adapters/applogy/applogy.go | 14 +- adapters/appnexus/appnexus.go | 28 +- adapters/appnexus/appnexus_test.go | 132 ++++---- adapters/audienceNetwork/facebook.go | 121 +++---- adapters/avocet/avocet.go | 12 +- adapters/avocet/avocet_test.go | 22 +- adapters/beachfront/beachfront.go | 66 ++-- adapters/beintoo/beintoo.go | 18 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/between/between.go | 18 +- .../supplemental/bad-response-body.json | 2 +- adapters/bidder.go | 10 +- adapters/brightroll/brightroll.go | 16 +- adapters/colossus/colossus.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/connectad/connectad.go | 18 +- .../supplemental/badresponse.json | 2 +- adapters/consumable/adtypes.go | 7 +- adapters/consumable/consumable.go | 14 +- adapters/conversant/cnvr_legacy.go | 20 +- adapters/conversant/cnvr_legacy_test.go | 40 +-- adapters/conversant/conversant.go | 24 +- adapters/cpmstar/cpmstar.go | 14 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/datablocks/datablocks.go | 18 +- .../supplemental/bad-response-body.json | 2 +- adapters/decenterads/decenterads.go | 12 +- .../supplemental/bad_response.json | 2 +- adapters/deepintent/deepintent.go | 18 +- .../supplemental/bad_response.json | 2 +- adapters/dmx/dmx.go | 30 +- adapters/dmx/dmx_test.go | 253 ++++++++------- adapters/emx_digital/emx_digital.go | 26 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/engagebdr/engagebdr.go | 12 +- adapters/eplanning/eplanning.go | 22 +- adapters/epom/epom.go | 12 +- adapters/gamma/gamma.go | 34 +- adapters/gamoshi/gamoshi.go | 10 +- adapters/grid/grid.go | 14 +- .../gridtest/supplemental/bad_response.json | 2 +- adapters/gumgum/gumgum.go | 20 +- adapters/improvedigital/improvedigital.go | 10 +- .../supplemental/bad_response.json | 2 +- adapters/infoawarebidder.go | 12 +- adapters/infoawarebidder_test.go | 72 ++--- adapters/inmobi/inmobi.go | 12 +- adapters/invibes/invibes.go | 32 +- adapters/ix/ix.go | 37 ++- adapters/ix/ix_test.go | 54 ++-- adapters/jixie/jixie.go | 8 +- adapters/kidoz/kidoz.go | 10 +- adapters/kidoz/kidoz_test.go | 22 +- adapters/krushmedia/krushmedia.go | 14 +- adapters/kubient/kubient.go | 12 +- .../supplemental/bad_response.json | 2 +- adapters/lifestreet/lifestreet.go | 8 +- adapters/lifestreet/lifestreet_test.go | 36 +-- adapters/lockerdome/lockerdome.go | 10 +- .../supplemental/bad_response.json | 2 +- adapters/logicad/logicad.go | 22 +- adapters/lunamedia/lunamedia.go | 28 +- adapters/marsmedia/marsmedia.go | 10 +- adapters/mgid/mgid.go | 12 +- adapters/mobfoxpb/mobfoxpb.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/mobilefuse/mobilefuse.go | 18 +- adapters/nanointeractive/nanointeractive.go | 14 +- adapters/ninthdecimal/ninthdecimal.go | 28 +- adapters/nobid/nobid.go | 12 +- adapters/onetag/onetag.go | 12 +- adapters/openrtb_util.go | 51 ++- adapters/openrtb_util_test.go | 66 ++-- adapters/openx/openx.go | 22 +- adapters/openx/openx_test.go | 8 +- adapters/orbidder/orbidder.go | 12 +- adapters/pangle/pangle.go | 14 +- adapters/pubmatic/pubmatic.go | 36 +-- adapters/pubmatic/pubmatic_test.go | 46 +-- adapters/pubnative/pubnative.go | 22 +- adapters/pulsepoint/pulsepoint.go | 33 +- adapters/pulsepoint/pulsepoint_test.go | 18 +- .../supplemental/bad-bid-data.json | 2 +- adapters/revcontent/revcontent.go | 13 +- .../supplemental/bad_response.json | 2 +- adapters/rhythmone/rhythmone.go | 12 +- adapters/rtbhouse/rtbhouse.go | 8 +- .../supplemental/bad_response.json | 2 +- adapters/rubicon/rubicon.go | 52 ++- adapters/rubicon/rubicon_test.go | 223 ++++++------- adapters/sharethrough/butler.go | 18 +- adapters/sharethrough/butler_test.go | 80 ++--- adapters/sharethrough/sharethrough.go | 6 +- adapters/sharethrough/sharethrough_test.go | 36 +-- adapters/sharethrough/utils.go | 25 +- adapters/sharethrough/utils_test.go | 67 ++-- adapters/silvermob/silvermob.go | 16 +- .../supplemental/invalid-response.json | 2 +- adapters/smaato/smaato.go | 24 +- adapters/smartadserver/smartadserver.go | 16 +- adapters/smartrtb/smartrtb.go | 12 +- .../supplemental/invalid-bid-json.json | 2 +- adapters/smartyads/smartyads.go | 14 +- adapters/somoaudience/somoaudience.go | 27 +- adapters/sonobi/sonobi.go | 14 +- adapters/sovrn/sovrn.go | 14 +- adapters/sovrn/sovrn_test.go | 22 +- adapters/synacormedia/synacormedia.go | 16 +- .../supplemental/bad_response.json | 2 +- adapters/tappx/tappx.go | 10 +- adapters/telaria/telaria.go | 24 +- adapters/triplelift/triplelift.go | 14 +- .../triplelift_native/triplelift_native.go | 18 +- adapters/ucfunnel/ucfunnel.go | 14 +- adapters/ucfunnel/ucfunnel_test.go | 60 ++-- adapters/unicorn/unicorn.go | 20 +- adapters/unruly/unruly.go | 20 +- adapters/unruly/unruly_test.go | 64 ++-- adapters/valueimpression/valueimpression.go | 12 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/verizonmedia/verizonmedia.go | 20 +- adapters/visx/visx.go | 12 +- adapters/vrtcal/vrtcal.go | 8 +- adapters/yeahmobi/yeahmobi.go | 16 +- .../supplemental/bad_response.json | 2 +- adapters/yieldlab/yieldlab.go | 22 +- adapters/yieldmo/yieldmo.go | 14 +- adapters/yieldone/yieldone.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/zeroclickfraud/zeroclickfraud.go | 16 +- .../supplemental/bad-response-body.json | 2 +- amp/parse.go | 22 +- amp/parse_test.go | 12 +- analytics/config/config_test.go | 9 +- analytics/core.go | 14 +- analytics/filesystem/file_module_test.go | 7 +- analytics/pubstack/helpers/json_test.go | 9 +- analytics/pubstack/pubstack_module_test.go | 6 +- endpoints/auction.go | 4 +- endpoints/auction_test.go | 14 +- endpoints/openrtb2/amp_auction.go | 40 +-- endpoints/openrtb2/amp_auction_test.go | 114 +++---- endpoints/openrtb2/auction.go | 260 +++++++++++---- endpoints/openrtb2/auction_test.go | 302 +++++++++--------- endpoints/openrtb2/interstitial.go | 20 +- endpoints/openrtb2/interstitial_test.go | 14 +- .../audio-maxbitrate-negative.json | 28 ++ .../invalid-whole/audio-maxseq-negative.json | 28 ++ .../audio-minbitrate-negative.json | 28 ++ .../audio-sequence-negative.json | 28 ++ .../invalid-whole/banner-h-negative.json | 23 ++ .../invalid-whole/banner-w-negative.json | 23 ++ .../device-geo-accuracy-negative.json | 30 ++ .../invalid-whole/device-h-negative.json | 27 ++ .../invalid-whole/device-ppi-negative.json | 28 ++ .../invalid-whole/device-w-negative.json | 27 ++ .../invalid-whole/format-h-negative.json | 20 ++ .../invalid-whole/format-hratio-negative.json | 21 ++ .../invalid-whole/format-w-negative.json | 20 ++ .../invalid-whole/format-wmin-negative.json | 21 ++ .../invalid-whole/format-wratio-negative.json | 21 ++ .../user-geo-accuracy-negative.json | 28 ++ .../invalid-whole/video-h-negative.json | 28 ++ .../video-maxbitrate-negative.json | 28 ++ .../video-minbitrate-negative.json | 28 ++ .../invalid-whole/video-w-negative.json | 28 ++ endpoints/openrtb2/video_auction.go | 20 +- endpoints/openrtb2/video_auction_test.go | 136 ++++---- exchange/adapter_util_test.go | 8 +- exchange/auction.go | 20 +- exchange/auction_test.go | 24 +- exchange/bidder.go | 18 +- exchange/bidder_test.go | 83 +++-- exchange/bidder_validate_bids.go | 6 +- exchange/bidder_validate_bids_test.go | 38 +-- exchange/events_test.go | 6 +- exchange/exchange.go | 38 +-- exchange/exchange_test.go | 290 ++++++++--------- exchange/gdpr.go | 6 +- exchange/gdpr_test.go | 28 +- exchange/legacy.go | 32 +- exchange/legacy_test.go | 88 ++--- exchange/targeting.go | 6 +- exchange/targeting_test.go | 46 +-- exchange/utils.go | 36 +-- exchange/utils_test.go | 142 ++++---- go.mod | 5 +- go.sum | 18 +- openrtb_ext/bid_request_video.go | 18 +- openrtb_ext/deal_tier.go | 4 +- openrtb_ext/deal_tier_test.go | 4 +- openrtb_ext/response.go | 6 +- pbs/pbsrequest.go | 54 ++-- pbs/pbsresponse.go | 4 +- prebid_cache_client/client.go | 2 +- prebid_cache_client/prebid_cache.go | 4 +- privacy/ccpa/consentwriter.go | 6 +- privacy/ccpa/consentwriter_test.go | 20 +- privacy/ccpa/parsedpolicy_test.go | 4 +- privacy/ccpa/policy.go | 18 +- privacy/ccpa/policy_test.go | 144 ++++----- privacy/enforcement.go | 8 +- privacy/enforcement_test.go | 22 +- privacy/gdpr/consentwriter.go | 7 +- privacy/gdpr/consentwriter_test.go | 40 +-- privacy/lmt/ios.go | 14 +- privacy/lmt/ios_test.go | 140 ++++---- privacy/lmt/policy.go | 6 +- privacy/lmt/policy_test.go | 14 +- privacy/scrubber.go | 16 +- privacy/scrubber_test.go | 78 ++--- privacy/writer.go | 8 +- privacy/writer_test.go | 6 +- router/router.go | 2 +- 247 files changed, 3701 insertions(+), 3104 deletions(-) create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/audio-maxbitrate-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/audio-maxseq-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/audio-minbitrate-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/audio-sequence-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/banner-h-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/banner-w-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/device-geo-accuracy-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/device-h-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/device-ppi-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/device-w-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/format-h-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/format-hratio-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/format-w-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/format-wmin-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/format-wratio-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/user-geo-accuracy-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/video-h-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/video-maxbitrate-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/video-minbitrate-negative.json create mode 100644 endpoints/openrtb2/sample-requests/invalid-whole/video-w-negative.json diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index a48c18e9f58..bc7229eda99 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -51,7 +51,7 @@ type bidTtxExt struct { } // MakeRequests create the object for TTX Reqeust. -func (a *TtxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TtxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -77,14 +77,14 @@ func (a *TtxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters return adapterRequests, errs } -func (a *TtxAdapter) makeRequest(request openrtb.BidRequest, imp openrtb.Imp) (*adapters.RequestData, error) { +func (a *TtxAdapter) makeRequest(request openrtb2.BidRequest, imp openrtb2.Imp) (*adapters.RequestData, error) { impCopy, err := makeImps(imp) if err != nil { return nil, err } - request.Imp = []openrtb.Imp{*impCopy} + request.Imp = []openrtb2.Imp{*impCopy} // Last Step reqJSON, err := json.Marshal(request) @@ -103,7 +103,7 @@ func (a *TtxAdapter) makeRequest(request openrtb.BidRequest, imp openrtb.Imp) (* }, nil } -func makeImps(imp openrtb.Imp) (*openrtb.Imp, error) { +func makeImps(imp openrtb2.Imp) (*openrtb2.Imp, error) { if imp.Banner == nil && imp.Video == nil { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Imp ID %s must have at least one of [Banner, Video] defined", imp.ID), @@ -158,7 +158,7 @@ func makeImps(imp openrtb.Imp) (*openrtb.Imp, error) { return &imp, nil } -func makeReqExt(request *openrtb.BidRequest) ([]byte, error) { +func makeReqExt(request *openrtb2.BidRequest) ([]byte, error) { var reqExt reqExt if len(request.Ext) > 0 { @@ -181,7 +181,7 @@ func makeReqExt(request *openrtb.BidRequest) ([]byte, error) { } // MakeBids make the bids for the bid response. -func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -198,7 +198,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -227,7 +227,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque } -func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, error) { +func validateVideoParams(video *openrtb2.Video, prod string) (*openrtb2.Video, error) { videoCopy := *video if videoCopy.W == 0 || videoCopy.H == 0 || @@ -248,7 +248,7 @@ func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, err videoCopy.Placement = 1 if videoCopy.StartDelay == nil { - videoCopy.StartDelay = openrtb.StartDelay.Ptr(0) + videoCopy.StartDelay = openrtb2.StartDelay.Ptr(0) } } diff --git a/adapters/acuityads/acuityads.go b/adapters/acuityads/acuityads.go index 9c6f73c27f0..a461dada391 100644 --- a/adapters/acuityads/acuityads.go +++ b/adapters/acuityads/acuityads.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -31,7 +31,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getHeaders(request *openrtb.BidRequest) http.Header { +func getHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -55,7 +55,7 @@ func getHeaders(request *openrtb.BidRequest) http.Header { } func (a *AcuityAdsAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -87,7 +87,7 @@ func (a *AcuityAdsAdapter) MakeRequests( }}, nil } -func (a *AcuityAdsAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtAcuityAds, error) { +func (a *AcuityAdsAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtAcuityAds, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -136,7 +136,7 @@ func (a *AcuityAdsAdapter) checkResponseStatusCodes(response *adapters.ResponseD } func (a *AcuityAdsAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -153,7 +153,7 @@ func (a *AcuityAdsAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Bad Server Response", @@ -178,7 +178,7 @@ func (a *AcuityAdsAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/adapterstest/adapter_test_util.go b/adapters/adapterstest/adapter_test_util.go index a5b3bb8b3f1..0c51a74e6b6 100644 --- a/adapters/adapterstest/adapter_test_util.go +++ b/adapters/adapterstest/adapter_test_util.go @@ -8,13 +8,13 @@ import ( "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" ) // OrtbMockService Represents a scaffolded OpenRTB service. type OrtbMockService struct { Server *httptest.Server - LastBidRequest *openrtb.BidRequest + LastBidRequest *openrtb2.BidRequest LastHttpRequest *http.Request } @@ -30,8 +30,8 @@ func BidOnTags(tags string) map[string]bool { } // SampleBid Produces a sample bid based on params given. -func SampleBid(width *uint64, height *uint64, impId string, index int) openrtb.Bid { - return openrtb.Bid{ +func SampleBid(width *int64, height *int64, impId string, index int) openrtb2.Bid { + return openrtb2.Bid{ ID: "Bid-123", ImpID: fmt.Sprintf("div-adunit-%d", index), Price: 2.1, @@ -64,7 +64,7 @@ func VerifyBoolValue(value bool, expected bool, t *testing.T) { } // VerifyBannerSize helper function to assert banner size -func VerifyBannerSize(banner *openrtb.Banner, expectedWidth int, expectedHeight int, t *testing.T) { +func VerifyBannerSize(banner *openrtb2.Banner, expectedWidth int, expectedHeight int, t *testing.T) { VerifyIntValue(int(*(banner.W)), expectedWidth, t) VerifyIntValue(int(*(banner.H)), expectedHeight, t) } diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index 1e3178ed23d..e33dbddaecf 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" @@ -128,7 +128,7 @@ func runSpec(t *testing.T, filename string, spec *testSpec, bidder adapters.Bidd } type testSpec struct { - BidRequest openrtb.BidRequest `json:"mockBidRequest"` + BidRequest openrtb2.BidRequest `json:"mockBidRequest"` HttpCalls []httpCall `json:"httpCalls"` BidResponses []expectedBidResponse `json:"expectedBidResponses"` MakeRequestErrors []testSpecExpectedError `json:"expectedMakeRequestsErrors"` @@ -281,7 +281,7 @@ func diffBids(t *testing.T, description string, actual *adapters.TypedBid, expec } // diffOrtbBids compares the actual Bid made by the adapter to the expectation from the JSON file. -func diffOrtbBids(t *testing.T, description string, actual *openrtb.Bid, expected json.RawMessage) { +func diffOrtbBids(t *testing.T, description string, actual *openrtb2.Bid, expected json.RawMessage) { if actual == nil { t.Errorf("Bidders cannot return nil Bids. %s was nil.", description) return diff --git a/adapters/adform/adform.go b/adapters/adform/adform.go index 79bac580f0b..df294b56154 100644 --- a/adapters/adform/adform.go +++ b/adapters/adform/adform.go @@ -13,14 +13,13 @@ import ( "strconv" "strings" + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v14/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" "github.com/prebid/prebid-server/pbs" - - "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" "golang.org/x/net/context/ctxhttp" ) @@ -235,8 +234,8 @@ func toPBSBidSlice(adformBids []*adformBid, r *adformRequest) pbs.PBSBidSlice { BidderCode: r.bidderCode, Price: bid.Price, Adm: adm, - Width: bid.Width, - Height: bid.Height, + Width: int64(bid.Width), + Height: int64(bid.Height), DealId: bid.DealId, Creative_id: bid.CreativeId, CreativeMediaType: string(bidType), @@ -374,7 +373,7 @@ func NewAdformLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, endpointURL } } -func (a *AdformAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdformAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { adformRequest, errors := openRtbToAdformRequest(request) if len(adformRequest.adUnits) == 0 { return nil, errors @@ -392,7 +391,7 @@ func (a *AdformAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt return requests, errors } -func openRtbToAdformRequest(request *openrtb.BidRequest) (*adformRequest, []error) { +func openRtbToAdformRequest(request *openrtb2.BidRequest) (*adformRequest, []error) { adUnits := make([]*adformAdUnit, 0, len(request.Imp)) errors := make([]error, 0, len(request.Imp)) secure := false @@ -529,35 +528,35 @@ func encodeEids(eids []openrtb_ext.ExtUserEid) string { return encodedEids } -func getIPSafely(device *openrtb.Device) string { +func getIPSafely(device *openrtb2.Device) string { if device == nil { return "" } return device.IP } -func getIFASafely(device *openrtb.Device) string { +func getIFASafely(device *openrtb2.Device) string { if device == nil { return "" } return device.IFA } -func getUASafely(device *openrtb.Device) string { +func getUASafely(device *openrtb2.Device) string { if device == nil { return "" } return device.UA } -func getBuyerUIDSafely(user *openrtb.User) string { +func getBuyerUIDSafely(user *openrtb2.User) string { if user == nil { return "" } return user.BuyerUID } -func (a *AdformAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdformAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -584,7 +583,7 @@ func (a *AdformAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, nil } -func toOpenRtbBidResponse(adformBids []*adformBid, r *openrtb.BidRequest) *adapters.BidderResponse { +func toOpenRtbBidResponse(adformBids []*adformBid, r *openrtb2.BidRequest) *adapters.BidderResponse { bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(adformBids)) currency := bidResponse.Currency @@ -598,13 +597,13 @@ func toOpenRtbBidResponse(adformBids []*adformBid, r *openrtb.BidRequest) *adapt continue } - openRtbBid := openrtb.Bid{ + openRtbBid := openrtb2.Bid{ ID: r.Imp[i].ID, ImpID: r.Imp[i].ID, Price: bid.Price, AdM: adm, - W: bid.Width, - H: bid.Height, + W: int64(bid.Width), + H: int64(bid.Height), DealID: bid.DealId, CrID: bid.CreativeId, } diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index 558453e4030..f2056c499c5 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/pbs" @@ -17,7 +18,6 @@ import ( "fmt" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -172,7 +172,7 @@ func TestAdformBasicResponse(t *testing.T) { if bid.Price != tag.price { t.Errorf("Incorrect bid price '%.2f' expected '%.2f'", bid.Price, tag.price) } - if bid.Width != adformTestData.width || bid.Height != adformTestData.height { + if bid.Width != int64(adformTestData.width) || bid.Height != int64(adformTestData.height) { t.Errorf("Incorrect bid size %dx%d, expected %dx%d", bid.Width, bid.Height, adformTestData.width, adformTestData.height) } if bid.Adm != tag.content { @@ -249,7 +249,7 @@ func preparePrebidRequest(serverUrl string, t *testing.T) *pbs.PBSRequest { // so User and Regs are copied from OpenRTB request, see legacy.go -> toLegacyRequest regs := getRegs() r.Regs = ®s - user := openrtb.User{ + user := openrtb2.User{ Ext: getUserExt(), } r.User = &user @@ -260,7 +260,7 @@ func preparePrebidRequest(serverUrl string, t *testing.T) *pbs.PBSRequest { func preparePrebidRequestBody(requestData aBidInfo, t *testing.T) *bytes.Buffer { prebidRequest := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 4), - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: requestData.deviceUA, IP: requestData.deviceIP, IFA: requestData.deviceIFA, @@ -271,10 +271,10 @@ func preparePrebidRequestBody(requestData aBidInfo, t *testing.T) *bytes.Buffer for i, tag := range requestData.tags { prebidRequest.AdUnits[i] = pbs.AdUnit{ Code: tag.code, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { - W: requestData.width, - H: requestData.height, + W: int64(requestData.width), + H: int64(requestData.height), }, }, Bids: []pbs.Bids{ @@ -332,16 +332,16 @@ func TestOpenRTBRequest(t *testing.T) { func TestOpenRTBIncorrectRequest(t *testing.T) { bidder := new(AdformAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ {ID: "incorrect-bidder-field", Ext: json.RawMessage(`{"bidder1": { "mid": "32344" }}`)}, {ID: "incorrect-adform-params", Ext: json.RawMessage(`{"bidder": { : "33" }}`)}, {ID: "mid-integer", Ext: json.RawMessage(`{"bidder": { "mid": 1.234 }}`)}, {ID: "mid-greater-then-zero", Ext: json.RawMessage(`{"bidder": { "mid": -1 }}`)}, }, - Device: &openrtb.Device{UA: "ua", IP: "ip"}, - User: &openrtb.User{BuyerUID: "buyerUID"}, + Device: &openrtb2.Device{UA: "ua", IP: "ip"}, + User: &openrtb2.User{BuyerUID: "buyerUID"}, } httpRequests, errs := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) @@ -374,36 +374,36 @@ func createTestData(secure bool) aBidInfo { return testData } -func createOpenRtbRequest(testData *aBidInfo) *openrtb.BidRequest { +func createOpenRtbRequest(testData *aBidInfo) *openrtb2.BidRequest { secure := int8(0) if testData.secure { secure = int8(1) } - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: make([]openrtb.Imp, len(testData.tags)), - Site: &openrtb.Site{ + Imp: make([]openrtb2.Imp, len(testData.tags)), + Site: &openrtb2.Site{ Page: testData.referrer, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: testData.deviceUA, IP: testData.deviceIP, IFA: testData.deviceIFA, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: testData.tid, }, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: testData.buyerUID, }, } for i, tag := range testData.tags { - bidRequest.Imp[i] = openrtb.Imp{ + bidRequest.Imp[i] = openrtb2.Imp{ ID: tag.code, Secure: &secure, Ext: json.RawMessage(fmt.Sprintf("{\"bidder\": %s}", formatAdUnitJson(tag))), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, } } @@ -457,7 +457,7 @@ func TestOpenRTBStandardResponse(t *testing.T) { if bid.Price != tag.price { t.Errorf("Incorrect bid price '%.2f' expected '%.2f'", bid.Price, tag.price) } - if bid.W != testData.width || bid.H != testData.height { + if bid.W != int64(testData.width) || bid.H != int64(testData.height) { t.Errorf("Incorrect bid size %dx%d, expected %dx%d", bid.W, bid.H, testData.width, testData.height) } if bid.AdM != tag.content { @@ -511,12 +511,12 @@ func TestAdformProperties(t *testing.T) { // helpers -func getRegs() openrtb.Regs { +func getRegs() openrtb2.Regs { var gdpr int8 = 1 regsExt := openrtb_ext.ExtRegs{ GDPR: &gdpr, } - regs := openrtb.Regs{} + regs := openrtb2.Regs{} regsExtData, err := json.Marshal(regsExt) if err == nil { regs.Ext = regsExtData @@ -689,37 +689,37 @@ func TestToOpenRtbBidResponse(t *testing.T) { expectedBids := 4 lastCurrency, anotherCurrency, emptyCurrency := "EUR", "USD", "" - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "banner-imp-no1", Ext: json.RawMessage(`{"bidder1": { "mid": "32341" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "banner-imp-no2", Ext: json.RawMessage(`{"bidder1": { "mid": "32342" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "banner-imp-no3", Ext: json.RawMessage(`{"bidder1": { "mid": "32343" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "banner-imp-no4", Ext: json.RawMessage(`{"bidder1": { "mid": "32344" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "video-imp-no4", Ext: json.RawMessage(`{"bidder1": { "mid": "32345" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, }, - Device: &openrtb.Device{UA: "ua", IP: "ip"}, - User: &openrtb.User{BuyerUID: "buyerUID"}, + Device: &openrtb2.Device{UA: "ua", IP: "ip"}, + User: &openrtb2.User{BuyerUID: "buyerUID"}, } testAdformBids := []*adformBid{ diff --git a/adapters/adgeneration/adgeneration.go b/adapters/adgeneration/adgeneration.go index b726d0c103a..fd87c6f4034 100644 --- a/adapters/adgeneration/adgeneration.go +++ b/adapters/adgeneration/adgeneration.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -41,7 +41,7 @@ type adgServerResponse struct { Results []interface{} `json:"results"` } -func (adg *AdgenerationAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adg *AdgenerationAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { numRequests := len(request.Imp) var errs []error @@ -79,7 +79,7 @@ func (adg *AdgenerationAdapter) MakeRequests(request *openrtb.BidRequest, reqInf return bidRequestArray, errs } -func (adg *AdgenerationAdapter) getRequestUri(request *openrtb.BidRequest, index int) (string, error) { +func (adg *AdgenerationAdapter) getRequestUri(request *openrtb2.BidRequest, index int) (string, error) { imp := request.Imp[index] adgExt, err := unmarshalExtImpAdgeneration(&imp) if err != nil { @@ -98,7 +98,7 @@ func (adg *AdgenerationAdapter) getRequestUri(request *openrtb.BidRequest, index return uriObj.String(), err } -func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb.BidRequest, imp *openrtb.Imp) *url.Values { +func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb2.BidRequest, imp *openrtb2.Imp) *url.Values { v := url.Values{} v.Set("posall", "SSPLOC") v.Set("id", id) @@ -121,7 +121,7 @@ func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb.BidReque return &v } -func unmarshalExtImpAdgeneration(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdgeneration, error) { +func unmarshalExtImpAdgeneration(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdgeneration, error) { var bidderExt adapters.ExtImpBidder var adgExt openrtb_ext.ExtImpAdgeneration if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { @@ -136,13 +136,13 @@ func unmarshalExtImpAdgeneration(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdgenerat return &adgExt, nil } -func getSizes(imp *openrtb.Imp) string { +func getSizes(imp *openrtb2.Imp) string { if imp.Banner == nil || len(imp.Banner.Format) == 0 { return "" } var sizeStr string for _, v := range imp.Banner.Format { - sizeStr += strconv.FormatUint(v.W, 10) + "x" + strconv.FormatUint(v.H, 10) + "," + sizeStr += strconv.FormatInt(v.W, 10) + "x" + strconv.FormatInt(v.H, 10) + "," } if len(sizeStr) > 0 && strings.LastIndex(sizeStr, ",") == len(sizeStr)-1 { sizeStr = sizeStr[:len(sizeStr)-1] @@ -150,7 +150,7 @@ func getSizes(imp *openrtb.Imp) string { return sizeStr } -func (adg *AdgenerationAdapter) getCurrency(request *openrtb.BidRequest) string { +func (adg *AdgenerationAdapter) getCurrency(request *openrtb2.BidRequest) string { if len(request.Cur) <= 0 { return adg.defaultCurrency } else { @@ -163,7 +163,7 @@ func (adg *AdgenerationAdapter) getCurrency(request *openrtb.BidRequest) string } } -func (adg *AdgenerationAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adg *AdgenerationAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -202,13 +202,13 @@ func (adg *AdgenerationAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex impId = v.ID bitType = openrtb_ext.BidTypeBanner adm = createAd(&bidResp, impId) - bid := openrtb.Bid{ + bid := openrtb2.Bid{ ID: bidResp.Locationid, ImpID: impId, AdM: adm, Price: bidResp.Cpm, - W: bidResp.W, - H: bidResp.H, + W: int64(bidResp.W), + H: int64(bidResp.H), CrID: bidResp.Creativeid, DealID: bidResp.Dealid, } diff --git a/adapters/adgeneration/adgeneration_test.go b/adapters/adgeneration/adgeneration_test.go index f63c99cb92d..01fff96ede1 100644 --- a/adapters/adgeneration/adgeneration_test.go +++ b/adapters/adgeneration/adgeneration_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -34,27 +34,27 @@ func TestgetRequestUri(t *testing.T) { bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) // Test items - failedRequest := &openrtb.BidRequest{ + failedRequest := &openrtb2.BidRequest{ ID: "test-failed-bid-request", - Imp: []openrtb.Imp{ - {ID: "extImpBidder-failed-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{{ "id": "58278" }}`)}, - {ID: "extImpBidder-failed-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"_bidder": { "id": "58278" }}`)}, - {ID: "extImpAdgeneration-failed-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "_id": "58278" }}`)}, + Imp: []openrtb2.Imp{ + {ID: "extImpBidder-failed-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{{ "id": "58278" }}`)}, + {ID: "extImpBidder-failed-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"_bidder": { "id": "58278" }}`)}, + {ID: "extImpAdgeneration-failed-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "_id": "58278" }}`)}, }, - Source: &openrtb.Source{TID: "SourceTID"}, - Device: &openrtb.Device{UA: "testUA", IP: "testIP"}, - Site: &openrtb.Site{Page: "https://supership.com"}, - User: &openrtb.User{BuyerUID: "buyerID"}, + Source: &openrtb2.Source{TID: "SourceTID"}, + Device: &openrtb2.Device{UA: "testUA", IP: "testIP"}, + Site: &openrtb2.Site{Page: "https://supership.com"}, + User: &openrtb2.User{BuyerUID: "buyerID"}, } - successRequest := &openrtb.BidRequest{ + successRequest := &openrtb2.BidRequest{ ID: "test-success-bid-request", - Imp: []openrtb.Imp{ - {ID: "bidRequest-success-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, + Imp: []openrtb2.Imp{ + {ID: "bidRequest-success-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, }, - Source: &openrtb.Source{TID: "SourceTID"}, - Device: &openrtb.Device{UA: "testUA", IP: "testIP"}, - Site: &openrtb.Site{Page: "https://supership.com"}, - User: &openrtb.User{BuyerUID: "buyerID"}, + Source: &openrtb2.Source{TID: "SourceTID"}, + Device: &openrtb2.Device{UA: "testUA", IP: "testIP"}, + Site: &openrtb2.Site{Page: "https://supership.com"}, + User: &openrtb2.User{BuyerUID: "buyerID"}, } numRequests := len(failedRequest.Imp) @@ -108,23 +108,23 @@ func TestgetRequestUri(t *testing.T) { func TestGetSizes(t *testing.T) { // Test items - var request *openrtb.Imp + var request *openrtb2.Imp var size string - multiFormatBanner := &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 320, H: 50}}} - noFormatBanner := &openrtb.Banner{Format: []openrtb.Format{}} - nativeFormat := &openrtb.Native{} + multiFormatBanner := &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 320, H: 50}}} + noFormatBanner := &openrtb2.Banner{Format: []openrtb2.Format{}} + nativeFormat := &openrtb2.Native{} - request = &openrtb.Imp{Banner: multiFormatBanner} + request = &openrtb2.Imp{Banner: multiFormatBanner} size = getSizes(request) if size != "300x250,320x50" { t.Errorf("%v does not match size.", multiFormatBanner) } - request = &openrtb.Imp{Banner: noFormatBanner} + request = &openrtb2.Imp{Banner: noFormatBanner} size = getSizes(request) if size != "" { t.Errorf("%v does not match size.", noFormatBanner) } - request = &openrtb.Imp{Native: nativeFormat} + request = &openrtb2.Imp{Native: nativeFormat} size = getSizes(request) if size != "" { t.Errorf("%v does not match size.", nativeFormat) @@ -142,17 +142,17 @@ func TestGetCurrency(t *testing.T) { bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) // Test items - var request *openrtb.BidRequest + var request *openrtb2.BidRequest var currency string innerDefaultCur := []string{"USD", "JPY"} usdCur := []string{"USD", "EUR"} - request = &openrtb.BidRequest{Cur: innerDefaultCur} + request = &openrtb2.BidRequest{Cur: innerDefaultCur} currency = bidderAdgeneration.getCurrency(request) if currency != "JPY" { t.Errorf("%v does not match currency.", innerDefaultCur) } - request = &openrtb.BidRequest{Cur: usdCur} + request = &openrtb2.BidRequest{Cur: usdCur} currency = bidderAdgeneration.getCurrency(request) if currency != "USD" { t.Errorf("%v does not match currency.", usdCur) @@ -212,14 +212,14 @@ func TestMakeBids(t *testing.T) { bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) - internalRequest := &openrtb.BidRequest{ + internalRequest := &openrtb2.BidRequest{ ID: "test-success-bid-request", - Imp: []openrtb.Imp{ - {ID: "bidRequest-success-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, + Imp: []openrtb2.Imp{ + {ID: "bidRequest-success-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, }, - Device: &openrtb.Device{UA: "testUA", IP: "testIP"}, - Site: &openrtb.Site{Page: "https://supership.com"}, - User: &openrtb.User{BuyerUID: "buyerID"}, + Device: &openrtb2.Device{UA: "testUA", IP: "testIP"}, + Site: &openrtb2.Site{Page: "https://supership.com"}, + User: &openrtb2.User{BuyerUID: "buyerID"}, } externalRequest := adapters.RequestData{} response := adapters.ResponseData{ @@ -254,8 +254,8 @@ func checkBidResponse(t *testing.T, bidderResponse *adapters.BidderResponse, exp var expectedID string = "58278" var expectedImpID = "bidRequest-success-test" var expectedPrice float64 = 30.0 - var expectedW uint64 = 300 - var expectedH uint64 = 250 + var expectedW int64 = 300 + var expectedH int64 = 250 var expectedCrID string = "Dummy_supership.jp" var extectedDealID string = "test-deal-id" diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index e13c03a101d..773b3b98fd6 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -11,7 +11,7 @@ import ( "text/template" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -57,7 +57,7 @@ func extractTargetParameters(parameters openrtb_ext.ExtImpAdhese) string { return parametersAsString } -func extractGdprParameter(request *openrtb.BidRequest) string { +func extractGdprParameter(request *openrtb2.BidRequest) string { if request.User != nil { var extUser openrtb_ext.ExtUser if err := json.Unmarshal(request.User.Ext, &extUser); err == nil { @@ -67,21 +67,21 @@ func extractGdprParameter(request *openrtb.BidRequest) string { return "" } -func extractRefererParameter(request *openrtb.BidRequest) string { +func extractRefererParameter(request *openrtb2.BidRequest) string { if request.Site != nil && request.Site.Page != "" { return "/xf" + url.QueryEscape(request.Site.Page) } return "" } -func extractIfaParameter(request *openrtb.BidRequest) string { +func extractIfaParameter(request *openrtb2.BidRequest) string { if request.Device != nil && request.Device.IFA != "" { return "/xz" + url.QueryEscape(request.Device.IFA) } return "" } -func (a *AdheseAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdheseAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var err error @@ -128,14 +128,14 @@ func (a *AdheseAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt }}, errs } -func (a *AdheseAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdheseAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } else if response.StatusCode != http.StatusOK { return nil, []error{WrapServerError(fmt.Sprintf("Unexpected status code: %d.", response.StatusCode))} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse var adheseBidResponseArray []AdheseBid if err := json.Unmarshal(response.Body, &adheseBidResponseArray); err != nil { @@ -163,11 +163,11 @@ func (a *AdheseAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe if err != nil { return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Price %v as float ", string(adheseBid.Extension.Prebid.Cpm.Amount)))} } - width, err := strconv.ParseUint(adheseBid.Width, 10, 64) + width, err := strconv.ParseInt(adheseBid.Width, 10, 64) if err != nil { return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Width %v as int ", string(adheseBid.Width)))} } - height, err := strconv.ParseUint(adheseBid.Height, 10, 64) + height, err := strconv.ParseInt(adheseBid.Height, 10, 64) if err != nil { return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Height %v as int ", string(adheseBid.Height)))} } @@ -198,16 +198,16 @@ func (a *AdheseAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidderResponse, errs } -func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData AdheseOriginData) openrtb.BidResponse { +func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData AdheseOriginData) openrtb2.BidResponse { adheseExtJson, err := json.Marshal(adheseOriginData) if err != nil { glog.Error(fmt.Sprintf("Unable to parse adhese Origin Data as JSON due to %v", err)) adheseExtJson = make([]byte, 0) } - return openrtb.BidResponse{ + return openrtb2.BidResponse{ ID: adheseExt.Id, - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ DealID: adheseExt.OrderId, CrID: adheseExt.Id, AdM: getAdMarkup(adheseBid, adheseExt), @@ -218,8 +218,8 @@ func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData } } -func convertAdheseOpenRtbBid(adheseBid AdheseBid) openrtb.BidResponse { - var response openrtb.BidResponse = adheseBid.OriginData +func convertAdheseOpenRtbBid(adheseBid AdheseBid) openrtb2.BidResponse { + var response openrtb2.BidResponse = adheseBid.OriginData if len(response.SeatBid) > 0 && len(response.SeatBid[0].Bid) > 0 { response.SeatBid[0].Bid[0].AdM = adheseBid.Body } diff --git a/adapters/adhese/utils.go b/adapters/adhese/utils.go index 9983be96d38..c83f9ef1480 100644 --- a/adapters/adhese/utils.go +++ b/adapters/adhese/utils.go @@ -1,6 +1,6 @@ package adhese -import "github.com/mxmCherry/openrtb" +import "github.com/mxmCherry/openrtb/v14/openrtb2" type AdheseOriginData struct { Priority string `json:"priority"` @@ -22,13 +22,13 @@ type AdheseExt struct { } type AdheseBid struct { - Origin string `json:"origin"` - OriginData openrtb.BidResponse `json:"originData"` - OriginInstance string `json:"originInstance,omitempty"` - Body string `json:"body,omitempty"` - Height string `json:"height"` - Width string `json:"width"` - Extension Prebid `json:"extension"` + Origin string `json:"origin"` + OriginData openrtb2.BidResponse `json:"originData"` + OriginInstance string `json:"originInstance,omitempty"` + Body string `json:"body,omitempty"` + Height string `json:"height"` + Width string `json:"width"` + Extension Prebid `json:"extension"` } type Prebid struct { diff --git a/adapters/adkernel/adkernel.go b/adapters/adkernel/adkernel.go index 6bedeec612f..93fb3c6f93d 100644 --- a/adapters/adkernel/adkernel.go +++ b/adapters/adkernel/adkernel.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -20,7 +20,7 @@ type adkernelAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *adkernelAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *adkernelAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, newBadInputError("No impression in the bid request")) @@ -52,10 +52,10 @@ func (adapter *adkernelAdapter) MakeRequests(request *openrtb.BidRequest, reqInf } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImpAdkernel, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) ([]openrtb2.Imp, []openrtb_ext.ExtImpAdkernel, []error) { impsCount := len(imps) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) resImpExts := make([]openrtb_ext.ExtImpAdkernel, 0, impsCount) for _, imp := range imps { @@ -74,7 +74,7 @@ func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImp return resImps, resImpExts, errors } -func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernel) error { +func validateImpression(imp *openrtb2.Imp, impExt *openrtb_ext.ExtImpAdkernel) error { if impExt.ZoneId < 1 { return newBadInputError(fmt.Sprintf("Invalid zoneId value: %d. Ignoring imp id=%s", impExt.ZoneId, imp.ID)) } @@ -88,8 +88,8 @@ func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernel) er } //Group impressions by AdKernel-specific parameters `zoneId` & `host` -func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkernel) (map[openrtb_ext.ExtImpAdkernel][]openrtb.Imp, []error) { - res := make(map[openrtb_ext.ExtImpAdkernel][]openrtb.Imp) +func dispatchImpressions(imps []openrtb2.Imp, impsExt []openrtb_ext.ExtImpAdkernel) (map[openrtb_ext.ExtImpAdkernel][]openrtb2.Imp, []error) { + res := make(map[openrtb_ext.ExtImpAdkernel][]openrtb2.Imp) errors := make([]error, 0) for idx := range imps { imp := imps[idx] @@ -100,7 +100,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } impExt := impsExt[idx] if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) } @@ -108,7 +108,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } //Alter impression info to comply with adkernel platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to adkernel platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -119,21 +119,21 @@ func compatImpression(imp *openrtb.Imp) error { return newBadInputError("Invalid impression") } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { imp.Audio = nil imp.Video = nil imp.Native = nil return nil } -func compatVideoImpression(imp *openrtb.Imp) error { +func compatVideoImpression(imp *openrtb2.Imp) error { imp.Banner = nil imp.Audio = nil imp.Native = nil return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernel, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdkernel, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -149,7 +149,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernel, error) { return &adkernelExt, nil } -func (adapter *adkernelAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *adkernelAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -173,7 +173,7 @@ func (adapter *adkernelAdapter) buildAdapterRequest(prebidBidRequest *openrtb.Bi Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps if bidRequest.Site != nil { @@ -198,7 +198,7 @@ func (adapter *adkernelAdapter) buildEndpointURL(params *openrtb_ext.ExtImpAdker } //MakeBids translates adkernel bid response to prebid-server specific format -func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -207,7 +207,7 @@ func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex newBadServerResponseError(fmt.Sprintf("Unexpected http status code: %d", response.StatusCode)), } } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{ newBadServerResponseError(fmt.Sprintf("Bad server response: %d", err)), @@ -233,7 +233,7 @@ func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Banner != nil { return openrtb_ext.BidTypeBanner diff --git a/adapters/adkernelAdn/adkernelAdn.go b/adapters/adkernelAdn/adkernelAdn.go index acd27c9e894..01024baad61 100644 --- a/adapters/adkernelAdn/adkernelAdn.go +++ b/adapters/adkernelAdn/adkernelAdn.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -22,7 +22,7 @@ type adkernelAdnAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *adkernelAdnAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *adkernelAdnAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, newBadInputError("No impression in the bid request")) @@ -54,10 +54,10 @@ func (adapter *adkernelAdnAdapter) MakeRequests(request *openrtb.BidRequest, req } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImpAdkernelAdn, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) ([]openrtb2.Imp, []openrtb_ext.ExtImpAdkernelAdn, []error) { impsCount := len(imps) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) resImpExts := make([]openrtb_ext.ExtImpAdkernelAdn, 0, impsCount) for _, imp := range imps { @@ -77,7 +77,7 @@ func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImp return resImps, resImpExts, errors } -func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernelAdn) error { +func validateImpression(imp *openrtb2.Imp, impExt *openrtb_ext.ExtImpAdkernelAdn) error { if impExt.PublisherID < 1 { return newBadInputError(fmt.Sprintf("Invalid pubId value. Ignoring imp id=%s", imp.ID)) } @@ -88,8 +88,8 @@ func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernelAdn) } //Group impressions by AdKernel-specific parameters `pubId` & `host` -func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkernelAdn) (map[openrtb_ext.ExtImpAdkernelAdn][]openrtb.Imp, []error) { - res := make(map[openrtb_ext.ExtImpAdkernelAdn][]openrtb.Imp) +func dispatchImpressions(imps []openrtb2.Imp, impsExt []openrtb_ext.ExtImpAdkernelAdn) (map[openrtb_ext.ExtImpAdkernelAdn][]openrtb2.Imp, []error) { + res := make(map[openrtb_ext.ExtImpAdkernelAdn][]openrtb2.Imp) errors := make([]error, 0) for idx := range imps { imp := imps[idx] @@ -100,7 +100,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } impExt := impsExt[idx] if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) @@ -109,7 +109,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } //Alter impression info to comply with adkernel platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to adkernel platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -120,7 +120,7 @@ func compatImpression(imp *openrtb.Imp) error { return newBadInputError("Unsupported impression has been received") } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner banner := &bannerCopy @@ -143,14 +143,14 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func compatVideoImpression(imp *openrtb.Imp) error { +func compatVideoImpression(imp *openrtb2.Imp) error { imp.Banner = nil imp.Audio = nil imp.Native = nil return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernelAdn, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdkernelAdn, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -166,7 +166,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernelAdn, error) return &adkernelAdnExt, nil } -func (adapter *adkernelAdnAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *adkernelAdnAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -190,7 +190,7 @@ func (adapter *adkernelAdnAdapter) buildAdapterRequest(prebidBidRequest *openrtb Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps @@ -222,7 +222,7 @@ func (adapter *adkernelAdnAdapter) buildEndpointURL(params *openrtb_ext.ExtImpAd } //MakeBids translates adkernel bid response to prebid-server specific format -func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -231,7 +231,7 @@ func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb.BidRequest, newBadServerResponseError(fmt.Sprintf("Unexpected http status code: %d", response.StatusCode)), } } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{ newBadServerResponseError(fmt.Sprintf("Bad server response: %d", err)), @@ -257,7 +257,7 @@ func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb.BidRequest, } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Banner != nil { return openrtb_ext.BidTypeBanner diff --git a/adapters/adman/adman.go b/adapters/adman/adman.go index e0f67db816f..0eab6204b6d 100644 --- a/adapters/adman/adman.go +++ b/adapters/adman/adman.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -30,7 +30,7 @@ type admanParams struct { } // MakeRequests create bid request for adman demand -func (a *AdmanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdmanAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var admanExt openrtb_ext.ExtImpAdman var err error @@ -39,7 +39,7 @@ func (a *AdmanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} var bidderExt adapters.ExtImpBidder if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { @@ -63,7 +63,7 @@ func (a *AdmanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte return adapterRequests, errs } -func (a *AdmanAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *AdmanAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -86,7 +86,7 @@ func (a *AdmanAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Reque } // MakeBids makes the bids -func (a *AdmanAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdmanAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -99,7 +99,7 @@ func (a *AdmanAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -124,7 +124,7 @@ func (a *AdmanAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/adman/admantest/supplemental/bad_response.json b/adapters/adman/admantest/supplemental/bad_response.json index d5a28c74256..4431a328154 100644 --- a/adapters/adman/admantest/supplemental/bad_response.json +++ b/adapters/adman/admantest/supplemental/bad_response.json @@ -78,7 +78,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index eff93746df2..86d7bfd9d5f 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -28,7 +28,7 @@ type admixerImpExt struct { CustomParams map[string]interface{} `json:"customParams"` } -func (a *AdmixerAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) { +func (a *AdmixerAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) { rq, errs := a.makeRequest(request) if len(errs) > 0 { @@ -43,9 +43,9 @@ func (a *AdmixerAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return } -func (a *AdmixerAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *AdmixerAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ @@ -84,7 +84,7 @@ func (a *AdmixerAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Req }, errs } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -126,7 +126,7 @@ func preprocess(imp *openrtb.Imp) error { return nil } -func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -149,7 +149,7 @@ func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -172,7 +172,7 @@ func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR return bidResponse, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/adocean/adocean.go b/adapters/adocean/adocean.go index 43aa067b3a9..97ace405ab0 100644 --- a/adapters/adocean/adocean.go +++ b/adapters/adocean/adocean.go @@ -13,7 +13,7 @@ import ( "strings" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -80,7 +80,7 @@ type AdOceanAdapter struct { measurementCode string } -func (a *AdOceanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdOceanAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impression in the bid request", @@ -119,8 +119,8 @@ func (a *AdOceanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap func (a *AdOceanAdapter) addNewBid( requestsData []*requestData, - imp *openrtb.Imp, - request *openrtb.BidRequest, + imp *openrtb2.Imp, + request *openrtb2.BidRequest, consentString string, ) ([]*requestData, error) { var bidderExt adapters.ExtImpBidder @@ -177,7 +177,7 @@ func (a *AdOceanAdapter) addNewBid( return requestsData, nil } -func addToExistingRequest(requestsData []*requestData, newParams *openrtb_ext.ExtImpAdOcean, imp *openrtb.Imp, testImp bool) bool { +func addToExistingRequest(requestsData []*requestData, newParams *openrtb_ext.ExtImpAdOcean, imp *openrtb2.Imp, testImp bool) bool { auctionID := imp.ID for _, requestData := range requestsData { @@ -209,8 +209,8 @@ func addToExistingRequest(requestsData []*requestData, newParams *openrtb_ext.Ex func (a *AdOceanAdapter) makeURL( params *openrtb_ext.ExtImpAdOcean, - imp *openrtb.Imp, - request *openrtb.BidRequest, + imp *openrtb2.Imp, + request *openrtb2.BidRequest, slaveSizes map[string]string, consentString string, ) (*url.URL, error) { @@ -256,7 +256,7 @@ func (a *AdOceanAdapter) makeURL( return endpointURL, nil } -func getImpSizes(imp *openrtb.Imp) string { +func getImpSizes(imp *openrtb2.Imp) string { if imp.Banner == nil { return "" } @@ -264,14 +264,14 @@ func getImpSizes(imp *openrtb.Imp) string { if len(imp.Banner.Format) > 0 { sizes := make([]string, len(imp.Banner.Format)) for i, format := range imp.Banner.Format { - sizes[i] = strconv.FormatUint(format.W, 10) + "x" + strconv.FormatUint(format.H, 10) + sizes[i] = strconv.FormatInt(format.W, 10) + "x" + strconv.FormatInt(format.H, 10) } return strings.Join(sizes, "_") } if imp.Banner.W != nil && imp.Banner.H != nil { - return strconv.FormatUint(*imp.Banner.W, 10) + "x" + strconv.FormatUint(*imp.Banner.H, 10) + return strconv.FormatInt(*imp.Banner.W, 10) + "x" + strconv.FormatInt(*imp.Banner.H, 10) } return "" @@ -304,7 +304,7 @@ func setSlaveSizesParam(queryParams *url.Values, slaveSizes map[string]string, o } func (a *AdOceanAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -337,8 +337,8 @@ func (a *AdOceanAdapter) MakeBids( } price, _ := strconv.ParseFloat(bid.Price, 64) - width, _ := strconv.ParseUint(bid.Width, 10, 64) - height, _ := strconv.ParseUint(bid.Height, 10, 64) + width, _ := strconv.ParseInt(bid.Width, 10, 64) + height, _ := strconv.ParseInt(bid.Height, 10, 64) adCode, err := a.prepareAdCodeForBid(bid) if err != nil { errors = append(errors, err) @@ -346,7 +346,7 @@ func (a *AdOceanAdapter) MakeBids( } parsedResponses.Bids = append(parsedResponses.Bids, &adapters.TypedBid{ - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ID: bid.ID, ImpID: auctionID, Price: price, diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index adbb177d887..56fae4295b4 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -8,7 +8,7 @@ import ( "net/url" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -50,7 +50,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } func (ads *AdopplerAdapter) MakeRequests( - req *openrtb.BidRequest, + req *openrtb2.BidRequest, info *adapters.ExtraRequestInfo, ) ( []*adapters.RequestData, @@ -69,9 +69,9 @@ func (ads *AdopplerAdapter) MakeRequests( continue } - var r openrtb.BidRequest = *req + var r openrtb2.BidRequest = *req r.ID = req.ID + "-" + ext.AdUnit - r.Imp = []openrtb.Imp{imp} + r.Imp = []openrtb2.Imp{imp} body, err := json.Marshal(r) if err != nil { @@ -99,7 +99,7 @@ func (ads *AdopplerAdapter) MakeRequests( } func (ads *AdopplerAdapter) MakeBids( - intReq *openrtb.BidRequest, + intReq *openrtb2.BidRequest, extReq *adapters.RequestData, resp *adapters.ResponseData, ) ( @@ -119,7 +119,7 @@ func (ads *AdopplerAdapter) MakeBids( return nil, []error{err} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err := json.Unmarshal(resp.Body, &bidResp) if err != nil { err := &errortypes.BadServerResponse{ diff --git a/adapters/adoppler/adopplertest/supplemental/invalid-response.json b/adapters/adoppler/adopplertest/supplemental/invalid-response.json index d0a7d2ef84b..83aa35f0ec1 100644 --- a/adapters/adoppler/adopplertest/supplemental/invalid-response.json +++ b/adapters/adoppler/adopplertest/supplemental/invalid-response.json @@ -49,7 +49,7 @@ ], "expectedMakeBidsErrors":[ { - "value":"invalid body: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value":"invalid body: json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison":"literal" } ] diff --git a/adapters/adot/adot.go b/adapters/adot/adot.go index c58c4a1ee7a..f4fd6c23bdb 100644 --- a/adapters/adot/adot.go +++ b/adapters/adot/adot.go @@ -3,12 +3,13 @@ package adot import ( "encoding/json" "fmt" - "github.com/mxmCherry/openrtb" + "net/http" + + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" - "net/http" ) type adapter struct { @@ -32,7 +33,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var reqJSON []byte var err error @@ -53,7 +54,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex // MakeBids unpacks the server's response into Bids. // The bidder return a status code 204 when it cannot delivery an ad. -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -70,7 +71,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -96,7 +97,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest } // getMediaTypeForBid determines which type of bid. -func getMediaTypeForBid(bid *openrtb.Bid) (openrtb_ext.BidType, error) { +func getMediaTypeForBid(bid *openrtb2.Bid) (openrtb_ext.BidType, error) { if bid == nil { return "", fmt.Errorf("the bid request object is nil") } diff --git a/adapters/adot/adot_test.go b/adapters/adot/adot_test.go index fca6b303626..3cb3d680ebd 100644 --- a/adapters/adot/adot_test.go +++ b/adapters/adot/adot_test.go @@ -2,13 +2,14 @@ package adot import ( "encoding/json" - "github.com/mxmCherry/openrtb" + "testing" + + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" - "testing" ) const testsBidderEndpoint = "https://dsp.adotmob.com/headerbidding/bidrequest" @@ -31,7 +32,7 @@ func TestMediaTypeError(t *testing.T) { assert.Error(t, err) byteInvalid, _ := json.Marshal(&adotBidExt{Adot: bidExt{"invalid"}}) - _, err = getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteInvalid)}) + _, err = getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteInvalid)}) assert.Error(t, err) } @@ -59,17 +60,17 @@ func TestMediaTypeForBid(t *testing.T) { byteVideo, _ := json.Marshal(&adotBidExt{Adot: bidExt{"video"}}) byteNative, _ := json.Marshal(&adotBidExt{Adot: bidExt{"native"}}) - bidTypeBanner, _ := getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteBanner)}) + bidTypeBanner, _ := getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteBanner)}) if bidTypeBanner != openrtb_ext.BidTypeBanner { t.Errorf("the type is not the valid one. actual: %v, expected: %v", bidTypeBanner, openrtb_ext.BidTypeBanner) } - bidTypeVideo, _ := getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteVideo)}) + bidTypeVideo, _ := getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteVideo)}) if bidTypeVideo != openrtb_ext.BidTypeVideo { t.Errorf("the type is not the valid one. actual: %v, expected: %v", bidTypeVideo, openrtb_ext.BidTypeVideo) } - bidTypeNative, _ := getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteNative)}) + bidTypeNative, _ := getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteNative)}) if bidTypeNative != openrtb_ext.BidTypeNative { t.Errorf("the type is not the valid one. actual: %v, expected: %v", bidTypeNative, openrtb_ext.BidTypeVideo) } diff --git a/adapters/adot/adottest/supplemental/unmarshal_error.json b/adapters/adot/adottest/supplemental/unmarshal_error.json index a87e1189a62..3094fa865e4 100644 --- a/adapters/adot/adottest/supplemental/unmarshal_error.json +++ b/adapters/adot/adottest/supplemental/unmarshal_error.json @@ -54,7 +54,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/adpone/adpone.go b/adapters/adpone/adpone.go index 7907ceb1891..ffc36cc5aba 100644 --- a/adapters/adpone/adpone.go +++ b/adapters/adpone/adpone.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" ) @@ -26,7 +26,7 @@ type adponeAdapter struct { } func (adapter *adponeAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -75,7 +75,7 @@ const unexpectedStatusCodeFormat = "" + "Unexpected status code: %d. Run with request.debug = 1 for more info" func (adapter *adponeAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -99,7 +99,7 @@ func (adapter *adponeAdapter) MakeBids( return nil, []error{err} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{err} } diff --git a/adapters/adpone/adponetest/supplemental/bad_response.json b/adapters/adpone/adponetest/supplemental/bad_response.json index 9cbc8b5d9c2..68da7064b97 100644 --- a/adapters/adpone/adponetest/supplemental/bad_response.json +++ b/adapters/adpone/adponetest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/adprime/adprime.go b/adapters/adprime/adprime.go index 0db9218fdb4..6489c543d56 100644 --- a/adapters/adprime/adprime.go +++ b/adapters/adprime/adprime.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -27,7 +27,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests create bid request for adprime demand -func (a *AdprimeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdprimeAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var err error var tagID string @@ -36,7 +36,7 @@ func (a *AdprimeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} tagID, err = jsonparser.GetString(reqCopy.Imp[0].Ext, "bidder", "TagID") if err != nil { @@ -55,7 +55,7 @@ func (a *AdprimeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return adapterRequests, errs } -func (a *AdprimeAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *AdprimeAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -78,7 +78,7 @@ func (a *AdprimeAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Req } // MakeBids makes the bids -func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -97,7 +97,7 @@ func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -122,7 +122,7 @@ func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/adprime/adprimetest/supplemental/bad_response.json b/adapters/adprime/adprimetest/supplemental/bad_response.json index 329e9c7269f..435529a485c 100644 --- a/adapters/adprime/adprimetest/supplemental/bad_response.json +++ b/adapters/adprime/adprimetest/supplemental/bad_response.json @@ -78,7 +78,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index 511918bb3df..b43e7e51b07 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -20,7 +20,7 @@ type adtargetImpExt struct { Adtarget openrtb_ext.ExtImpAdtarget `json:"adtarget"` } -func (a *AdtargetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdtargetAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { totalImps := len(request.Imp) errors := make([]error, 0, totalImps) @@ -55,7 +55,7 @@ func (a *AdtargetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada reqs := make([]*adapters.RequestData, 0, totalReqs) imps := request.Imp - request.Imp = make([]openrtb.Imp, 0, len(imps)) + request.Imp = make([]openrtb2.Imp, 0, len(imps)) for sourceId, impIndexes := range imp2source { request.Imp = request.Imp[:0] @@ -80,7 +80,7 @@ func (a *AdtargetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada return reqs, errors } -func (a *AdtargetAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdtargetAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { if httpRes.StatusCode == http.StatusNoContent { return nil, nil @@ -90,7 +90,7 @@ func (a *AdtargetAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters. Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", httpRes.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("error while decoding response, err: %s", err), @@ -137,7 +137,7 @@ func (a *AdtargetAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters. return bidResponse, errors } -func validateImpressionAndSetExt(imp *openrtb.Imp) (int, error) { +func validateImpressionAndSetExt(imp *openrtb2.Imp) (int, error) { if imp.Banner == nil && imp.Video == nil { return 0, &errortypes.BadInput{ diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index fd501fde01f..6c7bc1f3378 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -20,7 +20,7 @@ type adtelligentImpExt struct { Adtelligent openrtb_ext.ExtImpAdtelligent `json:"adtelligent"` } -func (a *AdtelligentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdtelligentAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { totalImps := len(request.Imp) errors := make([]error, 0, totalImps) @@ -55,7 +55,7 @@ func (a *AdtelligentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * reqs := make([]*adapters.RequestData, 0, totalReqs) imps := request.Imp - request.Imp = make([]openrtb.Imp, 0, len(imps)) + request.Imp = make([]openrtb2.Imp, 0, len(imps)) for sourceId, impIds := range imp2source { request.Imp = request.Imp[:0] @@ -85,13 +85,13 @@ func (a *AdtelligentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * } -func (a *AdtelligentAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdtelligentAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { if httpRes.StatusCode == http.StatusNoContent { return nil, nil } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("error while decoding response, err: %s", err), @@ -138,7 +138,7 @@ func (a *AdtelligentAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapte return bidResponse, errors } -func validateImpression(imp *openrtb.Imp) (int, error) { +func validateImpression(imp *openrtb2.Imp) (int, error) { if imp.Banner == nil && imp.Video == nil { return 0, &errortypes.BadInput{ diff --git a/adapters/advangelists/advangelists.go b/adapters/advangelists/advangelists.go index 95ddec0f452..8a12089df90 100644 --- a/adapters/advangelists/advangelists.go +++ b/adapters/advangelists/advangelists.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,7 +19,7 @@ type AdvangelistsAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *AdvangelistsAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *AdvangelistsAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "No impression in the bid request"}) @@ -51,9 +51,9 @@ func (adapter *AdvangelistsAdapter) MakeRequests(request *openrtb.BidRequest, re } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImpAdvangelists, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) ([]openrtb2.Imp, []openrtb_ext.ExtImpAdvangelists, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) + resImps := make([]openrtb2.Imp, 0, len(imps)) resImpExts := make([]openrtb_ext.ExtImpAdvangelists, 0, len(imps)) for _, imp := range imps { @@ -73,7 +73,7 @@ func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImp return resImps, resImpExts, errors } -func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdvangelists) error { +func validateImpression(imp *openrtb2.Imp, impExt *openrtb_ext.ExtImpAdvangelists) error { if impExt.PublisherID == "" { return &errortypes.BadInput{Message: "No pubid value provided"} } @@ -81,8 +81,8 @@ func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdvangelists } //Group impressions by advangelists-specific parameters `pubid -func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdvangelists) (map[openrtb_ext.ExtImpAdvangelists][]openrtb.Imp, []error) { - res := make(map[openrtb_ext.ExtImpAdvangelists][]openrtb.Imp) +func dispatchImpressions(imps []openrtb2.Imp, impsExt []openrtb_ext.ExtImpAdvangelists) (map[openrtb_ext.ExtImpAdvangelists][]openrtb2.Imp, []error) { + res := make(map[openrtb_ext.ExtImpAdvangelists][]openrtb2.Imp) errors := make([]error, 0) for idx, imp := range imps { err := compatImpression(&imp) @@ -92,7 +92,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdvange } impExt := impsExt[idx] if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) @@ -101,7 +101,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdvange } //Alter impression info to comply with advangelists platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to advangelists platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -109,7 +109,7 @@ func compatImpression(imp *openrtb.Imp) error { return nil } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner banner := &bannerCopy @@ -127,7 +127,7 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdvangelists, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdvangelists, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -143,7 +143,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdvangelists, error) return &advangelistsExt, nil } -func (adapter *AdvangelistsAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *AdvangelistsAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -167,7 +167,7 @@ func (adapter *AdvangelistsAdapter) buildAdapterRequest(prebidBidRequest *openrt Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -197,7 +197,7 @@ func (adapter *AdvangelistsAdapter) buildEndpointURL(params *openrtb_ext.ExtImpA } //MakeBids translates advangelists bid response to prebid-server specific format -func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var msg = "" if response.StatusCode == http.StatusNoContent { return nil, nil @@ -206,7 +206,7 @@ func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb.BidRequest msg = fmt.Sprintf("Unexpected http status code: %d", response.StatusCode) return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg = fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} @@ -230,7 +230,7 @@ func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb.BidRequest } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo diff --git a/adapters/adyoulike/adyoulike.go b/adapters/adyoulike/adyoulike.go index 9a137a41fef..4797341e7b5 100644 --- a/adapters/adyoulike/adyoulike.go +++ b/adapters/adyoulike/adyoulike.go @@ -9,7 +9,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" ) @@ -25,7 +25,7 @@ type adapter struct { } func (a *adapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -35,7 +35,7 @@ func (a *adapter) MakeRequests( var tagID string reqCopy := *openRTBRequest - reqCopy.Imp = []openrtb.Imp{} + reqCopy.Imp = []openrtb2.Imp{} for ind, imp := range openRTBRequest.Imp { reqCopy.Imp = append(reqCopy.Imp, imp) @@ -77,7 +77,7 @@ const unexpectedStatusCodeFormat = "" + "Unexpected status code: %d. Run with request.debug = 1 for more info" func (a *adapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -101,7 +101,7 @@ func (a *adapter) MakeBids( return nil, []error{err} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{err} } @@ -121,7 +121,7 @@ func (a *adapter) MakeBids( } // getMediaTypeForBid determines which type of bid. -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json b/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json index b156dd65ae3..bda8d3e6640 100644 --- a/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json +++ b/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json @@ -58,7 +58,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/aja/aja.go b/adapters/aja/aja.go index 07f9ad8bc96..1ff942ce4de 100644 --- a/adapters/aja/aja.go +++ b/adapters/aja/aja.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,10 +16,10 @@ type AJAAdapter struct { endpoint string } -func (a *AJAAdapter) MakeRequests(bidReq *openrtb.BidRequest, extraInfo *adapters.ExtraRequestInfo) (adapterReqs []*adapters.RequestData, errs []error) { +func (a *AJAAdapter) MakeRequests(bidReq *openrtb2.BidRequest, extraInfo *adapters.ExtraRequestInfo) (adapterReqs []*adapters.RequestData, errs []error) { // split imps by tagid tagIDs := []string{} - impsByTagID := map[string][]openrtb.Imp{} + impsByTagID := map[string][]openrtb2.Imp{} for _, imp := range bidReq.Imp { extAJA, err := parseExtAJA(imp) if err != nil { @@ -54,7 +54,7 @@ func (a *AJAAdapter) MakeRequests(bidReq *openrtb.BidRequest, extraInfo *adapter return } -func parseExtAJA(imp openrtb.Imp) (openrtb_ext.ExtImpAJA, error) { +func parseExtAJA(imp openrtb2.Imp) (openrtb_ext.ExtImpAJA, error) { var ( extImp adapters.ExtImpBidder extAJA openrtb_ext.ExtImpAJA @@ -75,7 +75,7 @@ func parseExtAJA(imp openrtb.Imp) (openrtb_ext.ExtImpAJA, error) { return extAJA, nil } -func (a *AJAAdapter) MakeBids(bidReq *openrtb.BidRequest, adapterReq *adapters.RequestData, adapterResp *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AJAAdapter) MakeBids(bidReq *openrtb2.BidRequest, adapterReq *adapters.RequestData, adapterResp *adapters.ResponseData) (*adapters.BidderResponse, []error) { if adapterResp.StatusCode != http.StatusOK { if adapterResp.StatusCode == http.StatusNoContent { return nil, nil @@ -90,7 +90,7 @@ func (a *AJAAdapter) MakeBids(bidReq *openrtb.BidRequest, adapterReq *adapters.R }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(adapterResp.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Failed to unmarshal bid response: %s", err.Error()), diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index a9dfd06f1b0..68f4ecdfbb4 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -7,7 +7,7 @@ import ( "net/url" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -49,9 +49,9 @@ type amxExt struct { Bidder openrtb_ext.ExtImpAMX `json:"bidder"` } -func ensurePublisherWithID(pub *openrtb.Publisher, publisherID string) openrtb.Publisher { +func ensurePublisherWithID(pub *openrtb2.Publisher, publisherID string) openrtb2.Publisher { if pub == nil { - return openrtb.Publisher{ID: publisherID} + return openrtb2.Publisher{ID: publisherID} } pubCopy := *pub @@ -60,7 +60,7 @@ func ensurePublisherWithID(pub *openrtb.Publisher, publisherID string) openrtb.P } // MakeRequests creates AMX adapter requests -func (adapter *AMXAdapter) MakeRequests(request *openrtb.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { +func (adapter *AMXAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { reqCopy := *request var publisherID string @@ -119,7 +119,7 @@ type amxBidExt struct { } // MakeBids will parse the bids from the AMX server -func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *AMXAdapter) MakeBids(request *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if http.StatusNoContent == response.StatusCode { @@ -140,7 +140,7 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -196,7 +196,7 @@ func pixelToImpression(pixel string) string { return fmt.Sprintf(vastImpressionFormat, pixel) } -func interpolateImpressions(bid openrtb.Bid, ext amxBidExt) string { +func interpolateImpressions(bid openrtb2.Bid, ext amxBidExt) string { var buffer strings.Builder if bid.NURL != "" { buffer.WriteString(pixelToImpression(bid.NURL)) diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index 8f05aec24d4..77947c068d0 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -48,7 +48,7 @@ func TestEndpointQueryStringMalformed(t *testing.T) { func TestMakeRequestsTagID(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ Endpoint: amxTestEndpoint}) @@ -75,12 +75,12 @@ func TestMakeRequestsTagID(t *testing.T) { } for _, tc := range tests { - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "sample_imp_1", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} @@ -94,16 +94,16 @@ func TestMakeRequestsTagID(t *testing.T) { imp1.TagID = tc.tagID } - inputRequest := openrtb.BidRequest{ - User: &openrtb.User{}, - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{}, + inputRequest := openrtb2.BidRequest{ + User: &openrtb2.User{}, + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{}, } actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) - var body openrtb.BidRequest + var body openrtb2.BidRequest assert.Nil(t, json.Unmarshal(actualAdapterRequests[0].Body, &body)) assert.Equal(t, tc.expectedTagID, body.Imp[0].TagID) } @@ -111,7 +111,7 @@ func TestMakeRequestsTagID(t *testing.T) { func TestMakeRequestsPublisherId(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ Endpoint: amxTestEndpoint}) @@ -137,12 +137,12 @@ func TestMakeRequestsPublisherId(t *testing.T) { } for _, tc := range tests { - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "sample_imp_1", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} @@ -152,15 +152,15 @@ func TestMakeRequestsPublisherId(t *testing.T) { fmt.Sprintf(`{"bidder":{"tagId":"%s"}}`, tc.extTagID)) } - inputRequest := openrtb.BidRequest{ - User: &openrtb.User{ID: "example_user_id"}, - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{}, + inputRequest := openrtb2.BidRequest{ + User: &openrtb2.User{ID: "example_user_id"}, + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{}, ID: "1234", } if tc.publisherID != "" || !tc.blankNil { - inputRequest.Site.Publisher = &openrtb.Publisher{ + inputRequest.Site.Publisher = &openrtb2.Publisher{ ID: tc.publisherID, } } @@ -168,7 +168,7 @@ func TestMakeRequestsPublisherId(t *testing.T) { actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) - var body openrtb.BidRequest + var body openrtb2.BidRequest assert.Nil(t, json.Unmarshal(actualAdapterRequests[0].Body, &body)) assert.Equal(t, tc.expectedPublisherID, body.Site.Publisher.ID) } @@ -182,7 +182,7 @@ func countImpressionPixels(vast string) int { } func TestVideoImpInsertion(t *testing.T) { - markup := interpolateImpressions(openrtb.Bid{ + markup := interpolateImpressions(openrtb2.Bid{ AdM: sampleVastADM, NURL: "https://example2.com/nurl", }, amxBidExt{Himp: []string{"https://example.com/pixel.png"}}) @@ -191,14 +191,14 @@ func TestVideoImpInsertion(t *testing.T) { assert.Equal(t, 3, countImpressionPixels(markup), "should have 3 Impression pixels") // make sure that a blank NURL won't result in a blank impression tag - markup = interpolateImpressions(openrtb.Bid{ + markup = interpolateImpressions(openrtb2.Bid{ AdM: sampleVastADM, NURL: "", }, amxBidExt{}) assert.Equal(t, 1, countImpressionPixels(markup), "should have 1 impression pixels") // we should also ignore blank ext.Himp pixels - markup = interpolateImpressions(openrtb.Bid{ + markup = interpolateImpressions(openrtb2.Bid{ AdM: sampleVastADM, NURL: "https://example-nurl.com/nurl", }, amxBidExt{Himp: []string{"", "", ""}}) @@ -206,7 +206,7 @@ func TestVideoImpInsertion(t *testing.T) { } func TestNoDisplayImpInsertion(t *testing.T) { - data := interpolateImpressions(openrtb.Bid{ + data := interpolateImpressions(openrtb2.Bid{ AdM: sampleDisplayADM, NURL: "https://example2.com/nurl", }, amxBidExt{Himp: []string{"https://example.com/pixel.png"}}) diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go index fe5fdc17933..6edc8135516 100644 --- a/adapters/applogy/applogy.go +++ b/adapters/applogy/applogy.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,7 +17,7 @@ type ApplogyAdapter struct { endpoint string } -func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ApplogyAdapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -41,8 +41,8 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E continue } banner := *impression.Banner - banner.W = openrtb.Uint64Ptr(banner.Format[0].W) - banner.H = openrtb.Uint64Ptr(banner.Format[0].H) + banner.W = openrtb2.Int64Ptr(banner.Format[0].W) + banner.H = openrtb2.Int64Ptr(banner.Format[0].H) impression.Banner = &banner } } @@ -70,7 +70,7 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E errs = append(errs, errors.New("Applogy token required")) continue } - request.Imp = []openrtb.Imp{impression} + request.Imp = []openrtb2.Imp{impression} body, err := json.Marshal(request) if err != nil { errs = append(errs, err) @@ -92,7 +92,7 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E return result, errs } -func (a *ApplogyAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ApplogyAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error switch responseData.StatusCode { @@ -110,7 +110,7 @@ func (a *ApplogyAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.Reque }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse err := json.Unmarshal(responseData.Body, &bidResponse) if err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index 0a8146fdc41..a384257d47b 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -12,12 +12,12 @@ import ( "strings" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/pbs" "golang.org/x/net/context/ctxhttp" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/metrics" @@ -163,9 +163,9 @@ func (a *AppNexusAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder } if anReq.Imp[i].Banner != nil && params.Position != "" { if params.Position == "above" { - anReq.Imp[i].Banner.Pos = openrtb.AdPositionAboveTheFold.Ptr() + anReq.Imp[i].Banner.Pos = openrtb2.AdPositionAboveTheFold.Ptr() } else if params.Position == "below" { - anReq.Imp[i].Banner.Pos = openrtb.AdPositionBelowTheFold.Ptr() + anReq.Imp[i].Banner.Pos = openrtb2.AdPositionBelowTheFold.Ptr() } } @@ -245,7 +245,7 @@ func (a *AppNexusAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder debug.ResponseBody = responseBody } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, err @@ -288,7 +288,7 @@ func (a *AppNexusAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder return bids, nil } -func (a *AppNexusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AppNexusAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { memberIds := make(map[string]bool) errs := make([]error, 0, len(request.Imp)) @@ -389,9 +389,9 @@ func generatePodId() string { return fmt.Sprint(val) } -func groupByPods(imps []openrtb.Imp) map[string]([]openrtb.Imp) { +func groupByPods(imps []openrtb2.Imp) map[string]([]openrtb2.Imp) { // find number of pods in response - podImps := make(map[string][]openrtb.Imp) + podImps := make(map[string][]openrtb2.Imp) for _, imp := range imps { pod := strings.Split(imp.ID, "_")[0] podImps[pod] = append(podImps[pod], imp) @@ -399,7 +399,7 @@ func groupByPods(imps []openrtb.Imp) map[string]([]openrtb.Imp) { return podImps } -func marshalAndSetRequestExt(request *openrtb.BidRequest, requestExtension appnexusReqExt, errs []error) { +func marshalAndSetRequestExt(request *openrtb2.BidRequest, requestExtension appnexusReqExt, errs []error) { var err error request.Ext, err = json.Marshal(requestExtension) if err != nil { @@ -407,7 +407,7 @@ func marshalAndSetRequestExt(request *openrtb.BidRequest, requestExtension appne } } -func splitRequests(imps []openrtb.Imp, request *openrtb.BidRequest, requestExtension appnexusReqExt, uri string, errs []error) ([]*adapters.RequestData, []error) { +func splitRequests(imps []openrtb2.Imp, request *openrtb2.BidRequest, requestExtension appnexusReqExt, uri string, errs []error) ([]*adapters.RequestData, []error) { // Initial capacity for future array of requests, memory optimization. // Let's say there are 35 impressions and limit impressions per request equals to 10. @@ -463,7 +463,7 @@ func keys(m map[string]bool) []string { // preprocess mutates the imp to get it ready to send to appnexus. // // It returns the member param, if it exists, and an error if anything went wrong during the preprocessing. -func preprocess(imp *openrtb.Imp, defaultDisplayManagerVer string) (string, error) { +func preprocess(imp *openrtb2.Imp, defaultDisplayManagerVer string) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return "", err @@ -501,9 +501,9 @@ func preprocess(imp *openrtb.Imp, defaultDisplayManagerVer string) (string, erro if imp.Banner != nil { bannerCopy := *imp.Banner if appnexusExt.Position == "above" { - bannerCopy.Pos = openrtb.AdPositionAboveTheFold.Ptr() + bannerCopy.Pos = openrtb2.AdPositionAboveTheFold.Ptr() } else if appnexusExt.Position == "below" { - bannerCopy.Pos = openrtb.AdPositionBelowTheFold.Ptr() + bannerCopy.Pos = openrtb2.AdPositionBelowTheFold.Ptr() } // Fixes #307 @@ -550,7 +550,7 @@ func makeKeywordStr(keywords []*openrtb_ext.ExtImpAppnexusKeyVal) string { return strings.Join(kvs, ",") } -func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -565,7 +565,7 @@ func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/appnexus/appnexus_test.go b/adapters/appnexus/appnexus_test.go index d453a779854..076d93eacb6 100644 --- a/adapters/appnexus/appnexus_test.go +++ b/adapters/appnexus/appnexus_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/cache/dummycache" @@ -20,7 +21,6 @@ import ( "fmt" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -65,16 +65,16 @@ func TestVideoSinglePod(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) result, err := a.MakeRequests(&req, &reqInfo) @@ -82,7 +82,7 @@ func TestVideoSinglePod(t *testing.T) { assert.Len(t, result, 1, "Only one request should be returned") var error error - var reqData *openrtb.BidRequest + var reqData *openrtb2.BidRequest error = json.Unmarshal(result[0].Body, &reqData) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -103,28 +103,28 @@ func TestVideoSinglePodManyImps(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_3", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_4", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_5", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_6", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_7", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_8", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_9", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_10", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_11", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_12", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_13", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_14", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_3", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_4", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_5", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_6", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_7", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_8", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_9", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_10", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_11", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_12", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_13", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_14", Ext: []byte(impExt)}) res, err := a.MakeRequests(&req, &reqInfo) @@ -132,7 +132,7 @@ func TestVideoSinglePodManyImps(t *testing.T) { assert.Len(t, res, 2, "Two requests should be returned") var error error - var reqData1 *openrtb.BidRequest + var reqData1 *openrtb2.BidRequest error = json.Unmarshal(res[0].Body, &reqData1) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -142,7 +142,7 @@ func TestVideoSinglePodManyImps(t *testing.T) { adPodId1 := reqDataExt1.Appnexus.AdPodId - var reqData2 *openrtb.BidRequest + var reqData2 *openrtb2.BidRequest error = json.Unmarshal(res[1].Body, &reqData2) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -163,20 +163,20 @@ func TestVideoTwoPods(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_2", Ext: []byte(impExt)}) res, err := a.MakeRequests(&req, &reqInfo) @@ -184,7 +184,7 @@ func TestVideoTwoPods(t *testing.T) { assert.Len(t, res, 2, "Two request should be returned") var error error - var reqData1 *openrtb.BidRequest + var reqData1 *openrtb2.BidRequest error = json.Unmarshal(res[0].Body, &reqData1) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -194,7 +194,7 @@ func TestVideoTwoPods(t *testing.T) { adPodId1 := reqDataExt1.Appnexus.AdPodId - var reqData2 *openrtb.BidRequest + var reqData2 *openrtb2.BidRequest error = json.Unmarshal(res[1].Body, &reqData2) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -215,32 +215,32 @@ func TestVideoTwoPodsManyImps(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) - - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_2", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_3", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_4", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_5", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_6", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_7", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_8", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_9", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_10", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_11", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_12", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_13", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_14", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) + + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_3", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_4", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_5", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_6", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_7", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_8", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_9", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_10", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_11", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_12", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_13", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_14", Ext: []byte(impExt)}) res, err := a.MakeRequests(&req, &reqInfo) @@ -248,7 +248,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { assert.Len(t, res, 3, "Three requests should be returned") var error error - var reqData1 *openrtb.BidRequest + var reqData1 *openrtb2.BidRequest error = json.Unmarshal(res[0].Body, &reqData1) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -256,7 +256,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { error = json.Unmarshal(reqData1.Ext, &reqDataExt1) assert.NoError(t, error, "Response ext unmarshalling error should be nil") - var reqData2 *openrtb.BidRequest + var reqData2 *openrtb2.BidRequest error = json.Unmarshal(res[1].Body, &reqData2) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -264,7 +264,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { error = json.Unmarshal(reqData2.Ext, &reqDataExt2) assert.NoError(t, error, "Response ext unmarshalling error should be nil") - var reqData3 *openrtb.BidRequest + var reqData3 *openrtb2.BidRequest error = json.Unmarshal(res[2].Body, &reqData3) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -286,7 +286,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { // ---------------------------------------------------------------------------- // Code below this line tests the legacy, non-openrtb code flow. It can be deleted after we -// clean up the existing code and make everything openrtb. +// clean up the existing code and make everything openrtb2. type anTagInfo struct { code string @@ -325,7 +325,7 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -338,14 +338,14 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: breq.ID, BidID: "a-random-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "Buyer Member ID", - Bid: make([]openrtb.Bid, 0, 2), + Bid: make([]openrtb2.Bid, 0, 2), }, }, } @@ -415,11 +415,11 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Empty imp.banner.format array"), http.StatusInternalServerError) return } - if andata.tags[i].position == "above" && *imp.Banner.Pos != openrtb.AdPosition(1) { + if andata.tags[i].position == "above" && *imp.Banner.Pos != openrtb2.AdPosition(1) { http.Error(w, fmt.Sprintf("Mismatch in position - expected 1 for atf"), http.StatusInternalServerError) return } - if andata.tags[i].position == "below" && *imp.Banner.Pos != openrtb.AdPosition(3) { + if andata.tags[i].position == "below" && *imp.Banner.Pos != openrtb2.AdPosition(3) { http.Error(w, fmt.Sprintf("Mismatch in position - expected 3 for btf"), http.StatusInternalServerError) return } @@ -442,7 +442,7 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { } } - resBid := openrtb.Bid{ + resBid := openrtb2.Bid{ ID: "random-id", ImpID: imp.ID, Price: andata.tags[i].bid, @@ -451,7 +451,7 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { } if imp.Video != nil { - resBid.Attr = []openrtb.CreativeAttribute{openrtb.CreativeAttribute(6)} + resBid.Attr = []openrtb2.CreativeAttribute{openrtb2.CreativeAttribute(6)} } resp.SeatBid[0].Bid = append(resp.SeatBid[0].Bid, resBid) } @@ -568,7 +568,7 @@ func TestAppNexusLegacyBasicResponse(t *testing.T) { pbin.AdUnits[i] = pbs.AdUnit{ Code: tag.code, MediaTypes: []string{tag.mediaType}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 600, diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index 909a03a2bcf..f2aaaed8f88 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -10,19 +10,18 @@ import ( "net/http" "strings" + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v14/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" "github.com/prebid/prebid-server/util/maputil" - - "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" ) -var supportedBannerHeights = map[uint64]bool{ - 50: true, - 250: true, +var supportedBannerHeights = map[int64]struct{}{ + 50: {}, + 250: {}, } type FacebookAdapter struct { @@ -40,7 +39,7 @@ type facebookReqExt struct { AuthID string `json:"authentication_id"` } -func (this *FacebookAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (this *FacebookAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impressions provided", @@ -62,7 +61,7 @@ func (this *FacebookAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * return this.buildRequests(request) } -func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { +func (this *FacebookAdapter) buildRequests(request *openrtb2.BidRequest) ([]*adapters.RequestData, []error) { // Documentation suggests bid request splitting by impression so that each // request only represents a single impression reqs := make([]*adapters.RequestData, 0, len(request.Imp)) @@ -77,7 +76,7 @@ func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adap // Make a copy of the request so that we don't change the original request which // is shared across multiple threads fbreq := *request - fbreq.Imp = []openrtb.Imp{imp} + fbreq.Imp = []openrtb2.Imp{imp} if err := this.modifyRequest(&fbreq); err != nil { errs = append(errs, err) @@ -109,14 +108,14 @@ func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adap // The authentication ID is a sha256 hmac hash encoded as a hex string, based on // the app secret and the ID of the bid request -func (this *FacebookAdapter) makeAuthID(req *openrtb.BidRequest) string { +func (this *FacebookAdapter) makeAuthID(req *openrtb2.BidRequest) string { h := hmac.New(sha256.New, []byte(this.appSecret)) h.Write([]byte(req.ID)) return hex.EncodeToString(h.Sum(nil)) } -func (this *FacebookAdapter) modifyRequest(out *openrtb.BidRequest) error { +func (this *FacebookAdapter) modifyRequest(out *openrtb2.BidRequest) error { if len(out.Imp) != 1 { panic("each bid request to facebook should only have a single impression") } @@ -146,7 +145,7 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb.BidRequest) error { if out.App != nil { app := *out.App - app.Publisher = &openrtb.Publisher{ID: pubId} + app.Publisher = &openrtb2.Publisher{ID: pubId} out.App = &app } @@ -157,13 +156,8 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb.BidRequest) error { return nil } -func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { - impType, ok := resolveImpType(out) - if !ok { - return &errortypes.BadInput{ - Message: fmt.Sprintf("imp #%s with invalid type", out.ID), - } - } +func (this *FacebookAdapter) modifyImp(out *openrtb2.Imp) error { + impType := resolveImpType(out) if out.Instl == 1 && impType != openrtb_ext.BidTypeBanner { return &errortypes.BadInput{ @@ -176,10 +170,9 @@ func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { out.Banner = &bannerCopy if out.Instl == 1 { - out.Banner.W = openrtb.Uint64Ptr(0) - out.Banner.H = openrtb.Uint64Ptr(0) + out.Banner.W = openrtb2.Int64Ptr(0) + out.Banner.H = openrtb2.Int64Ptr(0) out.Banner.Format = nil - return nil } @@ -204,15 +197,14 @@ func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { } } - /* This will get overwritten post-serialization */ - out.Banner.W = openrtb.Uint64Ptr(0) + out.Banner.W = openrtb2.Int64Ptr(-1) out.Banner.Format = nil } return nil } -func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb.Imp) (string, string, error) { +func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb2.Imp) (string, string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(out.Ext, &bidderExt); err != nil { return "", "", &errortypes.BadInput{ @@ -237,9 +229,9 @@ func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb.Imp) (str publisherID := fbExt.PublisherId // Support the legacy path with the caller was expected to pass in just placementId - // which was an underscore concantenated string with the publisherId and placementId. + // which was an underscore concatenated string with the publisherId and placementId. // The new path for callers is to pass in the placementId and publisherId independently - // and the below code will prefix the placementId that we pass to FAN with the publsiherId + // and the below code will prefix the placementId that we pass to FAN with the publisherId // so that we can abstract the implementation details from the caller toks := strings.Split(placementID, "_") if len(toks) == 1 { @@ -262,17 +254,17 @@ func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb.Imp) (str return placementID, publisherID, nil } -// XXX: This entire function is just a hack to get around mxmCherry 11.0.0 limitations, without -// having to fork the library and maintain our own branch -func modifyImpCustom(jsonData []byte, imp *openrtb.Imp) ([]byte, error) { - impType, ok := resolveImpType(imp) - if ok == false { - panic("processing an invalid impression") +// modifyImpCustom modifies the impression after it's marshalled to get around mxmCherry 14.0.0 limitations. +func modifyImpCustom(jsonData []byte, imp *openrtb2.Imp) ([]byte, error) { + impType := resolveImpType(imp) + + // we only need to modify video and native impressions + if impType != openrtb_ext.BidTypeVideo && impType != openrtb_ext.BidTypeNative { + return jsonData, nil } var jsonMap map[string]interface{} - err := json.Unmarshal(jsonData, &jsonMap) - if err != nil { + if err := json.Unmarshal(jsonData, &jsonMap); err != nil { return jsonData, err } @@ -286,28 +278,16 @@ func modifyImpCustom(jsonData []byte, imp *openrtb.Imp) ([]byte, error) { } switch impType { - case openrtb_ext.BidTypeBanner: - // The current version of mxmCherry (11.0.0) represents banner.w as an unsigned - // integer, so setting a value of -1 is not possible which is why we have to do it - // post-serialization - isInterstitial := imp.Instl == 1 - if !isInterstitial { - if bannerMap, ok := maputil.ReadEmbeddedMap(impMap, "banner"); ok { - bannerMap["w"] = json.RawMessage("-1") - } else { - return jsonData, errors.New("unable to find imp[0].banner in json data") - } + case openrtb_ext.BidTypeVideo: + videoMap, ok := maputil.ReadEmbeddedMap(impMap, "video") + if !ok { + return jsonData, errors.New("unable to find imp[0].video in json data") } - case openrtb_ext.BidTypeVideo: // mxmCherry omits video.w/h if set to zero, so we need to force set those // fields to zero post-serialization for the time being - if videoMap, ok := maputil.ReadEmbeddedMap(impMap, "video"); ok { - videoMap["w"] = json.RawMessage("0") - videoMap["h"] = json.RawMessage("0") - } else { - return jsonData, errors.New("unable to find imp[0].video in json data") - } + videoMap["w"] = json.RawMessage("0") + videoMap["h"] = json.RawMessage("0") case openrtb_ext.BidTypeNative: nativeMap, ok := maputil.ReadEmbeddedMap(impMap, "native") @@ -316,8 +296,8 @@ func modifyImpCustom(jsonData []byte, imp *openrtb.Imp) ([]byte, error) { } // Set w/h to -1 for native impressions based on the facebook native spec. - // We have to set this post-serialization since the OpenRTB protocol doesn't - // actually support w/h in the native object + // We have to set this post-serialization since these fields are not included + // in the OpenRTB 2.5 spec. nativeMap["w"] = json.RawMessage("-1") nativeMap["h"] = json.RawMessage("-1") @@ -335,13 +315,11 @@ func modifyImpCustom(jsonData []byte, imp *openrtb.Imp) ([]byte, error) { } } -func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { - /* No bid response */ +func (this *FacebookAdapter) MakeBids(request *openrtb2.BidRequest, adapterRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } - /* Any other http status codes outside of 200 and 204 should be treated as errors */ if response.StatusCode != http.StatusOK { msg := response.Headers.Get("x-fb-an-errors") return nil, []error{&errortypes.BadInput{ @@ -349,7 +327,7 @@ func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterReques }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -358,7 +336,9 @@ func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterReques var errs []error for _, seatbid := range bidResp.SeatBid { - for _, bid := range seatbid.Bid { + for i := range seatbid.Bid { + bid := seatbid.Bid[i] + if bid.AdM == "" { errs = append(errs, &errortypes.BadServerResponse{ Message: fmt.Sprintf("Bid %s missing 'adm'", bid.ID), @@ -394,38 +374,35 @@ func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterReques return out, errs } -func resolveBidType(bid *openrtb.Bid, req *openrtb.BidRequest) openrtb_ext.BidType { +func resolveBidType(bid *openrtb2.Bid, req *openrtb2.BidRequest) openrtb_ext.BidType { for _, imp := range req.Imp { if bid.ImpID == imp.ID { - if typ, ok := resolveImpType(&imp); ok { - return typ - } - - panic("Processing an invalid impression; cannot resolve impression type") + return resolveImpType(&imp) } } panic(fmt.Sprintf("Invalid bid imp ID %s does not match any imp IDs from the original bid request", bid.ImpID)) } -func resolveImpType(imp *openrtb.Imp) (openrtb_ext.BidType, bool) { +func resolveImpType(imp *openrtb2.Imp) openrtb_ext.BidType { if imp.Banner != nil { - return openrtb_ext.BidTypeBanner, true + return openrtb_ext.BidTypeBanner } if imp.Video != nil { - return openrtb_ext.BidTypeVideo, true + return openrtb_ext.BidTypeVideo } if imp.Audio != nil { - return openrtb_ext.BidTypeAudio, true + return openrtb_ext.BidTypeAudio } if imp.Native != nil { - return openrtb_ext.BidTypeNative, true + return openrtb_ext.BidTypeNative } - return openrtb_ext.BidTypeBanner, false + // Required to satisfy compiler. Not reachable in practice due to validations performed in PBS-Core. + return openrtb_ext.BidTypeBanner } // Builder builds a new instance of Facebook's Audience Network adapter for the given bidder with the given config. diff --git a/adapters/avocet/avocet.go b/adapters/avocet/avocet.go index dac7faaa4b3..b3cda3a1bdd 100644 --- a/adapters/avocet/avocet.go +++ b/adapters/avocet/avocet.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -18,7 +18,7 @@ type AvocetAdapter struct { Endpoint string } -func (a *AvocetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AvocetAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, nil } @@ -50,7 +50,7 @@ type avocetBidExtension struct { DealPriority int `json:"deal_priority"` } -func (a *AvocetAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AvocetAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -68,7 +68,7 @@ func (a *AvocetAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var br openrtb.BidResponse + var br openrtb2.BidResponse err := json.Unmarshal(response.Body, &br) if err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -105,12 +105,12 @@ func (a *AvocetAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe } // getBidType returns the openrtb_ext.BidType for the provided bid. -func getBidType(bid openrtb.Bid, ext avocetBidExt) openrtb_ext.BidType { +func getBidType(bid openrtb2.Bid, ext avocetBidExt) openrtb_ext.BidType { if ext.Avocet.Duration != 0 { return openrtb_ext.BidTypeVideo } switch bid.API { - case openrtb.APIFrameworkVPAID10, openrtb.APIFrameworkVPAID20: + case openrtb2.APIFrameworkVPAID10, openrtb2.APIFrameworkVPAID20: return openrtb_ext.BidTypeVideo default: return openrtb_ext.BidTypeBanner diff --git a/adapters/avocet/avocet_test.go b/adapters/avocet/avocet_test.go index e4a7c5f44fa..b256adc6f17 100644 --- a/adapters/avocet/avocet_test.go +++ b/adapters/avocet/avocet_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -30,7 +30,7 @@ func TestAvocetAdapter_MakeRequests(t *testing.T) { Endpoint string } type args struct { - request *openrtb.BidRequest + request *openrtb2.BidRequest reqInfo *adapters.ExtraRequestInfo } type reqData []*adapters.RequestData @@ -45,7 +45,7 @@ func TestAvocetAdapter_MakeRequests(t *testing.T) { name: "return nil if zero imps", fields: fields{Endpoint: "https://bid.avct.cloud"}, args: args{ - &openrtb.BidRequest{}, + &openrtb2.BidRequest{}, nil, }, want: nil, @@ -55,7 +55,7 @@ func TestAvocetAdapter_MakeRequests(t *testing.T) { name: "makes POST request with JSON content", fields: fields{Endpoint: "https://bid.avct.cloud"}, args: args{ - &openrtb.BidRequest{Imp: []openrtb.Imp{{}}}, + &openrtb2.BidRequest{Imp: []openrtb2.Imp{{}}}, nil, }, want: reqData{ @@ -100,7 +100,7 @@ func TestAvocetAdapter_MakeBids(t *testing.T) { Endpoint string } type args struct { - internalRequest *openrtb.BidRequest + internalRequest *openrtb2.BidRequest externalRequest *adapters.RequestData response *adapters.ResponseData } @@ -195,7 +195,7 @@ func TestAvocetAdapter_MakeBids(t *testing.T) { func Test_getBidType(t *testing.T) { type args struct { - bid openrtb.Bid + bid openrtb2.Bid ext avocetBidExt } tests := []struct { @@ -205,17 +205,17 @@ func Test_getBidType(t *testing.T) { }{ { name: "VPAID 1.0", - args: args{openrtb.Bid{API: openrtb.APIFrameworkVPAID10}, avocetBidExt{}}, + args: args{openrtb2.Bid{API: openrtb2.APIFrameworkVPAID10}, avocetBidExt{}}, want: openrtb_ext.BidTypeVideo, }, { name: "VPAID 2.0", - args: args{openrtb.Bid{API: openrtb.APIFrameworkVPAID20}, avocetBidExt{}}, + args: args{openrtb2.Bid{API: openrtb2.APIFrameworkVPAID20}, avocetBidExt{}}, want: openrtb_ext.BidTypeVideo, }, { name: "other", - args: args{openrtb.Bid{}, avocetBidExt{}}, + args: args{openrtb2.Bid{}, avocetBidExt{}}, want: openrtb_ext.BidTypeBanner, }, } @@ -228,7 +228,7 @@ func Test_getBidType(t *testing.T) { } } -var validBannerBid = openrtb.Bid{ +var validBannerBid = openrtb2.Bid{ AdM: "", ADomain: []string{"avocet.io"}, CID: "5b51e2d689654741306813a4", @@ -267,7 +267,7 @@ var validBannerBidResponseBody = []byte(`{ ] }`) -var validVideoBid = openrtb.Bid{ +var validVideoBid = openrtb2.Bid{ AdM: "Avocet", ADomain: []string{"avocet.io"}, CID: "5b51e2d689654741306813a4", diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 09dd9e93929..ea4ff2c83e5 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -51,9 +51,9 @@ type beachfrontRequests struct { // --------------------------------------------------- type beachfrontVideoRequest struct { - AppId string `json:"appId"` - VideoResponseType string `json:"videoResponseType"` - Request openrtb.BidRequest `json:"request"` + AppId string `json:"appId"` + VideoResponseType string `json:"videoResponseType"` + Request openrtb2.BidRequest `json:"request"` } // --------------------------------------------------- @@ -71,7 +71,7 @@ type beachfrontBannerRequest struct { IsMobile int8 `json:"isMobile"` UA string `json:"ua"` Dnt int8 `json:"dnt"` - User openrtb.User `json:"user"` + User openrtb2.User `json:"user"` AdapterName string `json:"adapterName"` AdapterVersion string `json:"adapterVersion"` IP string `json:"ip"` @@ -108,7 +108,7 @@ type beachfrontVideoBidExtension struct { Duration int `json:"duration"` } -func (a *BeachfrontAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BeachfrontAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { beachfrontRequests, errs := preprocess(request) headers := http.Header{} @@ -198,9 +198,9 @@ func (a *BeachfrontAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a return reqs, errs } -func preprocess(request *openrtb.BidRequest) (beachfrontReqs beachfrontRequests, errs []error) { - var videoImps = make([]openrtb.Imp, 0) - var bannerImps = make([]openrtb.Imp, 0) +func preprocess(request *openrtb2.BidRequest) (beachfrontReqs beachfrontRequests, errs []error) { + var videoImps = make([]openrtb2.Imp, 0) + var bannerImps = make([]openrtb2.Imp, 0) for i := 0; i < len(request.Imp); i++ { if request.Imp[i].Banner != nil && request.Imp[i].Banner.Format != nil && @@ -267,7 +267,7 @@ func getAppId(ext openrtb_ext.ExtImpBeachfront, media openrtb_ext.BidType) (stri getBannerRequest, singular. A "Slot" is an "imp," and each Slot can have an AppId, so just one request to the beachfront banner endpoint gets all banner Imps. */ -func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []error) { +func getBannerRequest(request *openrtb2.BidRequest) (beachfrontBannerRequest, []error) { var bfr beachfrontBannerRequest var errs = make([]error, 0, len(request.Imp)) @@ -301,8 +301,8 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e for j := 0; j < len(request.Imp[i].Banner.Format); j++ { slot.Sizes = append(slot.Sizes, beachfrontSize{ - H: request.Imp[i].Banner.Format[j].H, - W: request.Imp[i].Banner.Format[j].W, + H: uint64(request.Imp[i].Banner.Format[j].H), + W: uint64(request.Imp[i].Banner.Format[j].W), }) } @@ -327,7 +327,7 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e var t = fallBackDeviceType(request) - if t == openrtb.DeviceTypeMobileTablet { + if t == openrtb2.DeviceTypeMobileTablet { bfr.Page = request.App.Bundle if request.App.Domain == "" { bfr.Domain = getDomain(request.App.Domain) @@ -336,7 +336,7 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e } bfr.IsMobile = 1 - } else if t == openrtb.DeviceTypePersonalComputer { + } else if t == openrtb2.DeviceTypePersonalComputer { bfr.Page = request.Site.Page if request.Site.Domain == "" { bfr.Domain = getDomain(request.Site.Page) @@ -373,15 +373,15 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e return bfr, errs } -func fallBackDeviceType(request *openrtb.BidRequest) openrtb.DeviceType { +func fallBackDeviceType(request *openrtb2.BidRequest) openrtb2.DeviceType { if request.Site != nil { - return openrtb.DeviceTypePersonalComputer + return openrtb2.DeviceTypePersonalComputer } - return openrtb.DeviceTypeMobileTablet + return openrtb2.DeviceTypeMobileTablet } -func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, []error) { +func getVideoRequests(request *openrtb2.BidRequest) ([]beachfrontVideoRequest, []error) { var bfReqs = make([]beachfrontVideoRequest, len(request.Imp)) var errs = make([]error, 0, len(request.Imp)) var failedRequestIndicies = make([]int, 0) @@ -409,9 +409,9 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] bfReqs[i].Request = *request var secure int8 - var deviceCopy openrtb.Device + var deviceCopy openrtb2.Device if bfReqs[i].Request.Device == nil { - deviceCopy = openrtb.Device{} + deviceCopy = openrtb2.Device{} } else { deviceCopy = *bfReqs[i].Request.Device } @@ -473,7 +473,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } bfReqs[i].Request.Imp = nil - bfReqs[i].Request.Imp = make([]openrtb.Imp, 1) + bfReqs[i].Request.Imp = make([]openrtb2.Imp, 1) bfReqs[i].Request.Imp[0] = imp } @@ -488,7 +488,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] return bfReqs, errs } -func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -509,9 +509,9 @@ func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return nil, []error{fmt.Errorf("unexpected status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri)} } - var bids []openrtb.Bid + var bids []openrtb2.Bid var errs = make([]error, 0) - var xtrnal openrtb.BidRequest + var xtrnal openrtb2.BidRequest // For video, which uses RTB for the external request, this will unmarshal as expected. For banner, it will // only get the User struct and everything else will be nil @@ -560,10 +560,10 @@ func (a *BeachfrontAdapter) getBidType(externalRequest *adapters.RequestData) op return openrtb_ext.BidTypeBanner } -func postprocess(response *adapters.ResponseData, xtrnal openrtb.BidRequest, uri string, id string) ([]openrtb.Bid, []error) { +func postprocess(response *adapters.ResponseData, xtrnal openrtb2.BidRequest, uri string, id string) ([]openrtb2.Bid, []error) { var beachfrontResp []beachfrontResponseSlot - var openrtbResp openrtb.BidResponse + var openrtbResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &openrtbResp); err != nil || len(openrtbResp.SeatBid) == 0 { @@ -579,27 +579,27 @@ func postprocess(response *adapters.ResponseData, xtrnal openrtb.BidRequest, uri return postprocessVideo(openrtbResp.SeatBid[0].Bid, xtrnal, uri, id) } -func postprocessBanner(beachfrontResp []beachfrontResponseSlot, id string) ([]openrtb.Bid, []error) { +func postprocessBanner(beachfrontResp []beachfrontResponseSlot, id string) ([]openrtb2.Bid, []error) { - var bids = make([]openrtb.Bid, len(beachfrontResp)) + var bids = make([]openrtb2.Bid, len(beachfrontResp)) var errs = make([]error, 0) for i := 0; i < len(beachfrontResp); i++ { - bids[i] = openrtb.Bid{ + bids[i] = openrtb2.Bid{ CrID: beachfrontResp[i].CrID, ImpID: beachfrontResp[i].Slot, Price: beachfrontResp[i].Price, ID: fmt.Sprintf("%sBanner", beachfrontResp[i].Slot), AdM: beachfrontResp[i].Adm, - H: beachfrontResp[i].H, - W: beachfrontResp[i].W, + H: int64(beachfrontResp[i].H), + W: int64(beachfrontResp[i].W), } } return bids, errs } -func postprocessVideo(bids []openrtb.Bid, xtrnal openrtb.BidRequest, uri string, id string) ([]openrtb.Bid, []error) { +func postprocessVideo(bids []openrtb2.Bid, xtrnal openrtb2.BidRequest, uri string, id string) ([]openrtb2.Bid, []error) { var errs = make([]error, 0) @@ -633,7 +633,7 @@ func extractNurlVideoCrid(nurl string) string { return "" } -func getBeachfrontExtension(imp openrtb.Imp) (openrtb_ext.ExtImpBeachfront, error) { +func getBeachfrontExtension(imp openrtb2.Imp) (openrtb_ext.ExtImpBeachfront, error) { var err error var bidderExt adapters.ExtImpBidder var beachfrontExt openrtb_ext.ExtImpBeachfront diff --git a/adapters/beintoo/beintoo.go b/adapters/beintoo/beintoo.go index 5f22bfa7742..8b5698750e6 100644 --- a/adapters/beintoo/beintoo.go +++ b/adapters/beintoo/beintoo.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -18,7 +18,7 @@ type BeintooAdapter struct { endpoint string } -func (a *BeintooAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BeintooAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors []error if len(request.Imp) == 0 { @@ -64,7 +64,7 @@ func (a *BeintooAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap }}, errors } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpBeintoo, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpBeintoo, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -89,7 +89,7 @@ func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpBeintoo, error) { return &beintooExt, nil } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { imp.Ext = nil if imp.Banner == nil { @@ -118,7 +118,7 @@ func buildImpBanner(imp *openrtb.Imp) error { } // Add Beintoo required properties to Imp object -func addImpProps(imp *openrtb.Imp, secure *int8, BeintooExt *openrtb_ext.ExtImpBeintoo) { +func addImpProps(imp *openrtb2.Imp, secure *int8, BeintooExt *openrtb_ext.ExtImpBeintoo) { imp.TagID = BeintooExt.TagID imp.Secure = secure @@ -144,9 +144,9 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // Handle request errors and formatting to be sent to Beintoo -func preprocess(request *openrtb.BidRequest) []error { +func preprocess(request *openrtb2.BidRequest) []error { errors := make([]error, 0, len(request.Imp)) - resImps := make([]openrtb.Imp, 0, len(request.Imp)) + resImps := make([]openrtb2.Imp, 0, len(request.Imp)) secure := int8(0) if request.Site != nil && request.Site.Page != "" { @@ -178,7 +178,7 @@ func preprocess(request *openrtb.BidRequest) []error { } // MakeBids make the bids for the bid response. -func (a *BeintooAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BeintooAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -191,7 +191,7 @@ func (a *BeintooAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json b/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json index 5c5462c2990..6d587c2252b 100644 --- a/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type uint64", + "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type int64", "comparison": "regex" } ] diff --git a/adapters/between/between.go b/adapters/between/between.go index f8106bdd113..f1be7db5fc2 100644 --- a/adapters/between/between.go +++ b/adapters/between/between.go @@ -8,7 +8,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -24,7 +24,7 @@ type BetweenAdapter struct { // If BidFloor of openrtb_ext.ExtImpBetween is zero, set it to defaultBidFloor value, see addImpProps const defaultBidfloor = 0.00001 -func (a *BetweenAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BetweenAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors []error if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ @@ -70,7 +70,7 @@ func (a *BetweenAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap }}, errors } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpBetween, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpBetween, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -103,7 +103,7 @@ func (a *BetweenAdapter) buildEndpointURL(e *openrtb_ext.ExtImpBetween) (string, return macros.ResolveMacros(a.EndpointTemplate, macros.EndpointTemplateParams{Host: e.Host, PublisherID: e.PublisherID}) } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { if imp.Banner == nil { return &errortypes.BadInput{ Message: fmt.Sprintf("Request needs to include a Banner object"), @@ -127,7 +127,7 @@ func buildImpBanner(imp *openrtb.Imp) error { } // Add Between required properties to Imp object -func addImpProps(imp *openrtb.Imp, secure *int8, betweenExt *openrtb_ext.ExtImpBetween) { +func addImpProps(imp *openrtb2.Imp, secure *int8, betweenExt *openrtb_ext.ExtImpBetween) { imp.Secure = secure if betweenExt.BidFloor <= 0 { imp.BidFloor = defaultBidfloor @@ -147,9 +147,9 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // Handle request errors and formatting to be sent to Between -func preprocess(request *openrtb.BidRequest) (*openrtb_ext.ExtImpBetween, []error) { +func preprocess(request *openrtb2.BidRequest) (*openrtb_ext.ExtImpBetween, []error) { errors := make([]error, 0, len(request.Imp)) - resImps := make([]openrtb.Imp, 0, len(request.Imp)) + resImps := make([]openrtb2.Imp, 0, len(request.Imp)) secure := int8(0) if request.Site != nil && request.Site.Page != "" { @@ -181,7 +181,7 @@ func preprocess(request *openrtb.BidRequest) (*openrtb_ext.ExtImpBetween, []erro return betweenExt, errors } -func (a *BetweenAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BetweenAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -193,7 +193,7 @@ func (a *BetweenAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR Message: fmt.Sprintf("Invalid Status Returned: %d. Run with request.debug = 1 for more info", response.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Unable to unpackage bid response. Error %s", err.Error()), diff --git a/adapters/between/betweentest/supplemental/bad-response-body.json b/adapters/between/betweentest/supplemental/bad-response-body.json index 1712010a86b..fbd08206bd8 100644 --- a/adapters/between/betweentest/supplemental/bad-response-body.json +++ b/adapters/between/betweentest/supplemental/bad-response-body.json @@ -70,7 +70,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response. Error json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Unable to unpackage bid response. Error json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/bidder.go b/adapters/bidder.go index 9800a49c9cb..a389299f888 100644 --- a/adapters/bidder.go +++ b/adapters/bidder.go @@ -5,7 +5,7 @@ import ( "encoding/json" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/metrics" "github.com/prebid/prebid-server/openrtb_ext" @@ -26,7 +26,7 @@ type Bidder interface { // "subpar" in some way. For example: the request contained ad types which this bidder doesn't support. // // If the error is caused by bad user input, return an errortypes.BadInput. - MakeRequests(request *openrtb.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) + MakeRequests(request *openrtb2.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) // MakeBids unpacks the server's response into Bids. // @@ -37,7 +37,7 @@ type Bidder interface { // // If the error was caused by bad user input, return a errortypes.BadInput. // If the error was caused by a bad server response, return a errortypes.BadServerResponse - MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) + MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) } // TimeoutBidder is used to identify bidders that support timeout notifications. @@ -84,7 +84,7 @@ func NewBidderResponse() *BidderResponse { return NewBidderResponseWithBidsCapacity(0) } -// TypedBid packages the openrtb.Bid with any bidder-specific information that PBS needs to populate an +// TypedBid packages the openrtb2.Bid with any bidder-specific information that PBS needs to populate an // openrtb_ext.ExtBidPrebid. // // TypedBid.Bid.Ext will become "response.seatbid[i].bid.ext.bidder" in the final OpenRTB response. @@ -92,7 +92,7 @@ func NewBidderResponse() *BidderResponse { // TypedBid.BidVideo will become "response.seatbid[i].bid.ext.prebid.video" in the final OpenRTB response. // TypedBid.DealPriority is optionally provided by adapters and used internally by the exchange to support deal targeted campaigns. type TypedBid struct { - Bid *openrtb.Bid + Bid *openrtb2.Bid BidType openrtb_ext.BidType BidVideo *openrtb_ext.ExtBidPrebidVideo DealPriority int diff --git a/adapters/brightroll/brightroll.go b/adapters/brightroll/brightroll.go index 0e3fcb0669c..fe770b07d16 100644 --- a/adapters/brightroll/brightroll.go +++ b/adapters/brightroll/brightroll.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -30,7 +30,7 @@ type Account struct { BidFloor float64 `json:"bidfloor"` } -func (a *BrightrollAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BrightrollAdapter) MakeRequests(requestIn *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { request := *requestIn errs := make([]error, 0, len(request.Imp)) @@ -162,7 +162,7 @@ func (a *BrightrollAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo }}, errors } -func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -180,7 +180,7 @@ func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %d. ", err), @@ -199,10 +199,10 @@ func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return bidResponse, nil } -func getBlockedCreativetypes(attr []int8) []openrtb.CreativeAttribute { - var creativeAttr []openrtb.CreativeAttribute +func getBlockedCreativetypes(attr []int8) []openrtb2.CreativeAttribute { + var creativeAttr []openrtb2.CreativeAttribute for i := 0; i < len(attr); i++ { - creativeAttr = append(creativeAttr, openrtb.CreativeAttribute(attr[i])) + creativeAttr = append(creativeAttr, openrtb2.CreativeAttribute(attr[i])) } return creativeAttr } @@ -215,7 +215,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // getMediaTypeForImp figures out which media type this bid is for. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner //default type for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/colossus/colossus.go b/adapters/colossus/colossus.go index 4a5360ce122..801b338478a 100644 --- a/adapters/colossus/colossus.go +++ b/adapters/colossus/colossus.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -26,7 +26,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests create bid request for colossus demand -func (a *ColossusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ColossusAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var err error var tagID string @@ -35,7 +35,7 @@ func (a *ColossusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} tagID, err = jsonparser.GetString(reqCopy.Imp[0].Ext, "bidder", "TagID") if err != nil { @@ -54,7 +54,7 @@ func (a *ColossusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada return adapterRequests, errs } -func (a *ColossusAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *ColossusAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -77,7 +77,7 @@ func (a *ColossusAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Re } // MakeBids makes the bids -func (a *ColossusAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ColossusAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -96,7 +96,7 @@ func (a *ColossusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -121,7 +121,7 @@ func (a *ColossusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/colossus/colossustest/supplemental/bad_response.json b/adapters/colossus/colossustest/supplemental/bad_response.json index c69b00c8e6e..62b862b181e 100644 --- a/adapters/colossus/colossustest/supplemental/bad_response.json +++ b/adapters/colossus/colossustest/supplemental/bad_response.json @@ -78,7 +78,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/connectad/connectad.go b/adapters/connectad/connectad.go index 024dabcee98..9192a520a05 100644 --- a/adapters/connectad/connectad.go +++ b/adapters/connectad/connectad.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -30,7 +30,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *ConnectAdAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ConnectAdAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error @@ -73,7 +73,7 @@ func (a *ConnectAdAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad }}, errs } -func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { if httpRes.StatusCode == http.StatusNoContent { return nil, nil @@ -85,7 +85,7 @@ func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -107,10 +107,10 @@ func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters return bidResponse, nil } -func preprocess(request *openrtb.BidRequest) []error { +func preprocess(request *openrtb2.BidRequest) []error { impsCount := len(request.Imp) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) secure := int8(0) if request.Site != nil && request.Site.Page != "" { @@ -141,7 +141,7 @@ func preprocess(request *openrtb.BidRequest) []error { return errors } -func addImpInfo(imp *openrtb.Imp, secure *int8, cadExt *openrtb_ext.ExtImpConnectAd) { +func addImpInfo(imp *openrtb2.Imp, secure *int8, cadExt *openrtb_ext.ExtImpConnectAd) { imp.TagID = strconv.Itoa(cadExt.SiteID) imp.Secure = secure @@ -159,7 +159,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpConnectAd, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpConnectAd, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -183,7 +183,7 @@ func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpConnectAd, error) { return &cadExt, nil } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { imp.Ext = nil if imp.Banner == nil { diff --git a/adapters/connectad/connectadtest/supplemental/badresponse.json b/adapters/connectad/connectadtest/supplemental/badresponse.json index de56d8b4c91..6c3bdaa4985 100644 --- a/adapters/connectad/connectadtest/supplemental/badresponse.json +++ b/adapters/connectad/connectadtest/supplemental/badresponse.json @@ -83,7 +83,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response. Error: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Unable to unpackage bid response. Error: json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/consumable/adtypes.go b/adapters/consumable/adtypes.go index 5eb3d3b369e..20b89bdfe7f 100644 --- a/adapters/consumable/adtypes.go +++ b/adapters/consumable/adtypes.go @@ -1,16 +1,17 @@ package consumable import ( - "github.com/mxmCherry/openrtb" "strconv" + + "github.com/mxmCherry/openrtb/v14/openrtb2" ) /* Turn array of openrtb formats into consumable's code*/ -func getSizeCodes(Formats []openrtb.Format) []int { +func getSizeCodes(Formats []openrtb2.Format) []int { codes := make([]int, 0) for _, format := range Formats { - str := strconv.FormatUint(format.W, 10) + "x" + strconv.FormatUint(format.H, 10) + str := strconv.FormatInt(format.W, 10) + "x" + strconv.FormatInt(format.H, 10) if code, ok := sizeMap[str]; ok { codes = append(codes, code) } diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index 15511c0ebb7..d81bc20b0d3 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -83,7 +83,7 @@ type pricing struct { ClearPrice *float64 `json:"clearPrice"` } -func (a *ConsumableAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ConsumableAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{ "Content-Type": {"application/json"}, "Accept": {"application/json"}, @@ -211,7 +211,7 @@ func (a *ConsumableAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) */ func (a *ConsumableAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -245,13 +245,13 @@ func (a *ConsumableAdapter) MakeBids( for impID, decision := range serverResponse.Decisions { if decision.Pricing != nil && decision.Pricing.ClearPrice != nil { - bid := openrtb.Bid{} + bid := openrtb2.Bid{} bid.ID = internalRequest.ID bid.ImpID = impID bid.Price = *decision.Pricing.ClearPrice bid.AdM = retrieveAd(decision) - bid.W = decision.Width - bid.H = decision.Height + bid.W = int64(decision.Width) + bid.H = int64(decision.Height) bid.CrID = strconv.FormatInt(decision.AdID, 10) bid.Exp = 30 // TODO: Check this is intention of TTL @@ -273,7 +273,7 @@ func (a *ConsumableAdapter) MakeBids( return bidderResponse, errors } -func extractExtensions(impression openrtb.Imp) (*adapters.ExtImpBidder, *openrtb_ext.ExtImpConsumable, []error) { +func extractExtensions(impression openrtb2.Imp) (*adapters.ExtImpBidder, *openrtb_ext.ExtImpConsumable, []error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(impression.Ext, &bidderExt); err != nil { return nil, nil, []error{&errortypes.BadInput{ diff --git a/adapters/conversant/cnvr_legacy.go b/adapters/conversant/cnvr_legacy.go index 4672ee156b4..e29fb7c019b 100644 --- a/adapters/conversant/cnvr_legacy.go +++ b/adapters/conversant/cnvr_legacy.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/pbs" @@ -54,7 +54,7 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, // Create a map of impression objects for both request creation // and response parsing. - impMap := make(map[string]*openrtb.Imp, len(cnvrReq.Imp)) + impMap := make(map[string]*openrtb2.Imp, len(cnvrReq.Imp)) for idx := range cnvrReq.Imp { impMap[cnvrReq.Imp[idx].ID] = &cnvrReq.Imp[idx] } @@ -98,9 +98,9 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, imp.BidFloor = params.BidFloor imp.TagID = params.TagID - var position *openrtb.AdPosition + var position *openrtb2.AdPosition if params.Position != nil { - position = openrtb.AdPosition(*params.Position).Ptr() + position = openrtb2.AdPosition(*params.Position).Ptr() } if imp.Banner != nil { @@ -109,9 +109,9 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, imp.Video.Pos = position if len(params.API) > 0 { - imp.Video.API = make([]openrtb.APIFramework, 0, len(params.API)) + imp.Video.API = make([]openrtb2.APIFramework, 0, len(params.API)) for _, api := range params.API { - imp.Video.API = append(imp.Video.API, openrtb.APIFramework(api)) + imp.Video.API = append(imp.Video.API, openrtb2.APIFramework(api)) } } @@ -120,9 +120,9 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, // but are overridden if the custom params object also contains them. if len(params.Protocols) > 0 { - imp.Video.Protocols = make([]openrtb.Protocol, 0, len(params.Protocols)) + imp.Video.Protocols = make([]openrtb2.Protocol, 0, len(params.Protocols)) for _, protocol := range params.Protocols { - imp.Video.Protocols = append(imp.Video.Protocols, openrtb.Protocol(protocol)) + imp.Video.Protocols = append(imp.Video.Protocols, openrtb2.Protocol(protocol)) } } @@ -164,7 +164,7 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, } if cnvrReq.Device == nil { - cnvrReq.Device = &openrtb.Device{} + cnvrReq.Device = &openrtb2.Device{} } // Convert request to json to be sent over http @@ -217,7 +217,7 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, debug.ResponseBody = string(body) } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { diff --git a/adapters/conversant/cnvr_legacy_test.go b/adapters/conversant/cnvr_legacy_test.go index 712f85f4404..ef8a780c746 100644 --- a/adapters/conversant/cnvr_legacy_test.go +++ b/adapters/conversant/cnvr_legacy_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/config" @@ -497,12 +497,12 @@ func TestConversantVideoRequestWithParams(t *testing.T) { assertEqual(t, len(imp.Video.MIMEs), 1, "Request video MIMEs entries") assertEqual(t, imp.Video.MIMEs[0], "video/x-ms-wmv", "Requst video MIMEs type") assertEqual(t, len(imp.Video.Protocols), 2, "Request video protocols") - assertEqual(t, imp.Video.Protocols[0], openrtb.Protocol(1), "Request video protocols 1") - assertEqual(t, imp.Video.Protocols[1], openrtb.Protocol(2), "Request video protocols 2") + assertEqual(t, imp.Video.Protocols[0], openrtb2.Protocol(1), "Request video protocols 1") + assertEqual(t, imp.Video.Protocols[1], openrtb2.Protocol(2), "Request video protocols 2") assertEqual(t, imp.Video.MaxDuration, int64(90), "Request video 0 max duration") assertEqual(t, len(imp.Video.API), 2, "Request video api should be nil") - assertEqual(t, imp.Video.API[0], openrtb.APIFramework(1), "Request video api 1") - assertEqual(t, imp.Video.API[1], openrtb.APIFramework(2), "Request video api 2") + assertEqual(t, imp.Video.API[0], openrtb2.APIFramework(1), "Request video api 1") + assertEqual(t, imp.Video.API[1], openrtb2.APIFramework(2), "Request video api 2") } // Test video request with parameters in the video object @@ -557,8 +557,8 @@ func TestConversantVideoRequestWithParams2(t *testing.T) { assertEqual(t, len(imp.Video.MIMEs), 1, "Request video MIMEs entries") assertEqual(t, imp.Video.MIMEs[0], "video/x-ms-wmv", "Requst video MIMEs type") assertEqual(t, len(imp.Video.Protocols), 2, "Request video protocols") - assertEqual(t, imp.Video.Protocols[0], openrtb.Protocol(1), "Request video protocols 1") - assertEqual(t, imp.Video.Protocols[1], openrtb.Protocol(2), "Request video protocols 2") + assertEqual(t, imp.Video.Protocols[0], openrtb2.Protocol(1), "Request video protocols 1") + assertEqual(t, imp.Video.Protocols[1], openrtb2.Protocol(2), "Request video protocols 2") assertEqual(t, imp.Video.MaxDuration, int64(90), "Request video 0 max duration") } @@ -628,7 +628,7 @@ func CreateRequest(params ...string) *pbs.PBSRequest { for i := 0; i < num; i++ { req.AdUnits[i] = pbs.AdUnit{ Code: fmt.Sprintf("au-%03d", i), - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, @@ -672,7 +672,7 @@ func ConvertToVideoRequest(req *pbs.PBSRequest, videoParams ...string) (*pbs.PBS // Convert a request to an app request by adding required properties func ConvertToAppRequest(req *pbs.PBSRequest, appParams string) (*pbs.PBSRequest, error) { - app := new(openrtb.App) + app := new(openrtb2.App) err := json.Unmarshal([]byte(appParams), &app) if err == nil { req.App = app @@ -728,8 +728,8 @@ func CreateVideoRequest(params ...string) (*pbs.PBSRequest, error) { // Helper to create a test http server that receives and generate openrtb requests and responses -func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { - var lastBidRequest openrtb.BidRequest +func CreateServer(prices ...float64) (*httptest.Server, *openrtb2.BidRequest) { + var lastBidRequest openrtb2.BidRequest server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) @@ -738,10 +738,10 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { return } - var bidReq openrtb.BidRequest + var bidReq openrtb2.BidRequest var price float64 - var bids []openrtb.Bid - var bid openrtb.Bid + var bids []openrtb2.Bid + var bid openrtb2.Bid err = json.Unmarshal(body, &bidReq) if err != nil { @@ -758,7 +758,7 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { } if price > 0 { - bid = openrtb.Bid{ + bid = openrtb2.Bid{ ID: imp.ID, ImpID: imp.ID, Price: price, @@ -775,7 +775,7 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { bid.H = imp.Video.H } } else { - bid = openrtb.Bid{ + bid = openrtb2.Bid{ ID: imp.ID, ImpID: imp.ID, Price: 0, @@ -788,9 +788,9 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { if len(bids) == 0 { w.WriteHeader(http.StatusNoContent) } else { - js, _ := json.Marshal(openrtb.BidResponse{ + js, _ := json.Marshal(openrtb2.BidResponse{ ID: bidReq.ID, - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Bid: bids, }, @@ -808,9 +808,9 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { // Helper to remove impressions with $0 bids -func FilterZeroPrices(prices []float64, imps []openrtb.Imp) ([]float64, []openrtb.Imp) { +func FilterZeroPrices(prices []float64, imps []openrtb2.Imp) ([]float64, []openrtb2.Imp) { prices2 := make([]float64, 0) - imps2 := make([]openrtb.Imp, 0) + imps2 := make([]openrtb2.Imp, 0) for i := range prices { if prices[i] > 0 { diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index 248aa200d8e..d742033437a 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,7 +16,7 @@ type ConversantAdapter struct { URI string } -func (c ConversantAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (c ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { for i := 0; i < len(request.Imp); i++ { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(request.Imp[i].Ext, &bidderExt); err != nil { @@ -71,7 +71,7 @@ func (c ConversantAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad }}, nil } -func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { +func parseCnvrParams(imp *openrtb2.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.DisplayManager = "prebid-s2s" imp.DisplayManagerVer = "2.0.0" imp.BidFloor = cnvrExt.BidFloor @@ -82,9 +82,9 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.Secure = cnvrExt.Secure } - var position *openrtb.AdPosition + var position *openrtb2.AdPosition if cnvrExt.Position != nil { - position = openrtb.AdPosition(*cnvrExt.Position).Ptr() + position = openrtb2.AdPosition(*cnvrExt.Position).Ptr() } if imp.Banner != nil { tmpBanner := *imp.Banner @@ -97,9 +97,9 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.Video.Pos = position if len(cnvrExt.API) > 0 { - imp.Video.API = make([]openrtb.APIFramework, 0, len(cnvrExt.API)) + imp.Video.API = make([]openrtb2.APIFramework, 0, len(cnvrExt.API)) for _, api := range cnvrExt.API { - imp.Video.API = append(imp.Video.API, openrtb.APIFramework(api)) + imp.Video.API = append(imp.Video.API, openrtb2.APIFramework(api)) } } @@ -108,9 +108,9 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { // but are overridden if the custom params object also contains them. if len(cnvrExt.Protocols) > 0 { - imp.Video.Protocols = make([]openrtb.Protocol, 0, len(cnvrExt.Protocols)) + imp.Video.Protocols = make([]openrtb2.Protocol, 0, len(cnvrExt.Protocols)) for _, protocol := range cnvrExt.Protocols { - imp.Video.Protocols = append(imp.Video.Protocols, openrtb.Protocol(protocol)) + imp.Video.Protocols = append(imp.Video.Protocols, openrtb2.Protocol(protocol)) } } @@ -125,7 +125,7 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { } } -func (c ConversantAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (c ConversantAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil // no bid response } @@ -136,7 +136,7 @@ func (c ConversantAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var resp openrtb.BidResponse + var resp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &resp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %d. ", err), @@ -160,7 +160,7 @@ func (c ConversantAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa return bidResponse, nil } -func getBidType(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getBidType(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/cpmstar/cpmstar.go b/adapters/cpmstar/cpmstar.go index f3fbdf70516..b3100222e98 100644 --- a/adapters/cpmstar/cpmstar.go +++ b/adapters/cpmstar/cpmstar.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,7 +16,7 @@ type Adapter struct { endpoint string } -func (a *Adapter) MakeRequests(request *openrtb.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *Adapter) MakeRequests(request *openrtb2.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -36,7 +36,7 @@ func (a *Adapter) MakeRequests(request *openrtb.BidRequest, unused *adapters.Ext return adapterRequests, errs } -func (a *Adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *Adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { var err error jsonBody, err := json.Marshal(request) @@ -55,7 +55,7 @@ func (a *Adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestDat }, nil } -func preprocess(request *openrtb.BidRequest) error { +func preprocess(request *openrtb2.BidRequest) error { if len(request.Imp) == 0 { return &errortypes.BadInput{ Message: "No Imps in Bid Request", @@ -88,7 +88,7 @@ func preprocess(request *openrtb.BidRequest) error { return nil } -func validateImp(imp *openrtb.Imp) error { +func validateImp(imp *openrtb2.Imp) error { if imp.Banner == nil && imp.Video == nil { return &errortypes.BadInput{ Message: "Only Banner and Video bid-types are supported at this time", @@ -98,7 +98,7 @@ func validateImp(imp *openrtb.Imp) error { } // MakeBids based on cpmstar server response -func (a *Adapter) MakeBids(bidRequest *openrtb.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *Adapter) MakeBids(bidRequest *openrtb2.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil } @@ -109,7 +109,7 @@ func (a *Adapter) MakeBids(bidRequest *openrtb.BidRequest, unused *adapters.Requ }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json b/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json index e20acefe2c3..4350b2dc714 100644 --- a/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json @@ -59,7 +59,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type uint64", + "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type int64", "comparison": "regex" } ] diff --git a/adapters/datablocks/datablocks.go b/adapters/datablocks/datablocks.go index 56ac8f681d7..28b9c36360e 100644 --- a/adapters/datablocks/datablocks.go +++ b/adapters/datablocks/datablocks.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,7 +19,7 @@ type DatablocksAdapter struct { EndpointTemplate template.Template } -func (a *DatablocksAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *DatablocksAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) headers := http.Header{ @@ -69,7 +69,7 @@ func (a *DatablocksAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) */ func (a *DatablocksAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -84,7 +84,7 @@ func (a *DatablocksAdapter) MakeBids( }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -106,9 +106,9 @@ func (a *DatablocksAdapter) MakeBids( return bidResponse, nil } -func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpDatablocks][]openrtb.Imp, error) { +func splitImpressions(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpDatablocks][]openrtb2.Imp, error) { - var m = make(map[openrtb_ext.ExtImpDatablocks][]openrtb.Imp) + var m = make(map[openrtb_ext.ExtImpDatablocks][]openrtb2.Imp) for _, imp := range imps { bidderParams, err := getBidderParams(&imp) @@ -120,14 +120,14 @@ func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpDatablocks][]op if ok { m[*bidderParams] = append(v, imp) } else { - m[*bidderParams] = []openrtb.Imp{imp} + m[*bidderParams] = []openrtb2.Imp{imp} } } return m, nil } -func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpDatablocks, error) { +func getBidderParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpDatablocks, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -156,7 +156,7 @@ func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpDatablocks, error) { return &datablocksExt, nil } -func getMediaType(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaType(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner diff --git a/adapters/datablocks/datablockstest/supplemental/bad-response-body.json b/adapters/datablocks/datablockstest/supplemental/bad-response-body.json index c7ecf3c0eaa..7c4801e1685 100644 --- a/adapters/datablocks/datablockstest/supplemental/bad-response-body.json +++ b/adapters/datablocks/datablockstest/supplemental/bad-response-body.json @@ -81,7 +81,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/decenterads/decenterads.go b/adapters/decenterads/decenterads.go index 5719bf1e4b3..ac60a4042ae 100644 --- a/adapters/decenterads/decenterads.go +++ b/adapters/decenterads/decenterads.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -18,7 +18,7 @@ type adapter struct { endpoint string } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -40,7 +40,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraReq } impression.Ext = bidderExt - request.Imp = []openrtb.Imp{impression} + request.Imp = []openrtb2.Imp{impression} body, err := json.Marshal(request) if err != nil { errs = append(errs, err) @@ -58,7 +58,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraReq return result, errs } -func (a *adapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error switch responseData.StatusCode { @@ -76,7 +76,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse err := json.Unmarshal(responseData.Body, &bidResponse) if err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -98,7 +98,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, return response, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/decenterads/decenteradstest/supplemental/bad_response.json b/adapters/decenterads/decenteradstest/supplemental/bad_response.json index 9d9d977b14a..487d6adf413 100644 --- a/adapters/decenterads/decenteradstest/supplemental/bad_response.json +++ b/adapters/decenterads/decenteradstest/supplemental/bad_response.json @@ -76,7 +76,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/deepintent/deepintent.go b/adapters/deepintent/deepintent.go index 1ddaa1563c9..17168ae05f8 100644 --- a/adapters/deepintent/deepintent.go +++ b/adapters/deepintent/deepintent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -33,7 +33,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } //MakeRequests which creates request object for Deepintent DSP -func (d *DeepintentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (d *DeepintentAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var deepintentExt openrtb_ext.ExtImpDeepintent var err error @@ -42,7 +42,7 @@ func (d *DeepintentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} var bidderExt adapters.ExtImpBidder if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { @@ -76,7 +76,7 @@ func (d *DeepintentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a } // MakeBids makes the bids -func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -89,7 +89,7 @@ func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -114,11 +114,11 @@ func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return bidResponse, errs } -func (d *DeepintentAdapter) preprocess(request openrtb.BidRequest) (*adapters.RequestData, []error) { +func (d *DeepintentAdapter) preprocess(request openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error impsCount := len(request.Imp) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) for _, imp := range request.Imp { @@ -150,7 +150,7 @@ func (d *DeepintentAdapter) preprocess(request openrtb.BidRequest) (*adapters.Re }, errs } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { if imp.Banner == nil { return &errortypes.BadInput{ @@ -176,7 +176,7 @@ func buildImpBanner(imp *openrtb.Imp) error { return nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/deepintent/deepintenttest/supplemental/bad_response.json b/adapters/deepintent/deepintenttest/supplemental/bad_response.json index c03531b6232..b2c4c210df6 100644 --- a/adapters/deepintent/deepintenttest/supplemental/bad_response.json +++ b/adapters/deepintent/deepintenttest/supplemental/bad_response.json @@ -84,7 +84,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/dmx/dmx.go b/adapters/dmx/dmx.go index c66c6bf38fa..79e1d751712 100644 --- a/adapters/dmx/dmx.go +++ b/adapters/dmx/dmx.go @@ -8,7 +8,7 @@ import ( "net/url" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -55,15 +55,15 @@ func UserSellerOrPubId(str1, str2 string) string { return str2 } -func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { - var imps []openrtb.Imp +func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { + var imps []openrtb2.Imp var rootExtInfo dmxExt var publisherId string var sellerId string var userExt openrtb_ext.ExtUser var anyHasId = false - var reqCopy openrtb.BidRequest = *request - var dmxReq *openrtb.BidRequest = &reqCopy + var reqCopy openrtb2.BidRequest = *request + var dmxReq *openrtb2.BidRequest = &reqCopy var dmxRawPubId dmxPubExt if request.User == nil { @@ -121,7 +121,7 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapte } dmxReq.Site.Publisher.Ext = ext } else { - dmxReq.Site.Publisher = &openrtb.Publisher{ID: publisherId} + dmxReq.Site.Publisher = &openrtb2.Publisher{ID: publisherId} } } else { dmxReq.Site = nil @@ -152,9 +152,9 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapte } for _, inst := range dmxReq.Imp { - var banner *openrtb.Banner - var video *openrtb.Video - var ins openrtb.Imp + var banner *openrtb2.Banner + var video *openrtb2.Video + var ins openrtb2.Imp var params dmxExt const intVal int8 = 1 source := (*json.RawMessage)(&inst.Ext) @@ -207,7 +207,7 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapte return } -func (adapter *DmxAdapter) MakeBids(request *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *DmxAdapter) MakeBids(request *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if http.StatusNoContent == response.StatusCode { @@ -226,7 +226,7 @@ func (adapter *DmxAdapter) MakeBids(request *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -255,8 +255,8 @@ func (adapter *DmxAdapter) MakeBids(request *openrtb.BidRequest, externalRequest } -func fetchParams(params dmxExt, inst openrtb.Imp, ins openrtb.Imp, imps []openrtb.Imp, banner *openrtb.Banner, video *openrtb.Video, intVal int8) []openrtb.Imp { - var tempimp openrtb.Imp +func fetchParams(params dmxExt, inst openrtb2.Imp, ins openrtb2.Imp, imps []openrtb2.Imp, banner *openrtb2.Banner, video *openrtb2.Video, intVal int8) []openrtb2.Imp { + var tempimp openrtb2.Imp tempimp = inst if params.Bidder.Bidfloor != 0 { tempimp.BidFloor = params.Bidder.Bidfloor @@ -292,7 +292,7 @@ func addParams(str string) string { return "" } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { @@ -309,7 +309,7 @@ func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, } } -func videoImpInsertion(bid *openrtb.Bid) string { +func videoImpInsertion(bid *openrtb2.Bid) string { adm := bid.AdM nurl := bid.NURL search := "" diff --git a/adapters/dmx/dmx_test.go b/adapters/dmx/dmx_test.go index 80498de6e04..4288f2fa940 100644 --- a/adapters/dmx/dmx_test.go +++ b/adapters/dmx/dmx_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -20,17 +20,17 @@ var ( func TestFetchParams(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) - var arrImp []openrtb.Imp + var width, height int64 = int64(w), int64(h) + var arrImp []openrtb2.Imp var imps = fetchParams( dmxExt{Bidder: dmxParams{ TagId: "222", PublisherId: "5555", }}, - openrtb.Imp{ID: "32"}, - openrtb.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, arrImp, - &openrtb.Banner{W: &width, H: &height, Format: []openrtb.Format{ + &openrtb2.Banner{W: &width, H: &height, Format: []openrtb2.Format{ {W: 300, H: 250}, }}, nil, @@ -40,10 +40,10 @@ func TestFetchParams(t *testing.T) { DmxId: "222", MemberId: "5555", }}, - openrtb.Imp{ID: "32"}, - openrtb.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, arrImp, - &openrtb.Banner{W: &width, H: &height, Format: []openrtb.Format{ + &openrtb2.Banner{W: &width, H: &height, Format: []openrtb2.Format{ {W: 300, H: 250}, }}, nil, @@ -70,7 +70,7 @@ func TestJsonSamples(t *testing.T) { func TestMakeRequestsOtherPlacement(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -79,22 +79,22 @@ func TestMakeRequestsOtherPlacement(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - User: &openrtb.User{ID: "bscakucbkasucbkasunscancasuin"}, - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + User: &openrtb2.User{ID: "bscakucbkasucbkasunscancasuin"}, + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, @@ -115,7 +115,7 @@ func TestMakeRequestsOtherPlacement(t *testing.T) { func TestMakeRequestsInvalid(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -124,21 +124,21 @@ func TestMakeRequestsInvalid(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, @@ -159,7 +159,7 @@ func TestMakeRequestsInvalid(t *testing.T) { func TestMakeRequestNoSite(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -168,20 +168,20 @@ func TestMakeRequestNoSite(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - App: &openrtb.App{ID: "cansanuabnua", Publisher: &openrtb.Publisher{ID: "whatever"}}, + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + App: &openrtb2.App{ID: "cansanuabnua", Publisher: &openrtb2.Publisher{ID: "whatever"}}, ID: "1234", } @@ -190,7 +190,7 @@ func TestMakeRequestNoSite(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("openrtb type should be an Array when it's an App") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -207,7 +207,7 @@ func TestMakeRequestNoSite(t *testing.T) { func TestMakeRequestsApp(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -216,25 +216,25 @@ func TestMakeRequestsApp(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - App: &openrtb.App{ID: "cansanuabnua", Publisher: &openrtb.Publisher{ID: "whatever"}}, + App: &openrtb2.App{ID: "cansanuabnua", Publisher: &openrtb2.Publisher{ID: "whatever"}}, ID: "1234", } @@ -243,7 +243,7 @@ func TestMakeRequestsApp(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("openrtb type should be an Array when it's an App") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -257,7 +257,7 @@ func TestMakeRequestsApp(t *testing.T) { func TestMakeRequestsNoUser(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -266,21 +266,21 @@ func TestMakeRequestsNoUser(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, @@ -296,10 +296,9 @@ func TestMakeRequestsNoUser(t *testing.T) { } func TestMakeRequests(t *testing.T) { - //server := httptest.NewServer(http.HandlerFunc(DummyDmxServer)) var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -308,45 +307,45 @@ func TestMakeRequests(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "imp2", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - imp3 := openrtb.Imp{ + imp3 := openrtb2.Imp{ ID: "imp3", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp2, imp3}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp2, imp3}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID"}, + User: &openrtb2.User{ID: "districtmID"}, ID: "1234", } @@ -355,7 +354,7 @@ func TestMakeRequests(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("should have 1 request") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -369,7 +368,7 @@ func TestMakeRequests(t *testing.T) { func TestMakeBidVideo(t *testing.T) { var w, h int = 640, 480 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -378,23 +377,23 @@ func TestMakeBidVideo(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: width, H: height, MIMEs: []string{"video/mp4"}, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID"}, + User: &openrtb2.User{ID: "districtmID"}, ID: "1234", } @@ -403,7 +402,7 @@ func TestMakeBidVideo(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("should have 1 request") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -416,7 +415,7 @@ func TestMakeBidVideo(t *testing.T) { func TestMakeBidsNoContent(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -425,25 +424,25 @@ func TestMakeBidsNoContent(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID"}, + User: &openrtb2.User{ID: "districtmID"}, ID: "1234", } @@ -554,7 +553,7 @@ func TestMakeBidsNoContent(t *testing.T) { func TestUserExtEmptyObject(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -563,25 +562,25 @@ func TestUserExtEmptyObject(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{Ext: json.RawMessage(`{}`)}, + User: &openrtb2.User{Ext: json.RawMessage(`{}`)}, ID: "1234", } @@ -593,7 +592,7 @@ func TestUserExtEmptyObject(t *testing.T) { func TestUserEidsOnly(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -602,25 +601,25 @@ func TestUserEidsOnly(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{Ext: json.RawMessage(`{"eids": [{ + User: &openrtb2.User{Ext: json.RawMessage(`{"eids": [{ "source": "adserver.org", "uids": [{ "id": "111111111111", @@ -647,7 +646,7 @@ func TestUserEidsOnly(t *testing.T) { func TestUserDigitrustOnly(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -656,25 +655,25 @@ func TestUserDigitrustOnly(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{Ext: json.RawMessage(`{ + User: &openrtb2.User{Ext: json.RawMessage(`{ "digitrust": { "id": "11111111111", "keyv": 4 @@ -691,7 +690,7 @@ func TestUserDigitrustOnly(t *testing.T) { func TestUsersEids(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -700,25 +699,25 @@ func TestUsersEids(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID", Ext: json.RawMessage(`{"eids": [{ + User: &openrtb2.User{ID: "districtmID", Ext: json.RawMessage(`{"eids": [{ "source": "adserver.org", "uids": [{ "id": "111111111111", @@ -780,7 +779,7 @@ func TestUsersEids(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("should have 1 request") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -790,8 +789,8 @@ func TestUsersEids(t *testing.T) { } } func TestVideoImpInsertion(t *testing.T) { - var bidResp openrtb.BidResponse - var bid openrtb.Bid + var bidResp openrtb2.BidResponse + var bid openrtb2.Bid payload := []byte(`{ "id": "some-request-id", "seatbid": [ @@ -853,7 +852,7 @@ func TestVideoImpInsertion(t *testing.T) { if err != nil { t.Errorf("Payload is invalid") } - bid = openrtb.Bid(bidResp.SeatBid[0].Bid[0]) + bid = openrtb2.Bid(bidResp.SeatBid[0].Bid[0]) data := videoImpInsertion(&bid) find := strings.Index(data, "demo.arripiblik.com") if find == -1 { diff --git a/adapters/emx_digital/emx_digital.go b/adapters/emx_digital/emx_digital.go index e87f0681075..98a8b6eb943 100644 --- a/adapters/emx_digital/emx_digital.go +++ b/adapters/emx_digital/emx_digital.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -32,7 +32,7 @@ func buildEndpoint(endpoint string, testing bool, timeout int64) string { return endpoint + "?t=" + strconv.FormatInt(timeout, 10) + "&ts=" + strconv.FormatInt(time.Now().Unix(), 10) + "&src=pbserver" } -func (a *EmxDigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *EmxDigitalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error if len(request.Imp) == 0 { @@ -80,7 +80,7 @@ func (a *EmxDigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a }}, errs } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpEmxDigital, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpEmxDigital, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -111,7 +111,7 @@ func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpEmxDigital, error) { return &emxExt, nil } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { if imp.Banner == nil { return &errortypes.BadInput{ @@ -138,7 +138,7 @@ func buildImpBanner(imp *openrtb.Imp) error { return nil } -func buildImpVideo(imp *openrtb.Imp) error { +func buildImpVideo(imp *openrtb2.Imp) error { if len(imp.Video.MIMEs) == 0 { return &errortypes.BadInput{ @@ -162,11 +162,11 @@ func buildImpVideo(imp *openrtb.Imp) error { } // not supporting VAST protocol 7 (VAST 4.0); -func cleanProtocol(protocols []openrtb.Protocol) []openrtb.Protocol { - newitems := make([]openrtb.Protocol, 0, len(protocols)) +func cleanProtocol(protocols []openrtb2.Protocol) []openrtb2.Protocol { + newitems := make([]openrtb2.Protocol, 0, len(protocols)) for _, i := range protocols { - if i != openrtb.ProtocolVAST40 { + if i != openrtb2.ProtocolVAST40 { newitems = append(newitems, i) } } @@ -175,7 +175,7 @@ func cleanProtocol(protocols []openrtb.Protocol) []openrtb.Protocol { } // Add EMX required properties to Imp object -func addImpProps(imp *openrtb.Imp, secure *int8, emxExt *openrtb_ext.ExtImpEmxDigital) { +func addImpProps(imp *openrtb2.Imp, secure *int8, emxExt *openrtb_ext.ExtImpEmxDigital) { imp.TagID = emxExt.TagID imp.Secure = secure @@ -202,10 +202,10 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // Handle request errors and formatting to be sent to EMX -func preprocess(request *openrtb.BidRequest) []error { +func preprocess(request *openrtb2.BidRequest) []error { impsCount := len(request.Imp) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) secure := int8(0) domain := "" if request.Site != nil && request.Site.Page != "" { @@ -252,7 +252,7 @@ func preprocess(request *openrtb.BidRequest) []error { } // MakeBids make the bids for the bid response. -func (a *EmxDigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *EmxDigitalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -265,7 +265,7 @@ func (a *EmxDigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json b/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json index 1281db66fd8..4108c7a524a 100644 --- a/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json @@ -61,7 +61,7 @@ "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type uint64", + "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type int64", "comparison": "regex" } ] diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index 16d20afa611..6c55b99987b 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -4,12 +4,12 @@ import ( "encoding/json" "net/http" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "fmt" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" ) @@ -18,7 +18,7 @@ type EngageBDRAdapter struct { URI string } -func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0, len(request.Imp)) @@ -30,7 +30,7 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn } // EngageBDR uses different sspid parameters for banner and video. - sspidImps := make(map[string][]openrtb.Imp) + sspidImps := make(map[string][]openrtb2.Imp) for _, imp := range request.Imp { if imp.Audio != nil { @@ -92,7 +92,7 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn return adapterRequests, errors } -func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -109,7 +109,7 @@ func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb.BidRequest, e }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -127,7 +127,7 @@ func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb.BidRequest, e return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/eplanning/eplanning.go b/adapters/eplanning/eplanning.go index 8d0f7e8b662..2aa066ba2b2 100644 --- a/adapters/eplanning/eplanning.go +++ b/adapters/eplanning/eplanning.go @@ -11,7 +11,7 @@ import ( "fmt" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -64,7 +64,7 @@ type hbResponseAd struct { Height uint64 `json:"h,omitempty"` } -func (adapter *EPlanningAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *EPlanningAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0, len(request.Imp)) totalImps := len(request.Imp) spacesStrings := make([]string, 0, totalImps) @@ -191,8 +191,8 @@ func (adapter *EPlanningAdapter) MakeRequests(request *openrtb.BidRequest, reqIn return requests, errors } -func isMobileDevice(request *openrtb.BidRequest) bool { - return request.Device != nil && (request.Device.DeviceType == openrtb.DeviceTypeMobileTablet || request.Device.DeviceType == openrtb.DeviceTypePhone || request.Device.DeviceType == openrtb.DeviceTypeTablet) +func isMobileDevice(request *openrtb2.BidRequest) bool { + return request.Device != nil && (request.Device.DeviceType == openrtb2.DeviceTypeMobileTablet || request.Device.DeviceType == openrtb2.DeviceTypePhone || request.Device.DeviceType == openrtb2.DeviceTypeTablet) } func cleanName(name string) string { @@ -202,7 +202,7 @@ func cleanName(name string) string { return name } -func verifyImp(imp *openrtb.Imp, isMobile bool) (*openrtb_ext.ExtImpEPlanning, error) { +func verifyImp(imp *openrtb2.Imp, isMobile bool) (*openrtb_ext.ExtImpEPlanning, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { @@ -240,7 +240,7 @@ func verifyImp(imp *openrtb.Imp, isMobile bool) (*openrtb_ext.ExtImpEPlanning, e return &impExt, nil } -func searchSizePriority(hashedFormats map[string]int, format []openrtb.Format, priorityOrderForSizesAsc []string) (uint64, uint64) { +func searchSizePriority(hashedFormats map[string]int, format []openrtb2.Format, priorityOrderForSizesAsc []string) (int64, int64) { for i := len(priorityOrderForSizesAsc) - 1; i >= 0; i-- { if formatIndex, wasFound := hashedFormats[priorityOrderForSizesAsc[i]]; wasFound { return format[formatIndex].W, format[formatIndex].H @@ -249,7 +249,7 @@ func searchSizePriority(hashedFormats map[string]int, format []openrtb.Format, p return format[0].W, format[0].H } -func getSizeFromImp(imp *openrtb.Imp, isMobile bool) (uint64, uint64) { +func getSizeFromImp(imp *openrtb2.Imp, isMobile bool) (int64, int64) { if imp.Banner.W != nil && imp.Banner.H != nil { return *imp.Banner.W, *imp.Banner.H } @@ -279,7 +279,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func (adapter *EPlanningAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *EPlanningAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -322,15 +322,15 @@ func (adapter *EPlanningAdapter) MakeBids(internalRequest *openrtb.BidRequest, e for _, space := range parsedResponse.Spaces { for _, ad := range space.Ads { if price, err := strconv.ParseFloat(ad.Price, 64); err == nil { - bid := openrtb.Bid{ + bid := openrtb2.Bid{ ID: ad.ImpressionID, AdID: ad.AdID, ImpID: spaceNameToImpID[space.Name], Price: price, AdM: ad.AdM, CrID: ad.CrID, - W: ad.Width, - H: ad.Height, + W: int64(ad.Width), + H: int64(ad.Height), } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ diff --git a/adapters/epom/epom.go b/adapters/epom/epom.go index 4cb9a364cbd..b15c7b1cc04 100644 --- a/adapters/epom/epom.go +++ b/adapters/epom/epom.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -24,7 +24,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) { rq, errs := a.makeRequest(request) if len(errs) > 0 { @@ -38,7 +38,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return requests, nil } -func (a *adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { if request.Device == nil || request.Device.IP == "" { return nil, []error{&errortypes.BadInput{ Message: "ipv4 address is required field", @@ -61,7 +61,7 @@ func (a *adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestDat }, nil } -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -84,7 +84,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -111,7 +111,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/gamma/gamma.go b/adapters/gamma/gamma.go index f8681fb93c0..1408fdeeede 100644 --- a/adapters/gamma/gamma.go +++ b/adapters/gamma/gamma.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,9 +19,9 @@ type GammaAdapter struct { } type gammaBid struct { - openrtb.Bid //base - VastXML string `json:"vastXml,omitempty"` - VastURL string `json:"vastUrl,omitempty"` + openrtb2.Bid //base + VastXML string `json:"vastXml,omitempty"` + VastURL string `json:"vastUrl,omitempty"` } type gammaSeatBid struct { @@ -30,13 +30,13 @@ type gammaSeatBid struct { Ext json.RawMessage `json:"ext,omitempty"` } type gammaBidResponse struct { - ID string `json:"id"` - SeatBid []gammaSeatBid `json:"seatbid,omitempty"` - BidID string `json:"bidid,omitempty"` - Cur string `json:"cur,omitempty"` - CustomData string `json:"customdata,omitempty"` - NBR *openrtb.NoBidReasonCode `json:"nbr,omitempty"` - Ext json.RawMessage `json:"ext,omitempty"` + ID string `json:"id"` + SeatBid []gammaSeatBid `json:"seatbid,omitempty"` + BidID string `json:"bidid,omitempty"` + Cur string `json:"cur,omitempty"` + CustomData string `json:"customdata,omitempty"` + NBR *openrtb2.NoBidReasonCode `json:"nbr,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } func checkParams(gammaExt openrtb_ext.ExtImpGamma) error { @@ -57,7 +57,7 @@ func checkParams(gammaExt openrtb_ext.ExtImpGamma) error { } return nil } -func (a *GammaAdapter) makeRequest(request *openrtb.BidRequest, imp openrtb.Imp) (*adapters.RequestData, []error) { +func (a *GammaAdapter) makeRequest(request *openrtb2.BidRequest, imp openrtb2.Imp) (*adapters.RequestData, []error) { var errors []error var bidderExt adapters.ExtImpBidder @@ -139,7 +139,7 @@ func (a *GammaAdapter) makeRequest(request *openrtb.BidRequest, imp openrtb.Imp) Headers: headers, }, errors } -func (a *GammaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *GammaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { err := &errortypes.BadInput{ @@ -202,8 +202,8 @@ func (a *GammaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte return adapterRequests, errs } -func convertBid(gBid gammaBid, mediaType openrtb_ext.BidType) *openrtb.Bid { - var bid openrtb.Bid +func convertBid(gBid gammaBid, mediaType openrtb_ext.BidType) *openrtb2.Bid { + var bid openrtb2.Bid bid = gBid.Bid if mediaType == openrtb_ext.BidTypeVideo { @@ -224,7 +224,7 @@ func convertBid(gBid gammaBid, mediaType openrtb_ext.BidType) *openrtb.Bid { return &bid } -func (a *GammaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *GammaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -283,7 +283,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // getMediaTypeForImp figures out which media type this bid is for. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner //default type for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/gamoshi/gamoshi.go b/adapters/gamoshi/gamoshi.go index c0791e66ddc..50b7e9d58a5 100644 --- a/adapters/gamoshi/gamoshi.go +++ b/adapters/gamoshi/gamoshi.go @@ -7,7 +7,7 @@ import ( "strconv" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -18,7 +18,7 @@ type GamoshiAdapter struct { URI string } -func (a *GamoshiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *GamoshiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { @@ -125,7 +125,7 @@ func (a *GamoshiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap }}, errors } -func (a *GamoshiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *GamoshiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -143,7 +143,7 @@ func (a *GamoshiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %v. ", err), @@ -169,7 +169,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func getMediaType(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaType(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impId { if imp.Video != nil { diff --git a/adapters/grid/grid.go b/adapters/grid/grid.go index e70b1ddd632..69bc1500bf9 100644 --- a/adapters/grid/grid.go +++ b/adapters/grid/grid.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,7 +16,7 @@ type GridAdapter struct { endpoint string } -func processImp(imp *openrtb.Imp) error { +func processImp(imp *openrtb2.Imp) error { // get the grid extension var ext adapters.ExtImpBidder var gridExt openrtb_ext.ExtImpGrid @@ -38,13 +38,13 @@ func processImp(imp *openrtb.Imp) error { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *GridAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *GridAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) // copy the request, because we are going to mutate it requestCopy := *request // this will contain all the valid impressions - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // pre-process the imps for _, imp := range requestCopy.Imp { if err := processImp(&imp); err == nil { @@ -80,7 +80,7 @@ func (a *GridAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapter } // MakeBids unpacks the server's response into Bids. -func (a *GridAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *GridAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -97,7 +97,7 @@ func (a *GridAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequ }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -129,7 +129,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/grid/gridtest/supplemental/bad_response.json b/adapters/grid/gridtest/supplemental/bad_response.json index 87436da7fc1..a9d38368ab2 100644 --- a/adapters/grid/gridtest/supplemental/bad_response.json +++ b/adapters/grid/gridtest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index 426e6112655..0334aad9d43 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -20,9 +20,9 @@ type GumGumAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (g *GumGumAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - var validImps []openrtb.Imp - var siteCopy openrtb.Site +func (g *GumGumAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var validImps []openrtb2.Imp + var siteCopy openrtb2.Site if request.Site != nil { siteCopy = *request.Site } @@ -44,7 +44,7 @@ func (g *GumGumAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt if siteCopy.Publisher != nil { siteCopy.Publisher.ID = strconv.FormatFloat(gumgumExt.PubID, 'f', -1, 64) } else { - siteCopy.Publisher = &openrtb.Publisher{ID: strconv.FormatFloat(gumgumExt.PubID, 'f', -1, 64)} + siteCopy.Publisher = &openrtb2.Publisher{ID: strconv.FormatFloat(gumgumExt.PubID, 'f', -1, 64)} } } @@ -80,7 +80,7 @@ func (g *GumGumAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // MakeBids unpacks the server's response into Bids. -func (g *GumGumAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (g *GumGumAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -96,7 +96,7 @@ func (g *GumGumAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe Message: fmt.Sprintf("Bad server response: HTTP status %d", response.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d. ", err), @@ -124,7 +124,7 @@ func (g *GumGumAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, errs } -func preprocess(imp *openrtb.Imp) (*openrtb_ext.ExtImpGumGum, error) { +func preprocess(imp *openrtb2.Imp) (*openrtb_ext.ExtImpGumGum, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { err = &errortypes.BadInput{ @@ -169,7 +169,7 @@ func preprocess(imp *openrtb.Imp) (*openrtb_ext.ExtImpGumGum, error) { return &gumgumExt, nil } -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Banner != nil { return openrtb_ext.BidTypeBanner @@ -178,7 +178,7 @@ func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType return openrtb_ext.BidTypeVideo } -func validateVideoParams(video *openrtb.Video) (err error) { +func validateVideoParams(video *openrtb2.Video) (err error) { if video.W == 0 || video.H == 0 || video.MinDuration == 0 || video.MaxDuration == 0 || video.Placement == 0 || video.Linearity == 0 { return &errortypes.BadInput{ Message: "Invalid or missing video field(s)", diff --git a/adapters/improvedigital/improvedigital.go b/adapters/improvedigital/improvedigital.go index b1cc3640714..b942336b410 100644 --- a/adapters/improvedigital/improvedigital.go +++ b/adapters/improvedigital/improvedigital.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,7 +17,7 @@ type ImprovedigitalAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *ImprovedigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ImprovedigitalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) reqJSON, err := json.Marshal(request) @@ -38,7 +38,7 @@ func (a *ImprovedigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInf } // MakeBids unpacks the server's response into Bids. -func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -55,7 +55,7 @@ func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -103,7 +103,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json b/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json index 7099526bd90..7b103f011a1 100644 --- a/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json +++ b/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/infoawarebidder.go b/adapters/infoawarebidder.go index 53d80b23fc6..67227d822b3 100644 --- a/adapters/infoawarebidder.go +++ b/adapters/infoawarebidder.go @@ -3,7 +3,7 @@ package adapters import ( "fmt" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" @@ -32,7 +32,7 @@ func BuildInfoAwareBidder(bidder Bidder, info config.BidderInfo) Bidder { } } -func (i *InfoAwareBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) { +func (i *InfoAwareBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) { var allowedMediaTypes parsedSupports if request.Site != nil { @@ -72,7 +72,7 @@ func (i *InfoAwareBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *Ext // pruneImps trims invalid media types from each imp, and returns true if any of the // Imps have _no_ valid Media Types left. -func pruneImps(imps []openrtb.Imp, allowedTypes parsedSupports) (int, []error) { +func pruneImps(imps []openrtb2.Imp, allowedTypes parsedSupports) (int, []error) { numToFilter := 0 var errs []error for i := 0; i < len(imps); i++ { @@ -115,12 +115,12 @@ func parseAllowedTypes(allowedTypes []openrtb_ext.BidType) (allowBanner bool, al return } -func hasAnyTypes(imp *openrtb.Imp) bool { +func hasAnyTypes(imp *openrtb2.Imp) bool { return imp.Banner != nil || imp.Video != nil || imp.Audio != nil || imp.Native != nil } -func filterImps(imps []openrtb.Imp, numToFilter int) ([]openrtb.Imp, []error) { - newImps := make([]openrtb.Imp, 0, len(imps)-numToFilter) +func filterImps(imps []openrtb2.Imp, numToFilter int) ([]openrtb2.Imp, []error) { + newImps := make([]openrtb2.Imp, 0, len(imps)-numToFilter) errs := make([]error, 0, numToFilter) for i := 0; i < len(imps); i++ { if hasAnyTypes(&imps[i]) { diff --git a/adapters/infoawarebidder_test.go b/adapters/infoawarebidder_test.go index 6053f18ada9..60e5af041da 100644 --- a/adapters/infoawarebidder_test.go +++ b/adapters/infoawarebidder_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -22,9 +22,9 @@ func TestAppNotSupported(t *testing.T) { }, } constrained := adapters.BuildInfoAwareBidder(bidder, info) - bids, errs := constrained.MakeRequests(&openrtb.BidRequest{ - Imp: []openrtb.Imp{{ID: "imp-1", Banner: &openrtb.Banner{}}}, - App: &openrtb.App{}, + bids, errs := constrained.MakeRequests(&openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ID: "imp-1", Banner: &openrtb2.Banner{}}}, + App: &openrtb2.App{}, }, &adapters.ExtraRequestInfo{}) if !assert.Len(t, errs, 1) { return @@ -44,9 +44,9 @@ func TestSiteNotSupported(t *testing.T) { }, } constrained := adapters.BuildInfoAwareBidder(bidder, info) - bids, errs := constrained.MakeRequests(&openrtb.BidRequest{ - Imp: []openrtb.Imp{{ID: "imp-1", Banner: &openrtb.Banner{}}}, - Site: &openrtb.Site{}, + bids, errs := constrained.MakeRequests(&openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ID: "imp-1", Banner: &openrtb2.Banner{}}}, + Site: &openrtb2.Site{}, }, &adapters.ExtraRequestInfo{}) if !assert.Len(t, errs, 1) { return @@ -73,15 +73,15 @@ func TestImpFiltering(t *testing.T) { testCases := []struct { description string - inBidRequest *openrtb.BidRequest + inBidRequest *openrtb2.BidRequest expectedErrors []error expectedImpLen int }{ { description: "Empty Imp array. MakeRequest() call not expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{}, - Site: &openrtb.Site{}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{}, + Site: &openrtb2.Site{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "Bid request didn't contain media types supported by the bidder"}, @@ -90,9 +90,9 @@ func TestImpFiltering(t *testing.T) { }, { description: "Sole imp in bid request is of wrong media type. MakeRequest() call not expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ID: "imp-1", Video: &openrtb.Video{}}}, - App: &openrtb.App{}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ID: "imp-1", Video: &openrtb2.Video{}}}, + App: &openrtb2.App{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "request.imp[0] uses video, but this bidder doesn't support it"}, @@ -102,13 +102,13 @@ func TestImpFiltering(t *testing.T) { }, { description: "All imps in bid request of wrong media type, MakeRequest() call not expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ - {ID: "imp-1", Video: &openrtb.Video{}}, - {ID: "imp-2", Native: &openrtb.Native{}}, - {ID: "imp-3", Audio: &openrtb.Audio{}}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + {ID: "imp-1", Video: &openrtb2.Video{}}, + {ID: "imp-2", Native: &openrtb2.Native{}}, + {ID: "imp-3", Audio: &openrtb2.Audio{}}, }, - App: &openrtb.App{}, + App: &openrtb2.App{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "request.imp[0] uses video, but this bidder doesn't support it"}, @@ -120,25 +120,25 @@ func TestImpFiltering(t *testing.T) { }, { description: "Some imps with correct media type, MakeRequest() call expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ { ID: "imp-1", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, }, { - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, }, { ID: "imp-2", - Video: &openrtb.Video{}, - Native: &openrtb.Native{}, + Video: &openrtb2.Video{}, + Native: &openrtb2.Native{}, }, { - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, }, - Site: &openrtb.Site{}, + Site: &openrtb2.Site{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "request.imp[1] uses native, but this bidder doesn't support it"}, @@ -151,12 +151,12 @@ func TestImpFiltering(t *testing.T) { }, { description: "All imps with correct media type, MakeRequest() call expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ - {ID: "imp-1", Video: &openrtb.Video{}}, - {ID: "imp-2", Video: &openrtb.Video{}}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + {ID: "imp-1", Video: &openrtb2.Video{}}, + {ID: "imp-2", Video: &openrtb2.Video{}}, }, - Site: &openrtb.Site{}, + Site: &openrtb2.Site{}, }, expectedErrors: nil, expectedImpLen: 2, @@ -178,10 +178,10 @@ func TestImpFiltering(t *testing.T) { } type mockBidder struct { - gotRequest *openrtb.BidRequest + gotRequest *openrtb2.BidRequest } -func (m *mockBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (m *mockBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var adapterRequests []*adapters.RequestData for i := 0; i < len(request.Imp); i++ { @@ -191,6 +191,6 @@ func (m *mockBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters return adapterRequests, nil } -func (m *mockBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (m *mockBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { return nil, []error{errors.New("mock MakeBids error")} } diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go index 5d978ec7935..5034f01d77b 100644 --- a/adapters/inmobi/inmobi.go +++ b/adapters/inmobi/inmobi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -24,7 +24,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *InMobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *InMobiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error if len(request.Imp) == 0 { @@ -56,7 +56,7 @@ func (a *InMobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt }}, errs } -func (a *InMobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *InMobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -67,7 +67,7 @@ func (a *InMobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var serverBidResponse openrtb.BidResponse + var serverBidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &serverBidResponse); err != nil { return nil, []error{err} } @@ -87,7 +87,7 @@ func (a *InMobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, nil } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -117,7 +117,7 @@ func preprocess(imp *openrtb.Imp) error { return nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/invibes/invibes.go b/adapters/invibes/invibes.go index 31124bd108f..fb4d7641d79 100644 --- a/adapters/invibes/invibes.go +++ b/adapters/invibes/invibes.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -42,8 +42,8 @@ type InvibesBidParams struct { Properties map[string]InvibesPlacementProperty `json:"Properties"` } type InvibesPlacementProperty struct { - Formats []openrtb.Format `json:"Formats"` - ImpID string `json:"ImpId"` + Formats []openrtb2.Format `json:"Formats"` + ImpID string `json:"ImpId"` } type InvibesInternalParams struct { BidParams InvibesBidParams @@ -61,8 +61,8 @@ type BidServerBidderResponse struct { Error string `json:"error"` } type BidServerTypedBid struct { - Bid openrtb.Bid `json:"bid"` - DealPriority int `json:"dealPriority"` + Bid openrtb2.Bid `json:"bid"` + DealPriority int `json:"dealPriority"` } func (a *InvibesInternalParams) IsTestRequest() bool { @@ -86,7 +86,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return &bidder, nil } -func (a *InvibesAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *InvibesAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var httpRequests []*adapters.RequestData var tempErrors []error gdprApplies, consentString := readGDPR(request) @@ -155,7 +155,7 @@ func (a *InvibesAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return httpRequests, finalErrors } -func readGDPR(request *openrtb.BidRequest) (bool, string) { +func readGDPR(request *openrtb2.BidRequest) (bool, string) { consentString := "" if request.User != nil { var extUser openrtb_ext.ExtUser @@ -175,12 +175,12 @@ func readGDPR(request *openrtb.BidRequest) (bool, string) { return gdprApplies, consentString } -func readAdFormats(currentBanner openrtb.Banner) []openrtb.Format { - var adFormats []openrtb.Format +func readAdFormats(currentBanner openrtb2.Banner) []openrtb2.Format { + var adFormats []openrtb2.Format if currentBanner.Format != nil { adFormats = currentBanner.Format } else if currentBanner.W != nil && currentBanner.H != nil { - adFormats = []openrtb.Format{ + adFormats = []openrtb2.Format{ { W: *currentBanner.W, H: *currentBanner.H, @@ -190,7 +190,7 @@ func readAdFormats(currentBanner openrtb.Banner) []openrtb.Format { return adFormats } -func (a *InvibesAdapter) makeRequest(invibesParams InvibesInternalParams, reqInfo *adapters.ExtraRequestInfo, existingRequests []*adapters.RequestData, request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *InvibesAdapter) makeRequest(invibesParams InvibesInternalParams, reqInfo *adapters.ExtraRequestInfo, existingRequests []*adapters.RequestData, request *openrtb2.BidRequest) (*adapters.RequestData, error) { url, err := a.makeURL(request, invibesParams.DomainID) if err != nil { @@ -233,7 +233,7 @@ func (a *InvibesAdapter) makeRequest(invibesParams InvibesInternalParams, reqInf }, nil } -func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, request *openrtb.BidRequest) (*InvibesAdRequest, error) { +func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, request *openrtb2.BidRequest) (*InvibesAdRequest, error) { var lid string = "" if request.User != nil && request.User.BuyerUID != "" { lid = request.User.BuyerUID @@ -247,11 +247,11 @@ func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, requ var width, height string if request.Device != nil { if request.Device.W > 0 { - width = strconv.FormatUint(request.Device.W, 10) + width = strconv.FormatInt(request.Device.W, 10) } if request.Device.H > 0 { - height = strconv.FormatUint(request.Device.H, 10) + height = strconv.FormatInt(request.Device.H, 10) } } @@ -278,7 +278,7 @@ func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, requ return &invRequest, err } -func (a *InvibesAdapter) makeURL(request *openrtb.BidRequest, domainID int) (string, error) { +func (a *InvibesAdapter) makeURL(request *openrtb2.BidRequest, domainID int) (string, error) { host := "bid.videostep.com" if domainID == 1 { host = "adweb.videostepstage.com" @@ -307,7 +307,7 @@ func (a *InvibesAdapter) makeURL(request *openrtb.BidRequest, domainID int) (str } func (a *InvibesAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 96cd988de54..038a2c146b9 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "net/http" - "golang.org/x/net/context/ctxhttp" - - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/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" "github.com/prebid/prebid-server/pbs" + "golang.org/x/net/context/ctxhttp" ) type IxAdapter struct { @@ -46,8 +45,8 @@ type ixBidResult struct { type callOneObject struct { requestJSON bytes.Buffer - width uint64 - height uint64 + width int64 + height int64 bidType string } @@ -87,11 +86,11 @@ func (a *IxAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pbs.P thisImp.TagID = unit.Code if thisImp.Banner != nil { - thisImp.Banner.Format = []openrtb.Format{format} + thisImp.Banner.Format = []openrtb2.Format{format} thisImp.Banner.W = &format.W thisImp.Banner.H = &format.H } - indexReq.Imp = []openrtb.Imp{thisImp} + indexReq.Imp = []openrtb2.Imp{thisImp} // Index spec says "adunit path representing ad server inventory" but we don't have this // ext is DFP div ID and KV pairs if avail //indexReq.Imp[i].Ext = json.RawMessage("{}") @@ -99,7 +98,7 @@ func (a *IxAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pbs.P if indexReq.Site != nil { // Any objects pointed to by indexReq *must not be mutated*, or we will get race conditions. siteCopy := *indexReq.Site - siteCopy.Publisher = &openrtb.Publisher{ID: params.SiteID} + siteCopy.Publisher = &openrtb2.Publisher{ID: params.SiteID} indexReq.Site = &siteCopy } @@ -221,7 +220,7 @@ func (a *IxAdapter) callOne(ctx context.Context, reqJSON bytes.Buffer) (ixBidRes } result.ResponseBody = string(body) - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return result, &errortypes.BadServerResponse{ @@ -251,7 +250,7 @@ func (a *IxAdapter) callOne(ctx context.Context, reqJSON bytes.Buffer) (ixBidRes return result, nil } -func (a *IxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { nImp := len(request.Imp) if nImp > a.maxRequests { request.Imp = request.Imp[:a.maxRequests] @@ -286,8 +285,8 @@ func (a *IxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters. formats := getBannerFormats(&banner) for iFmt := range formats { banner.Format = formats[iFmt : iFmt+1] - banner.W = openrtb.Uint64Ptr(banner.Format[0].W) - banner.H = openrtb.Uint64Ptr(banner.Format[0].H) + banner.W = openrtb2.Int64Ptr(banner.Format[0].W) + banner.H = openrtb2.Int64Ptr(banner.Format[0].H) if requestData, err := createRequestData(a, request, &headers); err == nil { if iFmt == 0 { requests = append(requests, requestData) @@ -312,12 +311,12 @@ func (a *IxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters. return append(requests, multiSizeRequests...), errs } -func setSitePublisherId(request *openrtb.BidRequest, iImp int) error { +func setSitePublisherId(request *openrtb2.BidRequest, iImp int) error { if iImp == 0 { // first impression - create a site and pub copy site := *request.Site if site.Publisher == nil { - site.Publisher = &openrtb.Publisher{} + site.Publisher = &openrtb2.Publisher{} } else { publisher := *site.Publisher site.Publisher = &publisher @@ -339,14 +338,14 @@ func setSitePublisherId(request *openrtb.BidRequest, iImp int) error { return nil } -func getBannerFormats(banner *openrtb.Banner) []openrtb.Format { +func getBannerFormats(banner *openrtb2.Banner) []openrtb2.Format { if len(banner.Format) == 0 && banner.W != nil && banner.H != nil { - banner.Format = []openrtb.Format{{W: *banner.W, H: *banner.H}} + banner.Format = []openrtb2.Format{{W: *banner.W, H: *banner.H}} } return banner.Format } -func createRequestData(a *IxAdapter, request *openrtb.BidRequest, headers *http.Header) (*adapters.RequestData, error) { +func createRequestData(a *IxAdapter, request *openrtb2.BidRequest, headers *http.Header) (*adapters.RequestData, error) { body, err := json.Marshal(request) return &adapters.RequestData{ Method: "POST", @@ -356,7 +355,7 @@ func createRequestData(a *IxAdapter, request *openrtb.BidRequest, headers *http. }, err } -func (a *IxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { switch { case response.StatusCode == http.StatusNoContent: return nil, nil @@ -370,7 +369,7 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReques }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("JSON parsing error: %v", err), diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 8a75e6852b7..4c0515b4c6b 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -39,7 +39,7 @@ func getAdUnit() pbs.PBSAdUnit { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -54,7 +54,7 @@ func getVideoAdUnit() pbs.PBSAdUnit { Code: "unitCodeVideo", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, BidID: "bididvideo", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 100, H: 75, @@ -73,8 +73,8 @@ func getVideoAdUnit() pbs.PBSAdUnit { } } -func getOpenRTBBid(i openrtb.Imp) openrtb.Bid { - return openrtb.Bid{ +func getOpenRTBBid(i openrtb2.Imp) openrtb2.Bid { + return openrtb2.Bid{ ID: fmt.Sprintf("%d", rand.Intn(1000)), ImpID: i.ID, Price: 1.0, @@ -94,7 +94,7 @@ func dummyIXServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -103,10 +103,10 @@ func dummyIXServer(w http.ResponseWriter, r *http.Request) { impression := breq.Imp[0] - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ getOpenRTBBid(impression), }, }, @@ -141,7 +141,7 @@ func TestIxInvalidCall(t *testing.T) { func TestIxInvalidCallReqAppNil(t *testing.T) { ctx := context.TODO() pbReq := pbs.PBSRequest{ - App: &openrtb.App{}, + App: &openrtb2.App{}, } pbBidder := pbs.PBSBidder{} @@ -203,7 +203,7 @@ func TestIxTimeoutMultipleSlots(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -212,10 +212,10 @@ func TestIxTimeoutMultipleSlots(t *testing.T) { impression := breq.Imp[0] - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ getOpenRTBBid(impression), }, }, @@ -247,7 +247,7 @@ func TestIxTimeoutMultipleSlots(t *testing.T) { adUnit1 := getAdUnit() adUnit2 := getAdUnit() adUnit2.Code = "unitCode2" - adUnit2.Sizes = []openrtb.Format{ + adUnit2.Sizes = []openrtb2.Format{ { W: 8, H: 10, @@ -382,7 +382,7 @@ func TestIxInvalidCallMissingSize(t *testing.T) { ctx := context.TODO() pbReq := pbs.PBSRequest{} adUnit := getAdUnit() - adUnit.Sizes = []openrtb.Format{} + adUnit.Sizes = []openrtb2.Format{} pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", AdUnits: []pbs.PBSAdUnit{ @@ -423,17 +423,17 @@ func TestIxMismatchUnitCode(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ { ID: fmt.Sprintf("%d", rand.Intn(1000)), ImpID: "unitCode_bogus", @@ -477,14 +477,14 @@ func TestNoSeatBid(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{} + resp := openrtb2.BidResponse{} js, err := json.Marshal(resp) if err != nil { @@ -516,15 +516,15 @@ func TestNoSeatBidBid(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ {}, }, } @@ -650,7 +650,7 @@ func TestIxTwoSlotMultiSizeOnlyValidIXSizeResponse(t *testing.T) { ctx := context.TODO() pbReq := pbs.PBSRequest{} adUnit := getAdUnit() - adUnit.Sizes = append(adUnit.Sizes, openrtb.Format{W: 20, H: 22}) + adUnit.Sizes = append(adUnit.Sizes, openrtb2.Format{W: 20, H: 22}) pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", @@ -674,7 +674,7 @@ func TestIxTwoSlotMultiSizeOnlyValidIXSizeResponse(t *testing.T) { } } -func bidResponseForSizeExist(bids pbs.PBSBidSlice, h uint64, w uint64) bool { +func bidResponseForSizeExist(bids pbs.PBSBidSlice, h, w int64) bool { for _, v := range bids { if v.Height == h && v.Width == w { return true diff --git a/adapters/jixie/jixie.go b/adapters/jixie/jixie.go index 973bfcb42eb..565f8a588c3 100644 --- a/adapters/jixie/jixie.go +++ b/adapters/jixie/jixie.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -32,7 +32,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs = make([]error, 0) data, err := json.Marshal(request) @@ -80,7 +80,7 @@ func getBidType(bidAdm string) openrtb_ext.BidType { } // MakeBids make the bids for the bid response. -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -99,7 +99,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/kidoz/kidoz.go b/adapters/kidoz/kidoz.go index fda6869e12f..670bfb80b49 100644 --- a/adapters/kidoz/kidoz.go +++ b/adapters/kidoz/kidoz.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,7 +17,7 @@ type KidozAdapter struct { endpoint string } -func (a *KidozAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *KidozAdapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -102,7 +102,7 @@ func (a *KidozAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.Ext return result, errs } -func (a *KidozAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *KidozAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error switch responseData.StatusCode { @@ -129,7 +129,7 @@ func (a *KidozAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.Request }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse err := json.Unmarshal(responseData.Body, &bidResponse) if err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -169,7 +169,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters const UndefinedMediaType = openrtb_ext.BidType("") -func GetMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func GetMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { var bidType openrtb_ext.BidType = UndefinedMediaType for _, impression := range imps { if impression.ID != impID { diff --git a/adapters/kidoz/kidoz_test.go b/adapters/kidoz/kidoz_test.go index 5830f60ddb5..0de06392bba 100644 --- a/adapters/kidoz/kidoz_test.go +++ b/adapters/kidoz/kidoz_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -24,14 +24,14 @@ func TestJsonSamples(t *testing.T) { adapterstest.RunJSONBidderTest(t, "kidoztest", bidder) } -func makeBidRequest() *openrtb.BidRequest { - request := &openrtb.BidRequest{ +func makeBidRequest() *openrtb2.BidRequest { + request := &openrtb2.BidRequest{ ID: "test-req-id-0", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "test-imp-id-0", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: 320, H: 50, @@ -89,22 +89,22 @@ func TestMakeBids(t *testing.T) { } func TestGetMediaTypeForImp(t *testing.T) { - imps := []openrtb.Imp{ + imps := []openrtb2.Imp{ { ID: "1", - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "2", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, }, { ID: "3", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, }, { ID: "4", - Audio: &openrtb.Audio{}, + Audio: &openrtb2.Audio{}, }, } diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index d05b6e7979a..54e89200844 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getHeaders(request *openrtb.BidRequest) *http.Header { +func getHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -60,7 +60,7 @@ func getHeaders(request *openrtb.BidRequest) *http.Header { } func (a *KrushmediaAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -107,7 +107,7 @@ func (a *KrushmediaAdapter) MakeRequests( }}, nil } -func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtKrushmedia, error) { +func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtKrushmedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -129,7 +129,7 @@ func (a *KrushmediaAdapter) buildEndpointURL(params *openrtb_ext.ExtKrushmedia) } func (a *KrushmediaAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -157,7 +157,7 @@ func (a *KrushmediaAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Bad Server Response", @@ -176,7 +176,7 @@ func (a *KrushmediaAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/kubient/kubient.go b/adapters/kubient/kubient.go index a995586533a..8b011b7f795 100644 --- a/adapters/kubient/kubient.go +++ b/adapters/kubient/kubient.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" ) @@ -28,7 +28,7 @@ type KubientAdapter struct { // MakeRequests prepares the HTTP requests which should be made to fetch bids. func (adapter *KubientAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ([]*adapters.RequestData, []error) { if len(openRTBRequest.Imp) == 0 { @@ -65,7 +65,7 @@ func (adapter *KubientAdapter) MakeRequests( return requestsToBidder, errs } -func checkImpExt(impObj openrtb.Imp) error { +func checkImpExt(impObj openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(impObj.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -87,7 +87,7 @@ func checkImpExt(impObj openrtb.Imp) error { } // MakeBids makes the bids -func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -106,7 +106,7 @@ func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -131,7 +131,7 @@ func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/kubient/kubienttest/supplemental/bad_response.json b/adapters/kubient/kubienttest/supplemental/bad_response.json index 076acf29058..832dc975088 100644 --- a/adapters/kubient/kubienttest/supplemental/bad_response.json +++ b/adapters/kubient/kubienttest/supplemental/bad_response.json @@ -54,7 +54,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/lifestreet/lifestreet.go b/adapters/lifestreet/lifestreet.go index 4dbd7baed62..7114a9bbaac 100644 --- a/adapters/lifestreet/lifestreet.go +++ b/adapters/lifestreet/lifestreet.go @@ -9,9 +9,9 @@ import ( "net/http" "strings" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/pbs" @@ -63,7 +63,7 @@ func (a *LifestreetAdapter) callOne(ctx context.Context, req *pbs.PBSRequest, re return } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return @@ -98,11 +98,11 @@ func (a *LifestreetAdapter) callOne(ctx context.Context, req *pbs.PBSRequest, re return } -func (a *LifestreetAdapter) MakeOpenRtbBidRequest(req *pbs.PBSRequest, bidder *pbs.PBSBidder, slotTag string, mtype pbs.MediaType, unitInd int) (openrtb.BidRequest, error) { +func (a *LifestreetAdapter) MakeOpenRtbBidRequest(req *pbs.PBSRequest, bidder *pbs.PBSBidder, slotTag string, mtype pbs.MediaType, unitInd int) (openrtb2.BidRequest, error) { lsReq, err := adapters.MakeOpenRTBGeneric(req, bidder, a.Name(), []pbs.MediaType{mtype}) if err != nil { - return openrtb.BidRequest{}, err + return openrtb2.BidRequest{}, err } if lsReq.Imp != nil && len(lsReq.Imp) > 0 { diff --git a/adapters/lifestreet/lifestreet_test.go b/adapters/lifestreet/lifestreet_test.go index 412333c3714..215f137ccf4 100644 --- a/adapters/lifestreet/lifestreet_test.go +++ b/adapters/lifestreet/lifestreet_test.go @@ -10,13 +10,13 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/pbs" "github.com/prebid/prebid-server/usersync" "fmt" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" ) @@ -53,7 +53,7 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -84,7 +84,7 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Model '%s' doesn't match '%s", breq.Device.Model, lsdata.deviceModel), http.StatusInternalServerError) return } - if *breq.Device.ConnectionType != openrtb.ConnectionType(lsdata.deviceConnectiontype) { + if *breq.Device.ConnectionType != openrtb2.ConnectionType(lsdata.deviceConnectiontype) { http.Error(w, fmt.Sprintf("Connectiontype '%d' doesn't match '%d", breq.Device.ConnectionType, lsdata.deviceConnectiontype), http.StatusInternalServerError) return } @@ -96,24 +96,24 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Wrong number of imp objects sent: %d", len(breq.Imp)), http.StatusInternalServerError) return } - var bid *openrtb.Bid + var bid *openrtb2.Bid for _, tag := range lsdata.tags { if breq.Imp[0].Banner == nil { http.Error(w, fmt.Sprintf("No banner object sent"), http.StatusInternalServerError) return } - if *breq.Imp[0].Banner.W != lsdata.width || *breq.Imp[0].Banner.H != lsdata.height { + if *breq.Imp[0].Banner.W != int64(lsdata.width) || *breq.Imp[0].Banner.H != int64(lsdata.height) { http.Error(w, fmt.Sprintf("Size '%dx%d' doesn't match '%dx%d", breq.Imp[0].Banner.W, breq.Imp[0].Banner.H, lsdata.width, lsdata.height), http.StatusInternalServerError) return } if breq.Imp[0].TagID == tag.slotTag { - bid = &openrtb.Bid{ + bid = &openrtb2.Bid{ ID: "random-id", ImpID: breq.Imp[0].ID, Price: tag.bid, AdM: tag.content, - W: lsdata.width, - H: lsdata.height, + W: int64(lsdata.width), + H: int64(lsdata.height), } } } @@ -122,14 +122,14 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "2345676337", BidID: "975537589956", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "LSM", - Bid: []openrtb.Bid{*bid}, + Bid: []openrtb2.Bid{*bid}, }, }, } @@ -181,25 +181,25 @@ func TestLifestreetBasicResponse(t *testing.T) { pbin := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 2), - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: lsdata.appBundle, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: lsdata.deviceUA, IP: lsdata.deviceIP, Make: lsdata.deviceMake, Model: lsdata.deviceModel, - ConnectionType: openrtb.ConnectionType(lsdata.deviceConnectiontype).Ptr(), + ConnectionType: openrtb2.ConnectionType(lsdata.deviceConnectiontype).Ptr(), IFA: lsdata.deviceIfa, }, } for i, tag := range lsdata.tags { pbin.AdUnits[i] = pbs.AdUnit{ Code: tag.code, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { - W: lsdata.width, - H: lsdata.height, + W: int64(lsdata.width), + H: int64(lsdata.height), }, }, Bids: []pbs.Bids{ @@ -266,7 +266,7 @@ func TestLifestreetBasicResponse(t *testing.T) { if bid.Price != tag.bid { t.Errorf("Incorrect bid price '%.2f' expected '%.2f'", bid.Price, tag.bid) } - if bid.Width != lsdata.width || bid.Height != lsdata.height { + if bid.Width != int64(lsdata.width) || bid.Height != int64(lsdata.height) { t.Errorf("Incorrect bid size %dx%d, expected %dx%d", bid.Width, bid.Height, lsdata.width, lsdata.height) } if bid.Adm != tag.content { diff --git a/adapters/lockerdome/lockerdome.go b/adapters/lockerdome/lockerdome.go index a81313c6e80..483ffbd5bd6 100644 --- a/adapters/lockerdome/lockerdome.go +++ b/adapters/lockerdome/lockerdome.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -20,7 +20,7 @@ type LockerDomeAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids [from the bidder, in this case, LockerDome] -func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb.BidRequest, extraReqInfo *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { +func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb2.BidRequest, extraReqInfo *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { numberOfImps := len(openRTBRequest.Imp) @@ -70,7 +70,7 @@ func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb.BidReques indexesOfValidImps = append(indexesOfValidImps, i) } if numberOfImps > len(indexesOfValidImps) { - var validImps []openrtb.Imp + var validImps []openrtb2.Imp for j := 0; j < len(indexesOfValidImps); j++ { validImps = append(validImps, openRTBRequest.Imp[j]) } @@ -109,7 +109,7 @@ func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb.BidReques } // MakeBids unpacks the server's response into Bids. -func (adapter *LockerDomeAdapter) MakeBids(openRTBRequest *openrtb.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData) (bidderResponse *adapters.BidderResponse, errs []error) { +func (adapter *LockerDomeAdapter) MakeBids(openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData) (bidderResponse *adapters.BidderResponse, errs []error) { if bidderRawResponse.StatusCode == http.StatusNoContent { return nil, nil @@ -127,7 +127,7 @@ func (adapter *LockerDomeAdapter) MakeBids(openRTBRequest *openrtb.BidRequest, r }} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{ fmt.Errorf("Error unmarshaling LockerDome bid response - %s", err.Error()), diff --git a/adapters/lockerdome/lockerdometest/supplemental/bad_response.json b/adapters/lockerdome/lockerdometest/supplemental/bad_response.json index 8df8a0e1633..d119a47da80 100644 --- a/adapters/lockerdome/lockerdometest/supplemental/bad_response.json +++ b/adapters/lockerdome/lockerdometest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "Error unmarshaling LockerDome bid response - json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Error unmarshaling LockerDome bid response - json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/logicad/logicad.go b/adapters/logicad/logicad.go index 30d9dd5df4c..bc45652d127 100644 --- a/adapters/logicad/logicad.go +++ b/adapters/logicad/logicad.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,7 +16,7 @@ type LogicadAdapter struct { endpoint string } -func (adapter *LogicadAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *LogicadAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{Message: "No impression in the bid request"}} } @@ -38,10 +38,10 @@ func (adapter *LogicadAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo return result, errs } -func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLogicad][]openrtb.Imp, []openrtb.Imp, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpLogicad][]openrtb2.Imp, []openrtb2.Imp, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) - res := make(map[openrtb_ext.ExtImpLogicad][]openrtb.Imp) + resImps := make([]openrtb2.Imp, 0, len(imps)) + res := make(map[openrtb_ext.ExtImpLogicad][]openrtb2.Imp) for _, imp := range imps { impExt, err := getImpressionExt(&imp) @@ -55,7 +55,7 @@ func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLogicad][]ope } if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) resImps = append(resImps, imp) @@ -70,7 +70,7 @@ func validateImpression(impExt *openrtb_ext.ExtImpLogicad) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (openrtb_ext.ExtImpLogicad, error) { +func getImpressionExt(imp *openrtb2.Imp) (openrtb_ext.ExtImpLogicad, error) { var bidderExt adapters.ExtImpBidder var logicadExt openrtb_ext.ExtImpLogicad @@ -87,7 +87,7 @@ func getImpressionExt(imp *openrtb.Imp) (openrtb_ext.ExtImpLogicad, error) { return logicadExt, nil } -func (adapter *LogicadAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *LogicadAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -105,7 +105,7 @@ func (adapter *LogicadAdapter) buildAdapterRequest(prebidBidRequest *openrtb.Bid Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -117,7 +117,7 @@ func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext. } //MakeBids translates Logicad bid response to prebid-server specific format -func (adapter *LogicadAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *LogicadAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -126,7 +126,7 @@ func (adapter *LogicadAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg := fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} diff --git a/adapters/lunamedia/lunamedia.go b/adapters/lunamedia/lunamedia.go index 289d062c8bb..a8040365964 100644 --- a/adapters/lunamedia/lunamedia.go +++ b/adapters/lunamedia/lunamedia.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,7 +19,7 @@ type LunaMediaAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *LunaMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *LunaMediaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "No impression in the bid request"}) @@ -49,10 +49,10 @@ func (adapter *LunaMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqIn } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLunaMedia][]openrtb.Imp, []openrtb.Imp, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpLunaMedia][]openrtb2.Imp, []openrtb2.Imp, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) - res := make(map[openrtb_ext.ExtImpLunaMedia][]openrtb.Imp) + resImps := make([]openrtb2.Imp, 0, len(imps)) + res := make(map[openrtb_ext.ExtImpLunaMedia][]openrtb2.Imp) for _, imp := range imps { impExt, err := getImpressionExt(&imp) @@ -71,7 +71,7 @@ func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLunaMedia][]o continue } if res[*impExt] == nil { - res[*impExt] = make([]openrtb.Imp, 0) + res[*impExt] = make([]openrtb2.Imp, 0) } res[*impExt] = append(res[*impExt], imp) resImps = append(resImps, imp) @@ -87,7 +87,7 @@ func validateImpression(impExt *openrtb_ext.ExtImpLunaMedia) error { } //Alter impression info to comply with LunaMedia platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to LunaMedia platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -95,7 +95,7 @@ func compatImpression(imp *openrtb.Imp) error { return nil } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner @@ -114,7 +114,7 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpLunaMedia, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpLunaMedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -130,7 +130,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpLunaMedia, error) { return &LunaMediaExt, nil } -func (adapter *LunaMediaAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *LunaMediaAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -154,7 +154,7 @@ func (adapter *LunaMediaAdapter) buildAdapterRequest(prebidBidRequest *openrtb.B Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -184,7 +184,7 @@ func (adapter *LunaMediaAdapter) buildEndpointURL(params *openrtb_ext.ExtImpLuna } //MakeBids translates LunaMedia bid response to prebid-server specific format -func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var msg = "" if response.StatusCode == http.StatusNoContent { return nil, nil @@ -194,7 +194,7 @@ func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, e return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg = fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} @@ -218,7 +218,7 @@ func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, e } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo diff --git a/adapters/marsmedia/marsmedia.go b/adapters/marsmedia/marsmedia.go index eb1e8da0858..20d0d1fc645 100644 --- a/adapters/marsmedia/marsmedia.go +++ b/adapters/marsmedia/marsmedia.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,7 +17,7 @@ type MarsmediaAdapter struct { URI string } -func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { request := *requestIn @@ -106,7 +106,7 @@ func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo * }}, []error{} } -func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -124,7 +124,7 @@ func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d. ", err), @@ -150,7 +150,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // getMediaTypeForImp figures out which media type this bid is for. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner //default type for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/mgid/mgid.go b/adapters/mgid/mgid.go index d6ba175d336..0917003ab82 100644 --- a/adapters/mgid/mgid.go +++ b/adapters/mgid/mgid.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -26,7 +26,7 @@ type RespBidExt struct { CreativeType openrtb_ext.BidType `json:"crtype"` } -func (a *MgidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) (adapterRequests []*adapters.RequestData, errs []error) { +func (a *MgidAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (adapterRequests []*adapters.RequestData, errs []error) { adapterReq, errs := a.makeRequest(request) if adapterReq != nil && len(errs) == 0 { @@ -36,7 +36,7 @@ func (a *MgidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapter return } -func (a *MgidAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *MgidAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error path, err := preprocess(request) @@ -65,7 +65,7 @@ func (a *MgidAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Reques } // Mutate the request to get it ready to send to yieldmo. -func preprocess(request *openrtb.BidRequest) (path string, err error) { +func preprocess(request *openrtb2.BidRequest) (path string, err error) { if request.TMax == 0 { request.TMax = 200 } @@ -123,7 +123,7 @@ func preprocess(request *openrtb.BidRequest) (path string, err error) { return } -func (a *MgidAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *MgidAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -140,7 +140,7 @@ func (a *MgidAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.Requ }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} diff --git a/adapters/mobfoxpb/mobfoxpb.go b/adapters/mobfoxpb/mobfoxpb.go index 6982e419cd5..d39fbfb74e9 100644 --- a/adapters/mobfoxpb/mobfoxpb.go +++ b/adapters/mobfoxpb/mobfoxpb.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -37,7 +37,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests create bid request for mobfoxpb demand -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var route string var method string @@ -67,7 +67,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex requestURI = strings.Replace(requestURI, MACROS_ROUTE, route, 1) requestURI = strings.Replace(requestURI, MACROS_METHOD, method, 1) - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} adapterReq, err := a.makeRequest(&reqCopy, requestURI) if err != nil { errs = append(errs, err) @@ -78,7 +78,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return adapterRequests, errs } -func (a *adapter) makeRequest(request *openrtb.BidRequest, requestURI string) (*adapters.RequestData, error) { +func (a *adapter) makeRequest(request *openrtb2.BidRequest, requestURI string) (*adapters.RequestData, error) { reqJSON, err := json.Marshal(request) if err != nil { @@ -97,7 +97,7 @@ func (a *adapter) makeRequest(request *openrtb.BidRequest, requestURI string) (* } // MakeBids makes the bids -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -110,7 +110,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -134,7 +134,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json index efd1ac90d9d..d61cb8837c4 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json @@ -78,7 +78,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/mobilefuse/mobilefuse.go b/adapters/mobilefuse/mobilefuse.go index 76c18e27007..217f0f24b7b 100644 --- a/adapters/mobilefuse/mobilefuse.go +++ b/adapters/mobilefuse/mobilefuse.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (adapter *MobileFuseAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *MobileFuseAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var adapterRequests []*adapters.RequestData adapterRequest, errs := adapter.makeRequest(request) @@ -44,7 +44,7 @@ func (adapter *MobileFuseAdapter) MakeRequests(request *openrtb.BidRequest, reqI return adapterRequests, errs } -func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb.BidRequest, outgoingRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb2.BidRequest, outgoingRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -61,7 +61,7 @@ func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb.BidRequest, }} } - var incomingBidResponse openrtb.BidResponse + var incomingBidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &incomingBidResponse); err != nil { return nil, []error{err} @@ -81,7 +81,7 @@ func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb.BidRequest, return outgoingBidResponse, nil } -func (adapter *MobileFuseAdapter) makeRequest(bidRequest *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (adapter *MobileFuseAdapter) makeRequest(bidRequest *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error mobileFuseExtension, errs := adapter.getFirstMobileFuseExtension(bidRequest) @@ -124,7 +124,7 @@ func (adapter *MobileFuseAdapter) makeRequest(bidRequest *openrtb.BidRequest) (* }, errs } -func (adapter *MobileFuseAdapter) getFirstMobileFuseExtension(request *openrtb.BidRequest) (*openrtb_ext.ExtImpMobileFuse, []error) { +func (adapter *MobileFuseAdapter) getFirstMobileFuseExtension(request *openrtb2.BidRequest) (*openrtb_ext.ExtImpMobileFuse, []error) { var mobileFuseImpExtension openrtb_ext.ExtImpMobileFuse var errs []error @@ -167,8 +167,8 @@ func (adapter *MobileFuseAdapter) getEndpoint(ext *openrtb_ext.ExtImpMobileFuse) return url, nil } -func (adapter *MobileFuseAdapter) getValidImps(bidRequest *openrtb.BidRequest, ext *openrtb_ext.ExtImpMobileFuse) []openrtb.Imp { - var validImps []openrtb.Imp +func (adapter *MobileFuseAdapter) getValidImps(bidRequest *openrtb2.BidRequest, ext *openrtb_ext.ExtImpMobileFuse) []openrtb2.Imp { + var validImps []openrtb2.Imp for _, imp := range bidRequest.Imp { if imp.Banner != nil || imp.Video != nil { @@ -187,7 +187,7 @@ func (adapter *MobileFuseAdapter) getValidImps(bidRequest *openrtb.BidRequest, e return validImps } -func (adapter *MobileFuseAdapter) getBidType(imp_id string, imps []openrtb.Imp) openrtb_ext.BidType { +func (adapter *MobileFuseAdapter) getBidType(imp_id string, imps []openrtb2.Imp) openrtb_ext.BidType { if imps[0].Video != nil { return openrtb_ext.BidTypeVideo } diff --git a/adapters/nanointeractive/nanointeractive.go b/adapters/nanointeractive/nanointeractive.go index 7189543e0f8..afe80bcbfee 100644 --- a/adapters/nanointeractive/nanointeractive.go +++ b/adapters/nanointeractive/nanointeractive.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,10 +16,10 @@ type NanoInteractiveAdapter struct { endpoint string } -func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp var adapterRequests []*adapters.RequestData var referer string = "" @@ -47,7 +47,7 @@ func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb.BidRequest, re // set referer origin if referer != "" { if bidRequest.Site == nil { - bidRequest.Site = &openrtb.Site{} + bidRequest.Site = &openrtb2.Site{} } bidRequest.Site.Ref = referer } @@ -88,7 +88,7 @@ func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb.BidRequest, re } func (a *NanoInteractiveAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { @@ -104,7 +104,7 @@ func (a *NanoInteractiveAdapter) MakeBids( }} } - var openRtbBidResponse openrtb.BidResponse + var openRtbBidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &openRtbBidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -129,7 +129,7 @@ func (a *NanoInteractiveAdapter) MakeBids( return bidResponse, nil } -func checkImp(imp *openrtb.Imp) (string, error) { +func checkImp(imp *openrtb2.Imp) (string, error) { // We support only banner impression if imp.Banner == nil { return "", fmt.Errorf("invalid MediaType. NanoInteractive only supports Banner type. ImpID=%s", imp.ID) diff --git a/adapters/ninthdecimal/ninthdecimal.go b/adapters/ninthdecimal/ninthdecimal.go index 03095ee6c44..e819a2787a2 100755 --- a/adapters/ninthdecimal/ninthdecimal.go +++ b/adapters/ninthdecimal/ninthdecimal.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,7 +19,7 @@ type NinthDecimalAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *NinthDecimalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *NinthDecimalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "No impression in the bid request"}) @@ -49,10 +49,10 @@ func (adapter *NinthDecimalAdapter) MakeRequests(request *openrtb.BidRequest, re } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpNinthDecimal][]openrtb.Imp, []openrtb.Imp, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpNinthDecimal][]openrtb2.Imp, []openrtb2.Imp, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) - res := make(map[openrtb_ext.ExtImpNinthDecimal][]openrtb.Imp) + resImps := make([]openrtb2.Imp, 0, len(imps)) + res := make(map[openrtb_ext.ExtImpNinthDecimal][]openrtb2.Imp) for _, imp := range imps { impExt, err := getImpressionExt(&imp) @@ -71,7 +71,7 @@ func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpNinthDecimal] continue } if res[*impExt] == nil { - res[*impExt] = make([]openrtb.Imp, 0) + res[*impExt] = make([]openrtb2.Imp, 0) } res[*impExt] = append(res[*impExt], imp) resImps = append(resImps, imp) @@ -87,7 +87,7 @@ func validateImpression(impExt *openrtb_ext.ExtImpNinthDecimal) error { } //Alter impression info to comply with NinthDecimal platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to NinthDecimal platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -95,7 +95,7 @@ func compatImpression(imp *openrtb.Imp) error { return nil } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner @@ -114,7 +114,7 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpNinthDecimal, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpNinthDecimal, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -130,7 +130,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpNinthDecimal, error) return &NinthDecimalExt, nil } -func (adapter *NinthDecimalAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *NinthDecimalAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -154,7 +154,7 @@ func (adapter *NinthDecimalAdapter) buildAdapterRequest(prebidBidRequest *openrt Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -184,7 +184,7 @@ func (adapter *NinthDecimalAdapter) buildEndpointURL(params *openrtb_ext.ExtImpN } //MakeBids translates NinthDecimal bid response to prebid-server specific format -func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var msg = "" if response.StatusCode == http.StatusNoContent { return nil, nil @@ -194,7 +194,7 @@ func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb.BidRequest return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg = fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} @@ -218,7 +218,7 @@ func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb.BidRequest } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo diff --git a/adapters/nobid/nobid.go b/adapters/nobid/nobid.go index 875a7260e80..7fc7669b7c4 100644 --- a/adapters/nobid/nobid.go +++ b/adapters/nobid/nobid.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -26,7 +26,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests Makes the OpenRTB request payload -func (a *NoBidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *NoBidAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ @@ -52,7 +52,7 @@ func (a *NoBidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte } // MakeBids makes the bids -func (a *NoBidAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *NoBidAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -70,7 +70,7 @@ func (a *NoBidAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -98,7 +98,7 @@ func (a *NoBidAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, errs } -func getBidCount(bidResponse openrtb.BidResponse) int { +func getBidCount(bidResponse openrtb2.BidResponse) int { c := 0 for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) @@ -106,7 +106,7 @@ func getBidCount(bidResponse openrtb.BidResponse) int { return c } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/onetag/onetag.go b/adapters/onetag/onetag.go index ebf428439ed..6069682bc2a 100644 --- a/adapters/onetag/onetag.go +++ b/adapters/onetag/onetag.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -31,7 +31,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { pubID := "" for idx, imp := range request.Imp { onetagExt, err := getImpressionExt(imp) @@ -73,7 +73,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapter return []*adapters.RequestData{requestData}, nil } -func getImpressionExt(imp openrtb.Imp) (*openrtb_ext.ExtImpOnetag, error) { +func getImpressionExt(imp openrtb2.Imp) (*openrtb_ext.ExtImpOnetag, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -96,7 +96,7 @@ func (a *adapter) buildEndpointURL(pubID string) (string, error) { return macros.ResolveMacros(a.endpointTemplate, endpointParams) } -func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil } @@ -108,7 +108,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.Re return nil, []error{err} } - var response openrtb.BidResponse + var response openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &response); err != nil { return nil, []error{err} } @@ -131,7 +131,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.Re return bidResponse, nil } -func getMediaTypeForBid(impressions []openrtb.Imp, bid openrtb.Bid) (openrtb_ext.BidType, error) { +func getMediaTypeForBid(impressions []openrtb2.Imp, bid openrtb2.Bid) (openrtb_ext.BidType, error) { for _, impression := range impressions { if impression.ID == bid.ImpID { if impression.Banner != nil { diff --git a/adapters/openrtb_util.go b/adapters/openrtb_util.go index 55064ea7d07..bc18b9ebf17 100644 --- a/adapters/openrtb_util.go +++ b/adapters/openrtb_util.go @@ -3,10 +3,9 @@ package adapters import ( "encoding/json" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/pbs" - - "github.com/mxmCherry/openrtb" ) func min(x, y int) int { @@ -37,37 +36,37 @@ func commonMediaTypes(l1 []pbs.MediaType, l2 []pbs.MediaType) []pbs.MediaType { return res[:i] } -func makeBanner(unit pbs.PBSAdUnit) *openrtb.Banner { - return &openrtb.Banner{ - W: openrtb.Uint64Ptr(unit.Sizes[0].W), - H: openrtb.Uint64Ptr(unit.Sizes[0].H), +func makeBanner(unit pbs.PBSAdUnit) *openrtb2.Banner { + return &openrtb2.Banner{ + W: openrtb2.Int64Ptr(unit.Sizes[0].W), + H: openrtb2.Int64Ptr(unit.Sizes[0].H), Format: copyFormats(unit.Sizes), // defensive copy because adapters may mutate Imps, and this is shared data TopFrame: unit.TopFrame, } } -func makeVideo(unit pbs.PBSAdUnit) *openrtb.Video { +func makeVideo(unit pbs.PBSAdUnit) *openrtb2.Video { // empty mimes array is a sign of uninitialized Video object if len(unit.Video.Mimes) < 1 { return nil } mimes := make([]string, len(unit.Video.Mimes)) copy(mimes, unit.Video.Mimes) - pbm := make([]openrtb.PlaybackMethod, 1) + pbm := make([]openrtb2.PlaybackMethod, 1) //this will become int8 soon, so we only care about the first index in the array - pbm[0] = openrtb.PlaybackMethod(unit.Video.PlaybackMethod) + pbm[0] = openrtb2.PlaybackMethod(unit.Video.PlaybackMethod) - protocols := make([]openrtb.Protocol, 0, len(unit.Video.Protocols)) + protocols := make([]openrtb2.Protocol, 0, len(unit.Video.Protocols)) for _, protocol := range unit.Video.Protocols { - protocols = append(protocols, openrtb.Protocol(protocol)) + protocols = append(protocols, openrtb2.Protocol(protocol)) } - return &openrtb.Video{ + return &openrtb2.Video{ MIMEs: mimes, MinDuration: unit.Video.Minduration, MaxDuration: unit.Video.Maxduration, W: unit.Sizes[0].W, H: unit.Sizes[0].H, - StartDelay: openrtb.StartDelay(unit.Video.Startdelay).Ptr(), + StartDelay: openrtb2.StartDelay(unit.Video.Startdelay).Ptr(), PlaybackMethod: pbm, Protocols: protocols, } @@ -77,8 +76,8 @@ func makeVideo(unit pbs.PBSAdUnit) *openrtb.Video { // // Any objects pointed to by the returned BidRequest *must not be mutated*, or we will get race conditions. // The only exception is the Imp property, whose objects will be created new by this method and can be mutated freely. -func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily string, allowedMediatypes []pbs.MediaType) (openrtb.BidRequest, error) { - imps := make([]openrtb.Imp, 0, len(bidder.AdUnits)*len(allowedMediatypes)) +func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily string, allowedMediatypes []pbs.MediaType) (openrtb2.BidRequest, error) { + imps := make([]openrtb2.Imp, 0, len(bidder.AdUnits)*len(allowedMediatypes)) for _, unit := range bidder.AdUnits { if len(unit.Sizes) <= 0 { continue @@ -88,7 +87,7 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily continue } - newImp := openrtb.Imp{ + newImp := openrtb2.Imp{ ID: unit.Code, Secure: &req.Secure, Instl: unit.Instl, @@ -101,7 +100,7 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily newImp.Video = makeVideo(unit) // It's strange to error here... but preserves legacy behavior in legacy code. See #603. if newImp.Video == nil { - return openrtb.BidRequest{}, &errortypes.BadInput{ + return openrtb2.BidRequest{}, &errortypes.BadInput{ Message: "Invalid AdUnit: VIDEO media type with no video data", } } @@ -113,19 +112,19 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily } if len(imps) < 1 { - return openrtb.BidRequest{}, &errortypes.BadInput{ + return openrtb2.BidRequest{}, &errortypes.BadInput{ Message: "openRTB bids need at least one Imp", } } if req.App != nil { - return openrtb.BidRequest{ + return openrtb2.BidRequest{ ID: req.Tid, Imp: imps, App: req.App, Device: req.Device, User: req.User, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: req.Tid, }, AT: 1, @@ -142,20 +141,20 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily userExt = req.User.Ext } - return openrtb.BidRequest{ + return openrtb2.BidRequest{ ID: req.Tid, Imp: imps, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Domain: req.Domain, Page: req.Url, }, Device: req.Device, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: buyerUID, ID: id, Ext: userExt, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ FD: 1, // upstream, aka header TID: req.Tid, }, @@ -165,8 +164,8 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily }, nil } -func copyFormats(sizes []openrtb.Format) []openrtb.Format { - sizesCopy := make([]openrtb.Format, len(sizes)) +func copyFormats(sizes []openrtb2.Format) []openrtb2.Format { + sizesCopy := make([]openrtb2.Format, len(sizes)) for i := 0; i < len(sizes); i++ { sizesCopy[i] = sizes[i] sizesCopy[i].Ext = append([]byte(nil), sizes[i].Ext...) diff --git a/adapters/openrtb_util_test.go b/adapters/openrtb_util_test.go index 2cf67c22537..d859114b646 100644 --- a/adapters/openrtb_util_test.go +++ b/adapters/openrtb_util_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/pbs" "github.com/prebid/prebid-server/usersync" "github.com/stretchr/testify/assert" @@ -42,7 +42,7 @@ func TestOpenRTB(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -73,7 +73,7 @@ func TestOpenRTBVideo(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -96,8 +96,8 @@ func TestOpenRTBVideo(t *testing.T) { assert.Equal(t, resp.Imp[0].ID, "unitCode") assert.EqualValues(t, resp.Imp[0].Video.MaxDuration, 30) assert.EqualValues(t, resp.Imp[0].Video.MinDuration, 15) - assert.EqualValues(t, *resp.Imp[0].Video.StartDelay, openrtb.StartDelay(5)) - assert.EqualValues(t, resp.Imp[0].Video.PlaybackMethod, []openrtb.PlaybackMethod{openrtb.PlaybackMethod(1)}) + assert.EqualValues(t, *resp.Imp[0].Video.StartDelay, openrtb2.StartDelay(5)) + assert.EqualValues(t, resp.Imp[0].Video.PlaybackMethod, []openrtb2.PlaybackMethod{openrtb2.PlaybackMethod(1)}) assert.EqualValues(t, resp.Imp[0].Video.MIMEs, []string{"video/mp4"}) } @@ -110,7 +110,7 @@ func TestOpenRTBVideoNoVideoData(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -134,7 +134,7 @@ func TestOpenRTBVideoFilteredOut(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -152,7 +152,7 @@ func TestOpenRTBVideoFilteredOut(t *testing.T) { { Code: "unitCode2", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -179,7 +179,7 @@ func TestOpenRTBMultiMediaImp(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO, pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -215,7 +215,7 @@ func TestOpenRTBMultiMediaImpFiltered(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO, pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -237,7 +237,7 @@ func TestOpenRTBMultiMediaImpFiltered(t *testing.T) { assert.Equal(t, len(resp.Imp), 1) assert.Equal(t, resp.Imp[0].ID, "unitCode") assert.EqualValues(t, *resp.Imp[0].Banner.W, 10) - assert.EqualValues(t, resp.Imp[0].Video, (*openrtb.Video)(nil)) + assert.EqualValues(t, resp.Imp[0].Video, (*openrtb2.Video)(nil)) } func TestOpenRTBNoSize(t *testing.T) { @@ -267,20 +267,20 @@ func TestOpenRTBMobile(t *testing.T) { MaxKeyLength: 20, Secure: 1, TimeoutMillis: 1000, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "AppNexus.PrebidMobileDemo", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "1995257847363113", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "test_ua", IP: "test_ip", Make: "test_make", Model: "test_model", IFA: "test_ifa", }, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: "test_buyeruid", }, } @@ -290,7 +290,7 @@ func TestOpenRTBMobile(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, @@ -318,7 +318,7 @@ func TestOpenRTBMobile(t *testing.T) { func TestOpenRTBEmptyUser(t *testing.T) { pbReq := pbs.PBSRequest{ - User: &openrtb.User{}, + User: &openrtb2.User{}, } pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", @@ -326,7 +326,7 @@ func TestOpenRTBEmptyUser(t *testing.T) { { Code: "unitCode2", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -337,14 +337,14 @@ func TestOpenRTBEmptyUser(t *testing.T) { } resp, err := MakeOpenRTBGeneric(&pbReq, &pbBidder, "test", []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}) assert.Equal(t, err, nil) - assert.EqualValues(t, resp.User, &openrtb.User{}) + assert.EqualValues(t, resp.User, &openrtb2.User{}) } func TestOpenRTBUserWithCookie(t *testing.T) { pbsCookie := usersync.NewPBSCookie() pbsCookie.TrySync("test", "abcde") pbReq := pbs.PBSRequest{ - User: &openrtb.User{}, + User: &openrtb2.User{}, } pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", @@ -352,7 +352,7 @@ func TestOpenRTBUserWithCookie(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, @@ -368,7 +368,7 @@ func TestOpenRTBUserWithCookie(t *testing.T) { } func TestSizesCopy(t *testing.T) { - formats := []openrtb.Format{ + formats := []openrtb2.Format{ { W: 10, }, @@ -402,7 +402,7 @@ func TestMakeVideo(t *testing.T) { adUnit := pbs.PBSAdUnit{ Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -421,7 +421,7 @@ func TestMakeVideo(t *testing.T) { video := makeVideo(adUnit) assert.EqualValues(t, video.MinDuration, 15) assert.EqualValues(t, video.MaxDuration, 30) - assert.EqualValues(t, *video.StartDelay, openrtb.StartDelay(5)) + assert.EqualValues(t, *video.StartDelay, openrtb2.StartDelay(5)) assert.EqualValues(t, len(video.PlaybackMethod), 1) assert.EqualValues(t, len(video.Protocols), 4) } @@ -435,10 +435,10 @@ func TestGDPR(t *testing.T) { regsExt, _ := json.Marshal(rawRegsExt) pbReq := pbs.PBSRequest{ - User: &openrtb.User{ + User: &openrtb2.User{ Ext: userExt, }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: regsExt, }, } @@ -449,7 +449,7 @@ func TestGDPR(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -486,24 +486,24 @@ func TestGDPRMobile(t *testing.T) { MaxKeyLength: 20, Secure: 1, TimeoutMillis: 1000, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "AppNexus.PrebidMobileDemo", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "1995257847363113", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "test_ua", IP: "test_ip", Make: "test_make", Model: "test_model", IFA: "test_ifa", }, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: "test_buyeruid", Ext: userExt, }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: regsExt, }, } @@ -513,7 +513,7 @@ func TestGDPRMobile(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index b6640b1f5e9..c8c0de8d9d2 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -28,10 +28,10 @@ type openxReqExt struct { BidderConfig string `json:"bc"` } -func (a *OpenxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *OpenxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var bannerImps []openrtb.Imp - var videoImps []openrtb.Imp + var bannerImps []openrtb2.Imp + var videoImps []openrtb2.Imp for _, imp := range request.Imp { // OpenX doesn't allow multi-type imp. Banner takes priority over video. @@ -55,7 +55,7 @@ func (a *OpenxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte // OpenX only supports single imp video request for _, videoImp := range videoImps { - reqCopy.Imp = []openrtb.Imp{videoImp} + reqCopy.Imp = []openrtb2.Imp{videoImp} adapterReq, errors := a.makeRequest(&reqCopy) if adapterReq != nil { adapterRequests = append(adapterRequests, adapterReq) @@ -66,9 +66,9 @@ func (a *OpenxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte return adapterRequests, errs } -func (a *OpenxAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *OpenxAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp reqExt := openxReqExt{BidderConfig: hbconfig} for _, imp := range request.Imp { @@ -111,7 +111,7 @@ func (a *OpenxAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Reque } // Mutate the imp to get it ready to send to openx. -func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error { +func preprocess(imp *openrtb2.Imp, reqExt *openxReqExt) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -158,7 +158,7 @@ func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error { return nil } -func (a *OpenxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *OpenxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -175,7 +175,7 @@ func (a *OpenxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -202,7 +202,7 @@ func (a *OpenxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq // // OpenX doesn't support multi-type impressions. // If both banner and video exist, take banner as we do not want in-banner video. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/openx/openx_test.go b/adapters/openx/openx_test.go index 81d2ff227ec..aaf7ecf85a2 100644 --- a/adapters/openx/openx_test.go +++ b/adapters/openx/openx_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -41,10 +41,10 @@ func assertCurrencyInBidResponse(t *testing.T, expectedCurrency string, currency t.Fatalf("Builder returned unexpected error %v", buildErr) } - prebidRequest := &openrtb.BidRequest{ - Imp: []openrtb.Imp{}, + prebidRequest := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{}, } - mockedBidResponse := &openrtb.BidResponse{} + mockedBidResponse := &openrtb2.BidResponse{} if currency != nil { mockedBidResponse.Cur = *currency } diff --git a/adapters/orbidder/orbidder.go b/adapters/orbidder/orbidder.go index e26ad4efc0c..b0b3bcfbb7a 100644 --- a/adapters/orbidder/orbidder.go +++ b/adapters/orbidder/orbidder.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,9 +17,9 @@ type OrbidderAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids from orbidder. -func (rcv *OrbidderAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (rcv *OrbidderAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // check if imps exists, if not return error and do send request to orbidder. if len(request.Imp) == 0 { @@ -62,7 +62,7 @@ func (rcv *OrbidderAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a }}, errs } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -81,7 +81,7 @@ func preprocess(imp *openrtb.Imp) error { } // MakeBids unpacks server response into Bids. -func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -104,7 +104,7 @@ func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/pangle/pangle.go b/adapters/pangle/pangle.go index 97f9b542734..cc215412a5f 100644 --- a/adapters/pangle/pangle.go +++ b/adapters/pangle/pangle.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -41,7 +41,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters /* MakeRequests */ -func getAdType(imp openrtb.Imp, parsedImpExt *wrappedExtImpBidder) int { +func getAdType(imp openrtb2.Imp, parsedImpExt *wrappedExtImpBidder) int { // video if imp.Video != nil { if parsedImpExt != nil && parsedImpExt.Prebid != nil && parsedImpExt.Prebid.IsRewardedInventory == 1 { @@ -67,7 +67,7 @@ func getAdType(imp openrtb.Imp, parsedImpExt *wrappedExtImpBidder) int { return -1 } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var requests []*adapters.RequestData var errs []error @@ -98,7 +98,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapter continue } - requestCopy.Imp = []openrtb.Imp{imp} + requestCopy.Imp = []openrtb2.Imp{imp} requestJSON, err := json.Marshal(requestCopy) if err != nil { errs = append(errs, err) @@ -122,7 +122,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapter /* MakeBids */ -func getMediaTypeForBid(bid *openrtb.Bid) (openrtb_ext.BidType, error) { +func getMediaTypeForBid(bid *openrtb2.Bid) (openrtb_ext.BidType, error) { if bid == nil { return "", fmt.Errorf("the bid request object is nil") } @@ -150,7 +150,7 @@ func getMediaTypeForBid(bid *openrtb.Bid) (openrtb_ext.BidType, error) { return "", fmt.Errorf("unrecognized adtype in response") } -func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil } @@ -169,7 +169,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.Re return nil, []error{err} } - var response openrtb.BidResponse + var response openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &response); err != nil { return nil, []error{err} } diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index be3ebb313f3..f3f5785492d 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -158,8 +158,8 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder } pbReq.Imp[i].TagID = strings.TrimSpace(adSlot[0]) - pbReq.Imp[i].Banner.H = openrtb.Uint64Ptr(uint64(height)) - pbReq.Imp[i].Banner.W = openrtb.Uint64Ptr(uint64(width)) + pbReq.Imp[i].Banner.H = openrtb2.Int64Ptr(int64(height)) + pbReq.Imp[i].Banner.W = openrtb2.Int64Ptr(int64(width)) if len(params.Keywords) != 0 { kvstr := prepareImpressionExt(params.Keywords) @@ -190,12 +190,12 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder if pbReq.Site != nil { siteCopy := *pbReq.Site - siteCopy.Publisher = &openrtb.Publisher{ID: params.PublisherId, Domain: req.Domain} + siteCopy.Publisher = &openrtb2.Publisher{ID: params.PublisherId, Domain: req.Domain} pbReq.Site = &siteCopy } if pbReq.App != nil { appCopy := *pbReq.App - appCopy.Publisher = &openrtb.Publisher{ID: params.PublisherId, Domain: req.Domain} + appCopy.Publisher = &openrtb2.Publisher{ID: params.PublisherId, Domain: req.Domain} pbReq.App = &appCopy } } @@ -264,7 +264,7 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder debug.ResponseBody = string(body) } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, &errortypes.BadServerResponse{ @@ -314,7 +314,7 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder return bids, nil } -func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *PubmaticAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var err error @@ -343,7 +343,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada publisherCopy.ID = pubID siteCopy.Publisher = &publisherCopy } else { - siteCopy.Publisher = &openrtb.Publisher{ID: pubID} + siteCopy.Publisher = &openrtb2.Publisher{ID: pubID} } request.Site = &siteCopy } else if request.App != nil { @@ -353,7 +353,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada publisherCopy.ID = pubID appCopy.Publisher = &publisherCopy } else { - appCopy.Publisher = &openrtb.Publisher{ID: pubID} + appCopy.Publisher = &openrtb2.Publisher{ID: pubID} } request.App = &appCopy } @@ -384,7 +384,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada // validateAdslot validate the optional adslot string // valid formats are 'adslot@WxH', 'adslot' and no adslot -func validateAdSlot(adslot string, imp *openrtb.Imp) error { +func validateAdSlot(adslot string, imp *openrtb2.Imp) error { adSlotStr := strings.TrimSpace(adslot) if len(adSlotStr) == 0 { @@ -418,7 +418,7 @@ func validateAdSlot(adslot string, imp *openrtb.Imp) error { //In case of video, size could be derived from the player size if imp.Banner != nil { - imp.Banner = assignBannerHeightAndWidth(imp.Banner, uint64(height), uint64(width)) + imp.Banner = assignBannerHeightAndWidth(imp.Banner, int64(height), int64(width)) } } else { return errors.New(fmt.Sprintf("Invalid adSlot %v", adSlotStr)) @@ -427,7 +427,7 @@ func validateAdSlot(adslot string, imp *openrtb.Imp) error { return nil } -func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { +func assignBannerSize(banner *openrtb2.Banner) (*openrtb2.Banner, error) { if banner.W != nil && banner.H != nil { return banner, nil } @@ -439,17 +439,17 @@ func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { return assignBannerHeightAndWidth(banner, banner.Format[0].H, banner.Format[0].H), nil } -func assignBannerHeightAndWidth(banner *openrtb.Banner, h uint64, w uint64) *openrtb.Banner { +func assignBannerHeightAndWidth(banner *openrtb2.Banner, h, w int64) *openrtb2.Banner { bannerCopy := *banner - bannerCopy.W = openrtb.Uint64Ptr(w) - bannerCopy.H = openrtb.Uint64Ptr(h) + bannerCopy.W = openrtb2.Int64Ptr(w) + bannerCopy.H = openrtb2.Int64Ptr(h) return &bannerCopy } // parseImpressionObject parse the imp to get it ready to send to pubmatic -func parseImpressionObject(imp *openrtb.Imp, wrapExt *string, pubID *string) error { +func parseImpressionObject(imp *openrtb2.Imp, wrapExt *string, pubID *string) error { // PubMatic supports banner and video impressions. if imp.Banner == nil && imp.Video == nil { return fmt.Errorf("Invalid MediaType. PubMatic only supports Banner and Video. Ignoring ImpID=%s", imp.ID) @@ -537,7 +537,7 @@ func prepareImpressionExt(keywords map[string]string) string { return kvStr } -func (a *PubmaticAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *PubmaticAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -552,7 +552,7 @@ func (a *PubmaticAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/pubmatic/pubmatic_test.go b/adapters/pubmatic/pubmatic_test.go index 8ed2ccd391c..7e8f177a1ba 100644 --- a/adapters/pubmatic/pubmatic_test.go +++ b/adapters/pubmatic/pubmatic_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/cache/dummycache" @@ -35,7 +35,7 @@ func TestJsonSamples(t *testing.T) { // ---------------------------------------------------------------------------- // Code below this line tests the legacy, non-openrtb code flow. It can be deleted after we -// clean up the existing code and make everything openrtb. +// clean up the existing code and make everything openrtb2. func CompareStringValue(val1 string, val2 string, t *testing.T) { if val1 != val2 { @@ -51,29 +51,29 @@ func DummyPubMaticServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: breq.ID, BidID: "bidResponse_ID", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "pubmatic", - Bid: make([]openrtb.Bid, 0), + Bid: make([]openrtb2.Bid, 0), }, }, } rand.Seed(int64(time.Now().UnixNano())) - var bids []openrtb.Bid + var bids []openrtb2.Bid for i, imp := range breq.Imp { - bids = append(bids, openrtb.Bid{ + bids = append(bids, openrtb2.Bid{ ID: fmt.Sprintf("SeatID_%d", i), ImpID: imp.ID, Price: float64(int(rand.Float64()*1000)) / 100, @@ -130,7 +130,7 @@ func TestPubmaticTimeout(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -165,7 +165,7 @@ func TestPubmaticInvalidJson(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -201,7 +201,7 @@ func TestPubmaticInvalidStatusCode(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -234,7 +234,7 @@ func TestPubmaticInvalidInputParameters(t *testing.T) { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -306,7 +306,7 @@ func TestPubmaticBasicResponse_MandatoryParams(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -342,7 +342,7 @@ func TestPubmaticBasicResponse_AllParams(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -387,7 +387,7 @@ func TestPubmaticMultiImpressionResponse(t *testing.T) { Code: "unitCode1", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -399,7 +399,7 @@ func TestPubmaticMultiImpressionResponse(t *testing.T) { Code: "unitCode1", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 800, H: 200, @@ -435,7 +435,7 @@ func TestPubmaticMultiAdUnitResponse(t *testing.T) { Code: "unitCode1", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -447,7 +447,7 @@ func TestPubmaticMultiAdUnitResponse(t *testing.T) { Code: "unitCode2", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 800, H: 200, @@ -484,7 +484,7 @@ func TestPubmaticMobileResponse(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -495,7 +495,7 @@ func TestPubmaticMobileResponse(t *testing.T) { }, } - pbReq.App = &openrtb.App{ + pbReq.App = &openrtb2.App{ ID: "com.test", Name: "testApp", } @@ -524,7 +524,7 @@ func TestPubmaticInvalidLookupBidIDParameter(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -556,7 +556,7 @@ func TestPubmaticAdSlotParams(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -636,7 +636,7 @@ func TestPubmaticSampleRequest(t *testing.T) { } pbReq.AdUnits[0] = pbs.AdUnit{ Code: "adUnit_1", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 100, H: 120, diff --git a/adapters/pubnative/pubnative.go b/adapters/pubnative/pubnative.go index 9144d6ddaae..35bc7553db3 100644 --- a/adapters/pubnative/pubnative.go +++ b/adapters/pubnative/pubnative.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -18,7 +18,7 @@ type PubnativeAdapter struct { URI string } -func (a *PubnativeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *PubnativeAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { impCount := len(request.Imp) requestData := make([]*adapters.RequestData, 0, impCount) errs := []error{} @@ -53,7 +53,7 @@ func (a *PubnativeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad continue } - requestCopy.Imp = []openrtb.Imp{imp} + requestCopy.Imp = []openrtb2.Imp{imp} reqJSON, err := json.Marshal(&requestCopy) if err != nil { errs = append(errs, err) @@ -77,7 +77,7 @@ func (a *PubnativeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad return requestData, errs } -func checkRequest(request *openrtb.BidRequest) error { +func checkRequest(request *openrtb2.BidRequest) error { if request.Device == nil || len(request.Device.OS) == 0 { return &errortypes.BadInput{ Message: "Impression is missing device OS information", @@ -87,7 +87,7 @@ func checkRequest(request *openrtb.BidRequest) error { return nil } -func convertImpression(imp *openrtb.Imp) error { +func convertImpression(imp *openrtb2.Imp) error { if imp.Banner == nil && imp.Video == nil && imp.Native == nil { return &errortypes.BadInput{ Message: "Pubnative only supports banner, video or native ads.", @@ -105,15 +105,15 @@ func convertImpression(imp *openrtb.Imp) error { } // make sure that banner has openrtb 2.3-compatible size information -func convertBanner(banner *openrtb.Banner) (*openrtb.Banner, error) { +func convertBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { if len(banner.Format) > 0 { f := banner.Format[0] bannerCopy := *banner - bannerCopy.W = openrtb.Uint64Ptr(f.W) - bannerCopy.H = openrtb.Uint64Ptr(f.H) + bannerCopy.W = openrtb2.Int64Ptr(f.W) + bannerCopy.H = openrtb2.Int64Ptr(f.H) return &bannerCopy, nil } else { @@ -125,7 +125,7 @@ func convertBanner(banner *openrtb.Banner) (*openrtb.Banner, error) { return banner, nil } -func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -142,7 +142,7 @@ func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var parsedResponse openrtb.BidResponse + var parsedResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &parsedResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: err.Error(), @@ -173,7 +173,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/pulsepoint/pulsepoint.go b/adapters/pulsepoint/pulsepoint.go index b07a2cba66f..35297d795a6 100644 --- a/adapters/pulsepoint/pulsepoint.go +++ b/adapters/pulsepoint/pulsepoint.go @@ -1,17 +1,16 @@ package pulsepoint import ( + "bytes" + "context" "encoding/json" "fmt" + "io/ioutil" "net/http" "strconv" - - "bytes" - "context" - "io/ioutil" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -33,12 +32,12 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *PulsePointAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var err error pubID := "" - imps := make([]openrtb.Imp, 0, len(request.Imp)) + imps := make([]openrtb2.Imp, 0, len(request.Imp)) for i := 0; i < len(request.Imp); i++ { imp := request.Imp[i] var bidderExt adapters.ExtImpBidder @@ -77,7 +76,7 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a publisher.ID = pubID site.Publisher = &publisher } else { - site.Publisher = &openrtb.Publisher{ID: pubID} + site.Publisher = &openrtb2.Publisher{ID: pubID} } request.Site = &site } else if request.App != nil { @@ -87,7 +86,7 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a publisher.ID = pubID app.Publisher = &publisher } else { - app.Publisher = &openrtb.Publisher{ID: pubID} + app.Publisher = &openrtb2.Publisher{ID: pubID} } request.App = &app } @@ -109,7 +108,7 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a }}, errs } -func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { // passback if response.StatusCode == http.StatusNoContent { return nil, nil @@ -127,14 +126,14 @@ func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } // parse response - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) // map imps by id - impsByID := make(map[string]openrtb.Imp) + impsByID := make(map[string]openrtb2.Imp) for i := 0; i < len(internalRequest.Imp); i++ { impsByID[internalRequest.Imp[i].ID] = internalRequest.Imp[i] } @@ -156,7 +155,7 @@ func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return bidResponse, errs } -func getBidType(imp openrtb.Imp) openrtb_ext.BidType { +func getBidType(imp openrtb2.Imp) openrtb_ext.BidType { // derive the bidtype purely from the impression itself if imp.Banner != nil { return openrtb_ext.BidTypeBanner @@ -235,7 +234,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde break } ppReq.Imp[i].TagID = strconv.Itoa(params.TagId) - publisher := &openrtb.Publisher{ID: strconv.Itoa(params.PublisherId)} + publisher := &openrtb2.Publisher{ID: strconv.Itoa(params.PublisherId)} if ppReq.Site != nil { siteCopy := *ppReq.Site siteCopy.Publisher = publisher @@ -250,7 +249,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde if len(size) == 2 { width, err := strconv.Atoi(size[0]) if err == nil { - ppReq.Imp[i].Banner.W = openrtb.Uint64Ptr(uint64(width)) + ppReq.Imp[i].Banner.W = openrtb2.Int64Ptr(int64(width)) } else { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Invalid Width param %s", size[0]), @@ -258,7 +257,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde } height, err := strconv.Atoi(size[1]) if err == nil { - ppReq.Imp[i].Banner.H = openrtb.Uint64Ptr(uint64(height)) + ppReq.Imp[i].Banner.H = openrtb2.Int64Ptr(int64(height)) } else { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Invalid Height param %s", size[1]), @@ -318,7 +317,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde debug.ResponseBody = string(body) } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, &errortypes.BadServerResponse{ diff --git a/adapters/pulsepoint/pulsepoint_test.go b/adapters/pulsepoint/pulsepoint_test.go index 33023d0500a..a16f9a0e470 100644 --- a/adapters/pulsepoint/pulsepoint_test.go +++ b/adapters/pulsepoint/pulsepoint_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/openrtb_ext" @@ -187,7 +187,7 @@ func TestMobileAppRequest(t *testing.T) { server := service.Server ctx := context.TODO() req := SampleRequest(1, t) - req.App = &openrtb.App{ + req.App = &openrtb2.App{ ID: "com.facebook.katana", Name: "facebook", } @@ -215,7 +215,7 @@ func SampleRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { for i := 0; i < numberOfImpressions; i++ { req.AdUnits[i] = pbs.AdUnit{ Code: fmt.Sprintf("div-adunit-%d", i+1), - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -265,7 +265,7 @@ func SampleRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { */ func CreateService(tagsToBid map[string]bool) adapterstest.OrtbMockService { service := adapterstest.OrtbMockService{} - var lastBidRequest openrtb.BidRequest + var lastBidRequest openrtb2.BidRequest server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) @@ -273,14 +273,14 @@ func CreateService(tagsToBid map[string]bool) adapterstest.OrtbMockService { http.Error(w, err.Error(), http.StatusInternalServerError) return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } lastBidRequest = breq - var bids []openrtb.Bid + var bids []openrtb2.Bid for i, imp := range breq.Imp { if tagsToBid[imp.TagID] { bids = append(bids, adapterstest.SampleBid(imp.Banner.W, imp.Banner.H, imp.ID, i+1)) @@ -290,9 +290,9 @@ func CreateService(tagsToBid map[string]bool) adapterstest.OrtbMockService { if len(bids) == 0 { w.WriteHeader(204) } else { - // serialize the bids to openrtb.BidResponse - js, _ := json.Marshal(openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + // serialize the bids to openrtb2.BidResponse + js, _ := json.Marshal(openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { Bid: bids, }, diff --git a/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json b/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json index b5209ed4bbe..8d34bab0578 100644 --- a/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json +++ b/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json @@ -83,7 +83,7 @@ }], "expectedBidResponses": [], "expectedMakeBidsErrors": [{ - "value": "json: cannot unmarshal string into Go struct field Bid.seatbid.bid.w of type uint64", + "value": "json: cannot unmarshal string into Go struct field Bid.seatbid.bid.w of type int64", "comparison": "literal" } ] diff --git a/adapters/revcontent/revcontent.go b/adapters/revcontent/revcontent.go index 5a34f3ef199..f3b24436d63 100644 --- a/adapters/revcontent/revcontent.go +++ b/adapters/revcontent/revcontent.go @@ -3,12 +3,13 @@ package revcontent import ( "encoding/json" "fmt" - "github.com/mxmCherry/openrtb" + "net/http" + + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" - "net/http" ) type adapter struct { @@ -23,7 +24,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { reqBody, err := json.Marshal(request) if err != nil { @@ -46,7 +47,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return []*adapters.RequestData{req}, nil } -func checkRequest(request *openrtb.BidRequest) error { +func checkRequest(request *openrtb2.BidRequest) error { if (request.App == nil || len(request.App.Name) == 0) && (request.Site == nil || len(request.Site.Domain) == 0) { return &errortypes.BadInput{ Message: "Impression is missing app name or site domain, and must contain one.", @@ -57,7 +58,7 @@ func checkRequest(request *openrtb.BidRequest) error { } // MakeBids make the bids for the bid response. -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -74,7 +75,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} diff --git a/adapters/revcontent/revcontenttest/supplemental/bad_response.json b/adapters/revcontent/revcontenttest/supplemental/bad_response.json index bd562373f1b..751aed92c27 100644 --- a/adapters/revcontent/revcontenttest/supplemental/bad_response.json +++ b/adapters/revcontent/revcontenttest/supplemental/bad_response.json @@ -43,7 +43,7 @@ "expectedMakeBidsErrors": [ { "comparison": "literal", - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse" + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse" } ] } diff --git a/adapters/rhythmone/rhythmone.go b/adapters/rhythmone/rhythmone.go index a507e778550..096e9190622 100644 --- a/adapters/rhythmone/rhythmone.go +++ b/adapters/rhythmone/rhythmone.go @@ -6,7 +6,7 @@ import ( "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,7 +17,7 @@ type RhythmoneAdapter struct { endPoint string } -func (a *RhythmoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *RhythmoneAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var uri string @@ -43,7 +43,7 @@ func (a *RhythmoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad return nil, errs } -func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -59,7 +59,7 @@ func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa Message: fmt.Sprintf("unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %d. ", err), @@ -80,7 +80,7 @@ func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa return bidResponse, errs } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { @@ -103,7 +103,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *RhythmoneAdapter) preProcess(req *openrtb.BidRequest, errors []error) (*openrtb.BidRequest, string, []error) { +func (a *RhythmoneAdapter) preProcess(req *openrtb2.BidRequest, errors []error) (*openrtb2.BidRequest, string, []error) { numRequests := len(req.Imp) var uri string = "" for i := 0; i < numRequests; i++ { diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index 1f86d4f365b..b2eccd76305 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -27,7 +27,7 @@ type RTBHouseAdapter struct { // MakeRequests prepares the HTTP requests which should be made to fetch bids. func (adapter *RTBHouseAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -57,7 +57,7 @@ const unexpectedStatusCodeFormat = "" + // MakeBids unpacks the server's response into Bids. func (adapter *RTBHouseAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -81,7 +81,7 @@ func (adapter *RTBHouseAdapter) MakeBids( return nil, []error{err} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{err} } diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json b/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json index b6af4209f48..f84f5555259 100644 --- a/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json +++ b/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json @@ -54,7 +54,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index 32bf971cb6b..dff961cc79f 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -11,15 +11,13 @@ import ( "strings" "github.com/golang/glog" - "github.com/prebid/prebid-server/config" - "github.com/prebid/prebid-server/pbs" - - "golang.org/x/net/context/ctxhttp" - - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/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" + "github.com/prebid/prebid-server/pbs" + "golang.org/x/net/context/ctxhttp" ) const badvLimitSize = 50 @@ -326,7 +324,7 @@ func findPrimary(alt []int) (int, []int) { return primary, alt } -func parseRubiconSizes(sizes []openrtb.Format) (primary int, alt []int, err error) { +func parseRubiconSizes(sizes []openrtb2.Format) (primary int, alt []int, err error) { // Fixes #317 if len(sizes) < 1 { err = &errortypes.BadInput{ @@ -385,7 +383,7 @@ func (a *RubiconAdapter) callOne(ctx context.Context, reqJSON bytes.Buffer) (res return } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { err = &errortypes.BadServerResponse{ @@ -523,14 +521,14 @@ func (a *RubiconAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder * if rubiReq.Site != nil { siteCopy := *rubiReq.Site siteCopy.Ext, err = json.Marshal(&siteExt) - siteCopy.Publisher = &openrtb.Publisher{} + siteCopy.Publisher = &openrtb2.Publisher{} siteCopy.Publisher.Ext, err = json.Marshal(&pubExt) - siteCopy.Content = &openrtb.Content{} + siteCopy.Content = &openrtb2.Content{} siteCopy.Content.Language = rubiconUser.Language rubiReq.Site = &siteCopy } else { - site := &openrtb.Site{} - site.Content = &openrtb.Content{} + site := &openrtb2.Site{} + site.Content = &openrtb2.Content{} site.Content.Language = rubiconUser.Language rubiReq.Site = site } @@ -538,12 +536,12 @@ func (a *RubiconAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder * if rubiReq.App != nil { appCopy := *rubiReq.App appCopy.Ext, err = json.Marshal(&siteExt) - appCopy.Publisher = &openrtb.Publisher{} + appCopy.Publisher = &openrtb2.Publisher{} appCopy.Publisher.Ext, err = json.Marshal(&pubExt) rubiReq.App = &appCopy } - rubiReq.Imp = []openrtb.Imp{thisImp} + rubiReq.Imp = []openrtb2.Imp{thisImp} var reqBuffer bytes.Buffer err = json.NewEncoder(&reqBuffer).Encode(rubiReq) @@ -616,7 +614,7 @@ func (a *RubiconAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder * return bids, nil } -func resolveVideoSizeId(placement openrtb.VideoPlacementType, instl int8, impId string) (sizeID int, err error) { +func resolveVideoSizeId(placement openrtb2.VideoPlacementType, instl int8, impId string) (sizeID int, err error) { if placement != 0 { if placement == 1 { return 201, nil @@ -674,7 +672,7 @@ func NewRubiconLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, uri string, } } -func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { numRequests := len(request.Imp) errs := make([]error, 0, len(request.Imp)) var err error @@ -853,14 +851,14 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap if request.Site != nil { siteCopy := *request.Site siteCopy.Ext, err = json.Marshal(&siteExt) - siteCopy.Publisher = &openrtb.Publisher{} + siteCopy.Publisher = &openrtb2.Publisher{} siteCopy.Publisher.Ext, err = json.Marshal(&pubExt) rubiconRequest.Site = &siteCopy } if request.App != nil { appCopy := *request.App appCopy.Ext, err = json.Marshal(&siteExt) - appCopy.Publisher = &openrtb.Publisher{} + appCopy.Publisher = &openrtb2.Publisher{} appCopy.Publisher.Ext, err = json.Marshal(&pubExt) rubiconRequest.App = &appCopy } @@ -872,7 +870,7 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap } } - rubiconRequest.Imp = []openrtb.Imp{thisImp} + rubiconRequest.Imp = []openrtb2.Imp{thisImp} rubiconRequest.Cur = nil rubiconRequest.Ext = nil @@ -895,7 +893,7 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return requestData, errs } -func updateUserExtWithIabAttribute(userExtRP *rubiconUserExt, data []openrtb.Data) error { +func updateUserExtWithIabAttribute(userExtRP *rubiconUserExt, data []openrtb2.Data) error { var segmentIdsToCopy = make([]string, 0) for _, dataRecord := range data { @@ -1018,7 +1016,7 @@ func updateUserExtWithTpIdsAndSegments(userExtRP *rubiconUserExt, rubiconUidsPar return nil } -func isVideo(imp openrtb.Imp) bool { +func isVideo(imp openrtb2.Imp) bool { video := imp.Video if video != nil { // Do any other media types exist? Or check required video fields. @@ -1027,12 +1025,12 @@ func isVideo(imp openrtb.Imp) bool { return false } -func isFullyPopulatedVideo(video *openrtb.Video) bool { +func isFullyPopulatedVideo(video *openrtb2.Video) bool { // These are just recommended video fields for XAPI return video.MIMEs != nil && video.Protocols != nil && video.MaxDuration != 0 && video.Linearity != 0 && video.API != nil } -func (a *RubiconAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *RubiconAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -1049,14 +1047,14 @@ func (a *RubiconAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: err.Error(), }} } - var bidReq openrtb.BidRequest + var bidReq openrtb2.BidRequest if err := json.Unmarshal(externalRequest.Body, &bidReq); err != nil { return nil, []error{err} } @@ -1103,7 +1101,7 @@ func (a *RubiconAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR return bidResponse, nil } -func cmpOverrideFromBidRequest(bidRequest *openrtb.BidRequest) float64 { +func cmpOverrideFromBidRequest(bidRequest *openrtb2.BidRequest) float64 { var bidRequestExt bidRequestExt if err := json.Unmarshal(bidRequest.Ext, &bidRequestExt); err != nil { return 0 @@ -1112,7 +1110,7 @@ func cmpOverrideFromBidRequest(bidRequest *openrtb.BidRequest) float64 { return bidRequestExt.Prebid.Bidders.Rubicon.Debug.CpmOverride } -func mapImpIdToCpmOverride(imps []openrtb.Imp) map[string]float64 { +func mapImpIdToCpmOverride(imps []openrtb2.Imp) map[string]float64 { impIdToCmpOverride := make(map[string]float64) for _, imp := range imps { var bidderExt adapters.ExtImpBidder diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index 41e37f41126..747758bc820 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "github.com/prebid/prebid-server/errortypes" "io/ioutil" "net/http" "net/http/httptest" @@ -12,6 +11,9 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/pbs" @@ -21,7 +23,6 @@ import ( "strings" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -81,7 +82,7 @@ func DummyRubiconServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -126,14 +127,14 @@ func DummyRubiconServer(w http.ResponseWriter, r *http.Request) { return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 2), + Bid: make([]openrtb2.Bid, 2), }, }, } @@ -185,7 +186,7 @@ func DummyRubiconServer(w http.ResponseWriter, r *http.Request) { targeting := "{\"rp\":{\"targeting\":[{\"key\":\"key1\",\"values\":[\"value1\"]},{\"key\":\"key2\",\"values\":[\"value2\"]}]}}" rawTargeting := json.RawMessage(targeting) - resp.SeatBid[0].Bid[0] = openrtb.Bid{ + resp.SeatBid[0].Bid[0] = openrtb2.Bid{ ID: "random-id", ImpID: imp.ID, Price: rubidata.tags[ix].bid, @@ -320,8 +321,8 @@ func TestRubiconUserSyncInfo(t *testing.T) { assert.False(t, an.SkipNoCookies(), "SkipNoCookies should be false") } -func getTestSizes() map[int]openrtb.Format { - return map[int]openrtb.Format{ +func getTestSizes() map[int]openrtb2.Format { + return map[int]openrtb2.Format{ 15: {W: 300, H: 250}, 10: {W: 300, H: 600}, 2: {W: 728, H: 91}, @@ -335,7 +336,7 @@ func getTestSizes() map[int]openrtb.Format { func TestParseSizes(t *testing.T) { SIZE_ID := getTestSizes() - sizes := []openrtb.Format{ + sizes := []openrtb2.Format{ SIZE_ID[10], SIZE_ID[15], } @@ -345,7 +346,7 @@ func TestParseSizes(t *testing.T) { assert.Equal(t, 1, len(alt), "Alt not len 1") assert.Equal(t, 10, alt[0], "Alt not 10: %d", alt[0]) - sizes = []openrtb.Format{ + sizes = []openrtb2.Format{ { W: 1111, H: 2222, @@ -357,7 +358,7 @@ func TestParseSizes(t *testing.T) { assert.Equal(t, 15, primary, "Primary %d != 15", primary) assert.Equal(t, 0, len(alt), "Alt len %d != 0", len(alt)) - sizes = []openrtb.Format{ + sizes = []openrtb2.Format{ SIZE_ID[15], } primary, alt, err = parseRubiconSizes(sizes) @@ -365,7 +366,7 @@ func TestParseSizes(t *testing.T) { assert.Equal(t, 15, primary, "Primary %d != 15", primary) assert.Equal(t, 0, len(alt), "Alt len %d != 0", len(alt)) - sizes = []openrtb.Format{ + sizes = []openrtb2.Format{ { W: 1111, H: 1222, @@ -385,20 +386,20 @@ func TestMASAlgorithm(t *testing.T) { ok bool } type testStub struct { - input []openrtb.Format + input []openrtb2.Format output output } testStubs := []testStub{ { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[2], SIZE_ID[9], }, output{2, []int{9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[9], SIZE_ID[15], @@ -406,14 +407,14 @@ func TestMASAlgorithm(t *testing.T) { output{15, []int{9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[2], SIZE_ID[15], }, output{15, []int{2}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[15], SIZE_ID[9], SIZE_ID[2], @@ -421,7 +422,7 @@ func TestMASAlgorithm(t *testing.T) { output{15, []int{2, 9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[10], SIZE_ID[9], SIZE_ID[2], @@ -429,7 +430,7 @@ func TestMASAlgorithm(t *testing.T) { output{2, []int{10, 9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[15], @@ -437,7 +438,7 @@ func TestMASAlgorithm(t *testing.T) { output{15, []int{33, 8}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[9], @@ -446,7 +447,7 @@ func TestMASAlgorithm(t *testing.T) { output{2, []int{33, 8, 9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[9], @@ -454,7 +455,7 @@ func TestMASAlgorithm(t *testing.T) { output{9, []int{33, 8}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[2], @@ -462,24 +463,24 @@ func TestMASAlgorithm(t *testing.T) { output{2, []int{33, 8}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[2], }, output{2, []int{33}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[8], }, output{8, []int{}, false}, }, { - []openrtb.Format{}, + []openrtb2.Format{}, output{0, []int{}, true}, }, { - []openrtb.Format{ + []openrtb2.Format{ {W: 1111, H: 2345, }, @@ -527,7 +528,7 @@ func TestAppendTracker(t *testing.T) { func TestResolveVideoSizeId(t *testing.T) { testScenarios := []struct { - placement openrtb.VideoPlacementType + placement openrtb2.VideoPlacementType instl int8 impId string expected int @@ -626,11 +627,11 @@ func TestWrongFormatResponse(t *testing.T) { func TestZeroSeatBidResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{}, + SeatBid: []openrtb2.SeatBid{}, } js, _ := json.Marshal(resp) w.Write(js) @@ -647,14 +648,14 @@ func TestZeroSeatBidResponse(t *testing.T) { func TestEmptyBidResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 0), + Bid: make([]openrtb2.Bid, 0), }, }, } @@ -673,18 +674,18 @@ func TestEmptyBidResponse(t *testing.T) { func TestWrongBidIdResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 2), + Bid: make([]openrtb2.Bid, 2), }, }, } - resp.SeatBid[0].Bid[0] = openrtb.Bid{ + resp.SeatBid[0].Bid[0] = openrtb2.Bid{ ID: "random-id", ImpID: "zma", Price: 1.67, @@ -710,18 +711,18 @@ func TestWrongBidIdResponse(t *testing.T) { func TestZeroPriceBidResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 1), + Bid: make([]openrtb2.Bid, 1), }, }, } - resp.SeatBid[0].Bid[0] = openrtb.Bid{ + resp.SeatBid[0].Bid[0] = openrtb2.Bid{ ID: "test-bid-id", ImpID: "first-tag", Price: 0, @@ -747,7 +748,7 @@ func TestDifferentRequest(t *testing.T) { an, ctx, pbReq := CreatePrebidRequest(server, t) // test app not nil - pbReq.App = &openrtb.App{ + pbReq.App = &openrtb2.App{ ID: "com.test", Name: "testApp", } @@ -775,13 +776,13 @@ func TestDifferentRequest(t *testing.T) { pbReq.Bidders[0].AdUnits[0].Params = json.RawMessage(fmt.Sprintf("{\"zoneId\": %d, \"siteId\": %d, \"accountId\": %d, \"visitor\": %s, \"inventory\": %s}", 8394, rubidata.siteID, rubidata.accountID, rubidata.visitorTargeting, rubidata.inventoryTargeting)) // test invalid size - pbReq.Bidders[0].AdUnits[0].Sizes = []openrtb.Format{ + pbReq.Bidders[0].AdUnits[0].Sizes = []openrtb2.Format{ { W: 2222, H: 333, }, } - pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb.Format{ + pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb2.Format{ { W: 222, H: 3333, @@ -795,7 +796,7 @@ func TestDifferentRequest(t *testing.T) { b, err := an.Call(ctx, pbReq, pbReq.Bidders[0]) assert.NotNil(t, err, "Should have gotten an error: %v", err) - pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb.Format{ + pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb2.Format{ { W: 222, H: 3333, @@ -861,7 +862,7 @@ func CreatePrebidRequest(server *httptest.Server, t *testing.T) (an *RubiconAdap pbin := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 3), - Device: &openrtb.Device{PxRatio: rubidata.devicePxRatio}, + Device: &openrtb2.Device{PxRatio: rubidata.devicePxRatio}, SDK: &pbs.SDK{Source: rubidata.sdkSource, Platform: rubidata.sdkPlatform, Version: rubidata.sdkVersion}, } @@ -869,7 +870,7 @@ func CreatePrebidRequest(server *httptest.Server, t *testing.T) (an *RubiconAdap pbin.AdUnits[i] = pbs.AdUnit{ Code: tag.code, MediaTypes: []string{tag.mediaType}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ SIZE_ID[10], SIZE_ID[15], }, @@ -946,12 +947,12 @@ func TestOpenRTBRequest(t *testing.T) { devicePxRatio: 4.0, } - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-banner-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, @@ -965,7 +966,7 @@ func TestOpenRTBRequest(t *testing.T) { }}`), }, { ID: "test-imp-video-id", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, @@ -988,10 +989,10 @@ func TestOpenRTBRequest(t *testing.T) { } }}`), }}, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ PxRatio: rubidata.devicePxRatio, }, - User: &openrtb.User{ + User: &openrtb2.User{ Ext: json.RawMessage(`{"digitrust": { "id": "some-digitrust-id", "keyv": 1, @@ -1015,7 +1016,7 @@ func TestOpenRTBRequest(t *testing.T) { httpReq := reqs[i] assert.Equal(t, "POST", httpReq.Method, "Expected a POST message. Got %s", httpReq.Method) - var rpRequest openrtb.BidRequest + var rpRequest openrtb2.BidRequest if err := json.Unmarshal(httpReq.Body, &rpRequest); err != nil { t.Fatalf("Failed to unmarshal HTTP request: %v", rpRequest) } @@ -1031,16 +1032,16 @@ func TestOpenRTBRequest(t *testing.T) { t.Fatal("Error unmarshalling request from the outgoing request.") } - assert.Equal(t, uint64(300), rpRequest.Imp[0].Banner.Format[0].W, + assert.Equal(t, int64(300), rpRequest.Imp[0].Banner.Format[0].W, "Banner width does not match. Expected %d, Got %d", 300, rpRequest.Imp[0].Banner.Format[0].W) - assert.Equal(t, uint64(250), rpRequest.Imp[0].Banner.Format[0].H, + assert.Equal(t, int64(250), rpRequest.Imp[0].Banner.Format[0].H, "Banner height does not match. Expected %d, Got %d", 250, rpRequest.Imp[0].Banner.Format[0].H) - assert.Equal(t, uint64(300), rpRequest.Imp[0].Banner.Format[1].W, + assert.Equal(t, int64(300), rpRequest.Imp[0].Banner.Format[1].W, "Banner width does not match. Expected %d, Got %d", 300, rpRequest.Imp[0].Banner.Format[1].W) - assert.Equal(t, uint64(600), rpRequest.Imp[0].Banner.Format[1].H, + assert.Equal(t, int64(600), rpRequest.Imp[0].Banner.Format[1].H, "Banner height does not match. Expected %d, Got %d", 600, rpRequest.Imp[0].Banner.Format[1].H) } else if rpRequest.Imp[0].ID == "test-imp-video-id" { var rpExt rubiconVideoExt @@ -1048,10 +1049,10 @@ func TestOpenRTBRequest(t *testing.T) { t.Fatal("Error unmarshalling request from the outgoing request.") } - assert.Equal(t, uint64(640), rpRequest.Imp[0].Video.W, + assert.Equal(t, int64(640), rpRequest.Imp[0].Video.W, "Video width does not match. Expected %d, Got %d", 640, rpRequest.Imp[0].Video.W) - assert.Equal(t, uint64(360), rpRequest.Imp[0].Video.H, + assert.Equal(t, int64(360), rpRequest.Imp[0].Video.H, "Video height does not match. Expected %d, Got %d", 360, rpRequest.Imp[0].Video.H) assert.Equal(t, "video/mp4", rpRequest.Imp[0].Video.MIMEs[0], "Video MIMEs do not match. Expected %s, Got %s", "video/mp4", rpRequest.Imp[0].Video.MIMEs[0]) @@ -1084,17 +1085,17 @@ func TestOpenRTBRequestWithBannerImpEvenIfImpHasVideo(t *testing.T) { SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, @@ -1115,7 +1116,7 @@ func TestOpenRTBRequestWithBannerImpEvenIfImpHasVideo(t *testing.T) { assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1131,12 +1132,12 @@ func TestOpenRTBRequestWithImpAndAdSlotIncluded(t *testing.T) { SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, @@ -1160,7 +1161,7 @@ func TestOpenRTBRequestWithImpAndAdSlotIncluded(t *testing.T) { reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1191,13 +1192,13 @@ func TestOpenRTBRequestWithBadvOverflowed(t *testing.T) { badvOverflowed[i] = strconv.Itoa(i) } - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", BAdv: badvOverflowed, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], }, }, @@ -1215,7 +1216,7 @@ func TestOpenRTBRequestWithBadvOverflowed(t *testing.T) { reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1228,12 +1229,12 @@ func TestOpenRTBRequestWithSpecificExtUserEids(t *testing.T) { SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, @@ -1244,7 +1245,7 @@ func TestOpenRTBRequestWithSpecificExtUserEids(t *testing.T) { "accountId": 7891 }}`), }}, - User: &openrtb.User{ + User: &openrtb2.User{ Ext: json.RawMessage(`{"eids": [ { "source": "pubcid", @@ -1283,7 +1284,7 @@ func TestOpenRTBRequestWithSpecificExtUserEids(t *testing.T) { reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1324,24 +1325,24 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, - Protocols: []openrtb.Protocol{openrtb.ProtocolVAST10}, + Protocols: []openrtb2.Protocol{openrtb2.ProtocolVAST10}, MaxDuration: 30, Linearity: 1, - API: []openrtb.APIFramework{}, + API: []openrtb2.APIFramework{}, }, Ext: json.RawMessage(`{"bidder": { "zoneId": 8394, @@ -1360,7 +1361,7 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1376,18 +1377,18 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t func TestOpenRTBRequestWithVideoImpAndEnabledRewardedInventoryFlag(t *testing.T) { bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, - Protocols: []openrtb.Protocol{openrtb.ProtocolVAST10}, + Protocols: []openrtb2.Protocol{openrtb2.ProtocolVAST10}, MaxDuration: 30, Linearity: 1, - API: []openrtb.APIFramework{}, + API: []openrtb2.APIFramework{}, }, Ext: json.RawMessage(`{ "prebid":{ @@ -1401,7 +1402,7 @@ func TestOpenRTBRequestWithVideoImpAndEnabledRewardedInventoryFlag(t *testing.T) reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1439,12 +1440,12 @@ func TestOpenRTBSurpriseResponse(t *testing.T) { } func TestOpenRTBStandardResponse(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 320, H: 50, }}, @@ -1486,12 +1487,12 @@ func TestOpenRTBStandardResponse(t *testing.T) { } func TestOpenRTBResponseOverridePriceFromBidRequest(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 320, H: 50, }}, @@ -1533,12 +1534,12 @@ func TestOpenRTBResponseOverridePriceFromBidRequest(t *testing.T) { } func TestOpenRTBResponseOverridePriceFromCorrespondingImp(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 320, H: 50, }}, @@ -1583,9 +1584,9 @@ func TestOpenRTBResponseOverridePriceFromCorrespondingImp(t *testing.T) { } func TestOpenRTBCopyBidIdFromResponseIfZero(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{}}, + Imp: []openrtb2.Imp{{}}, } requestJson, _ := json.Marshal(request) diff --git a/adapters/sharethrough/butler.go b/adapters/sharethrough/butler.go index 36af79c4534..c9b9726ff4e 100644 --- a/adapters/sharethrough/butler.go +++ b/adapters/sharethrough/butler.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" @@ -33,7 +33,7 @@ type StrAdSeverParams struct { } type StrOpenRTBInterface interface { - requestFromOpenRTB(openrtb.Imp, *openrtb.BidRequest, string) (*adapters.RequestData, error) + requestFromOpenRTB(openrtb2.Imp, *openrtb2.BidRequest, string) (*adapters.RequestData, error) responseToOpenRTB([]byte, *adapters.RequestData) (*adapters.BidderResponse, []error) } @@ -70,7 +70,7 @@ type StrOpenRTBTranslator struct { UserAgentParsers UserAgentParsers } -func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb.Imp, request *openrtb.BidRequest, domain string) (*adapters.RequestData, error) { +func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb2.Imp, request *openrtb2.BidRequest, domain string) (*adapters.RequestData, error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -111,8 +111,8 @@ func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb.Imp, request *openr ConsentString: userInfo.Consent, USPrivacySignal: usPolicySignal, Iframe: strImpParams.Iframe, - Height: height, - Width: width, + Height: uint64(height), + Width: uint64(width), InstantPlayCapable: s.Util.canAutoPlayVideo(request.Device.UA, s.UserAgentParsers), TheTradeDeskUserId: userInfo.TtdUid, SharethroughUserId: userInfo.StxUid, @@ -152,7 +152,7 @@ func (s StrOpenRTBTranslator) responseToOpenRTB(strRawResp []byte, btlrReq *adap return nil, errs } - bid := &openrtb.Bid{ + bid := &openrtb2.Bid{ AdID: strResp.AdServerRequestID, ID: strResp.BidID, ImpID: btlrParams.BidID, @@ -161,8 +161,8 @@ func (s StrOpenRTBTranslator) responseToOpenRTB(strRawResp []byte, btlrReq *adap CrID: creative.Metadata.CreativeKey, DealID: creative.Metadata.DealID, AdM: adm, - H: btlrParams.Height, - W: btlrParams.Width, + H: int64(btlrParams.Height), + W: int64(btlrParams.Width), } typedBid.Bid = bid @@ -171,7 +171,7 @@ func (s StrOpenRTBTranslator) responseToOpenRTB(strRawResp []byte, btlrReq *adap return bidResponse, errs } -func (h StrBodyHelper) buildBody(request *openrtb.BidRequest, strImpParams openrtb_ext.ExtImpSharethrough) (body []byte, err error) { +func (h StrBodyHelper) buildBody(request *openrtb2.BidRequest, strImpParams openrtb_ext.ExtImpSharethrough) (body []byte, err error) { timeout := request.TMax if timeout == 0 { timeout = defaultTmax diff --git a/adapters/sharethrough/butler_test.go b/adapters/sharethrough/butler_test.go index 402e8365dd0..3b1f2159bb7 100644 --- a/adapters/sharethrough/butler_test.go +++ b/adapters/sharethrough/butler_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" @@ -19,7 +19,7 @@ import ( type MockUtil struct { mockCanAutoPlayVideo func() bool mockGdprApplies func() bool - mockGetPlacementSize func() (uint64, uint64) + mockGetPlacementSize func() (int64, int64) mockParseUserInfo func() userInfo UtilityInterface } @@ -28,15 +28,15 @@ func (m MockUtil) canAutoPlayVideo(userAgent string, parsers UserAgentParsers) b return m.mockCanAutoPlayVideo() } -func (m MockUtil) gdprApplies(request *openrtb.BidRequest) bool { +func (m MockUtil) gdprApplies(request *openrtb2.BidRequest) bool { return m.mockGdprApplies() } -func (m MockUtil) getPlacementSize(imp openrtb.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height uint64, width uint64) { +func (m MockUtil) getPlacementSize(imp openrtb2.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height, width int64) { return m.mockGetPlacementSize() } -func (m MockUtil) parseUserInfo(user *openrtb.User) (ui userInfo) { +func (m MockUtil) parseUserInfo(user *openrtb2.User) (ui userInfo) { return m.mockParseUserInfo() } @@ -75,26 +75,26 @@ func assertRequestDataEquals(t *testing.T, testName string, expected *adapters.R func TestSuccessRequestFromOpenRTB(t *testing.T) { tests := map[string]struct { - inputImp openrtb.Imp - inputReq *openrtb.BidRequest + inputImp openrtb2.Imp + inputReq *openrtb2.BidRequest inputDom string expected *adapters.RequestData }{ "Generates the correct AdServer request from Imp (no user provided)": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ ID: "abc", Ext: []byte(`{ "bidder": {"pkey": "pkey", "iframe": true, "iframeSize": [10, 20], "bidfloor": 1.0} }`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }, - inputReq: &openrtb.BidRequest{ - App: &openrtb.App{Ext: []byte(`{}`)}, - Device: &openrtb.Device{ + inputReq: &openrtb2.BidRequest{ + App: &openrtb2.App{Ext: []byte(`{}`)}, + Device: &openrtb2.Device{ UA: "Android Chome/60", IP: "127.0.0.1", }, - Site: &openrtb.Site{Page: "http://a.domain.com/page"}, + Site: &openrtb2.Site{Page: "http://a.domain.com/page"}, BAdv: []string{"domain1.com", "domain2.com"}, TMax: 700, }, @@ -114,20 +114,20 @@ func TestSuccessRequestFromOpenRTB(t *testing.T) { }, }, "Generates width/height if not provided": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ ID: "abc", Ext: []byte(`{ "bidder": {"pkey": "pkey", "iframe": true} }`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }, - inputReq: &openrtb.BidRequest{ - App: &openrtb.App{Ext: []byte(`{}`)}, - Device: &openrtb.Device{ + inputReq: &openrtb2.BidRequest{ + App: &openrtb2.App{Ext: []byte(`{}`)}, + Device: &openrtb2.Device{ UA: "Android Chome/60", IP: "127.0.0.1", }, - Site: &openrtb.Site{Page: "http://a.domain.com/page"}, + Site: &openrtb2.Site{Page: "http://a.domain.com/page"}, BAdv: []string{"domain1.com", "domain2.com"}, TMax: 700, }, @@ -157,7 +157,7 @@ func TestSuccessRequestFromOpenRTB(t *testing.T) { mockUtil := MockUtil{ mockCanAutoPlayVideo: func() bool { return true }, mockGdprApplies: func() bool { return true }, - mockGetPlacementSize: func() (uint64, uint64) { return 100, 200 }, + mockGetPlacementSize: func() (int64, int64) { return 100, 200 }, mockParseUserInfo: func() userInfo { return userInfo{Consent: "ok", TtdUid: "ttduid", StxUid: "stxuid"} }, } @@ -177,27 +177,27 @@ func TestSuccessRequestFromOpenRTB(t *testing.T) { func TestFailureRequestFromOpenRTB(t *testing.T) { tests := map[string]struct { - inputImp openrtb.Imp - inputReq *openrtb.BidRequest + inputImp openrtb2.Imp + inputReq *openrtb2.BidRequest expectedError string }{ "Fails when unable to parse imp.Ext": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ Ext: []byte(`{"abc`), }, - inputReq: &openrtb.BidRequest{ - Device: &openrtb.Device{UA: "A", IP: "ip"}, - Site: &openrtb.Site{Page: "page"}, + inputReq: &openrtb2.BidRequest{ + Device: &openrtb2.Device{UA: "A", IP: "ip"}, + Site: &openrtb2.Site{Page: "page"}, }, expectedError: `unexpected end of JSON input`, }, "Fails when unable to parse imp.Ext.Bidder": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ Ext: []byte(`{ "bidder": "{ abc" }`), }, - inputReq: &openrtb.BidRequest{ - Device: &openrtb.Device{UA: "A", IP: "ip"}, - Site: &openrtb.Site{Page: "page"}, + inputReq: &openrtb2.BidRequest{ + Device: &openrtb2.Device{UA: "A", IP: "ip"}, + Site: &openrtb2.Site{Page: "page"}, }, expectedError: `json: cannot unmarshal string into Go value of type openrtb_ext.ExtImpSharethrough`, }, @@ -212,7 +212,7 @@ func TestFailureRequestFromOpenRTB(t *testing.T) { mockUtil := MockUtil{ mockCanAutoPlayVideo: func() bool { return true }, mockGdprApplies: func() bool { return true }, - mockGetPlacementSize: func() (uint64, uint64) { return 100, 200 }, + mockGetPlacementSize: func() (int64, int64) { return 100, 200 }, mockParseUserInfo: func() userInfo { return userInfo{Consent: "ok", TtdUid: "ttduid", StxUid: "stxuid"} }, } @@ -288,7 +288,7 @@ func TestSuccessResponseToOpenRTB(t *testing.T) { expectedSuccess: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{{ BidType: openrtb_ext.BidTypeBanner, - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ AdID: "arid", ID: "bid", ImpID: "bidid", @@ -376,19 +376,19 @@ func TestFailResponseToOpenRTB(t *testing.T) { func TestBuildBody(t *testing.T) { tests := map[string]struct { - inputRequest *openrtb.BidRequest + inputRequest *openrtb2.BidRequest inputImp openrtb_ext.ExtImpSharethrough expectedJson []byte expectedError error }{ "Empty input: skips badomains, tmax default to 10 sec and sets deadline accordingly": { - inputRequest: &openrtb.BidRequest{}, + inputRequest: &openrtb2.BidRequest{}, inputImp: openrtb_ext.ExtImpSharethrough{}, expectedJson: []byte(`{"tmax":10000, "deadline":"2019-09-12T11:29:10.000123456Z"}`), expectedError: nil, }, "Sets badv as list of domains according to Badv (tmax default to 10 sec and sets deadline accordingly)": { - inputRequest: &openrtb.BidRequest{ + inputRequest: &openrtb2.BidRequest{ BAdv: []string{"dom1.com", "dom2.com"}, }, inputImp: openrtb_ext.ExtImpSharethrough{}, @@ -396,7 +396,7 @@ func TestBuildBody(t *testing.T) { expectedError: nil, }, "Sets tmax and deadline according to Tmax": { - inputRequest: &openrtb.BidRequest{ + inputRequest: &openrtb2.BidRequest{ TMax: 500, }, inputImp: openrtb_ext.ExtImpSharethrough{}, @@ -404,7 +404,7 @@ func TestBuildBody(t *testing.T) { expectedError: nil, }, "Sets bidfloor according to the Imp object": { - inputRequest: &openrtb.BidRequest{}, + inputRequest: &openrtb2.BidRequest{}, inputImp: openrtb_ext.ExtImpSharethrough{ BidFloor: 1.23, }, @@ -428,7 +428,7 @@ func TestBuildBody(t *testing.T) { func TestBuildUri(t *testing.T) { tests := map[string]struct { inputParams StrAdSeverParams - inputApp *openrtb.App + inputApp *openrtb2.App expected []string }{ "Generates expected URL, appending all params": { diff --git a/adapters/sharethrough/sharethrough.go b/adapters/sharethrough/sharethrough.go index a6ef4736fdf..65afb21adb7 100644 --- a/adapters/sharethrough/sharethrough.go +++ b/adapters/sharethrough/sharethrough.go @@ -5,7 +5,7 @@ import ( "net/http" "regexp" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -35,7 +35,7 @@ type SharethroughAdapter struct { AdServer StrOpenRTBInterface } -func (a SharethroughAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a SharethroughAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var reqs []*adapters.RequestData if request.Site == nil { @@ -56,7 +56,7 @@ func (a SharethroughAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * return reqs, []error{} } -func (a SharethroughAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a SharethroughAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } diff --git a/adapters/sharethrough/sharethrough_test.go b/adapters/sharethrough/sharethrough_test.go index 9fca80e03ee..194894fd893 100644 --- a/adapters/sharethrough/sharethrough_test.go +++ b/adapters/sharethrough/sharethrough_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -21,7 +21,7 @@ type MockStrAdServer struct { StrOpenRTBInterface } -func (m MockStrAdServer) requestFromOpenRTB(imp openrtb.Imp, request *openrtb.BidRequest, domain string) (*adapters.RequestData, error) { +func (m MockStrAdServer) requestFromOpenRTB(imp openrtb2.Imp, request *openrtb2.BidRequest, domain string) (*adapters.RequestData, error) { return m.mockRequestFromOpenRTB() } @@ -88,22 +88,22 @@ func TestSuccessMakeRequests(t *testing.T) { } tests := map[string]struct { - input *openrtb.BidRequest + input *openrtb2.BidRequest expected []*adapters.RequestData }{ "Generates expected Request": { - input: &openrtb.BidRequest{ - Site: &openrtb.Site{ + input: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "test.com", }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "Android Chome/60", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "abc", Ext: []byte(`{"pkey": "pkey", "iframe": true, "iframeSize": [10, 20]}`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }}, }, @@ -137,22 +137,22 @@ func TestSuccessMakeRequests(t *testing.T) { func TestFailureMakeRequests(t *testing.T) { tests := map[string]struct { - input *openrtb.BidRequest + input *openrtb2.BidRequest expected string }{ "Returns nil if failed to generate request": { - input: &openrtb.BidRequest{ - Site: &openrtb.Site{ + input: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "test.com", }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "Android Chome/60", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "abc", Ext: []byte(`{"pkey": "pkey", "iframe": true, "iframeSize": [10, 20]}`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }}, }, @@ -216,7 +216,7 @@ func TestSuccessMakeBids(t *testing.T) { for testName, test := range tests { t.Logf("Test case: %s\n", testName) - response, errors := adapter.MakeBids(&openrtb.BidRequest{}, &adapters.RequestData{}, test.inputResponse) + response, errors := adapter.MakeBids(&openrtb2.BidRequest{}, &adapters.RequestData{}, test.inputResponse) if len(errors) > 0 { t.Errorf("Expected no errors, got %d\n", len(errors)) } @@ -264,7 +264,7 @@ func TestFailureMakeBids(t *testing.T) { for testName, test := range tests { t.Logf("Test case: %s\n", testName) - response, errors := adapter.MakeBids(&openrtb.BidRequest{}, &adapters.RequestData{}, test.inputResponse) + response, errors := adapter.MakeBids(&openrtb2.BidRequest{}, &adapters.RequestData{}, test.inputResponse) if response != nil { t.Errorf("Expected response to be nil, got %+v\n", response) } diff --git a/adapters/sharethrough/utils.go b/adapters/sharethrough/utils.go index 76d8b7a1f76..4f27e738b99 100644 --- a/adapters/sharethrough/utils.go +++ b/adapters/sharethrough/utils.go @@ -5,27 +5,28 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" - "github.com/prebid/prebid-server/openrtb_ext" "html/template" "net" "net/url" "regexp" "strconv" "time" + + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/openrtb_ext" ) const minChromeVersion = 53 const minSafariVersion = 10 type UtilityInterface interface { - gdprApplies(*openrtb.BidRequest) bool - parseUserInfo(*openrtb.User) userInfo + gdprApplies(*openrtb2.BidRequest) bool + parseUserInfo(*openrtb2.User) userInfo getAdMarkup([]byte, openrtb_ext.ExtImpSharethroughResponse, *StrAdSeverParams) (string, error) - getBestFormat([]openrtb.Format) (uint64, uint64) - getPlacementSize(openrtb.Imp, openrtb_ext.ExtImpSharethrough) (uint64, uint64) + getBestFormat([]openrtb2.Format) (int64, int64) + getPlacementSize(openrtb2.Imp, openrtb_ext.ExtImpSharethrough) (int64, int64) canAutoPlayVideo(string, UserAgentParsers) bool isAndroid(string) bool @@ -123,10 +124,10 @@ func (u Util) getAdMarkup(strRawResp []byte, strResp openrtb_ext.ExtImpSharethro return templatedBuf.String(), nil } -func (u Util) getPlacementSize(imp openrtb.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height uint64, width uint64) { +func (u Util) getPlacementSize(imp openrtb2.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height, width int64) { height, width = 1, 1 if len(strImpParams.IframeSize) >= 2 { - height, width = uint64(strImpParams.IframeSize[0]), uint64(strImpParams.IframeSize[1]) + height, width = int64(strImpParams.IframeSize[0]), int64(strImpParams.IframeSize[1]) } else if imp.Banner != nil { height, width = u.getBestFormat(imp.Banner.Format) } @@ -134,7 +135,7 @@ func (u Util) getPlacementSize(imp openrtb.Imp, strImpParams openrtb_ext.ExtImpS return } -func (u Util) getBestFormat(formats []openrtb.Format) (height uint64, width uint64) { +func (u Util) getBestFormat(formats []openrtb2.Format) (height, width int64) { height, width = 1, 1 for i := 0; i < len(formats); i++ { format := formats[i] @@ -195,7 +196,7 @@ func (u Util) isAtMinSafariVersion(userAgent string, parser *regexp.Regexp) bool return u.isAtMinVersion(userAgent, parser, minSafariVersion) } -func (u Util) gdprApplies(request *openrtb.BidRequest) bool { +func (u Util) gdprApplies(request *openrtb2.BidRequest) bool { var gdprApplies int64 if request.Regs != nil { @@ -208,7 +209,7 @@ func (u Util) gdprApplies(request *openrtb.BidRequest) bool { return gdprApplies != 0 } -func (u Util) parseUserInfo(user *openrtb.User) (ui userInfo) { +func (u Util) parseUserInfo(user *openrtb2.User) (ui userInfo) { if user == nil { return } diff --git a/adapters/sharethrough/utils_test.go b/adapters/sharethrough/utils_test.go index fffc52f6140..fb199369e59 100644 --- a/adapters/sharethrough/utils_test.go +++ b/adapters/sharethrough/utils_test.go @@ -4,11 +4,12 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/mxmCherry/openrtb" - "github.com/prebid/prebid-server/openrtb_ext" - "github.com/stretchr/testify/assert" "regexp" "testing" + + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/stretchr/testify/assert" ) func TestGetAdMarkup(t *testing.T) { @@ -71,31 +72,31 @@ func TestGetAdMarkup(t *testing.T) { func TestGetPlacementSize(t *testing.T) { tests := map[string]struct { - imp openrtb.Imp + imp openrtb2.Imp strImpParams openrtb_ext.ExtImpSharethrough - expectedHeight uint64 - expectedWidth uint64 + expectedHeight int64 + expectedWidth int64 }{ "Returns size from STR params if provided": { - imp: openrtb.Imp{}, + imp: openrtb2.Imp{}, strImpParams: openrtb_ext.ExtImpSharethrough{IframeSize: []int{100, 200}}, expectedHeight: 100, expectedWidth: 200, }, "Skips size from STR params if malformed": { - imp: openrtb.Imp{}, + imp: openrtb2.Imp{}, strImpParams: openrtb_ext.ExtImpSharethrough{IframeSize: []int{100}}, expectedHeight: 1, expectedWidth: 1, }, "Returns size from banner format if provided": { - imp: openrtb.Imp{Banner: &openrtb.Banner{Format: []openrtb.Format{{H: 100, W: 200}}}}, + imp: openrtb2.Imp{Banner: &openrtb2.Banner{Format: []openrtb2.Format{{H: 100, W: 200}}}}, strImpParams: openrtb_ext.ExtImpSharethrough{}, expectedHeight: 100, expectedWidth: 200, }, "Defaults to 1x1": { - imp: openrtb.Imp{}, + imp: openrtb2.Imp{}, strImpParams: openrtb_ext.ExtImpSharethrough{}, expectedHeight: 1, expectedWidth: 1, @@ -114,22 +115,22 @@ func TestGetPlacementSize(t *testing.T) { func TestGetBestFormat(t *testing.T) { tests := map[string]struct { - input []openrtb.Format - expectedHeight uint64 - expectedWidth uint64 + input []openrtb2.Format + expectedHeight int64 + expectedWidth int64 }{ "Returns default size if empty input": { - input: []openrtb.Format{}, + input: []openrtb2.Format{}, expectedHeight: 1, expectedWidth: 1, }, "Returns size if only one is passed": { - input: []openrtb.Format{{H: 100, W: 100}}, + input: []openrtb2.Format{{H: 100, W: 100}}, expectedHeight: 100, expectedWidth: 100, }, "Returns biggest size if multiple are passed": { - input: []openrtb.Format{{H: 100, W: 100}, {H: 200, W: 200}, {H: 50, W: 50}}, + input: []openrtb2.Format{{H: 100, W: 100}, {H: 200, W: 200}, {H: 50, W: 50}}, expectedHeight: 200, expectedWidth: 200, }, @@ -344,27 +345,27 @@ func TestIsAtMinSafariVersion(t *testing.T) { } func TestGdprApplies(t *testing.T) { - bidRequestGdpr := openrtb.BidRequest{ - Regs: &openrtb.Regs{ + bidRequestGdpr := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ Ext: []byte(`{"gdpr": 1}`), }, } - bidRequestNonGdpr := openrtb.BidRequest{ - Regs: &openrtb.Regs{ + bidRequestNonGdpr := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ Ext: []byte(`{"gdpr": 0}`), }, } - bidRequestEmptyGdpr := openrtb.BidRequest{ - Regs: &openrtb.Regs{ + bidRequestEmptyGdpr := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ Ext: []byte(``), }, } - bidRequestEmptyRegs := openrtb.BidRequest{ - Regs: &openrtb.Regs{}, + bidRequestEmptyRegs := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{}, } tests := map[string]struct { - input *openrtb.BidRequest + input *openrtb2.BidRequest expected bool }{ "Return true if gdpr set to 1": { @@ -396,7 +397,7 @@ func TestGdprApplies(t *testing.T) { func TestParseUserInfo(t *testing.T) { tests := map[string]struct { - input *openrtb.User + input *openrtb2.User expected userInfo }{ "Return empty strings if no User": { @@ -404,31 +405,31 @@ func TestParseUserInfo(t *testing.T) { expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Return empty strings if no uids": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": []}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": []}] }`)}, expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Return empty strings if ID is not defined or empty string": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": null}]}, {"source": "adserver.org", "uids": [{"id": ""}]}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": null}]}, {"source": "adserver.org", "uids": [{"id": ""}]}] }`)}, expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Return consent correctly": { - input: &openrtb.User{Ext: []byte(`{ "consent": "abc" }`)}, + input: &openrtb2.User{Ext: []byte(`{ "consent": "abc" }`)}, expected: userInfo{Consent: "abc", TtdUid: "", StxUid: ""}, }, "Return ttd uid correctly": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, expected: userInfo{Consent: "", TtdUid: "abc123", StxUid: ""}, }, "Ignore non-trade-desk uid": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "something", "uids": [{"id": "xyz"}]}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "something", "uids": [{"id": "xyz"}]}] }`)}, expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Returns STX user id from buyer id": { - input: &openrtb.User{BuyerUID: "myid"}, + input: &openrtb2.User{BuyerUID: "myid"}, expected: userInfo{Consent: "", TtdUid: "", StxUid: "myid"}, }, "Full test": { - input: &openrtb.User{BuyerUID: "myid", Ext: []byte(`{ "consent": "abc", "eids": [{"source": "something", "uids": [{"id": "xyz"}]}, {"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, + input: &openrtb2.User{BuyerUID: "myid", Ext: []byte(`{ "consent": "abc", "eids": [{"source": "something", "uids": [{"id": "xyz"}]}, {"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, expected: userInfo{Consent: "abc", TtdUid: "abc123", StxUid: "myid"}, }, } diff --git a/adapters/silvermob/silvermob.go b/adapters/silvermob/silvermob.go index 2e31e51c0ad..47a762ecc04 100644 --- a/adapters/silvermob/silvermob.go +++ b/adapters/silvermob/silvermob.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -31,7 +31,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func GetHeaders(request *openrtb.BidRequest) *http.Header { +func GetHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -55,7 +55,7 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header { } func (a *SilverMobAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( []*adapters.RequestData, @@ -84,7 +84,7 @@ func (a *SilverMobAdapter) MakeRequests( continue } - requestCopy.Imp = []openrtb.Imp{imp} + requestCopy.Imp = []openrtb2.Imp{imp} reqJSON, err := json.Marshal(requestCopy) if err != nil { errs = append(errs, err) @@ -104,7 +104,7 @@ func (a *SilverMobAdapter) MakeRequests( return requestData, errs } -func (a *SilverMobAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtSilverMob, error) { +func (a *SilverMobAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtSilverMob, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -126,7 +126,7 @@ func (a *SilverMobAdapter) buildEndpointURL(params *openrtb_ext.ExtSilverMob) (s } func (a *SilverMobAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -149,7 +149,7 @@ func (a *SilverMobAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Error unmarshaling server Response: %s", err), @@ -176,7 +176,7 @@ func (a *SilverMobAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/silvermob/silvermobtest/supplemental/invalid-response.json b/adapters/silvermob/silvermobtest/supplemental/invalid-response.json index d2a1e890df0..4970678bef9 100644 --- a/adapters/silvermob/silvermobtest/supplemental/invalid-response.json +++ b/adapters/silvermob/silvermobtest/supplemental/invalid-response.json @@ -111,7 +111,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "Error unmarshaling server Response: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Error unmarshaling server Response: json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 29b4a5848bc..41229574f9e 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -58,7 +58,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SmaatoAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "no impressions in bid request"}) @@ -84,7 +84,7 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt if request.Site != nil { siteCopy := *request.Site - siteCopy.Publisher = &openrtb.Publisher{ID: publisherID} + siteCopy.Publisher = &openrtb2.Publisher{ID: publisherID} if request.Site.Ext != nil { var siteExt siteExt @@ -101,7 +101,7 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt if request.App != nil { appCopy := *request.App - appCopy.Publisher = &openrtb.Publisher{ID: publisherID} + appCopy.Publisher = &openrtb2.Publisher{ID: publisherID} request.App = &appCopy } @@ -163,7 +163,7 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // MakeBids unpacks the server's response into Bids. -func (a *SmaatoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SmaatoAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -178,7 +178,7 @@ func (a *SmaatoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return nil, []error{fmt.Errorf("unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -259,7 +259,7 @@ func getAdMarkupType(response *adapters.ResponseData, adMarkup string) (adMarkup return "", fmt.Errorf("Invalid ad markup %s", adMarkup) } -func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { +func assignBannerSize(banner *openrtb2.Banner) (*openrtb2.Banner, error) { if banner.W != nil && banner.H != nil { return banner, nil } @@ -267,16 +267,14 @@ func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { return banner, fmt.Errorf("No sizes provided for Banner %v", banner.Format) } bannerCopy := *banner - bannerCopy.W = new(uint64) - *bannerCopy.W = banner.Format[0].W - bannerCopy.H = new(uint64) - *bannerCopy.H = banner.Format[0].H + bannerCopy.W = openrtb2.Int64Ptr(banner.Format[0].W) + bannerCopy.H = openrtb2.Int64Ptr(banner.Format[0].H) return &bannerCopy, nil } // parseImpressionObject parse the imp to get it ready to send to smaato -func parseImpressionObject(imp *openrtb.Imp) error { +func parseImpressionObject(imp *openrtb2.Imp) error { adSpaceID, err := jsonparser.GetString(imp.Ext, "bidder", "adspaceId") if err != nil { return err @@ -303,7 +301,7 @@ func parseImpressionObject(imp *openrtb.Imp) error { return fmt.Errorf("invalid MediaType. SMAATO only supports Banner and Video. Ignoring ImpID=%s", imp.ID) } -func extractUserExtAttributes(userExt userExt, userCopy *openrtb.User) { +func extractUserExtAttributes(userExt userExt, userCopy *openrtb2.User) { gender := userExt.Data.Gender if gender != "" { userCopy.Gender = gender diff --git a/adapters/smartadserver/smartadserver.go b/adapters/smartadserver/smartadserver.go index e2735d3bece..1e1eeac4f95 100644 --- a/adapters/smartadserver/smartadserver.go +++ b/adapters/smartadserver/smartadserver.go @@ -8,7 +8,7 @@ import ( "path" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -28,7 +28,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SmartAdserverAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impression in the bid request", @@ -43,7 +43,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // We create or copy the Site object. if smartRequest.Site == nil { - smartRequest.Site = &openrtb.Site{} + smartRequest.Site = &openrtb2.Site{} } else { site := *smartRequest.Site smartRequest.Site = &site @@ -51,7 +51,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // We create or copy the Publisher object. if smartRequest.Site.Publisher == nil { - smartRequest.Site.Publisher = &openrtb.Publisher{} + smartRequest.Site.Publisher = &openrtb2.Publisher{} } else { publisher := *smartRequest.Site.Publisher smartRequest.Site.Publisher = &publisher @@ -79,7 +79,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo smartRequest.Site.Publisher.ID = strconv.Itoa(smartadserverExt.NetworkID) // We send one request for each impression. - smartRequest.Imp = []openrtb.Imp{imp} + smartRequest.Imp = []openrtb2.Imp{imp} var errMarshal error if imp.Ext, errMarshal = json.Marshal(smartadserverExt); errMarshal != nil { @@ -117,7 +117,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo } // MakeBids unpacks the server's response into Bids. -func (a *SmartAdserverAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SmartAdserverAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -134,7 +134,7 @@ func (a *SmartAdserverAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -169,7 +169,7 @@ func (a *SmartAdserverAdapter) BuildEndpointURL(params *openrtb_ext.ExtImpSmarta return uri.String(), nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Video != nil { diff --git a/adapters/smartrtb/smartrtb.go b/adapters/smartrtb/smartrtb.go index 4950f1cefb3..548d4f36db5 100644 --- a/adapters/smartrtb/smartrtb.go +++ b/adapters/smartrtb/smartrtb.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -59,7 +59,7 @@ func (adapter *SmartRTBAdapter) buildEndpointURL(pubID string) (string, error) { return macros.ResolveMacros(adapter.EndpointTemplate, endpointParams) } -func parseExtImp(dst *bidRequestExt, imp *openrtb.Imp) error { +func parseExtImp(dst *bidRequestExt, imp *openrtb2.Imp) error { var ext adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &ext); err != nil { return &errortypes.BadInput{ @@ -84,8 +84,8 @@ func parseExtImp(dst *bidRequestExt, imp *openrtb.Imp) error { return nil } -func (s *SmartRTBAdapter) MakeRequests(brq *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - var imps []openrtb.Imp +func (s *SmartRTBAdapter) MakeRequests(brq *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var imps []openrtb2.Imp var err error ext := bidRequestExt{} nrImps := len(brq.Imp) @@ -144,7 +144,7 @@ func (s *SmartRTBAdapter) MakeRequests(brq *openrtb.BidRequest, reqInfo *adapter } func (s *SmartRTBAdapter) MakeBids( - brq *openrtb.BidRequest, drq *adapters.RequestData, + brq *openrtb2.BidRequest, drq *adapters.RequestData, rs *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { if rs.StatusCode == http.StatusNoContent { @@ -157,7 +157,7 @@ func (s *SmartRTBAdapter) MakeBids( }} } - var brs openrtb.BidResponse + var brs openrtb2.BidResponse if err := json.Unmarshal(rs.Body, &brs); err != nil { return nil, []error{err} } diff --git a/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json b/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json index c56e7f21515..3d9f92df4a7 100644 --- a/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json +++ b/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json @@ -69,7 +69,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/smartyads/smartyads.go b/adapters/smartyads/smartyads.go index ba727b4730c..e02ba4200f3 100644 --- a/adapters/smartyads/smartyads.go +++ b/adapters/smartyads/smartyads.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func GetHeaders(request *openrtb.BidRequest) *http.Header { +func GetHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -64,7 +64,7 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header { } func (a *SmartyAdsAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -106,7 +106,7 @@ func (a *SmartyAdsAdapter) MakeRequests( }}, nil } -func (a *SmartyAdsAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtSmartyAds, error) { +func (a *SmartyAdsAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtSmartyAds, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -154,7 +154,7 @@ func (a *SmartyAdsAdapter) CheckResponseStatusCodes(response *adapters.ResponseD } func (a *SmartyAdsAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -167,7 +167,7 @@ func (a *SmartyAdsAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Bad Server Response", @@ -192,7 +192,7 @@ func (a *SmartyAdsAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/somoaudience/somoaudience.go b/adapters/somoaudience/somoaudience.go index 2bcb0282fe6..d799b5bb5f7 100644 --- a/adapters/somoaudience/somoaudience.go +++ b/adapters/somoaudience/somoaudience.go @@ -6,12 +6,11 @@ import ( "net/http" "strconv" + "github.com/mxmCherry/openrtb/v14/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" - - "github.com/mxmCherry/openrtb" ) const hbconfig = "hb_pbs_1.0.0" @@ -24,12 +23,12 @@ type somoaudienceReqExt struct { BidderConfig string `json:"prebid"` } -func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SomoaudienceAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var bannerImps []openrtb.Imp - var videoImps []openrtb.Imp - var nativeImps []openrtb.Imp + var bannerImps []openrtb2.Imp + var videoImps []openrtb2.Imp + var nativeImps []openrtb2.Imp for _, imp := range request.Imp { if imp.Banner != nil { @@ -53,7 +52,7 @@ func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // Somoaudience only supports single imp video request for _, videoImp := range videoImps { - reqCopy.Imp = []openrtb.Imp{videoImp} + reqCopy.Imp = []openrtb2.Imp{videoImp} adapterReq, errors := a.makeRequest(&reqCopy) if adapterReq != nil { adapterRequests = append(adapterRequests, adapterReq) @@ -63,7 +62,7 @@ func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // Somoaudience only supports single imp video request for _, nativeImp := range nativeImps { - reqCopy.Imp = []openrtb.Imp{nativeImp} + reqCopy.Imp = []openrtb2.Imp{nativeImp} adapterReq, errors := a.makeRequest(&reqCopy) if adapterReq != nil { adapterRequests = append(adapterRequests, adapterReq) @@ -74,10 +73,10 @@ func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo } -func (a *SomoaudienceAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *SomoaudienceAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error var err error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp reqExt := somoaudienceReqExt{BidderConfig: hbconfig} var placementHash string @@ -132,7 +131,7 @@ func (a *SomoaudienceAdapter) makeRequest(request *openrtb.BidRequest) (*adapter }, errs } -func preprocess(imp *openrtb.Imp, reqExt *somoaudienceReqExt) (string, error) { +func preprocess(imp *openrtb2.Imp, reqExt *somoaudienceReqExt) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return "", &errortypes.BadInput{ @@ -153,7 +152,7 @@ func preprocess(imp *openrtb.Imp, reqExt *somoaudienceReqExt) (string, error) { return somoExt.PlacementHash, nil } -func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -171,7 +170,7 @@ func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapt }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -190,7 +189,7 @@ func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapt return bidResponse, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/sonobi/sonobi.go b/adapters/sonobi/sonobi.go index a13e9c67d9a..c3527a6a73e 100644 --- a/adapters/sonobi/sonobi.go +++ b/adapters/sonobi/sonobi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -30,7 +30,7 @@ type sonobiParams struct { } // MakeRequests Makes the OpenRTB request payload -func (a *SonobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SonobiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var sonobiExt openrtb_ext.ExtImpSonobi var err error @@ -42,7 +42,7 @@ func (a *SonobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt for _, imp := range request.Imp { // Make a copy as we don't want to change the original request reqCopy := *request - reqCopy.Imp = append(make([]openrtb.Imp, 0, 1), imp) + reqCopy.Imp = append(make([]openrtb2.Imp, 0, 1), imp) var bidderExt adapters.ExtImpBidder if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { @@ -69,7 +69,7 @@ func (a *SonobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // makeRequest helper method to crete the http request data -func (a *SonobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *SonobiAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -92,7 +92,7 @@ func (a *SonobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Requ } // MakeBids makes the bids -func (a *SonobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SonobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -111,7 +111,7 @@ func (a *SonobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -136,7 +136,7 @@ func (a *SonobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/sovrn/sovrn.go b/adapters/sovrn/sovrn.go index 9e904872903..fd2acc1fcbd 100644 --- a/adapters/sovrn/sovrn.go +++ b/adapters/sovrn/sovrn.go @@ -12,7 +12,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -49,7 +49,7 @@ func (s *SovrnAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pb return nil, err } - sovrnReq := openrtb.BidRequest{ + sovrnReq := openrtb2.BidRequest{ ID: sReq.ID, Imp: sReq.Imp, Site: sReq.Site, @@ -133,7 +133,7 @@ func (s *SovrnAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pb debug.ResponseBody = responseBody } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, &errortypes.BadServerResponse{ @@ -173,7 +173,7 @@ func (s *SovrnAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pb return bids, nil } -func (s *SovrnAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (s *SovrnAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) for i := 0; i < len(request.Imp); i++ { @@ -228,7 +228,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func (s *SovrnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (s *SovrnAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -245,7 +245,7 @@ func (s *SovrnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: err.Error(), @@ -271,7 +271,7 @@ func (s *SovrnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, nil } -func preprocess(imp *openrtb.Imp) (string, error) { +func preprocess(imp *openrtb2.Imp) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return "", &errortypes.BadInput{ diff --git a/adapters/sovrn/sovrn_test.go b/adapters/sovrn/sovrn_test.go index aa1b98f00f5..a7bd2a204b9 100644 --- a/adapters/sovrn/sovrn_test.go +++ b/adapters/sovrn/sovrn_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/pbs" "github.com/prebid/prebid-server/usersync" @@ -38,7 +38,7 @@ func TestJsonSamples(t *testing.T) { // ---------------------------------------------------------------------------- // Code below this line tests the legacy, non-openrtb code flow. It can be deleted after we -// clean up the existing code and make everything openrtb. +// clean up the existing code and make everything openrtb2. var testSovrnUserId = "SovrnUser123" var testUserAgent = "user-agent-test" @@ -144,12 +144,12 @@ func checkHttpRequest(req http.Request, t *testing.T) { func SampleSovrnRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { dnt := int8(0) - device := openrtb.Device{ + device := openrtb2.Device{ Language: "murican", DNT: &dnt, } - user := openrtb.User{ + user := openrtb2.User{ ID: testSovrnUserId, } @@ -165,7 +165,7 @@ func SampleSovrnRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { for i := 0; i < numberOfImpressions; i++ { req.AdUnits[i] = pbs.AdUnit{ Code: fmt.Sprintf("div-adunit-%d", i+1), - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 728, H: 90, @@ -251,7 +251,7 @@ func TestNotFoundResponse(t *testing.T) { func CreateSovrnService(tagsToBid map[string]bool) adapterstest.OrtbMockService { service := adapterstest.OrtbMockService{} - var lastBidRequest openrtb.BidRequest + var lastBidRequest openrtb2.BidRequest var lastHttpReq http.Request server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -262,23 +262,23 @@ func CreateSovrnService(tagsToBid map[string]bool) adapterstest.OrtbMockService http.Error(w, err.Error(), http.StatusInternalServerError) return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } lastBidRequest = breq - var bids []openrtb.Bid + var bids []openrtb2.Bid for i, imp := range breq.Imp { if tagsToBid[imp.TagID] { bids = append(bids, adapterstest.SampleBid(imp.Banner.W, imp.Banner.H, imp.ID, i+1)) } } - // serialize the bids to openrtb.BidResponse - js, _ := json.Marshal(openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + // serialize the bids to openrtb2.BidResponse + js, _ := json.Marshal(openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { Bid: bids, }, diff --git a/adapters/synacormedia/synacormedia.go b/adapters/synacormedia/synacormedia.go index 7c9b4fab19f..f6ead542d2e 100644 --- a/adapters/synacormedia/synacormedia.go +++ b/adapters/synacormedia/synacormedia.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -40,7 +40,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *SynacorMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SynacorMediaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var bidRequests []*adapters.RequestData @@ -53,9 +53,9 @@ func (a *SynacorMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo return bidRequests, errs } -func (a *SynacorMediaAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *SynacorMediaAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp var re *ReqExt var firstExtImp *openrtb_ext.ExtImpSynacormedia = nil @@ -130,7 +130,7 @@ func (adapter *SynacorMediaAdapter) buildEndpointURL(params *openrtb_ext.ExtImpS return macros.ResolveMacros(adapter.EndpointTemplate, macros.EndpointTemplateParams{Host: params.SeatId}) } -func getExtImpObj(imp *openrtb.Imp) (*openrtb_ext.ExtImpSynacormedia, error) { +func getExtImpObj(imp *openrtb2.Imp) (*openrtb_ext.ExtImpSynacormedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -149,7 +149,7 @@ func getExtImpObj(imp *openrtb.Imp) (*openrtb_ext.ExtImpSynacormedia, error) { } // MakeBids make the bids for the bid response. -func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { const errorMessage string = "Unexpected status code: %d. Run with request.debug = 1 for more info" switch { case response.StatusCode == http.StatusNoContent: @@ -164,7 +164,7 @@ func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -187,7 +187,7 @@ func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/synacormedia/synacormediatest/supplemental/bad_response.json b/adapters/synacormedia/synacormediatest/supplemental/bad_response.json index 8e8b9a4d944..520f415bcf4 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/bad_response.json +++ b/adapters/synacormedia/synacormediatest/supplemental/bad_response.json @@ -64,7 +64,7 @@ "expectedMakeBidsErrors": [ { "comparison": "literal", - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse" + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse" } ] } diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index de8cb49a471..abe2d90b8a6 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -9,7 +9,7 @@ import ( "text/template" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -37,7 +37,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *TappxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TappxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impression in the bid request", @@ -146,7 +146,7 @@ func (a *TappxAdapter) buildEndpointURL(params *openrtb_ext.ExtImpTappx, test in return thisURI.String(), nil } -func (a *TappxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TappxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -161,7 +161,7 @@ func (a *TappxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -181,7 +181,7 @@ func (a *TappxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, []error{} } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/telaria/telaria.go b/adapters/telaria/telaria.go index d99d4a98616..cda22e06937 100644 --- a/adapters/telaria/telaria.go +++ b/adapters/telaria/telaria.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -35,7 +35,7 @@ func (a *TelariaAdapter) FetchEndpoint() string { } // Checker method to ensure len(request.Imp) > 0 -func (a *TelariaAdapter) CheckHasImps(request *openrtb.BidRequest) error { +func (a *TelariaAdapter) CheckHasImps(request *openrtb2.BidRequest) error { if len(request.Imp) == 0 { err := &errortypes.BadInput{ Message: "Telaria: Missing Imp Object", @@ -46,7 +46,7 @@ func (a *TelariaAdapter) CheckHasImps(request *openrtb.BidRequest) error { } // Checking if Imp[i].Video exists and Imp[i].Banner doesn't exist -func (a *TelariaAdapter) CheckHasVideoObject(request *openrtb.BidRequest) error { +func (a *TelariaAdapter) CheckHasVideoObject(request *openrtb2.BidRequest) error { hasVideoObject := false for _, imp := range request.Imp { @@ -69,7 +69,7 @@ func (a *TelariaAdapter) CheckHasVideoObject(request *openrtb.BidRequest) error } // Fetches the populated header object -func GetHeaders(request *openrtb.BidRequest) *http.Header { +func GetHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -97,7 +97,7 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header { } // Checks the imp[i].ext object and returns a imp.ext object as per ExtImpTelaria format -func (a *TelariaAdapter) FetchTelariaExtImpParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpTelaria, error) { +func (a *TelariaAdapter) FetchTelariaExtImpParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpTelaria, error) { var bidderExt adapters.ExtImpBidder err := json.Unmarshal(imp.Ext, &bidderExt) @@ -125,7 +125,7 @@ func (a *TelariaAdapter) FetchTelariaExtImpParams(imp *openrtb.Imp) (*openrtb_ex // Method to fetch the original publisher ID. Note that this method must be called // before we replace publisher.ID with seatCode -func (a *TelariaAdapter) FetchOriginalPublisherID(request *openrtb.BidRequest) string { +func (a *TelariaAdapter) FetchOriginalPublisherID(request *openrtb2.BidRequest) string { if request.Site != nil && request.Site.Publisher != nil { return request.Site.Publisher.ID @@ -137,8 +137,8 @@ func (a *TelariaAdapter) FetchOriginalPublisherID(request *openrtb.BidRequest) s } // Method to do a deep copy of the publisher object. It also adds the seatCode as publisher.ID -func (a *TelariaAdapter) MakePublisherObject(seatCode string, publisher *openrtb.Publisher) *openrtb.Publisher { - var pub = &openrtb.Publisher{ID: seatCode} +func (a *TelariaAdapter) MakePublisherObject(seatCode string, publisher *openrtb2.Publisher) *openrtb2.Publisher { + var pub = &openrtb2.Publisher{ID: seatCode} if publisher != nil { pub.Domain = publisher.Domain @@ -151,7 +151,7 @@ func (a *TelariaAdapter) MakePublisherObject(seatCode string, publisher *openrtb } // This method changes .publisher.id to the seatCode -func (a *TelariaAdapter) PopulatePublisherId(request *openrtb.BidRequest, seatCode string) (*openrtb.Site, *openrtb.App) { +func (a *TelariaAdapter) PopulatePublisherId(request *openrtb2.BidRequest, seatCode string) (*openrtb2.Site, *openrtb2.App) { if request.Site != nil { siteCopy := *request.Site siteCopy.Publisher = a.MakePublisherObject(seatCode, request.Site.Publisher) @@ -164,7 +164,7 @@ func (a *TelariaAdapter) PopulatePublisherId(request *openrtb.BidRequest, seatCo return nil, nil } -func (a *TelariaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TelariaAdapter) MakeRequests(requestIn *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { // make a copy of the incoming request request := *requestIn @@ -263,7 +263,7 @@ func (a *TelariaAdapter) CheckResponseStatusCodes(response *adapters.ResponseDat return nil } -func (a *TelariaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TelariaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { httpStatusError := a.CheckResponseStatusCodes(response) if httpStatusError != nil { @@ -272,7 +272,7 @@ func (a *TelariaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR responseBody := response.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Telaria: Bad Server Response", diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 0b100094dbb..2e2b525ea50 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -32,7 +32,7 @@ func getBidType(ext TripleliftRespExt) openrtb_ext.BidType { return openrtb_ext.BidTypeBanner } -func processImp(imp *openrtb.Imp) error { +func processImp(imp *openrtb2.Imp) error { // get the triplelift extension var ext adapters.ExtImpBidder var tlext openrtb_ext.ExtImpTriplelift @@ -56,13 +56,13 @@ func processImp(imp *openrtb.Imp) error { return nil } -func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TripleliftAdapter) MakeRequests(request *openrtb2.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)+1) reqs := make([]*adapters.RequestData, 0, 1) // copy the request, because we are going to mutate it tlRequest := *request // this will contain all the valid impressions - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // pre-process the imps for _, imp := range tlRequest.Imp { if err := processImp(&imp); err == nil { @@ -94,7 +94,7 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest, extra *ada return reqs, errs } -func getBidCount(bidResponse openrtb.BidResponse) int { +func getBidCount(bidResponse openrtb2.BidResponse) int { c := 0 for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) @@ -102,7 +102,7 @@ func getBidCount(bidResponse openrtb.BidResponse) int { return c } -func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -116,7 +116,7 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern if response.StatusCode != http.StatusOK { return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 9936bf82283..3a4d0588e7a 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -37,7 +37,7 @@ func getBidType(ext TripleliftRespExt) openrtb_ext.BidType { return openrtb_ext.BidTypeNative } -func processImp(imp *openrtb.Imp) error { +func processImp(imp *openrtb2.Imp) error { // get the triplelift extension var ext adapters.ExtImpBidder var tlext openrtb_ext.ExtImpTriplelift @@ -64,7 +64,7 @@ func processImp(imp *openrtb.Imp) error { } // Returns the effective publisher ID -func effectivePubID(pub *openrtb.Publisher) string { +func effectivePubID(pub *openrtb2.Publisher) string { if pub != nil { if pub.Ext != nil { var pubExt openrtb_ext.ExtPublisher @@ -80,13 +80,13 @@ func effectivePubID(pub *openrtb.Publisher) string { return "unknown" } -func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb2.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)+1) reqs := make([]*adapters.RequestData, 0, 1) // copy the request, because we are going to mutate it tlRequest := *request // this will contain all the valid impressions - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // pre-process the imps for _, imp := range tlRequest.Imp { if err := processImp(&imp); err == nil { @@ -124,14 +124,14 @@ func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb.BidRequest, extr return reqs, errs } -func getPublisher(request *openrtb.BidRequest) *openrtb.Publisher { +func getPublisher(request *openrtb2.BidRequest) *openrtb2.Publisher { if request.App != nil { return request.App.Publisher } return request.Site.Publisher } -func getBidCount(bidResponse openrtb.BidResponse) int { +func getBidCount(bidResponse openrtb2.BidResponse) int { c := 0 for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) @@ -139,7 +139,7 @@ func getBidCount(bidResponse openrtb.BidResponse) int { return c } -func (a *TripleliftNativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TripleliftNativeAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -153,7 +153,7 @@ func (a *TripleliftNativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, 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 openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/ucfunnel/ucfunnel.go b/adapters/ucfunnel/ucfunnel.go index 8df715e38be..f1d4fa9f175 100644 --- a/adapters/ucfunnel/ucfunnel.go +++ b/adapters/ucfunnel/ucfunnel.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -25,7 +25,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -43,12 +43,12 @@ func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } var errs []error - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } - var bidReq openrtb.BidRequest + var bidReq openrtb2.BidRequest if err := json.Unmarshal(externalRequest.Body, &bidReq); err != nil { return nil, []error{err} } @@ -69,7 +69,7 @@ func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return bidResponse, errs } -func (a *UcfunnelAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *UcfunnelAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) // If all the requests were malformed, don't bother making a server call with no impressions. @@ -101,7 +101,7 @@ func (a *UcfunnelAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada }}, errs } -func getPartnerId(request *openrtb.BidRequest) (string, []error) { +func getPartnerId(request *openrtb2.BidRequest) (string, []error) { var ext ExtBidderUcfunnel var errs = []error{} err := json.Unmarshal(request.Imp[0].Ext, &ext) @@ -125,7 +125,7 @@ func checkBidderParameter(ext ExtBidderUcfunnel) []error { return nil } -func getBidType(bidReq openrtb.BidRequest, impid string) openrtb_ext.BidType { +func getBidType(bidReq openrtb2.BidRequest, impid string) openrtb_ext.BidType { for i := range bidReq.Imp { if bidReq.Imp[i].ID == impid { if bidReq.Imp[i].Banner != nil { diff --git a/adapters/ucfunnel/ucfunnel_test.go b/adapters/ucfunnel/ucfunnel_test.go index 216c06dff7f..c735cb567ce 100644 --- a/adapters/ucfunnel/ucfunnel_test.go +++ b/adapters/ucfunnel/ucfunnel_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -13,32 +13,32 @@ import ( func TestMakeRequests(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "1234", - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, } - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "1235", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imp3 := openrtb.Imp{ + imp3 := openrtb2.Imp{ ID: "1236", - Audio: &openrtb.Audio{}, + Audio: &openrtb2.Audio{}, } - imp4 := openrtb.Imp{ + imp4 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - imp5 := openrtb.Imp{ + imp5 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - internalRequest01 := openrtb.BidRequest{Imp: []openrtb.Imp{}} - internalRequest02 := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2, imp3, imp4, imp5}} - internalRequest03 := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2, imp3, imp4, imp5}} + internalRequest01 := openrtb2.BidRequest{Imp: []openrtb2.Imp{}} + internalRequest02 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2, imp3, imp4, imp5}} + internalRequest03 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2, imp3, imp4, imp5}} internalRequest03.Imp[0].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) internalRequest03.Imp[1].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) @@ -54,12 +54,12 @@ func TestMakeRequests(t *testing.T) { } var testCases = []struct { - in []openrtb.BidRequest + in []openrtb2.BidRequest out1 [](int) out2 [](bool) }{ { - in: []openrtb.BidRequest{internalRequest01, internalRequest02, internalRequest03}, + in: []openrtb2.BidRequest{internalRequest01, internalRequest02, internalRequest03}, out1: [](int){1, 1, 0}, out2: [](bool){false, false, true}, }, @@ -76,31 +76,31 @@ func TestMakeRequests(t *testing.T) { } func TestMakeBids(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "1234", - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, } - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "1235", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imp3 := openrtb.Imp{ + imp3 := openrtb2.Imp{ ID: "1236", - Audio: &openrtb.Audio{}, + Audio: &openrtb2.Audio{}, } - imp4 := openrtb.Imp{ + imp4 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - imp5 := openrtb.Imp{ + imp5 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - internalRequest03 := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2, imp3, imp4, imp5}} - internalRequest04 := openrtb.BidRequest{Imp: []openrtb.Imp{imp}} + internalRequest03 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2, imp3, imp4, imp5}} + internalRequest04 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp}} internalRequest03.Imp[0].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) internalRequest03.Imp[1].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) @@ -126,14 +126,14 @@ func TestMakeBids(t *testing.T) { } var testCases = []struct { - in1 []openrtb.BidRequest + in1 []openrtb2.BidRequest in2 []adapters.RequestData in3 []adapters.ResponseData out1 [](bool) out2 [](bool) }{ { - in1: []openrtb.BidRequest{internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest04}, + in1: []openrtb2.BidRequest{internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest04}, in2: []adapters.RequestData{RequestData01, RequestData01, RequestData01, RequestData01, RequestData01, RequestData02}, in3: []adapters.ResponseData{mockResponse200, mockResponse203, mockResponse204, mockResponse400, mockResponseError, mockResponse200}, out1: [](bool){true, false, false, false, false, false}, diff --git a/adapters/unicorn/unicorn.go b/adapters/unicorn/unicorn.go index 52441e1a882..b9741c8c9e3 100644 --- a/adapters/unicorn/unicorn.go +++ b/adapters/unicorn/unicorn.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -42,7 +42,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var extRegs openrtb_ext.ExtRegs if request.Regs != nil { if request.Regs.COPPA == 1 { @@ -69,11 +69,11 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapter return nil, []error{err} } - var modifiableSource openrtb.Source + var modifiableSource openrtb2.Source if request.Source != nil { modifiableSource = *request.Source } else { - modifiableSource = openrtb.Source{} + modifiableSource = openrtb2.Source{} } modifiableSource.Ext = setSourceExt() request.Source = &modifiableSource @@ -98,7 +98,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, requestInfo *adapter return []*adapters.RequestData{requestData}, nil } -func getHeaders(request *openrtb.BidRequest) http.Header { +func getHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -121,7 +121,7 @@ func getHeaders(request *openrtb.BidRequest) http.Header { return headers } -func modifyImps(request *openrtb.BidRequest) error { +func modifyImps(request *openrtb2.BidRequest) error { for i := 0; i < len(request.Imp); i++ { imp := &request.Imp[i] @@ -157,7 +157,7 @@ func modifyImps(request *openrtb.BidRequest) error { return nil } -func getStoredRequestImpID(imp *openrtb.Imp) (string, error) { +func getStoredRequestImpID(imp *openrtb2.Imp) (string, error) { v, err := jsonparser.GetString(imp.Ext, "prebid", "storedrequest", "id") if err != nil { @@ -171,7 +171,7 @@ func setSourceExt() json.RawMessage { return json.RawMessage(`{"stype": "prebid_server_uncn", "bidder": "unicorn"}`) } -func setExt(request *openrtb.BidRequest) (json.RawMessage, error) { +func setExt(request *openrtb2.BidRequest) (json.RawMessage, error) { accountID, err := jsonparser.GetInt(request.Imp[0].Ext, "bidder", "accountId") if err != nil { accountID = 0 @@ -195,7 +195,7 @@ func setExt(request *openrtb.BidRequest) (json.RawMessage, error) { } // MakeBids unpacks the server's response into Bids. -func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil @@ -215,7 +215,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, requestData *adapters.Re return nil, []error{err} } - var response openrtb.BidResponse + var response openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &response); err != nil { return nil, []error{err} } diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index ae0243aaf4e..871af6df46d 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -24,13 +24,13 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *UnrulyAdapter) ReplaceImp(imp openrtb.Imp, request *openrtb.BidRequest) *openrtb.BidRequest { +func (a *UnrulyAdapter) ReplaceImp(imp openrtb2.Imp, request *openrtb2.BidRequest) *openrtb2.BidRequest { reqCopy := *request - reqCopy.Imp = append(make([]openrtb.Imp, 0, 1), imp) + reqCopy.Imp = append(make([]openrtb2.Imp, 0, 1), imp) return &reqCopy } -func (a *UnrulyAdapter) BuildRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *UnrulyAdapter) BuildRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { reqJSON, err := json.Marshal(request) if err != nil { return nil, []error{err} @@ -52,7 +52,7 @@ func AddHeadersToRequest() http.Header { return headers } -func (a *UnrulyAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *UnrulyAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData for _, imp := range request.Imp { @@ -71,7 +71,7 @@ func (a *UnrulyAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt return adapterRequests, errs } -func getMediaTypeForImpWithId(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImpWithId(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { return openrtb_ext.BidTypeVideo, nil @@ -91,9 +91,9 @@ func CheckResponse(response *adapters.ResponseData) error { return nil } -func convertToAdapterBidResponse(response *adapters.ResponseData, internalRequest *openrtb.BidRequest) (*adapters.BidderResponse, []error) { +func convertToAdapterBidResponse(response *adapters.ResponseData, internalRequest *openrtb2.BidRequest) (*adapters.BidderResponse, []error) { var errs []error - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -115,7 +115,7 @@ func convertToAdapterBidResponse(response *adapters.ResponseData, internalReques return bidResponse, errs } -func convertBidderNameInExt(imp *openrtb.Imp) (*openrtb.Imp, error) { +func convertBidderNameInExt(imp *openrtb2.Imp) (*openrtb2.Imp, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, err @@ -136,7 +136,7 @@ func convertBidderNameInExt(imp *openrtb.Imp) (*openrtb.Imp, error) { return imp, nil } -func (a *UnrulyAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *UnrulyAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if err := CheckResponse(response); err != nil { return nil, []error{err} } diff --git a/adapters/unruly/unruly_test.go b/adapters/unruly/unruly_test.go index 18a21b7dfd6..b7c9a28eb47 100644 --- a/adapters/unruly/unruly_test.go +++ b/adapters/unruly/unruly_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" @@ -41,7 +41,7 @@ func TestReturnsNewUnrulyBidderWithParams(t *testing.T) { } func TestBuildRequest(t *testing.T) { - request := openrtb.BidRequest{} + request := openrtb2.BidRequest{} expectedJson, _ := json.Marshal(request) mockHeaders := http.Header{} mockHeaders.Add("Content-Type", "application/json;charset=utf-8") @@ -65,19 +65,19 @@ func TestBuildRequest(t *testing.T) { } func TestReplaceImp(t *testing.T) { - imp1 := openrtb.Imp{ID: "imp1"} - imp2 := openrtb.Imp{ID: "imp2"} - imp3 := openrtb.Imp{ID: "imp3"} - newImp := openrtb.Imp{ID: "imp4"} - request := openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}} + imp1 := openrtb2.Imp{ID: "imp1"} + imp2 := openrtb2.Imp{ID: "imp2"} + imp3 := openrtb2.Imp{ID: "imp3"} + newImp := openrtb2.Imp{ID: "imp4"} + request := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}} adapter := UnrulyAdapter{URI: "http://mockEndpoint.com"} newRequest := adapter.ReplaceImp(newImp, &request) if len(newRequest.Imp) != 1 { t.Errorf("Size of Imp Array should be 1") } - if !reflect.DeepEqual(request, openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}}) { - t.Errorf("actual = %v expected = %v", request, openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}}) + if !reflect.DeepEqual(request, openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}}) { + t.Errorf("actual = %v expected = %v", request, openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}}) } if !reflect.DeepEqual(newImp, newRequest.Imp[0]) { t.Errorf("actual = %v expected = %v", newRequest.Imp[0], newImp) @@ -85,7 +85,7 @@ func TestReplaceImp(t *testing.T) { } func TestConvertBidderNameInExt(t *testing.T) { - imp := openrtb.Imp{Ext: json.RawMessage(`{"bidder": {"uuid": "1234", "siteid": "aSiteID"}}`)} + imp := openrtb2.Imp{Ext: json.RawMessage(`{"bidder": {"uuid": "1234", "siteid": "aSiteID"}}`)} actualImp, err := convertBidderNameInExt(&imp) @@ -112,17 +112,17 @@ func TestConvertBidderNameInExt(t *testing.T) { func TestMakeRequests(t *testing.T) { adapter := UnrulyAdapter{URI: "http://mockEndpoint.com"} - imp1 := openrtb.Imp{ID: "imp1", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid1", "siteid": "siteID1"}}`)} - imp2 := openrtb.Imp{ID: "imp2", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid2", "siteid": "siteID2"}}`)} - imp3 := openrtb.Imp{ID: "imp3", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid3", "siteid": "siteID3"}}`)} + imp1 := openrtb2.Imp{ID: "imp1", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid1", "siteid": "siteID1"}}`)} + imp2 := openrtb2.Imp{ID: "imp2", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid2", "siteid": "siteID2"}}`)} + imp3 := openrtb2.Imp{ID: "imp3", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid3", "siteid": "siteID3"}}`)} - expectImp1 := openrtb.Imp{ID: "imp1", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid1", "siteid": "siteID1"}}`)} - expectImp2 := openrtb.Imp{ID: "imp2", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid2", "siteid": "siteID2"}}`)} - expectImp3 := openrtb.Imp{ID: "imp3", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid3", "siteid": "siteID3"}}`)} + expectImp1 := openrtb2.Imp{ID: "imp1", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid1", "siteid": "siteID1"}}`)} + expectImp2 := openrtb2.Imp{ID: "imp2", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid2", "siteid": "siteID2"}}`)} + expectImp3 := openrtb2.Imp{ID: "imp3", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid3", "siteid": "siteID3"}}`)} - expectImps := []openrtb.Imp{expectImp1, expectImp2, expectImp3} + expectImps := []openrtb2.Imp{expectImp1, expectImp2, expectImp3} - inputRequest := openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}} + inputRequest := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}} actualAdapterRequests, _ := adapter.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) mockHeaders := http.Header{} mockHeaders.Add("Content-Type", "application/json;charset=utf-8") @@ -132,7 +132,7 @@ func TestMakeRequests(t *testing.T) { t.Errorf("should have 3 imps") } for n, imp := range expectImps { - request := openrtb.BidRequest{Imp: []openrtb.Imp{imp}} + request := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp}} expectedJson, _ := json.Marshal(request) data := adapters.RequestData{ Method: "POST", @@ -149,11 +149,11 @@ func TestMakeRequests(t *testing.T) { func TestGetMediaTypeForImpIsVideo(t *testing.T) { testID := string("4321") testBidMediaType := openrtb_ext.BidTypeVideo - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: testID, - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imps := []openrtb.Imp{imp} + imps := []openrtb2.Imp{imp} actual, _ := getMediaTypeForImpWithId(testID, imps) if actual != "video" { @@ -162,11 +162,11 @@ func TestGetMediaTypeForImpIsVideo(t *testing.T) { } func TestGetMediaTypeForImpWithNoIDPresent(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "4321", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imps := []openrtb.Imp{imp} + imps := []openrtb2.Imp{imp} _, err := getMediaTypeForImpWithId("1234", imps) expected := &errortypes.BadInput{ Message: fmt.Sprintf("Failed to find impression \"%s\" ", "1234"), @@ -177,26 +177,26 @@ func TestGetMediaTypeForImpWithNoIDPresent(t *testing.T) { } func TestConvertToAdapterBidResponseHasCorrectNumberOfBids(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "1234", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "1235", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } mockResponse := adapters.ResponseData{StatusCode: 200, Body: json.RawMessage(`{"seatbid":[{"bid":[{"impid":"1234"}]},{"bid":[{"impid":"1235"}]}]}`)} - internalRequest := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2}} + internalRequest := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2}} mockBidResponse := adapters.NewBidderResponseWithBidsCapacity(5) typedBid := &adapters.TypedBid{ - Bid: &openrtb.Bid{ImpID: "1234"}, + Bid: &openrtb2.Bid{ImpID: "1234"}, BidType: "Video", } typedBid2 := &adapters.TypedBid{ - Bid: &openrtb.Bid{ImpID: "1235"}, + Bid: &openrtb2.Bid{ImpID: "1235"}, BidType: "Video", } diff --git a/adapters/valueimpression/valueimpression.go b/adapters/valueimpression/valueimpression.go index 5cbcf3e19b5..1397f6e020d 100644 --- a/adapters/valueimpression/valueimpression.go +++ b/adapters/valueimpression/valueimpression.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,7 +16,7 @@ type ValueImpressionAdapter struct { endpoint string } -func (a *ValueImpressionAdapter) MakeRequests(request *openrtb.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ValueImpressionAdapter) MakeRequests(request *openrtb2.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -36,7 +36,7 @@ func (a *ValueImpressionAdapter) MakeRequests(request *openrtb.BidRequest, unuse return adapterRequests, errs } -func (a *ValueImpressionAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *ValueImpressionAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { var err error jsonBody, err := json.Marshal(request) @@ -55,7 +55,7 @@ func (a *ValueImpressionAdapter) makeRequest(request *openrtb.BidRequest) (*adap }, nil } -func preprocess(request *openrtb.BidRequest) error { +func preprocess(request *openrtb2.BidRequest) error { if len(request.Imp) == 0 { return &errortypes.BadInput{ Message: "No Imps in Bid Request", @@ -85,7 +85,7 @@ func preprocess(request *openrtb.BidRequest) error { } // MakeBids based on valueimpression server response -func (a *ValueImpressionAdapter) MakeBids(bidRequest *openrtb.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ValueImpressionAdapter) MakeBids(bidRequest *openrtb2.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil } @@ -102,7 +102,7 @@ func (a *ValueImpressionAdapter) MakeBids(bidRequest *openrtb.BidRequest, unused }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json b/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json index c854548b78b..2de5213d686 100644 --- a/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json @@ -59,7 +59,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type uint64", + "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type int64", "comparison": "regex" } ] diff --git a/adapters/verizonmedia/verizonmedia.go b/adapters/verizonmedia/verizonmedia.go index a721b67cf05..edbb05a3a62 100644 --- a/adapters/verizonmedia/verizonmedia.go +++ b/adapters/verizonmedia/verizonmedia.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,7 +17,7 @@ type VerizonMediaAdapter struct { URI string } -func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *VerizonMediaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0, 1) if len(request.Imp) == 0 { @@ -79,7 +79,7 @@ func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // Split up multi-impression requests into multiple requests so that // each split request is only associated to a single impression reqCopy := *request - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} if request.Site != nil { siteCopy := *request.Site @@ -111,7 +111,7 @@ func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo return reqs, errors } -func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -123,7 +123,7 @@ func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d.", err), @@ -156,7 +156,7 @@ func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte return bidResponse, nil } -func getImpInfo(impId string, imps []openrtb.Imp) (bool, openrtb_ext.BidType) { +func getImpInfo(impId string, imps []openrtb2.Imp) (bool, openrtb_ext.BidType) { var mediaType openrtb_ext.BidType var exists bool for _, imp := range imps { @@ -171,7 +171,7 @@ func getImpInfo(impId string, imps []openrtb.Imp) (bool, openrtb_ext.BidType) { return exists, mediaType } -func changeRequestForBidService(request *openrtb.BidRequest, extension *openrtb_ext.ExtImpVerizonMedia) error { +func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb_ext.ExtImpVerizonMedia) error { /* Always override the tag ID and (site ID or app ID) of the request */ request.Imp[0].TagID = extension.Pos if request.Site != nil { @@ -198,10 +198,8 @@ func changeRequestForBidService(request *openrtb.BidRequest, extension *openrtb_ return errors.New(fmt.Sprintf("No sizes provided for Banner %v", banner.Format)) } - banner.W = new(uint64) - *banner.W = banner.Format[0].W - banner.H = new(uint64) - *banner.H = banner.Format[0].H + banner.W = openrtb2.Int64Ptr(banner.Format[0].W) + banner.H = openrtb2.Int64Ptr(banner.Format[0].H) return nil } diff --git a/adapters/visx/visx.go b/adapters/visx/visx.go index f5a21f2269e..1f1fae0a484 100644 --- a/adapters/visx/visx.go +++ b/adapters/visx/visx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -38,7 +38,7 @@ type visxResponse struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *VisxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *VisxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) // copy the request, because we are going to mutate it @@ -65,7 +65,7 @@ func (a *VisxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapter } // MakeBids unpacks the server's response into Bids. -func (a *VisxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *VisxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -91,14 +91,14 @@ func (a *VisxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequ for _, sb := range bidResp.SeatBid { for i := range sb.Bid { - bid := openrtb.Bid{} + bid := openrtb2.Bid{} bid.ID = internalRequest.ID bid.CrID = sb.Bid[i].CrID bid.ImpID = sb.Bid[i].ImpID bid.Price = sb.Bid[i].Price bid.AdM = sb.Bid[i].AdM - bid.W = sb.Bid[i].W - bid.H = sb.Bid[i].H + bid.W = int64(sb.Bid[i].W) + bid.H = int64(sb.Bid[i].H) bid.ADomain = sb.Bid[i].ADomain bid.DealID = sb.Bid[i].DealID diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index dadb03238ae..ff5bc2dc733 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -16,7 +16,7 @@ type VrtcalAdapter struct { endpoint string } -func (a *VrtcalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *VrtcalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -42,7 +42,7 @@ func (a *VrtcalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // MakeBids make the bids for the bid response. -func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -60,7 +60,7 @@ func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} diff --git a/adapters/yeahmobi/yeahmobi.go b/adapters/yeahmobi/yeahmobi.go index d603397b09f..74208ca4c30 100644 --- a/adapters/yeahmobi/yeahmobi.go +++ b/adapters/yeahmobi/yeahmobi.go @@ -8,7 +8,7 @@ import ( "text/template" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -33,7 +33,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (adapter *YeahmobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *YeahmobiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var adapterRequests []*adapters.RequestData adapterRequest, errs := adapter.makeRequest(request) @@ -44,7 +44,7 @@ func (adapter *YeahmobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInf return adapterRequests, errs } -func (adapter *YeahmobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (adapter *YeahmobiAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error yeahmobiExt, errs := getYeahmobiExt(request) @@ -75,7 +75,7 @@ func (adapter *YeahmobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapt }, errs } -func transform(request *openrtb.BidRequest) { +func transform(request *openrtb2.BidRequest) { for i, imp := range request.Imp { if imp.Native != nil { var nativeRequest map[string]interface{} @@ -103,7 +103,7 @@ func transform(request *openrtb.BidRequest) { } } -func getYeahmobiExt(request *openrtb.BidRequest) (*openrtb_ext.ExtImpYeahmobi, []error) { +func getYeahmobiExt(request *openrtb2.BidRequest) (*openrtb_ext.ExtImpYeahmobi, []error) { var extImpYeahmobi openrtb_ext.ExtImpYeahmobi var errs []error @@ -131,7 +131,7 @@ func (adapter *YeahmobiAdapter) getEndpoint(ext *openrtb_ext.ExtImpYeahmobi) (st } // MakeBids make the bids for the bid response. -func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -148,7 +148,7 @@ func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, external }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -169,7 +169,7 @@ func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } -func getBidType(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getBidType(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json b/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json index 22939466309..0d77e5af93a 100644 --- a/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json +++ b/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json @@ -49,7 +49,7 @@ "expectedMakeBidsErrors": [ { "comparison": "literal", - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse" + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse" } ] } diff --git a/adapters/yieldlab/yieldlab.go b/adapters/yieldlab/yieldlab.go index 086ce059898..447f8aa55fd 100644 --- a/adapters/yieldlab/yieldlab.go +++ b/adapters/yieldlab/yieldlab.go @@ -9,9 +9,9 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" "golang.org/x/text/currency" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -36,7 +36,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // Builds endpoint url based on adapter-specific pub settings from imp.ext -func (a *YieldlabAdapter) makeEndpointURL(req *openrtb.BidRequest, params *openrtb_ext.ExtImpYieldlab) (string, error) { +func (a *YieldlabAdapter) makeEndpointURL(req *openrtb2.BidRequest, params *openrtb_ext.ExtImpYieldlab) (string, error) { uri, err := url.Parse(a.endpoint) if err != nil { return "", fmt.Errorf("failed to parse yieldlab endpoint: %v", err) @@ -86,7 +86,7 @@ func (a *YieldlabAdapter) makeEndpointURL(req *openrtb.BidRequest, params *openr return uri.String(), nil } -func (a *YieldlabAdapter) getGDPR(request *openrtb.BidRequest) (string, string, error) { +func (a *YieldlabAdapter) getGDPR(request *openrtb2.BidRequest) (string, string, error) { gdpr := "" var extRegs openrtb_ext.ExtRegs if request.Regs != nil { @@ -118,7 +118,7 @@ func (a *YieldlabAdapter) makeTargetingValues(params *openrtb_ext.ExtImpYieldlab return values.Encode() } -func (a *YieldlabAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *YieldlabAdapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{fmt.Errorf("invalid request %+v, no Impressions given", request)} } @@ -149,7 +149,7 @@ func (a *YieldlabAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters. } // parseRequest extracts the Yieldlab request information from the request -func (a *YieldlabAdapter) parseRequest(request *openrtb.BidRequest) []*openrtb_ext.ExtImpYieldlab { +func (a *YieldlabAdapter) parseRequest(request *openrtb2.BidRequest) []*openrtb_ext.ExtImpYieldlab { params := make([]*openrtb_ext.ExtImpYieldlab, 0) for i := 0; i < len(request.Imp); i++ { @@ -187,7 +187,7 @@ func (a *YieldlabAdapter) mergeParams(params []*openrtb_ext.ExtImpYieldlab) *ope } // MakeBids make the bids for the bid response. -func (a *YieldlabAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YieldlabAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode != 200 { return nil, []error{ &errortypes.BadServerResponse{ @@ -226,14 +226,14 @@ func (a *YieldlabAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } var bidType openrtb_ext.BidType - responseBid := &openrtb.Bid{ + responseBid := &openrtb2.Bid{ ID: strconv.FormatUint(bid.ID, 10), Price: float64(bid.Price) / 100, ImpID: internalRequest.Imp[i].ID, CrID: a.makeCreativeID(req, bid), DealID: strconv.FormatUint(bid.Pid, 10), - W: width, - H: height, + W: int64(width), + H: int64(height), } if internalRequest.Imp[i].Video != nil { @@ -268,11 +268,11 @@ func (a *YieldlabAdapter) findBidReq(adslotID uint64, params []*openrtb_ext.ExtI return nil } -func (a *YieldlabAdapter) makeBannerAdSource(req *openrtb.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { +func (a *YieldlabAdapter) makeBannerAdSource(req *openrtb2.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { return fmt.Sprintf(adSourceBanner, a.makeAdSourceURL(req, ext, res)) } -func (a *YieldlabAdapter) makeAdSourceURL(req *openrtb.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { +func (a *YieldlabAdapter) makeAdSourceURL(req *openrtb2.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { val := url.Values{} val.Set("ts", a.cacheBuster()) val.Set("id", ext.ExtId) diff --git a/adapters/yieldmo/yieldmo.go b/adapters/yieldmo/yieldmo.go index 2d84444441e..6c9524a8823 100644 --- a/adapters/yieldmo/yieldmo.go +++ b/adapters/yieldmo/yieldmo.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -20,7 +20,7 @@ type Ext struct { PlacementId string `json:"placement_id"` } -func (a *YieldmoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *YieldmoAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -33,7 +33,7 @@ func (a *YieldmoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return adapterRequests, errors } -func (a *YieldmoAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *YieldmoAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error if err := preprocess(request); err != nil { @@ -59,7 +59,7 @@ func (a *YieldmoAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Req } // Mutate the request to get it ready to send to yieldmo. -func preprocess(request *openrtb.BidRequest) error { +func preprocess(request *openrtb2.BidRequest) error { for i := 0; i < len(request.Imp); i++ { var imp = request.Imp[i] var bidderExt adapters.ExtImpBidder @@ -95,7 +95,7 @@ func preprocess(request *openrtb.BidRequest) error { } // MakeBids make the bids for the bid response. -func (a *YieldmoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YieldmoAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -112,7 +112,7 @@ func (a *YieldmoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -140,7 +140,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { //default to video unless banner exists in impression for _, imp := range imps { if imp.ID == impId && imp.Banner != nil { diff --git a/adapters/yieldone/yieldone.go b/adapters/yieldone/yieldone.go index 5d7edd63018..813746e1d99 100644 --- a/adapters/yieldone/yieldone.go +++ b/adapters/yieldone/yieldone.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -17,10 +17,10 @@ type YieldoneAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *YieldoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *YieldoneAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) - var validImps []openrtb.Imp + var validImps []openrtb2.Imp for i := 0; i < len(request.Imp); i++ { if err := preprocess(&request.Imp[i]); err == nil { validImps = append(validImps, request.Imp[i]) @@ -49,7 +49,7 @@ func (a *YieldoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada } // MakeBids unpacks the server's response into Bids. -func (a *YieldoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YieldoneAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -66,7 +66,7 @@ func (a *YieldoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, external }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -98,7 +98,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var ext adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &ext); err != nil { @@ -122,7 +122,7 @@ func preprocess(imp *openrtb.Imp) error { return nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/yieldone/yieldonetest/supplemental/bad_response.json b/adapters/yieldone/yieldonetest/supplemental/bad_response.json index fa993a2fff5..3112d1f7ba0 100644 --- a/adapters/yieldone/yieldonetest/supplemental/bad_response.json +++ b/adapters/yieldone/yieldonetest/supplemental/bad_response.json @@ -58,7 +58,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/zeroclickfraud/zeroclickfraud.go b/adapters/zeroclickfraud/zeroclickfraud.go index 17fbba747df..ab1938fa518 100644 --- a/adapters/zeroclickfraud/zeroclickfraud.go +++ b/adapters/zeroclickfraud/zeroclickfraud.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,7 +19,7 @@ type ZeroClickFraudAdapter struct { EndpointTemplate template.Template } -func (a *ZeroClickFraudAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ZeroClickFraudAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) headers := http.Header{ @@ -69,7 +69,7 @@ func (a *ZeroClickFraudAdapter) MakeRequests(request *openrtb.BidRequest, reqInf internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) */ func (a *ZeroClickFraudAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -88,7 +88,7 @@ func (a *ZeroClickFraudAdapter) MakeBids( }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -110,9 +110,9 @@ func (a *ZeroClickFraudAdapter) MakeBids( return bidResponse, nil } -func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpZeroClickFraud][]openrtb.Imp, error) { +func splitImpressions(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpZeroClickFraud][]openrtb2.Imp, error) { - var m = make(map[openrtb_ext.ExtImpZeroClickFraud][]openrtb.Imp) + var m = make(map[openrtb_ext.ExtImpZeroClickFraud][]openrtb2.Imp) for _, imp := range imps { bidderParams, err := getBidderParams(&imp) @@ -126,7 +126,7 @@ func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpZeroClickFraud] return m, nil } -func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpZeroClickFraud, error) { +func getBidderParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpZeroClickFraud, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -155,7 +155,7 @@ func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpZeroClickFraud, error return &zeroclickfraudExt, nil } -func getMediaType(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaType(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner diff --git a/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json b/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json index 84d6bd9d889..87ad168467d 100644 --- a/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json +++ b/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json @@ -81,7 +81,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/amp/parse.go b/amp/parse.go index 9e0e019f953..40604c774be 100644 --- a/amp/parse.go +++ b/amp/parse.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" ) // Params defines the paramters of an AMP request. @@ -24,11 +24,11 @@ type Params struct { // Size defines size information of an AMP request. type Size struct { - Height uint64 - Multisize []openrtb.Format - OverrideHeight uint64 - OverrideWidth uint64 - Width uint64 + Height int64 + Multisize []openrtb2.Format + OverrideHeight int64 + OverrideWidth int64 + Width int64 } // ParseParams parses the AMP paramters from a HTTP request. @@ -67,26 +67,26 @@ func parseIntPtr(value string) *uint64 { return nil } -func parseInt(value string) uint64 { - if parsed, err := strconv.ParseUint(value, 10, 64); err == nil { +func parseInt(value string) int64 { + if parsed, err := strconv.ParseInt(value, 10, 64); err == nil { return parsed } return 0 } -func parseMultisize(multisize string) []openrtb.Format { +func parseMultisize(multisize string) []openrtb2.Format { if multisize == "" { return nil } sizeStrings := strings.Split(multisize, ",") - sizes := make([]openrtb.Format, 0, len(sizeStrings)) + sizes := make([]openrtb2.Format, 0, len(sizeStrings)) for _, sizeString := range sizeStrings { wh := strings.Split(sizeString, "x") if len(wh) != 2 { return nil } - f := openrtb.Format{ + f := openrtb2.Format{ W: parseInt(wh[0]), H: parseInt(wh[1]), } diff --git a/amp/parse_test.go b/amp/parse_test.go index e2c82d71030..3a15e81ab46 100644 --- a/amp/parse_test.go +++ b/amp/parse_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) @@ -40,7 +40,7 @@ func TestParseParams(t *testing.T) { OverrideHeight: 3, OverrideWidth: 4, Width: 2, - Multisize: []openrtb.Format{ + Multisize: []openrtb2.Format{ {W: 10, H: 11}, {W: 12, H: 13}, }, }, @@ -96,7 +96,7 @@ func TestParseMultisize(t *testing.T) { testCases := []struct { description string multisize string - expectedFormats []openrtb.Format + expectedFormats []openrtb2.Format }{ { description: "Empty", @@ -106,18 +106,18 @@ func TestParseMultisize(t *testing.T) { { description: "One", multisize: "1x2", - expectedFormats: []openrtb.Format{{W: 1, H: 2}}, + expectedFormats: []openrtb2.Format{{W: 1, H: 2}}, }, { description: "Many", multisize: "1x2,3x4", - expectedFormats: []openrtb.Format{{W: 1, H: 2}, {W: 3, H: 4}}, + expectedFormats: []openrtb2.Format{{W: 1, H: 2}, {W: 3, H: 4}}, }, { // Existing Behavior: The " 3" token in the second size is parsed as 0. description: "Many With Space - Quirky Result", multisize: "1x2, 3x4", - expectedFormats: []openrtb.Format{{W: 1, H: 2}, {W: 0, H: 4}}, + expectedFormats: []openrtb2.Format{{W: 1, H: 2}, {W: 0, H: 4}}, }, { description: "One - Zero Size - Ignored", diff --git a/analytics/config/config_test.go b/analytics/config/config_test.go index 52edc79c2e3..1ec0c27e923 100644 --- a/analytics/config/config_test.go +++ b/analytics/config/config_test.go @@ -1,12 +1,13 @@ package config import ( - "github.com/stretchr/testify/assert" "net/http" "os" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/stretchr/testify/assert" + "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" ) @@ -19,8 +20,8 @@ func TestSampleModule(t *testing.T) { am.LogAuctionObject(&analytics.AuctionObject{ Status: http.StatusOK, Errors: nil, - Request: &openrtb.BidRequest{}, - Response: &openrtb.BidResponse{}, + Request: &openrtb2.BidRequest{}, + Response: &openrtb2.BidResponse{}, }) if count != 1 { t.Errorf("PBSAnalyticsModule failed at LogAuctionObject") diff --git a/analytics/core.go b/analytics/core.go index 6837304541d..e9403968c27 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -3,7 +3,7 @@ package analytics import ( "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/usersync" @@ -30,8 +30,8 @@ type PBSAnalyticsModule interface { type AuctionObject struct { Status int Errors []error - Request *openrtb.BidRequest - Response *openrtb.BidResponse + Request *openrtb2.BidRequest + Response *openrtb2.BidResponse Account *config.Account StartTime time.Time } @@ -40,8 +40,8 @@ type AuctionObject struct { type AmpObject struct { Status int Errors []error - Request *openrtb.BidRequest - AuctionResponse *openrtb.BidResponse + Request *openrtb2.BidRequest + AuctionResponse *openrtb2.BidResponse AmpTargetingValues map[string]string Origin string StartTime time.Time @@ -51,8 +51,8 @@ type AmpObject struct { type VideoObject struct { Status int Errors []error - Request *openrtb.BidRequest - Response *openrtb.BidResponse + Request *openrtb2.BidRequest + Response *openrtb2.BidResponse VideoRequest *openrtb_ext.BidRequestVideo VideoResponse *openrtb_ext.BidResponseVideo StartTime time.Time diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index cfc923c70f6..cfb72f487b0 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -1,13 +1,14 @@ package filesystem import ( - "github.com/prebid/prebid-server/config" "net/http" "os" "strings" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/usersync" ) @@ -18,7 +19,7 @@ func TestAmpObject_ToJson(t *testing.T) { ao := &analytics.AmpObject{ Status: http.StatusOK, Errors: make([]error, 0), - AuctionResponse: &openrtb.BidResponse{}, + AuctionResponse: &openrtb2.BidResponse{}, AmpTargetingValues: map[string]string{}, } if aoJson := jsonifyAmpObject(ao); strings.Contains(aoJson, "Transactional Logs Error") { diff --git a/analytics/pubstack/helpers/json_test.go b/analytics/pubstack/helpers/json_test.go index 4e36e8db2be..ba97d60da18 100644 --- a/analytics/pubstack/helpers/json_test.go +++ b/analytics/pubstack/helpers/json_test.go @@ -1,11 +1,12 @@ package helpers import ( - "github.com/mxmCherry/openrtb" - "github.com/prebid/prebid-server/analytics" - "github.com/prebid/prebid-server/usersync" "net/http" "testing" + + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/usersync" ) func TestJsonifyAuctionObject(t *testing.T) { @@ -52,7 +53,7 @@ func TestJsonifyAmpObject(t *testing.T) { ao := &analytics.AmpObject{ Status: http.StatusOK, Errors: make([]error, 0), - AuctionResponse: &openrtb.BidResponse{}, + AuctionResponse: &openrtb2.BidResponse{}, AmpTargetingValues: map[string]string{}, } if _, err := JsonifyAmpObject(ao, "scopeId"); err != nil { diff --git a/analytics/pubstack/pubstack_module_test.go b/analytics/pubstack/pubstack_module_test.go index 6bebc937f5e..8cc572022ef 100644 --- a/analytics/pubstack/pubstack_module_test.go +++ b/analytics/pubstack/pubstack_module_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/analytics" "github.com/stretchr/testify/assert" ) @@ -21,7 +21,7 @@ func loadJSONFromFile() (*analytics.AuctionObject, error) { } defer req.Close() - reqCtn := openrtb.BidRequest{} + reqCtn := openrtb2.BidRequest{} reqPayload, err := ioutil.ReadAll(req) if err != nil { return nil, err @@ -38,7 +38,7 @@ func loadJSONFromFile() (*analytics.AuctionObject, error) { } defer res.Close() - resCtn := openrtb.BidResponse{} + resCtn := openrtb2.BidResponse{} resPayload, err := ioutil.ReadAll(res) if err != nil { return nil, err diff --git a/endpoints/auction.go b/endpoints/auction.go index 92e9769d59e..069abfec4e5 100644 --- a/endpoints/auction.go +++ b/endpoints/auction.go @@ -307,8 +307,8 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr hbSize := "" if bid.Width != 0 && bid.Height != 0 { - width := strconv.FormatUint(bid.Width, 10) - height := strconv.FormatUint(bid.Height, 10) + width := strconv.FormatInt(bid.Width, 10) + height := strconv.FormatInt(bid.Height, 10) hbSize = width + "x" + height } diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index ed9a526d760..e99856129f7 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -10,7 +10,7 @@ import ( "net/http/httptest" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/gdpr" @@ -518,7 +518,7 @@ func TestBidSizeValidate(t *testing.T) { AdUnits: []pbs.PBSAdUnit{ { BidID: "test_bidid1", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 350, H: 250, @@ -535,7 +535,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid2", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 100, H: 100, @@ -548,7 +548,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid3", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 200, H: 200, @@ -561,7 +561,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid_video", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 400, H: 400, @@ -574,7 +574,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid3", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 150, H: 150, @@ -587,7 +587,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid_y", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 150, H: 150, diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index 1f3d622b80d..cc8df0bf1b2 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -14,7 +14,7 @@ import ( "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" accountService "github.com/prebid/prebid-server/account" "github.com/prebid/prebid-server/amp" "github.com/prebid/prebid-server/analytics" @@ -289,7 +289,7 @@ func (deps *endpointDeps) AmpAuction(w http.ResponseWriter, r *http.Request, _ h // possible, it will return errors with messages that suggest improvements. // // If the errors list has at least one element, then no guarantees are made about the returned request. -func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openrtb.BidRequest, errs []error) { +func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openrtb2.BidRequest, errs []error) { // Load the stored request for the AMP ID. req, e := deps.loadRequestJSONForAmp(httpRequest) if errs = append(errs, e...); errortypes.ContainsFatalError(errs) { @@ -313,8 +313,8 @@ func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openr } // Load the stored OpenRTB request for an incoming AMP request, or return the errors found. -func (deps *endpointDeps) loadRequestJSONForAmp(httpRequest *http.Request) (req *openrtb.BidRequest, errs []error) { - req = &openrtb.BidRequest{} +func (deps *endpointDeps) loadRequestJSONForAmp(httpRequest *http.Request) (req *openrtb2.BidRequest, errs []error) { + req = &openrtb2.BidRequest{} errs = nil ampParams, err := amp.ParseParams(httpRequest) @@ -372,9 +372,9 @@ func (deps *endpointDeps) loadRequestJSONForAmp(httpRequest *http.Request) (req return } -func (deps *endpointDeps) overrideWithParams(ampParams amp.Params, req *openrtb.BidRequest) []error { +func (deps *endpointDeps) overrideWithParams(ampParams amp.Params, req *openrtb2.BidRequest) []error { if req.Site == nil { - req.Site = &openrtb.Site{} + req.Site = &openrtb2.Site{} } // Override the stored request sizes with AMP ones, if they exist. @@ -423,25 +423,25 @@ func (deps *endpointDeps) overrideWithParams(ampParams amp.Params, req *openrtb. return nil } -func makeFormatReplacement(size amp.Size) []openrtb.Format { - var formats []openrtb.Format +func makeFormatReplacement(size amp.Size) []openrtb2.Format { + var formats []openrtb2.Format if size.OverrideWidth != 0 && size.OverrideHeight != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.OverrideWidth, H: size.OverrideHeight, }} } else if size.OverrideWidth != 0 && size.Height != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.OverrideWidth, H: size.Height, }} } else if size.Width != 0 && size.OverrideHeight != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.Width, H: size.OverrideHeight, }} } else if size.Width != 0 && size.Height != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.Width, H: size.Height, }} @@ -450,13 +450,13 @@ func makeFormatReplacement(size amp.Size) []openrtb.Format { return append(formats, size.Multisize...) } -func setWidths(formats []openrtb.Format, width uint64) { +func setWidths(formats []openrtb2.Format, width int64) { for i := 0; i < len(formats); i++ { formats[i].W = width } } -func setHeights(formats []openrtb.Format, height uint64) { +func setHeights(formats []openrtb2.Format, height int64) { for i := 0; i < len(formats); i++ { formats[i].H = height } @@ -464,7 +464,7 @@ func setHeights(formats []openrtb.Format, height uint64) { // AMP won't function unless ext.prebid.targeting and ext.prebid.cache.bids are defined. // If the user didn't include them, default those here. -func defaultRequestExt(req *openrtb.BidRequest) (errs []error) { +func defaultRequestExt(req *openrtb2.BidRequest) (errs []error) { errs = nil extRequest := &openrtb_ext.ExtRequest{} if req.Ext != nil && len(req.Ext) > 0 { @@ -506,7 +506,7 @@ func defaultRequestExt(req *openrtb.BidRequest) (errs []error) { return } -func setAmpExt(site *openrtb.Site, value string) { +func setAmpExt(site *openrtb2.Site, value string) { if len(site.Ext) > 0 { if _, dataType, _, _ := jsonparser.Get(site.Ext, "amp"); dataType == jsonparser.NotExist { if val, err := jsonparser.Set(site.Ext, []byte(value), "amp"); err == nil { @@ -538,16 +538,16 @@ func readPolicy(consent string) (privacy.PolicyWriter, error) { } // Sets the effective publisher ID for amp request -func setEffectiveAmpPubID(req *openrtb.BidRequest, account string) { - var pub *openrtb.Publisher +func setEffectiveAmpPubID(req *openrtb2.BidRequest, account string) { + var pub *openrtb2.Publisher if req.App != nil { if req.App.Publisher == nil { - req.App.Publisher = new(openrtb.Publisher) + req.App.Publisher = new(openrtb2.Publisher) } pub = req.App.Publisher } else if req.Site != nil { if req.Site.Publisher == nil { - req.Site.Publisher = new(openrtb.Publisher) + req.Site.Publisher = new(openrtb2.Publisher) } pub = req.Site.Publisher } diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index 77e76613c29..45bbb2dd3e5 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -11,10 +11,10 @@ import ( "strconv" "testing" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/mxmCherry/openrtb" analyticsConf "github.com/prebid/prebid-server/analytics/config" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/exchange" @@ -189,7 +189,7 @@ func TestGDPRConsent(t *testing.T) { // Build Request bid, err := getTestBidRequest(test.nilUser, test.userExt, true, nil) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -341,7 +341,7 @@ func TestCCPAConsent(t *testing.T) { // Build Request bid, err := getTestBidRequest(true, nil, test.nilRegs, test.regsExt) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -446,7 +446,7 @@ func TestConsentWarnings(t *testing.T) { bid, err := getTestBidRequest(true, nil, testCase.regs == nil, testCase.regs) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -543,7 +543,7 @@ func TestNewAndLegacyConsentBothProvided(t *testing.T) { // Build Request bid, err := getTestBidRequest(false, nil, true, nil) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -712,7 +712,7 @@ func TestAmpDebug(t *testing.T) { // Prevents #452 func TestAmpTargetingDefaults(t *testing.T) { - req := &openrtb.BidRequest{} + req := &openrtb2.BidRequest{} if errs := defaultRequestExt(req); len(errs) != 0 { t.Fatalf("Unexpected error defaulting request.ext for AMP: %v", errs) } @@ -797,7 +797,7 @@ func TestOverrideDimensions(t *testing.T) { formatOverrideSpec{ overrideWidth: 20, overrideHeight: 40, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }}, @@ -808,7 +808,7 @@ func TestOverrideHeightNormalWidth(t *testing.T) { formatOverrideSpec{ width: 20, overrideHeight: 40, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }}, @@ -819,7 +819,7 @@ func TestOverrideWidthNormalHeight(t *testing.T) { formatOverrideSpec{ overrideWidth: 20, height: 40, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }}, @@ -829,7 +829,7 @@ func TestOverrideWidthNormalHeight(t *testing.T) { func TestMultisize(t *testing.T) { formatOverrideSpec{ multisize: "200x50,100x60", - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 200, H: 50, }, { @@ -844,7 +844,7 @@ func TestSizeWithMultisize(t *testing.T) { width: 20, height: 40, multisize: "200x50,100x60", - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }, { @@ -860,7 +860,7 @@ func TestSizeWithMultisize(t *testing.T) { func TestHeightOnly(t *testing.T) { formatOverrideSpec{ height: 200, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 300, H: 200, }}, @@ -870,7 +870,7 @@ func TestHeightOnly(t *testing.T) { func TestWidthOnly(t *testing.T) { formatOverrideSpec{ width: 150, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 150, H: 600, }}, @@ -884,7 +884,7 @@ type formatOverrideSpec struct { overrideHeight uint64 multisize string account string - expect []openrtb.Format + expect []openrtb2.Format } func (s formatOverrideSpec) execute(t *testing.T) { @@ -942,7 +942,7 @@ func (cf *mockAmpStoredReqFetcher) FetchRequests(ctx context.Context, requestIDs } type mockAmpExchange struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest } var expectedErrorsFromHoldAuction map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage = map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderMessage{ @@ -954,12 +954,12 @@ var expectedErrorsFromHoldAuction map[openrtb_ext.BidderName][]openrtb_ext.ExtBi }, } -func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest - response := &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + response := &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", Ext: json.RawMessage(`{ "prebid": {"targeting": { "hb_pb": "1.20", "hb_appnexus_pb": "1.20", "hb_cache_id": "some_id"}}}`), }}, @@ -980,10 +980,10 @@ func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq type mockAmpExchangeWarnings struct{} -func (m *mockAmpExchangeWarnings) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { - response := &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ +func (m *mockAmpExchangeWarnings) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { + response := &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", Ext: json.RawMessage(`{ "prebid": {"targeting": { "hb_pb": "1.20", "hb_appnexus_pb": "1.20", "hb_cache_id": "some_id"}}}`), }}, @@ -994,16 +994,16 @@ func (m *mockAmpExchangeWarnings) HoldAuction(ctx context.Context, r exchange.Au } func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, regsExt *openrtb_ext.ExtRegs) ([]byte, error) { - var width uint64 = 300 - var height uint64 = 300 - bidRequest := &openrtb.BidRequest{ + var width int64 = 300 + var height int64 = 300 + bidRequest := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "/19968336/header-bid-tag-0", Ext: json.RawMessage(`{"appnexus": { "placementId":12883451 }}`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: width, H: 250, @@ -1018,7 +1018,7 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, }, }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "site-id", Page: "some-page", }, @@ -1034,7 +1034,7 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, } if !nilUser { - bidRequest.User = &openrtb.User{ + bidRequest.User = &openrtb2.User{ ID: "aUserId", BuyerUID: "aBuyerID", Ext: userExtData, @@ -1051,7 +1051,7 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, } if !nilRegs { - bidRequest.Regs = &openrtb.Regs{ + bidRequest.Regs = &openrtb2.Regs{ COPPA: 1, Ext: regsExtData, } @@ -1064,14 +1064,14 @@ func TestSetEffectiveAmpPubID(t *testing.T) { testCases := []struct { description string - req *openrtb.BidRequest + req *openrtb2.BidRequest account string expectedPubID string }{ { description: "No publisher ID provided", - req: &openrtb.BidRequest{ - App: &openrtb.App{ + req: &openrtb2.BidRequest{ + App: &openrtb2.App{ Publisher: nil, }, }, @@ -1079,9 +1079,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "Publisher ID present in req.App.Publisher.ID", - req: &openrtb.BidRequest{ - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: testPubID, }, }, @@ -1090,9 +1090,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "Publisher ID present in req.Site.Publisher.ID", - req: &openrtb.BidRequest{ - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: testPubID, }, }, @@ -1101,9 +1101,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "Publisher ID present in account parameter", - req: &openrtb.BidRequest{ - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "", }, }, @@ -1113,9 +1113,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "req.Site.Publisher present but ID set to empty string", - req: &openrtb.BidRequest{ - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "", }, }, @@ -1206,21 +1206,21 @@ func TestBuildAmpObject(t *testing.T) { expectedAmpObject: &analytics.AmpObject{ Status: http.StatusOK, Errors: nil, - Request: &openrtb.BidRequest{ + Request: &openrtb2.BidRequest{ ID: "some-request-id", - Device: &openrtb.Device{ + Device: &openrtb2.Device{ IP: "192.0.2.1", }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Page: "prebid.org", - Publisher: &openrtb.Publisher{}, + Publisher: &openrtb2.Publisher{}, Ext: json.RawMessage(`{"amp":1}`), }, - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "some-impression-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: 300, H: 250, @@ -1235,9 +1235,9 @@ func TestBuildAmpObject(t *testing.T) { TMax: 500, Ext: json.RawMessage(`{"prebid":{"cache":{"bids":{"returnCreative":null},"vastxml":null},"targeting":{"pricegranularity":{"precision":2,"ranges":[{"min":0,"max":20,"increment":0.1}]},"includewinners":true,"includebidderkeys":true,"includebrandcategory":null,"includeformat":false,"durationrangesec":null,"preferdeals":false}}}`), }, - AuctionResponse: &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + AuctionResponse: &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", Ext: json.RawMessage(`{ "prebid": {"targeting": { "hb_pb": "1.20", "hb_appnexus_pb": "1.20", "hb_cache_id": "some_id"}}}`), }}, diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index 70d8e72629e..91acab33ea1 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -18,9 +18,9 @@ import ( "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mxmCherry/openrtb" - "github.com/mxmCherry/openrtb/native" - nativeRequests "github.com/mxmCherry/openrtb/native/request" + "github.com/mxmCherry/openrtb/v14/native1" + nativeRequests "github.com/mxmCherry/openrtb/v14/native1/request" + "github.com/mxmCherry/openrtb/v14/openrtb2" accountService "github.com/prebid/prebid-server/account" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" @@ -223,8 +223,8 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http // possible, it will return errors with messages that suggest improvements. // // If the errors list has at least one element, then no guarantees are made about the returned request. -func (deps *endpointDeps) parseRequest(httpRequest *http.Request) (req *openrtb.BidRequest, errs []error) { - req = &openrtb.BidRequest{} +func (deps *endpointDeps) parseRequest(httpRequest *http.Request) (req *openrtb2.BidRequest, errs []error) { + req = &openrtb2.BidRequest{} errs = nil // Pull the request body into a buffer, so we have it for later usage. @@ -292,7 +292,7 @@ func parseTimeout(requestJson []byte, defaultTimeout time.Duration) time.Duratio return defaultTimeout } -func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error { +func (deps *endpointDeps) validateRequest(req *openrtb2.BidRequest) []error { errL := []error{} if req.ID == "" { return []error{errors.New("request missing required field: \"id\"")} @@ -362,6 +362,10 @@ func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error { return append(errL, err) } + if err := validateDevice(req.Device); err != nil { + return append(errL, err) + } + if ccpaPolicy, err := ccpa.ReadFromRequest(req); err != nil { return append(errL, err) } else if _, err := ccpaPolicy.Parse(exchange.GetValidBidders(aliases)); err != nil { @@ -397,9 +401,9 @@ func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error { return errL } -func validateAndFillSourceTID(req *openrtb.BidRequest) error { +func validateAndFillSourceTID(req *openrtb2.BidRequest) error { if req.Source == nil { - req.Source = &openrtb.Source{} + req.Source = &openrtb2.Source{} } if req.Source.TID == "" { if rawUUID, err := uuid.NewV4(); err == nil { @@ -475,7 +479,7 @@ func validateBidders(bidders []string, knownBidders map[string]openrtb_ext.Bidde return nil } -func (deps *endpointDeps) validateImp(imp *openrtb.Imp, aliases map[string]string, index int) []error { +func (deps *endpointDeps) validateImp(imp *openrtb2.Imp, aliases map[string]string, index int) []error { if imp.ID == "" { return []error{fmt.Errorf("request.imp[%d] missing required field: \"id\"", index)} } @@ -492,12 +496,12 @@ func (deps *endpointDeps) validateImp(imp *openrtb.Imp, aliases map[string]strin return []error{err} } - if imp.Video != nil && len(imp.Video.MIMEs) < 1 { - return []error{fmt.Errorf("request.imp[%d].video.mimes must contain at least one supported MIME type", index)} + if err := validateVideo(imp.Video, index); err != nil { + return []error{err} } - if imp.Audio != nil && len(imp.Audio.MIMEs) < 1 { - return []error{fmt.Errorf("request.imp[%d].audio.mimes must contain at least one supported MIME type", index)} + if err := validateAudio(imp.Audio, index); err != nil { + return []error{err} } if err := fillAndValidateNative(imp.Native, index); err != nil { @@ -516,13 +520,22 @@ func (deps *endpointDeps) validateImp(imp *openrtb.Imp, aliases map[string]strin return nil } -func validateBanner(banner *openrtb.Banner, impIndex int) error { +func validateBanner(banner *openrtb2.Banner, impIndex int) error { if banner == nil { return nil } - // Although these are only deprecated in the spec... since this is a new endpoint, we know nobody uses them yet. - // Let's start things off by pointing callers in the right direction. + // The following fields were previously uints in the OpenRTB library we use, but have + // since been changed to ints. We decided to maintain the non-negative check. + if banner.W != nil && *banner.W < 0 { + return fmt.Errorf("request.imp[%d].banner.w must be a positive number", impIndex) + } + if banner.H != nil && *banner.H < 0 { + return fmt.Errorf("request.imp[%d].banner.h must be a positive number", impIndex) + } + + // The following fields are deprecated in the OpenRTB 2.5 spec but are still present + // in the OpenRTB library we use. Enforce they are not specified. if banner.WMin != 0 { return fmt.Errorf("request.imp[%d].banner uses unsupported property: \"wmin\". Use the \"format\" array instead.", impIndex) } @@ -541,16 +554,71 @@ func validateBanner(banner *openrtb.Banner, impIndex int) error { return fmt.Errorf("request.imp[%d].banner has no sizes. Define \"w\" and \"h\", or include \"format\" elements.", impIndex) } - for fmtIndex, format := range banner.Format { - if err := validateFormat(&format, impIndex, fmtIndex); err != nil { + for i, format := range banner.Format { + if err := validateFormat(&format, impIndex, i); err != nil { return err } } + + return nil +} + +func validateVideo(video *openrtb2.Video, impIndex int) error { + if video == nil { + return nil + } + + if len(video.MIMEs) < 1 { + return fmt.Errorf("request.imp[%d].video.mimes must contain at least one supported MIME type", impIndex) + } + + // The following fields were previously uints in the OpenRTB library we use, but have + // since been changed to ints. We decided to maintain the non-negative check. + if video.W < 0 { + return fmt.Errorf("request.imp[%d].video.w must be a positive number", impIndex) + } + if video.H < 0 { + return fmt.Errorf("request.imp[%d].video.h must be a positive number", impIndex) + } + if video.MinBitRate < 0 { + return fmt.Errorf("request.imp[%d].video.minbitrate must be a positive number", impIndex) + } + if video.MaxBitRate < 0 { + return fmt.Errorf("request.imp[%d].video.maxbitrate must be a positive number", impIndex) + } + + return nil +} + +func validateAudio(audio *openrtb2.Audio, impIndex int) error { + if audio == nil { + return nil + } + + if len(audio.MIMEs) < 1 { + return fmt.Errorf("request.imp[%d].audio.mimes must contain at least one supported MIME type", impIndex) + } + + // The following fields were previously uints in the OpenRTB library we use, but have + // since been changed to ints. We decided to maintain the non-negative check. + if audio.Sequence < 0 { + return fmt.Errorf("request.imp[%d].audio.sequence must be a positive number", impIndex) + } + if audio.MaxSeq < 0 { + return fmt.Errorf("request.imp[%d].audio.maxseq must be a positive number", impIndex) + } + if audio.MinBitrate < 0 { + return fmt.Errorf("request.imp[%d].audio.minbitrate must be a positive number", impIndex) + } + if audio.MaxBitrate < 0 { + return fmt.Errorf("request.imp[%d].audio.maxbitrate must be a positive number", impIndex) + } + return nil } // fillAndValidateNative validates the request, and assigns the Asset IDs as recommended by the Native v1.2 spec. -func fillAndValidateNative(n *openrtb.Native, impIndex int) error { +func fillAndValidateNative(n *openrtb2.Native, impIndex int) error { if n == nil { return nil } @@ -584,12 +652,12 @@ func fillAndValidateNative(n *openrtb.Native, impIndex int) error { return nil } -func validateNativeContextTypes(cType native.ContextType, cSubtype native.ContextSubType, impIndex int) error { +func validateNativeContextTypes(cType native1.ContextType, cSubtype native1.ContextSubType, impIndex int) error { if cType == 0 { // Context is only recommended, so none is a valid type. return nil } - if cType < native.ContextTypeContent || cType > native.ContextTypeProduct { + if cType < native1.ContextTypeContent || cType > native1.ContextTypeProduct { return fmt.Errorf("request.imp[%d].native.request.context is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } if cSubtype < 0 { @@ -602,20 +670,20 @@ func validateNativeContextTypes(cType native.ContextType, cSubtype native.Contex if cSubtype >= 500 { return fmt.Errorf("request.imp[%d].native.request.contextsubtype can't be greater than or equal to 500. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } - if cSubtype >= native.ContextSubTypeGeneral && cSubtype <= native.ContextSubTypeUserGenerated { - if cType != native.ContextTypeContent { + if cSubtype >= native1.ContextSubTypeGeneral && cSubtype <= native1.ContextSubTypeUserGenerated { + if cType != native1.ContextTypeContent { return fmt.Errorf("request.imp[%d].native.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) } return nil } - if cSubtype >= native.ContextSubTypeSocial && cSubtype <= native.ContextSubTypeChat { - if cType != native.ContextTypeSocial { + if cSubtype >= native1.ContextSubTypeSocial && cSubtype <= native1.ContextSubTypeChat { + if cType != native1.ContextTypeSocial { return fmt.Errorf("request.imp[%d].native.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) } return nil } - if cSubtype >= native.ContextSubTypeSelling && cSubtype <= native.ContextSubTypeProductReview { - if cType != native.ContextTypeProduct { + if cSubtype >= native1.ContextSubTypeSelling && cSubtype <= native1.ContextSubTypeProductReview { + if cType != native1.ContextTypeProduct { return fmt.Errorf("request.imp[%d].native.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) } return nil @@ -624,12 +692,12 @@ func validateNativeContextTypes(cType native.ContextType, cSubtype native.Contex return fmt.Errorf("request.imp[%d].native.request.contextsubtype is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } -func validateNativePlacementType(pt native.PlacementType, impIndex int) error { +func validateNativePlacementType(pt native1.PlacementType, impIndex int) error { if pt == 0 { // Placement Type is only reccomended, not required. return nil } - if pt < native.PlacementTypeFeed || pt > native.PlacementTypeRecommendationWidget { + if pt < native1.PlacementTypeFeed || pt > native1.PlacementTypeRecommendationWidget { return fmt.Errorf("request.imp[%d].native.request.plcmttype is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=40", impIndex) } return nil @@ -686,7 +754,9 @@ func validateNativeAsset(asset nativeRequests.Asset, impIndex int, assetIndex in return fmt.Errorf(assetErr, impIndex, assetIndex) } foundType = true - // It is technically valid to have neither w/h nor wmin/hmin, so no check + if err := validateNativeAssetImage(asset.Img, impIndex, assetIndex); err != nil { + return err + } } if asset.Video != nil { @@ -727,20 +797,20 @@ func validateNativeEventTrackers(trackers []nativeRequests.EventTracker, impInde func validateNativeAssetTitle(title *nativeRequests.Title, impIndex int, assetIndex int) error { if title.Len < 1 { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].title.len must be a positive integer", impIndex, assetIndex) + return fmt.Errorf("request.imp[%d].native.request.assets[%d].title.len must be a positive number", impIndex, assetIndex) } return nil } func validateNativeEventTracker(tracker nativeRequests.EventTracker, impIndex int, eventIndex int) error { - if tracker.Event < native.EventTypeImpression || tracker.Event > native.EventTypeViewableVideo50 { + if tracker.Event < native1.EventTypeImpression || tracker.Event > native1.EventTypeViewableVideo50 { return fmt.Errorf("request.imp[%d].native.request.eventtrackers[%d].event is invalid. See section 7.6: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex) } if len(tracker.Methods) < 1 { return fmt.Errorf("request.imp[%d].native.request.eventtrackers[%d].method is required. See section 7.7: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex) } for methodIndex, method := range tracker.Methods { - if method < native.EventTrackingMethodImage || method > native.EventTrackingMethodJS { + if method < native1.EventTrackingMethodImage || method > native1.EventTrackingMethodJS { return fmt.Errorf("request.imp[%d].native.request.eventtrackers[%d].methods[%d] is invalid. See section 7.7: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex, methodIndex) } } @@ -748,6 +818,22 @@ func validateNativeEventTracker(tracker nativeRequests.EventTracker, impIndex in return nil } +func validateNativeAssetImage(img *nativeRequests.Image, impIndex int, assetIndex int) error { + if img.W < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.w must be a positive integer", impIndex, assetIndex) + } + if img.H < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.h must be a positive integer", impIndex, assetIndex) + } + if img.WMin < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.wmin must be a positive integer", impIndex, assetIndex) + } + if img.HMin < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.hmin must be a positive integer", impIndex, assetIndex) + } + return nil +} + func validateNativeAssetVideo(video *nativeRequests.Video, impIndex int, assetIndex int) error { if len(video.MIMEs) < 1 { return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.mimes must be an array with at least one MIME type", impIndex, assetIndex) @@ -766,14 +852,14 @@ func validateNativeAssetVideo(video *nativeRequests.Video, impIndex int, assetIn } func validateNativeAssetData(data *nativeRequests.Data, impIndex int, assetIndex int) error { - if data.Type < native.DataAssetTypeSponsored || data.Type > native.DataAssetTypeCTAText { + if data.Type < native1.DataAssetTypeSponsored || data.Type > native1.DataAssetTypeCTAText { return fmt.Errorf("request.imp[%d].native.request.assets[%d].data.type is invalid. See section 7.4: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=40", impIndex, assetIndex) } return nil } -func validateNativeVideoProtocols(protocols []native.Protocol, impIndex int, assetIndex int) error { +func validateNativeVideoProtocols(protocols []native1.Protocol, impIndex int, assetIndex int) error { if len(protocols) < 1 { return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.protocols must be an array with at least one element", impIndex, assetIndex) } @@ -785,16 +871,35 @@ func validateNativeVideoProtocols(protocols []native.Protocol, impIndex int, ass return nil } -func validateNativeVideoProtocol(protocol native.Protocol, impIndex int, assetIndex int, protocolIndex int) error { - if protocol < native.ProtocolVAST10 || protocol > native.ProtocolDAAST10Wrapper { +func validateNativeVideoProtocol(protocol native1.Protocol, impIndex int, assetIndex int, protocolIndex int) error { + if protocol < native1.ProtocolVAST10 || protocol > native1.ProtocolDAAST10Wrapper { return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.protocols[%d] is invalid. See Section 5.8: https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf#page=52", impIndex, assetIndex, protocolIndex) } return nil } -func validateFormat(format *openrtb.Format, impIndex int, formatIndex int) error { +func validateFormat(format *openrtb2.Format, impIndex, formatIndex int) error { usesHW := format.W != 0 || format.H != 0 usesRatios := format.WMin != 0 || format.WRatio != 0 || format.HRatio != 0 + + // The following fields were previously uints in the OpenRTB library we use, but have + // since been changed to ints. We decided to maintain the non-negative check. + if format.W < 0 { + return fmt.Errorf("request.imp[%d].banner.format[%d].w must be a positive number", impIndex, formatIndex) + } + if format.H < 0 { + return fmt.Errorf("request.imp[%d].banner.format[%d].h must be a positive number", impIndex, formatIndex) + } + if format.WRatio < 0 { + return fmt.Errorf("request.imp[%d].banner.format[%d].wratio must be a positive number", impIndex, formatIndex) + } + if format.HRatio < 0 { + return fmt.Errorf("request.imp[%d].banner.format[%d].hratio must be a positive number", impIndex, formatIndex) + } + if format.WMin < 0 { + return fmt.Errorf("request.imp[%d].banner.format[%d].wmin must be a positive number", impIndex, formatIndex) + } + if usesHW && usesRatios { return fmt.Errorf("Request imp[%d].banner.format[%d] should define *either* {w, h} *or* {wmin, wratio, hratio}, but not both. If both are valid, send two \"format\" objects in the request.", impIndex, formatIndex) } @@ -810,7 +915,7 @@ func validateFormat(format *openrtb.Format, impIndex int, formatIndex int) error return nil } -func validatePmp(pmp *openrtb.PMP, impIndex int) error { +func validatePmp(pmp *openrtb2.PMP, impIndex int) error { if pmp == nil { return nil } @@ -823,7 +928,7 @@ func validatePmp(pmp *openrtb.PMP, impIndex int) error { return nil } -func (deps *endpointDeps) validateImpExt(imp *openrtb.Imp, aliases map[string]string, impIndex int) []error { +func (deps *endpointDeps) validateImpExt(imp *openrtb2.Imp, aliases map[string]string, impIndex int) []error { errL := []error{} if len(imp.Ext) == 0 { return []error{fmt.Errorf("request.imp[%d].ext is required", impIndex)} @@ -937,7 +1042,7 @@ func (deps *endpointDeps) validateAliases(aliases map[string]string) error { return nil } -func (deps *endpointDeps) validateSite(site *openrtb.Site) error { +func (deps *endpointDeps) validateSite(site *openrtb2.Site) error { if site == nil { return nil } @@ -955,7 +1060,7 @@ func (deps *endpointDeps) validateSite(site *openrtb.Site) error { return nil } -func (deps *endpointDeps) validateApp(app *openrtb.App) error { +func (deps *endpointDeps) validateApp(app *openrtb2.App) error { if app == nil { return nil } @@ -976,9 +1081,18 @@ func (deps *endpointDeps) validateApp(app *openrtb.App) error { return nil } -func (deps *endpointDeps) validateUser(user *openrtb.User, aliases map[string]string) error { - // DigiTrust support - if user != nil && user.Ext != nil { +func (deps *endpointDeps) validateUser(user *openrtb2.User, aliases map[string]string) error { + if user == nil { + return nil + } + + // The following fields were previously uints in the OpenRTB library we use, but have + // since been changed to ints. We decided to maintain the non-negative check. + if user.Geo != nil && user.Geo.Accuracy < 0 { + return errors.New("request.user.geo.accuracy must be a positive number") + } + + if user.Ext != nil { // Creating ExtUser object to check if DigiTrust is valid var userExt openrtb_ext.ExtUser if err := json.Unmarshal(user.Ext, &userExt); err == nil { @@ -1030,7 +1144,6 @@ func (deps *endpointDeps) validateUser(user *openrtb.User, aliases map[string]st } } } else { - // Return error. return fmt.Errorf("request.user.ext object is not valid: %v", err) } } @@ -1038,7 +1151,7 @@ func (deps *endpointDeps) validateUser(user *openrtb.User, aliases map[string]st return nil } -func validateRegs(regs *openrtb.Regs) error { +func validateRegs(regs *openrtb2.Regs) error { if regs != nil && len(regs.Ext) > 0 { var regsExt openrtb_ext.ExtRegs if err := json.Unmarshal(regs.Ext, ®sExt); err != nil { @@ -1051,7 +1164,30 @@ func validateRegs(regs *openrtb.Regs) error { return nil } -func sanitizeRequest(r *openrtb.BidRequest, ipValidator iputil.IPValidator) { +func validateDevice(device *openrtb2.Device) error { + if device == nil { + return nil + } + + // The following fields were previously uints in the OpenRTB library we use, but have + // since been changed to ints. We decided to maintain the non-negative check. + if device.W < 0 { + return errors.New("request.device.w must be a positive number") + } + if device.H < 0 { + return errors.New("request.device.h must be a positive number") + } + if device.PPI < 0 { + return errors.New("request.device.ppi must be a positive number") + } + if device.Geo != nil && device.Geo.Accuracy < 0 { + return errors.New("request.device.geo.accuracy must be a positive number") + } + + return nil +} + +func sanitizeRequest(r *openrtb2.BidRequest, ipValidator iputil.IPValidator) { if r.Device != nil { if ip, ver := iputil.ParseIP(r.Device.IP); ip == nil || ver != iputil.IPv4 || !ipValidator.IsValid(ip, ver) { r.Device.IP = "" @@ -1068,7 +1204,7 @@ func sanitizeRequest(r *openrtb.BidRequest, ipValidator iputil.IPValidator) { // OpenRTB properties from the headers and other implicit info. // // This function _should not_ override any fields which were defined explicitly by the caller in the request. -func (deps *endpointDeps) setFieldsImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func (deps *endpointDeps) setFieldsImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { sanitizeRequest(bidReq, deps.privateNetworkIPValidator) setDeviceImplicitly(httpReq, bidReq, deps.privateNetworkIPValidator) @@ -1083,7 +1219,7 @@ func (deps *endpointDeps) setFieldsImplicitly(httpReq *http.Request, bidReq *ope } // setDeviceImplicitly uses implicit info from httpReq to populate bidReq.Device -func setDeviceImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipValidtor iputil.IPValidator) { +func setDeviceImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest, ipValidtor iputil.IPValidator) { setIPImplicitly(httpReq, bidReq, ipValidtor) setUAImplicitly(httpReq, bidReq) setDoNotTrackImplicitly(httpReq, bidReq) @@ -1092,7 +1228,7 @@ func setDeviceImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipVa // setAuctionTypeImplicitly sets the auction type to 1 if it wasn't on the request, // since header bidding is generally a first-price auction. -func setAuctionTypeImplicitly(bidReq *openrtb.BidRequest) { +func setAuctionTypeImplicitly(bidReq *openrtb2.BidRequest) { if bidReq.AT == 0 { bidReq.AT = 1 } @@ -1100,13 +1236,13 @@ func setAuctionTypeImplicitly(bidReq *openrtb.BidRequest) { } // setSiteImplicitly uses implicit info from httpReq to populate bidReq.Site -func setSiteImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func setSiteImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { if bidReq.Site == nil || bidReq.Site.Page == "" || bidReq.Site.Domain == "" { referrerCandidate := httpReq.Referer() if parsedUrl, err := url.Parse(referrerCandidate); err == nil { if domain, err := publicsuffix.EffectiveTLDPlusOne(parsedUrl.Host); err == nil { if bidReq.Site == nil { - bidReq.Site = &openrtb.Site{} + bidReq.Site = &openrtb2.Site{} } if bidReq.Site.Domain == "" { bidReq.Site.Domain = domain @@ -1125,7 +1261,7 @@ func setSiteImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { } } -func setImpsImplicitly(httpReq *http.Request, imps []openrtb.Imp) { +func setImpsImplicitly(httpReq *http.Request, imps []openrtb2.Imp) { secure := int8(1) for i := 0; i < len(imps); i++ { if imps[i].Secure == nil && httputil.IsSecure(httpReq) { @@ -1285,18 +1421,18 @@ func getStoredRequestId(data []byte) (string, bool, error) { } // setIPImplicitly sets the IP address on bidReq, if it's not explicitly defined and we can figure it out. -func setIPImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipValidator iputil.IPValidator) { +func setIPImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest, ipValidator iputil.IPValidator) { if bidReq.Device == nil || (bidReq.Device.IP == "" && bidReq.Device.IPv6 == "") { if ip, ver := httputil.FindIP(httpReq, ipValidator); ip != nil { switch ver { case iputil.IPv4: if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } bidReq.Device.IP = ip.String() case iputil.IPv6: if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } bidReq.Device.IPv6 = ip.String() } @@ -1305,23 +1441,23 @@ func setIPImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipValida } // setUAImplicitly sets the User Agent on bidReq, if it's not explicitly defined and it's defined on the request. -func setUAImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func setUAImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { if bidReq.Device == nil || bidReq.Device.UA == "" { if ua := httpReq.UserAgent(); ua != "" { if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } bidReq.Device.UA = ua } } } -func setDoNotTrackImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func setDoNotTrackImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { if bidReq.Device == nil || bidReq.Device.DNT == nil { dnt := httpReq.Header.Get(dntKey) if dnt == "0" || dnt == "1" { if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } switch dnt { @@ -1368,7 +1504,7 @@ func writeError(errs []error, w http.ResponseWriter, labels *metrics.Labels) boo } // Returns the account ID for the request -func getAccountID(pub *openrtb.Publisher) string { +func getAccountID(pub *openrtb2.Publisher) string { if pub != nil { if pub.Ext != nil { var pubExt openrtb_ext.ExtPublisher diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index 19c58f05ae0..2deb5d1b762 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -17,11 +17,11 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/stored_requests" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" - "github.com/mxmCherry/openrtb" analyticsConf "github.com/prebid/prebid-server/analytics/config" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -152,8 +152,8 @@ func runTestCase(t *testing.T, fileData []byte, testFile string) { } if len(test.ExpectedBidResponse) > 0 { - var expectedBidResponse openrtb.BidResponse - var actualBidResponse openrtb.BidResponse + var expectedBidResponse openrtb2.BidResponse + var actualBidResponse openrtb2.BidResponse var err error err = json.Unmarshal(test.ExpectedBidResponse, &expectedBidResponse) @@ -241,7 +241,7 @@ func (tc *testConfigValues) getAdaptersConfigMap() map[string]config.Adapter { // Once unmarshalled, bidResponse objects can't simply be compared with an `assert.Equalf()` call // because tests fail if the elements inside the `bidResponse.SeatBid` and `bidResponse.SeatBid.Bid` // arrays, if any, are not listed in the exact same order in the actual version and in the expected version. -func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse openrtb.BidResponse, actualBidResponse openrtb.BidResponse) { +func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse openrtb2.BidResponse, actualBidResponse openrtb2.BidResponse) { //Assert non-array BidResponse fields assert.Equalf(t, expectedBidResponse.ID, actualBidResponse.ID, "BidResponse.ID doesn't match expected. Test: %s\n", testFile) @@ -252,12 +252,12 @@ func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse o assert.Len(t, actualBidResponse.SeatBid, len(expectedBidResponse.SeatBid), "BidResponse.SeatBid array doesn't match expected. Test: %s\n", testFile) //Given that bidResponses have the same length, compare them in an order-independent way using maps - var actualSeatBidsMap map[string]openrtb.SeatBid = make(map[string]openrtb.SeatBid, 0) + var actualSeatBidsMap map[string]openrtb2.SeatBid = make(map[string]openrtb2.SeatBid, 0) for _, seatBid := range actualBidResponse.SeatBid { actualSeatBidsMap[seatBid.Seat] = seatBid } - var expectedSeatBidsMap map[string]openrtb.SeatBid = make(map[string]openrtb.SeatBid, 0) + var expectedSeatBidsMap map[string]openrtb2.SeatBid = make(map[string]openrtb2.SeatBid, 0) for _, seatBid := range expectedBidResponse.SeatBid { expectedSeatBidsMap[seatBid.Seat] = seatBid } @@ -275,76 +275,76 @@ func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse o } func TestBidRequestAssert(t *testing.T) { - appnexusB1 := openrtb.Bid{ID: "appnexus-bid-1", Price: 5.00} - appnexusB2 := openrtb.Bid{ID: "appnexus-bid-2", Price: 7.00} - rubiconB1 := openrtb.Bid{ID: "rubicon-bid-1", Price: 1.50} - rubiconB2 := openrtb.Bid{ID: "rubicon-bid-2", Price: 4.00} + appnexusB1 := openrtb2.Bid{ID: "appnexus-bid-1", Price: 5.00} + appnexusB2 := openrtb2.Bid{ID: "appnexus-bid-2", Price: 7.00} + rubiconB1 := openrtb2.Bid{ID: "rubicon-bid-1", Price: 1.50} + rubiconB2 := openrtb2.Bid{ID: "rubicon-bid-2", Price: 4.00} - sampleSeatBids := []openrtb.SeatBid{ + sampleSeatBids := []openrtb2.SeatBid{ { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB1, appnexusB2}, + Bid: []openrtb2.Bid{appnexusB1, appnexusB2}, }, { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB1, rubiconB2}, + Bid: []openrtb2.Bid{rubiconB1, rubiconB2}, }, } testSuites := []struct { description string - expectedBidResponse openrtb.BidResponse - actualBidResponse openrtb.BidResponse + expectedBidResponse openrtb2.BidResponse + actualBidResponse openrtb2.BidResponse }{ { "identical SeatBids, exact same SeatBid and Bid arrays order", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, }, { "identical SeatBids but Seatbid array elements come in different order", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", - SeatBid: []openrtb.SeatBid{ + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", + SeatBid: []openrtb2.SeatBid{ { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB1, rubiconB2}, + Bid: []openrtb2.Bid{rubiconB1, rubiconB2}, }, { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB1, appnexusB2}, + Bid: []openrtb2.Bid{appnexusB1, appnexusB2}, }, }, }, }, { "SeatBids seem to be identical except for the different order of Bid array elements in one of them", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", - SeatBid: []openrtb.SeatBid{ + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", + SeatBid: []openrtb2.SeatBid{ { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB2, appnexusB1}, + Bid: []openrtb2.Bid{appnexusB2, appnexusB1}, }, { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB1, rubiconB2}, + Bid: []openrtb2.Bid{rubiconB1, rubiconB2}, }, }, }, }, { "Both SeatBid elements and bid elements come in different order", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", - SeatBid: []openrtb.SeatBid{ + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", + SeatBid: []openrtb2.SeatBid{ { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB2, rubiconB1}, + Bid: []openrtb2.Bid{rubiconB2, rubiconB1}, }, { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB2, appnexusB1}, + Bid: []openrtb2.Bid{appnexusB2, appnexusB1}, }, }, }, @@ -626,7 +626,7 @@ func TestExchangeError(t *testing.T) { func TestUserAgentSetting(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set("User-Agent", "foo") - bidReq := &openrtb.BidRequest{} + bidReq := &openrtb2.BidRequest{} setUAImplicitly(httpReq, bidReq) @@ -642,8 +642,8 @@ func TestUserAgentSetting(t *testing.T) { func TestUserAgentOverride(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set("User-Agent", "foo") - bidReq := &openrtb.BidRequest{ - Device: &openrtb.Device{ + bidReq := &openrtb2.BidRequest{ + Device: &openrtb2.Device{ UA: "bar", }, } @@ -656,7 +656,7 @@ func TestUserAgentOverride(t *testing.T) { } func TestAuctionTypeDefault(t *testing.T) { - bidReq := &openrtb.BidRequest{} + bidReq := &openrtb2.BidRequest{} setAuctionTypeImplicitly(bidReq) if bidReq.AT != 1 { @@ -757,21 +757,21 @@ func TestImplicitDNT(t *testing.T) { testCases := []struct { description string dntHeader string - request openrtb.BidRequest - expectedRequest openrtb.BidRequest + request openrtb2.BidRequest + expectedRequest openrtb2.BidRequest }{ { description: "Device Missing - Not Set In Header", dntHeader: "", - request: openrtb.BidRequest{}, - expectedRequest: openrtb.BidRequest{}, + request: openrtb2.BidRequest{}, + expectedRequest: openrtb2.BidRequest{}, }, { description: "Device Missing - Set To 0 In Header", dntHeader: "0", - request: openrtb.BidRequest{}, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{}, + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &disabled, }, }, @@ -779,9 +779,9 @@ func TestImplicitDNT(t *testing.T) { { description: "Device Missing - Set To 1 In Header", dntHeader: "1", - request: openrtb.BidRequest{}, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{}, + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -789,21 +789,21 @@ func TestImplicitDNT(t *testing.T) { { description: "Not Set In Request - Not Set In Header", dntHeader: "", - request: openrtb.BidRequest{ - Device: &openrtb.Device{}, + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{}, + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, }, { description: "Not Set In Request - Set To 0 In Header", dntHeader: "0", - request: openrtb.BidRequest{ - Device: &openrtb.Device{}, + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &disabled, }, }, @@ -811,11 +811,11 @@ func TestImplicitDNT(t *testing.T) { { description: "Not Set In Request - Set To 1 In Header", dntHeader: "1", - request: openrtb.BidRequest{ - Device: &openrtb.Device{}, + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -823,13 +823,13 @@ func TestImplicitDNT(t *testing.T) { { description: "Set In Request - Not Set In Header", dntHeader: "", - request: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -837,13 +837,13 @@ func TestImplicitDNT(t *testing.T) { { description: "Set In Request - Set To 0 In Header", dntHeader: "0", - request: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -851,13 +851,13 @@ func TestImplicitDNT(t *testing.T) { { description: "Set In Request - Set To 1 In Header", dntHeader: "1", - request: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -946,7 +946,7 @@ func TestImplicitSecure(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set(http.CanonicalHeaderKey("X-Forwarded-Proto"), "https") - imps := []openrtb.Imp{ + imps := []openrtb2.Imp{ {}, {}, } @@ -961,7 +961,7 @@ func TestImplicitSecure(t *testing.T) { func TestRefererParsing(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set("Referer", "http://test.mysite.com") - bidReq := &openrtb.BidRequest{} + bidReq := &openrtb2.BidRequest{} setSiteImplicitly(httpReq, bidReq) @@ -1123,8 +1123,8 @@ func TestImplicitAMPNoExt(t *testing.T) { return } - bidReq := openrtb.BidRequest{ - Site: &openrtb.Site{}, + bidReq := openrtb2.BidRequest{ + Site: &openrtb2.Site{}, } setSiteImplicitly(httpReq, &bidReq) assert.JSONEq(t, `{"amp":0}`, string(bidReq.Site.Ext)) @@ -1136,8 +1136,8 @@ func TestImplicitAMPOtherExt(t *testing.T) { return } - bidReq := openrtb.BidRequest{ - Site: &openrtb.Site{ + bidReq := openrtb2.BidRequest{ + Site: &openrtb2.Site{ Ext: json.RawMessage(`{"other":true}`), }, } @@ -1151,8 +1151,8 @@ func TestExplicitAMP(t *testing.T) { return } - bidReq := openrtb.BidRequest{ - Site: &openrtb.Site{ + bidReq := openrtb2.BidRequest{ + Site: &openrtb2.Site{ Ext: json.RawMessage(`{"amp":1}`), }, } @@ -1394,7 +1394,7 @@ func TestValidateImpExt(t *testing.T) { for _, group := range testGroups { for _, test := range group.testCases { - imp := &openrtb.Imp{Ext: test.impExt} + imp := &openrtb2.Imp{Ext: test.impExt} errs := deps.validateImpExt(imp, nil, 0) @@ -1438,20 +1438,20 @@ func TestCurrencyTrunc(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, Cur: []string{"USD", "EUR"}, @@ -1482,23 +1482,23 @@ func TestCCPAInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy": "invalid by length"}`), }, } @@ -1532,23 +1532,23 @@ func TestNoSaleInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy": "1NYN"}`), }, Ext: json.RawMessage(`{"prebid": {"nosale": ["*", "appnexus"]} }`), @@ -1583,20 +1583,20 @@ func TestValidateSourceTID(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, } @@ -1624,20 +1624,20 @@ func TestSChainInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, Ext: json.RawMessage(`{"prebid":{"schains":[{"bidders":["appnexus"],"schain":{"complete":1,"nodes":[{"asi":"directseller1.com","sid":"00001","rid":"BidRequest1","hp":1}],"ver":"1.0"}}, {"bidders":["appnexus"],"schain":{"complete":1,"nodes":[{"asi":"directseller2.com","sid":"00002","rid":"BidRequest2","hp":1}],"ver":"1.0"}}]}}`), @@ -1662,12 +1662,12 @@ func TestGetAccountID(t *testing.T) { testCases := []struct { description string - pub *openrtb.Publisher + pub *openrtb2.Publisher expectedAccID string }{ { description: "Publisher.ID and Publisher.Ext.Prebid.ParentAccount both present", - pub: &openrtb.Publisher{ + pub: &openrtb2.Publisher{ ID: testPubID, Ext: testPubExtJSON, }, @@ -1675,7 +1675,7 @@ func TestGetAccountID(t *testing.T) { }, { description: "Only Publisher.Ext.Prebid.ParentAccount present", - pub: &openrtb.Publisher{ + pub: &openrtb2.Publisher{ ID: "", Ext: testPubExtJSON, }, @@ -1683,14 +1683,14 @@ func TestGetAccountID(t *testing.T) { }, { description: "Only Publisher.ID present", - pub: &openrtb.Publisher{ + pub: &openrtb2.Publisher{ ID: testPubID, }, expectedAccID: testPubID, }, { description: "Neither Publisher.ID or Publisher.Ext.Prebid.ParentAccount present", - pub: &openrtb.Publisher{}, + pub: &openrtb2.Publisher{}, expectedAccID: metrics.PublisherUnknown, }, { @@ -1709,15 +1709,15 @@ func TestGetAccountID(t *testing.T) { func TestSanitizeRequest(t *testing.T) { testCases := []struct { description string - req *openrtb.BidRequest + req *openrtb2.BidRequest ipValidator iputil.IPValidator expectedIPv4 string expectedIPv6 string }{ { description: "Empty", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "", IPv6: "", }, @@ -1727,8 +1727,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Valid", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "1.1.1.1", IPv6: "1111::", }, @@ -1739,8 +1739,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Invalid", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "1.1.1.1", IPv6: "1111::", }, @@ -1751,8 +1751,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Invalid - Wrong IP Types", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "1111::", IPv6: "1.1.1.1", }, @@ -1763,8 +1763,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Malformed", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "malformed", IPv6: "malformed", }, @@ -1785,26 +1785,26 @@ func TestValidateAndFillSourceTID(t *testing.T) { testTID := "some-tid" testCases := []struct { description string - req *openrtb.BidRequest + req *openrtb2.BidRequest expectRandTID bool expectedTID string }{ { description: "req.Source not present. Expecting a randomly generated TID value", - req: &openrtb.BidRequest{}, + req: &openrtb2.BidRequest{}, expectRandTID: true, }, { description: "req.Source.TID not present. Expecting a randomly generated TID value", - req: &openrtb.BidRequest{ - Source: &openrtb.Source{}, + req: &openrtb2.BidRequest{ + Source: &openrtb2.Source{}, }, expectRandTID: true, }, { description: "req.Source.TID present. Expecting no change", - req: &openrtb.BidRequest{ - Source: &openrtb.Source{ + req: &openrtb2.BidRequest{ + Source: &openrtb2.Source{ TID: testTID, }, }, @@ -1843,20 +1843,20 @@ func TestEidPermissionsInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, Ext: json.RawMessage(`{"prebid": {"data": {"eidpermissions": [{"source":"a", "bidders":[]}]} } }`), @@ -2150,39 +2150,39 @@ type warningsCheckExchange struct { auctionRequest exchange.AuctionRequest } -func (e *warningsCheckExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (e *warningsCheckExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { e.auctionRequest = r return nil, nil } // nobidExchange is a well-behaved exchange which always bids "no bid". type nobidExchange struct { - gotRequest *openrtb.BidRequest + gotRequest *openrtb2.BidRequest } -func (e *nobidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (e *nobidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { e.gotRequest = r.BidRequest - return &openrtb.BidResponse{ + return &openrtb2.BidResponse{ ID: r.BidRequest.ID, BidID: "test bid id", - NBR: openrtb.NoBidReasonCodeUnknownError.Ptr(), + NBR: openrtb2.NoBidReasonCodeUnknownError.Ptr(), }, nil } type mockBidExchange struct { - gotRequest *openrtb.BidRequest + gotRequest *openrtb2.BidRequest } // mockBidExchange is a well-behaved exchange that lists the bidders found in every bidRequest.Imp[i].Ext // into the bidResponse.Ext to assert the bidder adapters that were not filtered out in the validation process -func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { - bidResponse := &openrtb.BidResponse{ +func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { + bidResponse := &openrtb2.BidResponse{ ID: r.BidRequest.ID, BidID: "test bid id", - NBR: openrtb.NoBidReasonCodeUnknownError.Ptr(), + NBR: openrtb2.NoBidReasonCodeUnknownError.Ptr(), } if len(r.BidRequest.Imp) > 0 { - var SeatBidMap = make(map[string]openrtb.SeatBid, 0) + var SeatBidMap = make(map[string]openrtb2.SeatBid, 0) for _, imp := range r.BidRequest.Imp { var bidderExts map[string]json.RawMessage if err := json.Unmarshal(imp.Ext, &bidderExts); err != nil { @@ -2205,9 +2205,9 @@ func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq for bidderNameOrAlias := range bidderExts { if isBidderToValidate(bidderNameOrAlias) { if val, ok := SeatBidMap[bidderNameOrAlias]; ok { - val.Bid = append(val.Bid, openrtb.Bid{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}) + val.Bid = append(val.Bid, openrtb2.Bid{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}) } else { - SeatBidMap[bidderNameOrAlias] = openrtb.SeatBid{Seat: fmt.Sprintf("%s-bids", bidderNameOrAlias), Bid: []openrtb.Bid{{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}}} + SeatBidMap[bidderNameOrAlias] = openrtb2.SeatBid{Seat: fmt.Sprintf("%s-bids", bidderNameOrAlias), Bid: []openrtb2.Bid{{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}}} } } } @@ -2222,7 +2222,7 @@ func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq type brokenExchange struct{} -func (e *brokenExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (e *brokenExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { return nil, errors.New("Critical, unrecoverable error.") } @@ -2585,14 +2585,14 @@ func (af mockAccountFetcher) FetchAccount(ctx context.Context, accountID string) } type mockExchange struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest } -func (m *mockExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", }}, }}, diff --git a/endpoints/openrtb2/interstitial.go b/endpoints/openrtb2/interstitial.go index b42945488cc..67f9bc37b28 100644 --- a/endpoints/openrtb2/interstitial.go +++ b/endpoints/openrtb2/interstitial.go @@ -4,13 +4,13 @@ import ( "encoding/json" "fmt" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" ) -func processInterstitials(req *openrtb.BidRequest) error { +func processInterstitials(req *openrtb2.BidRequest) error { var devExt openrtb_ext.ExtDevice unmarshalled := true for i := range req.Imp { @@ -38,8 +38,8 @@ func processInterstitials(req *openrtb.BidRequest) error { return nil } -func processInterstitialsForImp(imp *openrtb.Imp, devExt *openrtb_ext.ExtDevice, device *openrtb.Device) error { - var maxWidth, maxHeight, minWidth, minHeight uint64 +func processInterstitialsForImp(imp *openrtb2.Imp, devExt *openrtb_ext.ExtDevice, device *openrtb2.Device) error { + var maxWidth, maxHeight, minWidth, minHeight int64 if imp.Banner == nil { // custom interstitial support is only available for banner requests. return nil @@ -56,8 +56,8 @@ func processInterstitialsForImp(imp *openrtb.Imp, devExt *openrtb_ext.ExtDevice, maxWidth = device.W maxHeight = device.H } - minWidth = (maxWidth * devExt.Prebid.Interstitial.MinWidthPerc) / 100 - minHeight = (maxHeight * devExt.Prebid.Interstitial.MinHeightPerc) / 100 + minWidth = (maxWidth * int64(devExt.Prebid.Interstitial.MinWidthPerc)) / 100 + minHeight = (maxHeight * int64(devExt.Prebid.Interstitial.MinHeightPerc)) / 100 imp.Banner.Format = genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight) if len(imp.Banner.Format) == 0 { return &errortypes.BadInput{Message: fmt.Sprintf("Unable to set interstitial size list for Imp id=%s (No valid sizes between %dx%d and %dx%d)", imp.ID, minWidth, minHeight, maxWidth, maxHeight)} @@ -65,10 +65,10 @@ func processInterstitialsForImp(imp *openrtb.Imp, devExt *openrtb_ext.ExtDevice, return nil } -func genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight uint64) []openrtb.Format { +func genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight int64) []openrtb2.Format { sizes := make([]config.InterstitialSize, 0, 10) for _, size := range config.ResolvedInterstitialSizes { - if size.Width >= minWidth && size.Width <= maxWidth && size.Height >= minHeight && size.Height <= maxHeight { + if int64(size.Width) >= minWidth && int64(size.Width) <= maxWidth && int64(size.Height) >= minHeight && int64(size.Height) <= maxHeight { sizes = append(sizes, size) if len(sizes) >= 10 { // we have enough sizes @@ -76,9 +76,9 @@ func genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight uint64) []op } } } - formatList := make([]openrtb.Format, 0, len(sizes)) + formatList := make([]openrtb2.Format, 0, len(sizes)) for _, size := range sizes { - formatList = append(formatList, openrtb.Format{W: size.Width, H: size.Height}) + formatList = append(formatList, openrtb2.Format{W: int64(size.Width), H: int64(size.Height)}) } return formatList } diff --git a/endpoints/openrtb2/interstitial_test.go b/endpoints/openrtb2/interstitial_test.go index 1c6eb2555db..7691a6672e0 100644 --- a/endpoints/openrtb2/interstitial_test.go +++ b/endpoints/openrtb2/interstitial_test.go @@ -4,17 +4,17 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) -var request = &openrtb.BidRequest{ +var request = &openrtb2.BidRequest{ ID: "some-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "my-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: 300, H: 600, @@ -25,7 +25,7 @@ var request = &openrtb.BidRequest{ Ext: json.RawMessage(`{"appnexus": {"placementId": 12883451}}`), }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ H: 640, W: 320, Ext: json.RawMessage(`{"prebid": {"interstitial": {"minwidthperc": 60, "minheightperc": 60}}}`), @@ -37,7 +37,7 @@ func TestInterstitial(t *testing.T) { if err := processInterstitials(myRequest); err != nil { t.Fatalf("Error processing interstitials: %v", err) } - targetFormat := []openrtb.Format{ + targetFormat := []openrtb2.Format{ { W: 300, H: 600, diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/audio-maxbitrate-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/audio-maxbitrate-negative.json new file mode 100644 index 00000000000..62a96050121 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/audio-maxbitrate-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative audio max bitrate.", + + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "some-imp-id", + "audio": { + "mimes": ["audio/mp4"], + "maxbitrate": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].audio.maxbitrate must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/audio-maxseq-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/audio-maxseq-negative.json new file mode 100644 index 00000000000..5eb48e0c396 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/audio-maxseq-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative audio max sequence.", + + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "some-imp-id", + "audio": { + "mimes": ["audio/mp4"], + "maxseq": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].audio.maxseq must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/audio-minbitrate-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/audio-minbitrate-negative.json new file mode 100644 index 00000000000..304b77e2165 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/audio-minbitrate-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative audio min bitrate.", + + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "some-imp-id", + "audio": { + "mimes": ["audio/mp4"], + "minbitrate": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].audio.minbitrate must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/audio-sequence-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/audio-sequence-negative.json new file mode 100644 index 00000000000..2c1e181d96b --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/audio-sequence-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative audio sequence.", + + "mockBidRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "some-imp-id", + "audio": { + "mimes": ["audio/mp4"], + "sequence": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].audio.sequence must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-negative.json new file mode 100644 index 00000000000..b4ab8eefadb --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/banner-h-negative.json @@ -0,0 +1,23 @@ +{ + "description": "Request has a negative banner height.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": 50, + "h": -1 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.h must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-negative.json new file mode 100644 index 00000000000..968cc366b8f --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/banner-w-negative.json @@ -0,0 +1,23 @@ +{ + "description": "Request has a negative banner width.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": -1, + "h": 50 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.w must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/device-geo-accuracy-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/device-geo-accuracy-negative.json new file mode 100644 index 00000000000..ce9cf24a860 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/device-geo-accuracy-negative.json @@ -0,0 +1,30 @@ +{ + "description": "Request has a negative device geography accuracy.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "device": { + "w": 50, + "h": 50, + "geo": { + "accuracy": -1 + } + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": 50, + "h": 50 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.device.geo.accuracy must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/device-h-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/device-h-negative.json new file mode 100644 index 00000000000..12a0b6cb662 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/device-h-negative.json @@ -0,0 +1,27 @@ +{ + "description": "Request has a negative device height.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "device": { + "w": 50, + "h": -1 + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": 50, + "h": 50 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.device.h must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/device-ppi-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/device-ppi-negative.json new file mode 100644 index 00000000000..8ca2c03c198 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/device-ppi-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative PPI height.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "device": { + "w": 50, + "h": 50, + "ppi": -1 + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": 50, + "h": 50 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.device.ppi must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/device-w-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/device-w-negative.json new file mode 100644 index 00000000000..f3c17cee1f8 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/device-w-negative.json @@ -0,0 +1,27 @@ +{ + "description": "Request has a negative device width.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "device": { + "w": -1, + "h": 50 + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": 50, + "h": 50 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.device.w must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/format-h-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/format-h-negative.json new file mode 100644 index 00000000000..3d47c9a00ec --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/format-h-negative.json @@ -0,0 +1,20 @@ +{ + "description": "Request has a negative banner format height.", + "mockBidRequest": { + "id": "req-id", + "imp": [{ + "id": "imp-id", + "banner": { + "format": [{ + "w": 50, + "h": -1 + }] + } + }], + "app": { + "id": "app_001" + } + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.format[0].h must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/format-hratio-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/format-hratio-negative.json new file mode 100644 index 00000000000..93832f566ae --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/format-hratio-negative.json @@ -0,0 +1,21 @@ +{ + "description": "Request has a negative banner format height ratio.", + "mockBidRequest": { + "id": "req-id", + "imp": [{ + "id": "imp-id", + "banner": { + "format": [{ + "w": 50, + "h": 50, + "hratio": -1 + }] + } + }], + "app": { + "id": "app_001" + } + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.format[0].hratio must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/format-w-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/format-w-negative.json new file mode 100644 index 00000000000..7e845c63bcd --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/format-w-negative.json @@ -0,0 +1,20 @@ +{ + "description": "Request has a negative banner format width.", + "mockBidRequest": { + "id": "req-id", + "imp": [{ + "id": "imp-id", + "banner": { + "format": [{ + "w": -1, + "h": 50 + }] + } + }], + "app": { + "id": "app_001" + } + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.format[0].w must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/format-wmin-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/format-wmin-negative.json new file mode 100644 index 00000000000..ed618c0f459 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/format-wmin-negative.json @@ -0,0 +1,21 @@ +{ + "description": "Request has a negative banner format width minimum.", + "mockBidRequest": { + "id": "req-id", + "imp": [{ + "id": "imp-id", + "banner": { + "format": [{ + "w": 50, + "h": 50, + "wmin": -1 + }] + } + }], + "app": { + "id": "app_001" + } + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.format[0].wmin must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/format-wratio-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/format-wratio-negative.json new file mode 100644 index 00000000000..84c72b47d69 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/format-wratio-negative.json @@ -0,0 +1,21 @@ +{ + "description": "Request has a negative banner format width ratio.", + "mockBidRequest": { + "id": "req-id", + "imp": [{ + "id": "imp-id", + "banner": { + "format": [{ + "w": 50, + "h": 50, + "wratio": -1 + }] + } + }], + "app": { + "id": "app_001" + } + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].banner.format[0].wratio must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/user-geo-accuracy-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/user-geo-accuracy-negative.json new file mode 100644 index 00000000000..163a88eeb79 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/user-geo-accuracy-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative user geography accuracy.", + "mockBidRequest": { + "id": "req-id", + "site": { + "id": "some-site" + }, + "imp": [{ + "id": "imp-id", + "banner": { + "w": 50, + "h": 50 + }, + "ext": { + "appnexus": { + "placementId": 12883451 + } + } + }], + "user": { + "geo": { + "accuracy": -1 + } + } + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.user.geo.accuracy must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/video-h-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/video-h-negative.json new file mode 100644 index 00000000000..2534dd626ea --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/video-h-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative video height.", + + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "imp-id", + "video": { + "mimes": ["video/mp4"], + "h": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].video.h must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/video-maxbitrate-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/video-maxbitrate-negative.json new file mode 100644 index 00000000000..07c1af1d9a1 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/video-maxbitrate-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative video max bitrate.", + + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "imp-id", + "video": { + "mimes": ["video/mp4"], + "maxbitrate": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].video.maxbitrate must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/video-minbitrate-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/video-minbitrate-negative.json new file mode 100644 index 00000000000..54ead28e8e2 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/video-minbitrate-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative video min bitrate.", + + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "imp-id", + "video": { + "mimes": ["video/mp4"], + "minbitrate": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].video.minbitrate must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/sample-requests/invalid-whole/video-w-negative.json b/endpoints/openrtb2/sample-requests/invalid-whole/video-w-negative.json new file mode 100644 index 00000000000..cf50e8eddd7 --- /dev/null +++ b/endpoints/openrtb2/sample-requests/invalid-whole/video-w-negative.json @@ -0,0 +1,28 @@ +{ + "description": "Request has a negative video width.", + + "mockBidRequest": { + "id": "req-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [{ + "id": "imp-id", + "video": { + "mimes": ["video/mp4"], + "w": -1 + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 12345 + } + } + } + } + }] + }, + "expectedReturnCode": 400, + "expectedErrorMessage": "Invalid request: request.imp[0].video.w must be a positive number" +} \ No newline at end of file diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index 7735d886730..f46a8c2a1d5 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -17,12 +17,12 @@ import ( "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" "github.com/gofrs/uuid" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/util/iputil" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mxmCherry/openrtb" accountService "github.com/prebid/prebid-server/account" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" @@ -197,7 +197,7 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re vo.VideoRequest = videoBidReq - var bidReq = &openrtb.BidRequest{} + var bidReq = &openrtb2.BidRequest{} if deps.defaultRequest { if err := json.Unmarshal(deps.defReqJSON, bidReq); err != nil { err = fmt.Errorf("Invalid JSON in Default Request Settings: %s", err) @@ -370,13 +370,13 @@ func handleError(labels *metrics.Labels, w http.ResponseWriter, errL []error, vo vo.Errors = append(vo.Errors, errL...) } -func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVideo, podErrors []PodError) ([]openrtb.Imp, []PodError) { +func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVideo, podErrors []PodError) ([]openrtb2.Imp, []PodError) { videoDur := videoReq.PodConfig.DurationRangeSec minDuration, maxDuration := minMax(videoDur) reqExactDur := videoReq.PodConfig.RequireExactDuration videoData := videoReq.Video - finalImpsArray := make([]openrtb.Imp, 0) + finalImpsArray := make([]openrtb2.Imp, 0) for ind, pod := range videoReq.PodConfig.Pods { //load stored impression @@ -400,7 +400,7 @@ func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVide } impDivNumber := numImps / len(videoDur) - impsArray := make([]openrtb.Imp, numImps) + impsArray := make([]openrtb2.Imp, numImps) for impInd := range impsArray { newImp := createImpressionTemplate(storedImp, videoData) impsArray[impInd] = newImp @@ -432,18 +432,18 @@ func max(a, b int) int { return b } -func createImpressionTemplate(imp openrtb.Imp, video *openrtb.Video) openrtb.Imp { +func createImpressionTemplate(imp openrtb2.Imp, video *openrtb2.Video) openrtb2.Imp { //for every new impression we need to have it's own copy of video object, because we customize it in further processing newVideo := *video imp.Video = &newVideo return imp } -func (deps *endpointDeps) loadStoredImp(storedImpId string) (openrtb.Imp, []error) { +func (deps *endpointDeps) loadStoredImp(storedImpId string) (openrtb2.Imp, []error) { ctx, cancel := context.WithTimeout(context.Background(), time.Duration(storedRequestTimeoutMillis)*time.Millisecond) defer cancel() - impr := openrtb.Imp{} + impr := openrtb2.Imp{} _, imp, err := deps.storedReqFetcher.FetchRequests(ctx, []string{}, []string{storedImpId}) if err != nil { return impr, err @@ -469,7 +469,7 @@ func minMax(array []int) (int, int) { return min, max } -func buildVideoResponse(bidresponse *openrtb.BidResponse, podErrors []PodError) (*openrtb_ext.BidResponseVideo, error) { +func buildVideoResponse(bidresponse *openrtb2.BidResponse, podErrors []PodError) (*openrtb_ext.BidResponseVideo, error) { adPods := make([]*openrtb_ext.AdPod, 0) anyBidsReturned := false @@ -561,7 +561,7 @@ func getVideoStoredRequestId(request []byte) (string, error) { return string(value), nil } -func mergeData(videoRequest *openrtb_ext.BidRequestVideo, bidRequest *openrtb.BidRequest) error { +func mergeData(videoRequest *openrtb_ext.BidRequestVideo, bidRequest *openrtb2.BidRequest) error { if videoRequest.Site != nil { bidRequest.Site = videoRequest.Site diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index a70d45ac3b8..16dc02ee97b 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -12,7 +12,7 @@ import ( "strings" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/analytics" analyticsConf "github.com/prebid/prebid-server/analytics/config" "github.com/prebid/prebid-server/config" @@ -364,7 +364,7 @@ func TestVideoEndpointValidationsPositive(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -375,13 +375,13 @@ func TestVideoEndpointValidationsPositive(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -407,7 +407,7 @@ func TestVideoEndpointValidationsCritical(t *testing.T) { mimes = append(mimes, "") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) req := openrtb_ext.BidRequestVideo{ StoredRequestId: "", @@ -419,7 +419,7 @@ func TestVideoEndpointValidationsCritical(t *testing.T) { IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 0, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -476,7 +476,7 @@ func TestVideoEndpointValidationsPodErrors(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -487,13 +487,13 @@ func TestVideoEndpointValidationsPodErrors(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -546,7 +546,7 @@ func TestVideoEndpointValidationsSiteAndApp(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -557,16 +557,16 @@ func TestVideoEndpointValidationsSiteAndApp(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -604,7 +604,7 @@ func TestVideoEndpointValidationsSiteMissingRequiredField(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -615,13 +615,13 @@ func TestVideoEndpointValidationsSiteMissingRequiredField(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Domain: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -655,7 +655,7 @@ func TestVideoEndpointValidationsMissingVideo(t *testing.T) { }, }, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ @@ -670,16 +670,16 @@ func TestVideoEndpointValidationsMissingVideo(t *testing.T) { } func TestVideoBuildVideoResponseMissedCacheForOneBid(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0) - seatBids := make([]openrtb.SeatBid, 0) - seatBid := openrtb.SeatBid{} + seatBids := make([]openrtb2.SeatBid, 0) + seatBid := openrtb2.SeatBid{} - bids := make([]openrtb.Bid, 0) - bid1 := openrtb.Bid{} - bid2 := openrtb.Bid{} - bid3 := openrtb.Bid{} + bids := make([]openrtb2.Bid, 0) + bid1 := openrtb2.Bid{} + bid2 := openrtb2.Bid{} + bid3 := openrtb2.Bid{} extBid1 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_123_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) extBid2 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_456_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) @@ -708,16 +708,16 @@ func TestVideoBuildVideoResponseMissedCacheForOneBid(t *testing.T) { } func TestVideoBuildVideoResponseMissedCacheForAllBids(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0) - seatBids := make([]openrtb.SeatBid, 0) - seatBid := openrtb.SeatBid{} + seatBids := make([]openrtb2.SeatBid, 0) + seatBid := openrtb2.SeatBid{} - bids := make([]openrtb.Bid, 0) - bid1 := openrtb.Bid{} - bid2 := openrtb.Bid{} - bid3 := openrtb.Bid{} + bids := make([]openrtb2.Bid, 0) + bid1 := openrtb2.Bid{} + bid2 := openrtb2.Bid{} + bid3 := openrtb2.Bid{} extBid1 := []byte(`{"prebid":{"targeting":{"hb_bidder":"appnexus","hb_pb":"17.00","hb_pb_cat_dur":"17.00_123_30s","hb_size":"1x1"}}}`) extBid2 := []byte(`{"prebid":{"targeting":{"hb_bidder":"appnexus","hb_pb":"17.00","hb_pb_cat_dur":"17.00_456_30s","hb_size":"1x1"}}}`) @@ -742,15 +742,15 @@ func TestVideoBuildVideoResponseMissedCacheForAllBids(t *testing.T) { } func TestVideoBuildVideoResponsePodErrors(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0, 2) - seatBids := make([]openrtb.SeatBid, 0) - seatBid := openrtb.SeatBid{} + seatBids := make([]openrtb2.SeatBid, 0) + seatBid := openrtb2.SeatBid{} - bids := make([]openrtb.Bid, 0) - bid1 := openrtb.Bid{} - bid2 := openrtb.Bid{} + bids := make([]openrtb2.Bid, 0) + bid1 := openrtb2.Bid{} + bid2 := openrtb2.Bid{} extBid1 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_123_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) extBid2 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_456_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) @@ -785,30 +785,30 @@ func TestVideoBuildVideoResponsePodErrors(t *testing.T) { } func TestVideoBuildVideoResponseNoBids(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0, 0) - openRtbBidResp.SeatBid = make([]openrtb.SeatBid, 0) + openRtbBidResp.SeatBid = make([]openrtb2.SeatBid, 0) bidRespVideo, err := buildVideoResponse(&openRtbBidResp, podErrors) assert.NoError(t, err, "Error should be nil") assert.Len(t, bidRespVideo.AdPods, 0, "AdPods length should be 0") } func TestMergeOpenRTBToVideoRequest(t *testing.T) { - var bidReq = &openrtb.BidRequest{} + var bidReq = &openrtb2.BidRequest{} var videoReq = &openrtb_ext.BidRequestVideo{} - videoReq.App = &openrtb.App{ + videoReq.App = &openrtb2.App{ Domain: "test.com", Bundle: "test.bundle", } - videoReq.Site = &openrtb.Site{ + videoReq.Site = &openrtb2.Site{ Page: "site.com/index", } var dnt int8 = 4 var lmt int8 = 5 - videoReq.Device = openrtb.Device{ + videoReq.Device = openrtb2.Device{ DNT: &dnt, Lmt: &lmt, } @@ -816,11 +816,11 @@ func TestMergeOpenRTBToVideoRequest(t *testing.T) { videoReq.BCat = []string{"test1", "test2"} videoReq.BAdv = []string{"test3", "test4"} - videoReq.Regs = &openrtb.Regs{ + videoReq.Regs = &openrtb2.Regs{ Ext: json.RawMessage(`{"gdpr":1,"us_privacy":"1NYY","existing":"any","consent":"anyConsent"}`), } - videoReq.User = &openrtb.User{ + videoReq.User = &openrtb2.User{ BuyerUID: "test UID", Yob: 1980, Keywords: "test keywords", @@ -1057,27 +1057,27 @@ func TestHandleErrorDebugLog(t *testing.T) { func TestCreateImpressionTemplate(t *testing.T) { - imp := openrtb.Imp{} - imp.Video = &openrtb.Video{} - imp.Video.Protocols = []openrtb.Protocol{1, 2} + imp := openrtb2.Imp{} + imp.Video = &openrtb2.Video{} + imp.Video.Protocols = []openrtb2.Protocol{1, 2} imp.Video.MIMEs = []string{"video/mp4"} imp.Video.H = 200 imp.Video.W = 400 - imp.Video.PlaybackMethod = []openrtb.PlaybackMethod{5, 6} + imp.Video.PlaybackMethod = []openrtb2.PlaybackMethod{5, 6} - video := openrtb.Video{} - video.Protocols = []openrtb.Protocol{3, 4} + video := openrtb2.Video{} + video.Protocols = []openrtb2.Protocol{3, 4} video.MIMEs = []string{"video/flv"} video.H = 300 video.W = 0 - video.PlaybackMethod = []openrtb.PlaybackMethod{7, 8} + video.PlaybackMethod = []openrtb2.PlaybackMethod{7, 8} res := createImpressionTemplate(imp, &video) - assert.Equal(t, res.Video.Protocols, []openrtb.Protocol{3, 4}, "Incorrect video protocols") + assert.Equal(t, res.Video.Protocols, []openrtb2.Protocol{3, 4}, "Incorrect video protocols") assert.Equal(t, res.Video.MIMEs, []string{"video/flv"}, "Incorrect video MIMEs") assert.Equal(t, int(res.Video.H), 300, "Incorrect video height") assert.Equal(t, int(res.Video.W), 0, "Incorrect video width") - assert.Equal(t, res.Video.PlaybackMethod, []openrtb.PlaybackMethod{7, 8}, "Incorrect video playback method") + assert.Equal(t, res.Video.PlaybackMethod, []openrtb2.PlaybackMethod{7, 8}, "Incorrect video playback method") } func TestCCPA(t *testing.T) { @@ -1331,20 +1331,20 @@ func (cf mockVideoStoredReqFetcher) FetchRequests(ctx context.Context, requestID } type mockExchangeVideo struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest cache *mockCacheClient } -func (m *mockExchangeVideo) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchangeVideo) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest if debugLog != nil && debugLog.Enabled { m.cache.called = true } ext := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"20.00","hb_pb_cat_dur_appnex":"20.00_395_30s","hb_size":"1x1", "hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"},"type":"video","dealpriority":0,"dealtiersatisfied":false},"bidder":{"appnexus":{"brand_id":1,"auction_id":7840037870526938650,"bidder_id":2,"bid_ad_type":1,"creative_info":{"video":{"duration":30,"mimes":["video\/mp4"]}}}}}`) - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ Seat: "appnexus", - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ {ID: "01", ImpID: "1_0", Ext: ext}, {ID: "02", ImpID: "1_1", Ext: ext}, {ID: "03", ImpID: "1_2", Ext: ext}, @@ -1367,20 +1367,20 @@ func (m *mockExchangeVideo) HoldAuction(ctx context.Context, r exchange.AuctionR } type mockExchangeAppendBidderNames struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest cache *mockCacheClient } -func (m *mockExchangeAppendBidderNames) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchangeAppendBidderNames) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest if debugLog != nil && debugLog.Enabled { m.cache.called = true } ext := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"20.00","hb_pb_cat_dur_appnex":"20.00_395_30s_appnexus","hb_size":"1x1", "hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"},"type":"video"},"bidder":{"appnexus":{"brand_id":1,"auction_id":7840037870526938650,"bidder_id":2,"bid_ad_type":1,"creative_info":{"video":{"duration":30,"mimes":["video\/mp4"]}}}}}`) - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ Seat: "appnexus", - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ {ID: "01", ImpID: "1_0", Ext: ext}, {ID: "02", ImpID: "1_1", Ext: ext}, {ID: "03", ImpID: "1_2", Ext: ext}, @@ -1403,14 +1403,14 @@ func (m *mockExchangeAppendBidderNames) HoldAuction(ctx context.Context, r excha } type mockExchangeVideoNoBids struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest cache *mockCacheClient } -func (m *mockExchangeVideoNoBids) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchangeVideoNoBids) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{}}, + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{}}, }, nil } diff --git a/exchange/adapter_util_test.go b/exchange/adapter_util_test.go index 7420779f787..73a456f54b1 100644 --- a/exchange/adapter_util_test.go +++ b/exchange/adapter_util_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/appnexus" "github.com/prebid/prebid-server/adapters/lifestreet" @@ -371,7 +371,7 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) { type fakeAdaptedBidder struct{} -func (fakeAdaptedBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (fakeAdaptedBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { return nil, nil } @@ -379,11 +379,11 @@ type fakeBidder struct { name string } -func (fakeBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (fakeBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return nil, nil } -func (fakeBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (fakeBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { return nil, nil } diff --git a/exchange/auction.go b/exchange/auction.go index 97f82d3c6eb..b3878709c29 100644 --- a/exchange/auction.go +++ b/exchange/auction.go @@ -11,7 +11,7 @@ import ( "time" uuid "github.com/gofrs/uuid" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/prebid_cache_client" @@ -125,7 +125,7 @@ func newAuction(seatBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, numImps int } // isNewWinningBid calculates if the new bid (nbid) will win against the current winning bid (wbid) given preferDeals. -func isNewWinningBid(bid, wbid *openrtb.Bid, preferDeals bool) bool { +func isNewWinningBid(bid, wbid *openrtb2.Bid, preferDeals bool) bool { if preferDeals { if len(wbid.DealID) > 0 && len(bid.DealID) == 0 { return false @@ -147,7 +147,7 @@ func (a *auction) setRoundedPrices(priceGranularity openrtb_ext.PriceGranularity a.roundedPrices = roundedPrices } -func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, evTracking *eventTracking, bidRequest *openrtb.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string, debugLog *DebugLog) []error { +func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, evTracking *eventTracking, bidRequest *openrtb2.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string, debugLog *DebugLog) []error { var bids, vast, includeBidderKeys, includeWinners bool = targData.includeCacheBids, targData.includeCacheVast, targData.includeBidderKeys, targData.includeWinners if !((bids || vast) && (includeBidderKeys || includeWinners)) { return nil @@ -155,8 +155,8 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, var errs []error expectNumBids := valOrZero(bids, len(a.roundedPrices)) expectNumVast := valOrZero(vast, len(a.roundedPrices)) - bidIndices := make(map[int]*openrtb.Bid, expectNumBids) - vastIndices := make(map[int]*openrtb.Bid, expectNumVast) + bidIndices := make(map[int]*openrtb2.Bid, expectNumBids) + vastIndices := make(map[int]*openrtb2.Bid, expectNumVast) toCache := make([]prebid_cache_client.Cacheable, 0, expectNumBids+expectNumVast) expByImp := make(map[string]int64) competitiveExclusion := false @@ -257,7 +257,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, } if bids { - a.cacheIds = make(map[*openrtb.Bid]string, len(bidIndices)) + a.cacheIds = make(map[*openrtb2.Bid]string, len(bidIndices)) for index, bid := range bidIndices { if ids[index] != "" { a.cacheIds[bid] = ids[index] @@ -265,7 +265,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, } } if vast { - a.vastCacheIds = make(map[*openrtb.Bid]string, len(vastIndices)) + a.vastCacheIds = make(map[*openrtb2.Bid]string, len(vastIndices)) for index, bid := range vastIndices { if ids[index] != "" { if competitiveExclusion && strings.HasSuffix(ids[index], hbCacheID) { @@ -282,7 +282,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, // makeVAST returns some VAST XML for the given bid. If AdM is defined, // it takes precedence. Otherwise the Nurl will be wrapped in a redirect tag. -func makeVAST(bid *openrtb.Bid) string { +func makeVAST(bid *openrtb2.Bid) string { if bid.AdM == "" { return `` + `prebid.org wrapper` + @@ -355,7 +355,7 @@ type auction struct { // roundedPrices stores the price strings rounded for each bid according to the price granularity. roundedPrices map[*pbsOrtbBid]string // cacheIds stores the UUIDs from Prebid Cache for fetching the full bid JSON. - cacheIds map[*openrtb.Bid]string + cacheIds map[*openrtb2.Bid]string // vastCacheIds stores UUIDS from Prebid cache for fetching the VAST markup to video bids. - vastCacheIds map[*openrtb.Bid]string + vastCacheIds map[*openrtb2.Bid]string } diff --git a/exchange/auction_test.go b/exchange/auction_test.go index 7e8a8a8cec9..bd32607bdf3 100644 --- a/exchange/auction_test.go +++ b/exchange/auction_test.go @@ -11,17 +11,17 @@ import ( "strconv" "testing" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/prebid_cache_client" - "github.com/mxmCherry/openrtb" "github.com/stretchr/testify/assert" ) func TestMakeVASTGiven(t *testing.T) { const expect = `` - bid := &openrtb.Bid{ + bid := &openrtb2.Bid{ AdM: expect, } vast := makeVAST(bid) @@ -35,7 +35,7 @@ func TestMakeVASTNurl(t *testing.T) { `` + `` + `` - bid := &openrtb.Bid{ + bid := &openrtb2.Bid{ NURL: url, } vast := makeVAST(bid) @@ -268,45 +268,45 @@ func runCacheSpec(t *testing.T, fileDisplayName string, specData *cacheSpec) { func TestNewAuction(t *testing.T) { bid1p077 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 0.77, }, } bid1p123 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 1.23, }, } bid1p230 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 2.30, }, } bid1p088d := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 0.88, DealID: "SpecialDeal", }, } bid1p166d := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 1.66, DealID: "BigDeal", }, } bid2p123 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp2", Price: 1.23, }, } bid2p144 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp2", Price: 1.44, }, @@ -486,7 +486,7 @@ func TestNewAuction(t *testing.T) { } type cacheSpec struct { - BidRequest openrtb.BidRequest `json:"bidRequest"` + BidRequest openrtb2.BidRequest `json:"bidRequest"` PbsBids []pbsBid `json:"pbsBids"` ExpectedCacheables []prebid_cache_client.Cacheable `json:"expectedCacheables"` DefaultTTLs config.DefaultTTLs `json:"defaultTTLs"` @@ -500,7 +500,7 @@ type cacheSpec struct { } type pbsBid struct { - Bid *openrtb.Bid `json:"bid"` + Bid *openrtb2.Bid `json:"bid"` BidType openrtb_ext.BidType `json:"bidType"` Bidder openrtb_ext.BidderName `json:"bidder"` } diff --git a/exchange/bidder.go b/exchange/bidder.go index b0818dfdbe3..d6b8028c2e9 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -16,9 +16,9 @@ import ( "github.com/prebid/prebid-server/config/util" "github.com/prebid/prebid-server/currency" - "github.com/mxmCherry/openrtb" - nativeRequests "github.com/mxmCherry/openrtb/native/request" - nativeResponse "github.com/mxmCherry/openrtb/native/response" + nativeRequests "github.com/mxmCherry/openrtb/v14/native1/request" + nativeResponse "github.com/mxmCherry/openrtb/v14/native1/response" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -49,7 +49,7 @@ type adaptedBidder interface { // // Any errors will be user-facing in the API. // Error messages should help publishers understand what might account for "bad" bids. - requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) + requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) } // pbsOrtbBid is a Bid returned by an adaptedBidder. @@ -62,7 +62,7 @@ type adaptedBidder interface { // pbsOrtbBid.dealPriority is optionally provided by adapters and used internally by the exchange to support deal targeted campaigns. // pbsOrtbBid.dealTierSatisfied is set to true by exchange.updateHbPbCatDur if deal tier satisfied otherwise it will be set to false type pbsOrtbBid struct { - bid *openrtb.Bid + bid *openrtb2.Bid bidType openrtb_ext.BidType bidTargets map[string]string bidVideo *openrtb_ext.ExtBidPrebidVideo @@ -73,7 +73,7 @@ type pbsOrtbBid struct { // pbsOrtbSeatBid is a SeatBid returned by an adaptedBidder. // -// This is distinct from the openrtb.SeatBid so that the prebid-server ext can be passed back with typesafety. +// This is distinct from the openrtb2.SeatBid so that the prebid-server ext can be passed back with typesafety. type pbsOrtbSeatBid struct { // bids is the list of bids which this adaptedBidder wishes to make. bids []*pbsOrtbBid @@ -124,7 +124,7 @@ type bidderAdapterConfig struct { DebugInfo config.DebugInfo } -func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { reqData, errs := bidder.Bidder.MakeRequests(request, reqInfo) if len(reqData) == 0 { @@ -248,7 +248,7 @@ func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb.Bi return seatBid, errs } -func addNativeTypes(bid *openrtb.Bid, request *openrtb.BidRequest) (*nativeResponse.Response, []error) { +func addNativeTypes(bid *openrtb2.Bid, request *openrtb2.BidRequest) (*nativeResponse.Response, []error) { var errs []error var nativeMarkup *nativeResponse.Response if err := json.Unmarshal(json.RawMessage(bid.AdM), &nativeMarkup); err != nil || len(nativeMarkup.Assets) == 0 { @@ -307,7 +307,7 @@ func setAssetTypes(asset nativeResponse.Asset, nativePayload nativeRequests.Requ return nil } -func getNativeImpByImpID(impID string, request *openrtb.BidRequest) (*openrtb.Native, error) { +func getNativeImpByImpID(impID string, request *openrtb2.BidRequest) (*openrtb2.Native, error) { for _, impInRequest := range request.Imp { if impInRequest.ID == impID && impInRequest.Native != nil { return impInRequest.Native, nil diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index e4eb7b9574e..8cc5b5e9383 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -16,7 +16,9 @@ import ( "time" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" + nativeRequests "github.com/mxmCherry/openrtb/v14/native1/request" + nativeResponse "github.com/mxmCherry/openrtb/v14/native1/response" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" @@ -26,9 +28,6 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - - nativeRequests "github.com/mxmCherry/openrtb/native/request" - nativeResponse "github.com/mxmCherry/openrtb/native/response" ) // TestSingleBidder makes sure that the following things work if the Bidder needs only one request. @@ -76,14 +75,14 @@ func TestSingleBidder(t *testing.T) { mockBidderResponse := &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ Price: firstInitialPrice, }, BidType: openrtb_ext.BidTypeBanner, DealPriority: 4, }, { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ Price: secondInitialPrice, }, BidType: openrtb_ext.BidTypeVideo, @@ -96,7 +95,7 @@ func TestSingleBidder(t *testing.T) { bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, test.debugInfo) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - seatBid, errs := bidder.requestBid(ctx, &openrtb.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(ctx, &openrtb2.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) // Make sure the goodSingleBidder was called with the expected arguments. if bidderImpl.httpResponse == nil { @@ -158,11 +157,11 @@ func TestMultiBidder(t *testing.T) { mockBidderResponse := &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeBanner, }, { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeVideo, }, }, @@ -185,7 +184,7 @@ func TestMultiBidder(t *testing.T) { } bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, nil) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) if seatBid == nil { t.Fatalf("SeatBid should exist, because bids exist.") @@ -515,7 +514,7 @@ func TestMultiCurrencies(t *testing.T) { mockBidderResponses[i] = &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ Price: bid.price, }, BidType: openrtb_ext.BidTypeBanner, @@ -556,7 +555,7 @@ func TestMultiCurrencies(t *testing.T) { seatBid, errs := bidder.requestBid( context.Background(), - &openrtb.BidRequest{}, + &openrtb2.BidRequest{}, "test", 1, currencyConverter.Rates(), @@ -681,7 +680,7 @@ func TestMultiCurrencies_RateConverterNotSet(t *testing.T) { mockBidderResponses[i] = &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeBanner, }, }, @@ -701,7 +700,7 @@ func TestMultiCurrencies_RateConverterNotSet(t *testing.T) { currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) seatBid, errs := bidder.requestBid( context.Background(), - &openrtb.BidRequest{}, + &openrtb2.BidRequest{}, "test", 1, currencyConverter.Rates(), @@ -844,7 +843,7 @@ func TestMultiCurrencies_RequestCurrencyPick(t *testing.T) { { Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeBanner, }, }, @@ -872,7 +871,7 @@ func TestMultiCurrencies_RequestCurrencyPick(t *testing.T) { ) seatBid, errs := bidder.requestBid( context.Background(), - &openrtb.BidRequest{ + &openrtb2.BidRequest{ Cur: tc.bidRequestCurrencies, }, "test", @@ -984,27 +983,27 @@ func TestMobileNativeTypes(t *testing.T) { reqURL := server.URL testCases := []struct { - mockBidderRequest *openrtb.BidRequest + mockBidderRequest *openrtb2.BidRequest mockBidderResponse *adapters.BidderResponse expectedValue string description string }{ { - mockBidderRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ + mockBidderRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ { ID: "some-imp-id", - Native: &openrtb.Native{ + Native: &openrtb2.Native{ Request: "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}}]}", }, }, }, - App: &openrtb.App{}, + App: &openrtb2.App{}, }, mockBidderResponse: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ImpID: "some-imp-id", AdM: "{\"assets\":[{\"id\":2,\"img\":{\"url\":\"http://vcdn.adnxs.com/p/creative-image/f8/7f/0f/13/f87f0f13-230c-4f05-8087-db9216e393de.jpg\",\"w\":989,\"h\":742,\"ext\":{\"appnexus\":{\"prevent_crop\":0}}}},{\"id\":1,\"title\":{\"text\":\"This is a Prebid Native Creative\"}},{\"id\":3,\"data\":{\"value\":\"Prebid.org\"}},{\"id\":4,\"data\":{\"value\":\"This is a Prebid Native Creative. There are many like it, but this one is mine.\"}}],\"link\":{\"url\":\"http://some-url.com\"},\"imptrackers\":[\"http://someimptracker.com\"],\"jstracker\":\"some-js-tracker\"}", Price: 10, @@ -1017,21 +1016,21 @@ func TestMobileNativeTypes(t *testing.T) { description: "Checks types in response", }, { - mockBidderRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ + mockBidderRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ { ID: "some-imp-id", - Native: &openrtb.Native{ + Native: &openrtb2.Native{ Request: "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}}]}", }, }, }, - App: &openrtb.App{}, + App: &openrtb2.App{}, }, mockBidderResponse: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ImpID: "some-imp-id", AdM: "{\"some-diff-markup\":\"creative\"}", Price: 10, @@ -1079,7 +1078,7 @@ func TestMobileNativeTypes(t *testing.T) { func TestErrorReporting(t *testing.T) { bidder := adaptBidder(&bidRejector{}, nil, &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, nil) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - bids, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + bids, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) if bids != nil { t.Errorf("There should be no seatbid if no http requests are returned.") } @@ -1262,7 +1261,7 @@ func TestCallRecordAdapterConnections(t *testing.T) { // Run requestBid using an http.Client with a mock handler bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, metrics, openrtb_ext.BidderAppnexus, nil) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - _, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + _, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) // Assert no errors assert.Equal(t, 0, len(errs), "bidder.requestBid returned errors %v \n", errs) @@ -1467,31 +1466,31 @@ func wrapWithBidderInfo(bidder adapters.Bidder) adapters.Bidder { } type goodSingleBidder struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest httpRequest *adapters.RequestData httpResponse *adapters.ResponseData bidResponse *adapters.BidderResponse } -func (bidder *goodSingleBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *goodSingleBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { bidder.bidRequest = request return []*adapters.RequestData{bidder.httpRequest}, nil } -func (bidder *goodSingleBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *goodSingleBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidder.httpResponse = response return bidder.bidResponse, nil } type goodMultiHTTPCallsBidder struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest httpRequest []*adapters.RequestData httpResponses []*adapters.ResponseData bidResponses []*adapters.BidderResponse bidResponseNumber int } -func (bidder *goodMultiHTTPCallsBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *goodMultiHTTPCallsBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { bidder.bidRequest = request response := make([]*adapters.RequestData, len(bidder.httpRequest)) @@ -1501,7 +1500,7 @@ func (bidder *goodMultiHTTPCallsBidder) MakeRequests(request *openrtb.BidRequest return response, nil } -func (bidder *goodMultiHTTPCallsBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *goodMultiHTTPCallsBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { br := bidder.bidResponses[bidder.bidResponseNumber] bidder.bidResponseNumber++ bidder.httpResponses = append(bidder.httpResponses, response) @@ -1510,18 +1509,18 @@ func (bidder *goodMultiHTTPCallsBidder) MakeBids(internalRequest *openrtb.BidReq } type mixedMultiBidder struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest httpRequests []*adapters.RequestData httpResponses []*adapters.ResponseData bidResponse *adapters.BidderResponse } -func (bidder *mixedMultiBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *mixedMultiBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { bidder.bidRequest = request return bidder.httpRequests, []error{errors.New("The requests weren't ideal.")} } -func (bidder *mixedMultiBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *mixedMultiBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidder.httpResponses = append(bidder.httpResponses, response) return bidder.bidResponse, []error{errors.New("The bidResponse weren't ideal.")} } @@ -1531,11 +1530,11 @@ type bidRejector struct { httpResponse *adapters.ResponseData } -func (bidder *bidRejector) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *bidRejector) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return nil, []error{errors.New("Invalid params on BidRequest.")} } -func (bidder *bidRejector) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *bidRejector) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidder.httpResponse = response return nil, []error{errors.New("Can't make a response.")} } @@ -1545,11 +1544,11 @@ type notifyingBidder struct { notifyRequest adapters.RequestData } -func (bidder *notifyingBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *notifyingBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return bidder.requests, nil } -func (bidder *notifyingBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *notifyingBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { return nil, nil } diff --git a/exchange/bidder_validate_bids.go b/exchange/bidder_validate_bids.go index cf74dfb1dd5..ad387cf4fcc 100644 --- a/exchange/bidder_validate_bids.go +++ b/exchange/bidder_validate_bids.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" @@ -28,7 +28,7 @@ type validatedBidder struct { bidder adaptedBidder } -func (v *validatedBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (v *validatedBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { seatBid, errs := v.bidder.requestBid(ctx, request, name, bidAdjustment, conversions, reqInfo, accountDebugAllowed) if validationErrors := removeInvalidBids(request, seatBid); len(validationErrors) > 0 { errs = append(errs, validationErrors...) @@ -37,7 +37,7 @@ func (v *validatedBidder) requestBid(ctx context.Context, request *openrtb.BidRe } // validateBids will run some validation checks on the returned bids and excise any invalid bids -func removeInvalidBids(request *openrtb.BidRequest, seatBid *pbsOrtbSeatBid) []error { +func removeInvalidBids(request *openrtb2.BidRequest, seatBid *pbsOrtbSeatBid) []error { // Exit early if there is nothing to do. if seatBid == nil || len(seatBid.bids) == 0 { return nil diff --git a/exchange/bidder_validate_bids_test.go b/exchange/bidder_validate_bids_test.go index e7fc0b046dd..97a11a6b743 100644 --- a/exchange/bidder_validate_bids_test.go +++ b/exchange/bidder_validate_bids_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" @@ -16,7 +16,7 @@ func TestAllValidBids(t *testing.T) { bidResponse: &pbsOrtbSeatBid{ bids: []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", ImpID: "thisImp", Price: 0.45, @@ -24,7 +24,7 @@ func TestAllValidBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", Price: 0.40, @@ -32,7 +32,7 @@ func TestAllValidBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "123", ImpID: "456", Price: 0.44, @@ -42,7 +42,7 @@ func TestAllValidBids(t *testing.T) { }, }, }) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) assert.Len(t, seatBid.bids, 3) assert.Len(t, errs, 0) } @@ -52,28 +52,28 @@ func TestAllBadBids(t *testing.T) { bidResponse: &pbsOrtbSeatBid{ bids: []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", Price: 0.45, CrID: "thisCreative", }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", CrID: "thatCreative", }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "123", ImpID: "456", Price: 0.44, }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "456", Price: 0.44, CrID: "blah", @@ -83,7 +83,7 @@ func TestAllBadBids(t *testing.T) { }, }, }) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) assert.Len(t, seatBid.bids, 0) assert.Len(t, errs, 5) } @@ -93,7 +93,7 @@ func TestMixedBids(t *testing.T) { bidResponse: &pbsOrtbSeatBid{ bids: []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", ImpID: "thisImp", Price: 0.45, @@ -101,14 +101,14 @@ func TestMixedBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", CrID: "thatCreative", }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "123", ImpID: "456", Price: 0.44, @@ -116,7 +116,7 @@ func TestMixedBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "456", Price: 0.44, CrID: "blah", @@ -126,7 +126,7 @@ func TestMixedBids(t *testing.T) { }, }, }) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) assert.Len(t, seatBid.bids, 2) assert.Len(t, errs, 3) } @@ -210,7 +210,7 @@ func TestCurrencyBids(t *testing.T) { for _, tc := range currencyTestCases { bids := []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", ImpID: "thisImp", Price: 0.45, @@ -218,7 +218,7 @@ func TestCurrencyBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", Price: 0.44, @@ -242,7 +242,7 @@ func TestCurrencyBids(t *testing.T) { expectedValidBids = 0 } - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ Cur: tc.brqCur, } @@ -257,6 +257,6 @@ type mockAdaptedBidder struct { errorResponse []error } -func (b *mockAdaptedBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (b *mockAdaptedBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { return b.bidResponse, b.errorResponse } diff --git a/exchange/events_test.go b/exchange/events_test.go index 1d72739d873..6685918ee6e 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -3,7 +3,7 @@ package exchange import ( "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) @@ -60,7 +60,7 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { auctionTimestampMs: 1234567890, externalURL: "http://localhost", } - bid := &pbsOrtbBid{bid: &openrtb.Bid{ID: "BID-1"}, bidType: tt.args.bidType} + bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType} assert.Equal(t, tt.want, evData.makeBidExtEvents(bid, openrtb_ext.BidderOpenx)) }) } @@ -124,7 +124,7 @@ func Test_eventsData_modifyBidJSON(t *testing.T) { auctionTimestampMs: 1234567890, externalURL: "http://localhost", } - bid := &pbsOrtbBid{bid: &openrtb.Bid{ID: "BID-1"}, bidType: tt.args.bidType} + bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType} modifiedJSON, err := evData.modifyBidJSON(bid, openrtb_ext.BidderOpenx, tt.jsonBytes) if tt.want != nil { assert.NoError(t, err, "Unexpected error") diff --git a/exchange/exchange.go b/exchange/exchange.go index d8ac60ba46a..e06f87bf677 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -14,10 +14,10 @@ import ( "strings" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/stored_requests" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" @@ -39,7 +39,7 @@ type extCacheInstructions struct { // Exchange runs Auctions. Implementations must be threadsafe, and will be shared across many goroutines. type Exchange interface { // HoldAuction executes an OpenRTB v2.5 Auction. - HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb.BidResponse, error) + HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb2.BidResponse, error) } // IdFetcher can find the user's ID for a specific Bidder. @@ -102,7 +102,7 @@ func NewExchange(adapters map[openrtb_ext.BidderName]adaptedBidder, cache prebid // AuctionRequest holds the bid request for the auction // and all other information needed to process that request type AuctionRequest struct { - BidRequest *openrtb.BidRequest + BidRequest *openrtb2.BidRequest Account config.Account UserSyncs IdFetcher RequestType metrics.RequestType @@ -117,13 +117,13 @@ type AuctionRequest struct { // BidderRequest holds the bidder specific request and all other // information needed to process that bidder request. type BidderRequest struct { - BidRequest *openrtb.BidRequest + BidRequest *openrtb2.BidRequest BidderName openrtb_ext.BidderName BidderCoreName openrtb_ext.BidderName BidderLabels metrics.AdapterLabels } -func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb.BidResponse, error) { +func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb2.BidResponse, error) { var err error requestExt, err := extractBidRequestExt(r.BidRequest) if err != nil { @@ -258,9 +258,9 @@ func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog * return e.buildBidResponse(ctx, liveAdapters, adapterBids, r.BidRequest, adapterExtra, auc, bidResponseExt, cacheInstructions.returnCreative, errs) } -func (e *exchange) parseUsersyncIfAmbiguous(bidRequest *openrtb.BidRequest) bool { +func (e *exchange) parseUsersyncIfAmbiguous(bidRequest *openrtb2.BidRequest) bool { usersyncIfAmbiguous := e.UsersyncIfAmbiguous - var geo *openrtb.Geo = nil + var geo *openrtb2.Geo = nil if bidRequest.User != nil && bidRequest.User.Geo != nil { geo = bidRequest.User.Geo @@ -281,7 +281,7 @@ func (e *exchange) parseUsersyncIfAmbiguous(bidRequest *openrtb.BidRequest) bool return usersyncIfAmbiguous } -func recordImpMetrics(bidRequest *openrtb.BidRequest, metricsEngine metrics.MetricsEngine) { +func recordImpMetrics(bidRequest *openrtb2.BidRequest, metricsEngine metrics.MetricsEngine) { for _, impInRequest := range bidRequest.Imp { var impLabels metrics.ImpLabels = metrics.ImpLabels{ BannerImps: impInRequest.Banner != nil, @@ -294,7 +294,7 @@ func recordImpMetrics(bidRequest *openrtb.BidRequest, metricsEngine metrics.Metr } // applyDealSupport updates targeting keys with deal prefixes if minimum deal tier exceeded -func applyDealSupport(bidRequest *openrtb.BidRequest, auc *auction, bidCategory map[string]string) []error { +func applyDealSupport(bidRequest *openrtb2.BidRequest, auc *auction, bidCategory map[string]string) []error { errs := []error{} impDealMap := getDealTiers(bidRequest) @@ -315,7 +315,7 @@ func applyDealSupport(bidRequest *openrtb.BidRequest, auc *auction, bidCategory } // getDealTiers creates map of impression to bidder deal tier configuration -func getDealTiers(bidRequest *openrtb.BidRequest) map[string]openrtb_ext.DealTierBidderMap { +func getDealTiers(bidRequest *openrtb2.BidRequest) map[string]openrtb_ext.DealTierBidderMap { impDealMap := make(map[string]openrtb_ext.DealTierBidderMap) for _, imp := range bidRequest.Imp { @@ -538,19 +538,19 @@ func errsToBidderWarnings(errs []error) []openrtb_ext.ExtBidderMessage { } // This piece takes all the bids supplied by the adapters and crafts an openRTB response to send back to the requester -func (e *exchange) buildBidResponse(ctx context.Context, liveAdapters []openrtb_ext.BidderName, adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, bidRequest *openrtb.BidRequest, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, bidResponseExt *openrtb_ext.ExtBidResponse, returnCreative bool, errList []error) (*openrtb.BidResponse, error) { - bidResponse := new(openrtb.BidResponse) +func (e *exchange) buildBidResponse(ctx context.Context, liveAdapters []openrtb_ext.BidderName, adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, bidRequest *openrtb2.BidRequest, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, bidResponseExt *openrtb_ext.ExtBidResponse, returnCreative bool, errList []error) (*openrtb2.BidResponse, error) { + bidResponse := new(openrtb2.BidResponse) var err error bidResponse.ID = bidRequest.ID if len(liveAdapters) == 0 { // signal "Invalid Request" if no valid bidders. - bidResponse.NBR = openrtb.NoBidReasonCode.Ptr(openrtb.NoBidReasonCodeInvalidRequest) + bidResponse.NBR = openrtb2.NoBidReasonCode.Ptr(openrtb2.NoBidReasonCodeInvalidRequest) } // Create the SeatBids. We use a zero sized slice so that we can append non-zero seat bids, and not include seatBid // objects for seatBids without any bids. Preallocate the max possible size to avoid reallocating the array as we go. - seatBids := make([]openrtb.SeatBid, 0, len(liveAdapters)) + seatBids := make([]openrtb2.SeatBid, 0, len(liveAdapters)) for _, a := range liveAdapters { //while processing every single bib, do we need to handle categories here? if adapterBids[a] != nil && len(adapterBids[a].bids) > 0 { @@ -825,8 +825,8 @@ func (e *exchange) makeExtBidResponse(adapterBids map[openrtb_ext.BidderName]*pb // Return an openrtb seatBid for a bidder // BuildBidResponse is responsible for ensuring nil bid seatbids are not included -func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.BidderName, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, returnCreative bool) *openrtb.SeatBid { - seatBid := &openrtb.SeatBid{ +func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.BidderName, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, returnCreative bool) *openrtb2.SeatBid { + seatBid := &openrtb2.SeatBid{ Seat: adapter.String(), Group: 0, // Prebid cannot support roadblocking } @@ -840,8 +840,8 @@ func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.B return seatBid } -func (e *exchange) makeBid(bids []*pbsOrtbBid, auc *auction, returnCreative bool) ([]openrtb.Bid, []error) { - result := make([]openrtb.Bid, 0, len(bids)) +func (e *exchange) makeBid(bids []*pbsOrtbBid, auc *auction, returnCreative bool) ([]openrtb2.Bid, []error) { + result := make([]openrtb2.Bid, 0, len(bids)) errs := make([]error, 0, 1) for _, bid := range bids { @@ -890,7 +890,7 @@ func makeBidExtJSON(ext json.RawMessage, prebid *openrtb_ext.ExtBidPrebid) (json return json.Marshal(extMap) } -// If bid got cached inside `(a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, bidRequest *openrtb.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string)`, +// If bid got cached inside `(a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, bidRequest *openrtb2.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string)`, // a UUID should be found inside `a.cacheIds` or `a.vastCacheIds`. This function returns the UUID along with the internal cache URL func (e *exchange) getBidCacheInfo(bid *pbsOrtbBid, auction *auction) (cacheInfo openrtb_ext.ExtBidPrebidCacheBids, found bool) { uuid, found := findCacheID(bid, auction) diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 3eaa625f74f..1cffa79b127 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -16,6 +16,7 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" @@ -29,7 +30,6 @@ import ( "github.com/prebid/prebid-server/stored_requests/backends/file_fetcher" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" "github.com/stretchr/testify/assert" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" @@ -75,7 +75,7 @@ func TestNewExchange(t *testing.T) { } } -// The objective is to get to execute e.buildBidResponse(ctx.Background(), liveA... ) (*openrtb.BidResponse, error) +// The objective is to get to execute e.buildBidResponse(ctx.Background(), liveA... ) (*openrtb2.BidResponse, error) // and check whether the returned request successfully prints any '&' characters as it should // To do so, we: // 1) Write the endpoint adapter URL with an '&' character into a new config,Configuration struct @@ -123,16 +123,16 @@ func TestCharacterEscape(t *testing.T) { adapterBids := make(map[openrtb_ext.BidderName]*pbsOrtbSeatBid, 1) adapterBids["appnexus"] = &pbsOrtbSeatBid{currency: "USD"} - //An openrtb.BidRequest struct as specified in https://github.com/prebid/prebid-server/issues/465 - bidRequest := &openrtb.BidRequest{ + //An openrtb2.BidRequest struct as specified in https://github.com/prebid/prebid-server/issues/465 + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 1}}}],"tmax": 500}`), @@ -163,7 +163,7 @@ func TestCharacterEscape(t *testing.T) { } // TestDebugBehaviour asserts the HttpCalls object is included inside the json "debug" field of the bidResponse extension when the -// openrtb.BidRequest "Test" value is set to 1 or the openrtb.BidRequest.Ext.Debug boolean field is set to true +// openrtb2.BidRequest "Test" value is set to 1 or the openrtb2.BidRequest.Ext.Debug boolean field is set to true func TestDebugBehaviour(t *testing.T) { // Define test cases @@ -258,15 +258,15 @@ func TestDebugBehaviour(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", err) } - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, } @@ -442,15 +442,15 @@ func TestTwoBiddersDebugDisabledAndEnabled(t *testing.T) { debugLog := DebugLog{Enabled: true} for _, testCase := range testCases { - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"telaria": {"placementId": 1}, "appnexus": {"placementid": 2}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, } @@ -637,7 +637,7 @@ func TestReturnCreativeEndToEnd(t *testing.T) { bidResponse: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{AdM: sampleAd}, + Bid: &openrtb2.Bid{AdM: sampleAd}, }, }, }, @@ -654,14 +654,14 @@ func TestReturnCreativeEndToEnd(t *testing.T) { e.categoriesFetcher = categoriesFetcher // Define mock incoming bid requeset - mockBidRequest := &openrtb.BidRequest{ + mockBidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, } // Run tests @@ -750,7 +750,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { liveAdapters := []openrtb_ext.BidderName{bidderName} //adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, - bids := []*openrtb.Bid{ + bids := []*openrtb2.Bid{ { ID: "some-imp-id", ImpID: "", @@ -782,7 +782,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { }, } auc := &auction{ - cacheIds: map[*openrtb.Bid]string{ + cacheIds: map[*openrtb2.Bid]string{ bids[0]: testUUID, }, } @@ -816,14 +816,14 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { }, }, } - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", TMax: 1000, - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "test-div", - Secure: openrtb.Int8Ptr(0), - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, + Secure: openrtb2.Int8Ptr(0), + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(` { "rubicon": { "accountId": 1001, @@ -838,9 +838,9 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { }`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Page: "http://rubitest.com/index.html", - Publisher: &openrtb.Publisher{ID: "1001"}, + Publisher: &openrtb2.Publisher{ID: "1001"}, }, Test: 1, Ext: json.RawMessage(`{"prebid": { "cache": { "bids": {}, "vastxml": {} }, "targeting": { "pricegranularity": "med", "includewinners": true, "includebidderkeys": false } }}`), @@ -854,11 +854,11 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { /* 5) Assert we have no errors and the bid response we expected*/ assert.NoError(t, err, "[TestGetBidCacheInfo] buildBidResponse() threw an error") - expectedBidResponse := &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + expectedBidResponse := &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { Seat: string(bidderName), - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ { Ext: json.RawMessage(`{ "prebid": { "cache": { "bids": { "cacheId": "` + testUUID + `", "url": "` + testExternalCacheScheme + `://` + testExternalCacheHost + `/` + testExternalCachePath + `?uuid=` + testUUID + `" }, "key": "", "url": "" }`), }, @@ -887,7 +887,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { func TestBidReturnsCreative(t *testing.T) { sampleAd := "" - sampleOpenrtbBid := &openrtb.Bid{ID: "some-bid-id", AdM: sampleAd} + sampleOpenrtbBid := &openrtb2.Bid{ID: "some-bid-id", AdM: sampleAd} // Define test cases testCases := []struct { @@ -915,7 +915,7 @@ func TestBidReturnsCreative(t *testing.T) { bidTargets: map[string]string{}, }, } - sampleAuction := &auction{cacheIds: map[*openrtb.Bid]string{sampleOpenrtbBid: "CACHE_UUID_1234"}} + sampleAuction := &auction{cacheIds: map[*openrtb2.Bid]string{sampleOpenrtbBid: "CACHE_UUID_1234"}} noBidHandler := func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(204) } server := httptest.NewServer(http.HandlerFunc(noBidHandler)) @@ -954,7 +954,7 @@ func TestBidReturnsCreative(t *testing.T) { } func TestGetBidCacheInfo(t *testing.T) { - bid := &openrtb.Bid{ID: "42"} + bid := &openrtb2.Bid{ID: "42"} testCases := []struct { description string scheme string @@ -972,7 +972,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "https://prebid.org/cache?uuid=anyID", @@ -983,7 +983,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{vastCacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{vastCacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "https://prebid.org/cache?uuid=anyID", @@ -1004,7 +1004,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "prebid.org/cache?uuid=anyID", @@ -1012,7 +1012,7 @@ func TestGetBidCacheInfo(t *testing.T) { { description: "Host And Path Not Provided - Without Scheme", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "", @@ -1021,7 +1021,7 @@ func TestGetBidCacheInfo(t *testing.T) { description: "Host And Path Not Provided - With Scheme", scheme: "https", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "", @@ -1032,7 +1032,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: nil, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: false, expectedCacheID: "", expectedCacheURL: "", @@ -1043,7 +1043,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: nil}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: false, expectedCacheID: "", expectedCacheURL: "", @@ -1103,15 +1103,15 @@ func TestBidResponseCurrency(t *testing.T) { liveAdapters := make([]openrtb_ext.BidderName, 1) liveAdapters[0] = "appnexus" - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`), @@ -1123,7 +1123,7 @@ func TestBidResponseCurrency(t *testing.T) { var errList []error - sampleBid := &openrtb.Bid{ + sampleBid := &openrtb2.Bid{ ID: "some-imp-id", Price: 9.517803, W: 300, @@ -1131,10 +1131,10 @@ func TestBidResponseCurrency(t *testing.T) { Ext: nil, } aPbsOrtbBidArr := []*pbsOrtbBid{{bid: sampleBid, bidType: openrtb_ext.BidTypeBanner}} - sampleSeatBid := []openrtb.SeatBid{ + sampleSeatBid := []openrtb2.SeatBid{ { Seat: "appnexus", - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ { ID: "some-imp-id", Price: 9.517803, @@ -1145,13 +1145,13 @@ func TestBidResponseCurrency(t *testing.T) { }, }, } - emptySeatBid := []openrtb.SeatBid{} + emptySeatBid := []openrtb2.SeatBid{} // Test cases type aTest struct { description string adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid - expectedBidResponse *openrtb.BidResponse + expectedBidResponse *openrtb2.BidResponse } testCases := []aTest{ { @@ -1162,7 +1162,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "USD", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: sampleSeatBid, Cur: "USD", @@ -1178,7 +1178,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "USD", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: emptySeatBid, Cur: "", @@ -1194,7 +1194,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: sampleSeatBid, Cur: "", @@ -1210,7 +1210,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: emptySeatBid, Cur: "", @@ -1305,39 +1305,39 @@ func newCategoryFetcher(directory string) (stored_requests.CategoryFetcher, erro // newRaceCheckingRequest builds a BidRequest from all the params in the // adapters/{bidder}/{bidder}test/params/race/*.json files -func newRaceCheckingRequest(t *testing.T) *openrtb.BidRequest { +func newRaceCheckingRequest(t *testing.T) *openrtb2.BidRequest { dnt := int8(1) - return &openrtb.BidRequest{ - Site: &openrtb.Site{ + return &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", IFA: "ifa", IP: "132.173.230.74", DNT: &dnt, Language: "EN", }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ COPPA: 1, Ext: json.RawMessage(`{"gdpr":1}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1347,7 +1347,7 @@ func newRaceCheckingRequest(t *testing.T) *openrtb.BidRequest { }, Ext: buildImpExt(t, "banner"), }, { - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: []string{"video/mp4"}, MinDuration: 1, MaxDuration: 300, @@ -1399,14 +1399,14 @@ func TestPanicRecovery(t *testing.T) { BidderName: "bidder1", BidderCoreName: "appnexus", BidderLabels: apnLabels, - BidRequest: &openrtb.BidRequest{ + BidRequest: &openrtb2.BidRequest{ ID: "b-1", }, }, { BidderName: "bidder2", BidderCoreName: "bidder2", - BidRequest: &openrtb.BidRequest{ + BidRequest: &openrtb2.BidRequest{ ID: "b-2", }, }, @@ -1479,23 +1479,23 @@ func TestPanicRecoveryHighLevel(t *testing.T) { e.adapterMap[openrtb_ext.BidderBeachfront] = panicingAdapter{} e.adapterMap[openrtb_ext.BidderAppnexus] = panicingAdapter{} - request := &openrtb.BidRequest{ - Site: &openrtb.Site{ + request := &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1685,7 +1685,7 @@ func runSpec(t *testing.T, filename string, spec *exchangeSpec) { } } -func findBiddersInAuction(t *testing.T, context string, req *openrtb.BidRequest) []string { +func findBiddersInAuction(t *testing.T, context string, req *openrtb2.BidRequest) []string { if splitImps, err := splitImps(req.Imp); err != nil { t.Errorf("%s: Failed to parse Bidders from request: %v", context, err) return nil @@ -1701,7 +1701,7 @@ func findBiddersInAuction(t *testing.T, context string, req *openrtb.BidRequest) // extractResponseTimes validates the format of bid.ext.responsetimemillis, and then removes it. // This is done because the response time will change from run to run, so it's impossible to hardcode a value // into the JSON. The best we can do is make sure that the property exists. -func extractResponseTimes(t *testing.T, context string, bid *openrtb.BidResponse) map[string]int { +func extractResponseTimes(t *testing.T, context string, bid *openrtb2.BidResponse) map[string]int { if data, dataType, _, err := jsonparser.Get(bid.Ext, "responsetimemillis"); err != nil || dataType != jsonparser.Object { t.Errorf("%s: Exchange did not return ext.responsetimemillis object: %v", context, err) return nil @@ -1852,10 +1852,10 @@ func TestCategoryMapping(t *testing.T) { cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -1907,10 +1907,10 @@ func TestCategoryMappingNoIncludeBrandCategory(t *testing.T) { cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -1962,9 +1962,9 @@ func TestCategoryMappingTranslateCategoriesNil(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -2044,9 +2044,9 @@ func TestCategoryMappingTranslateCategoriesFalse(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -2094,11 +2094,11 @@ func TestCategoryDedupe(t *testing.T) { cats2 := []string{"IAB1-4"} // bid3 will be same price, category, and duration as bid1 so one of them should get removed cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 15.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} - bid5 := openrtb.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 20.0000, Cat: cats1, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 15.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} + bid5 := openrtb2.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 20.0000, Cat: cats1, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 50}, nil, 0, false} @@ -2173,11 +2173,11 @@ func TestNoCategoryDedupe(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 14.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 14.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} - bid5 := openrtb.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 14.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 14.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} + bid5 := openrtb2.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 10.0000, Cat: cats1, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2256,8 +2256,8 @@ func TestCategoryMappingBidderName(t *testing.T) { cats1 := []string{"IAB1-1"} cats2 := []string{"IAB1-2"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 10.0000, Cat: cats2, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 10.0000, Cat: cats2, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2310,8 +2310,8 @@ func TestCategoryMappingBidderNameNoCategories(t *testing.T) { cats1 := []string{"IAB1-1"} cats2 := []string{"IAB1-2"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 12.0000, Cat: cats2, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 12.0000, Cat: cats2, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2368,7 +2368,7 @@ func TestBidRejectionErrors(t *testing.T) { testCases := []struct { description string reqExt openrtb_ext.ExtRequest - bids []*openrtb.Bid + bids []*openrtb2.Bid duration int expectedRejections []string expectedCatDur string @@ -2376,7 +2376,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to not containing a category", reqExt: requestExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{}, W: 1, H: 1}, }, duration: 30, @@ -2387,7 +2387,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to missing category mapping file", reqExt: invalidReqExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, }, duration: 30, @@ -2398,7 +2398,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to duration exceeding maximum", reqExt: requestExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, }, duration: 70, @@ -2409,7 +2409,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to duplicate bid", reqExt: requestExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, }, @@ -2471,8 +2471,8 @@ func TestCategoryMappingTwoBiddersOneBidEachNoCategorySamePrice(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} - bidApn1 := openrtb.Bid{ID: "bid_idApn1", ImpID: "imp_idApn1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bidApn2 := openrtb.Bid{ID: "bid_idApn2", ImpID: "imp_idApn2", Price: 10.0000, Cat: cats2, W: 1, H: 1} + bidApn1 := openrtb2.Bid{ID: "bid_idApn1", ImpID: "imp_idApn1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bidApn2 := openrtb2.Bid{ID: "bid_idApn2", ImpID: "imp_idApn2", Price: 10.0000, Cat: cats2, W: 1, H: 1} bid1_Apn1 := pbsOrtbBid{&bidApn1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_Apn2 := pbsOrtbBid{&bidApn2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2592,9 +2592,9 @@ func TestApplyDealSupport(t *testing.T) { bidderName := openrtb_ext.BidderName("appnexus") for _, test := range testCases { - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "imp_id1", Ext: test.impExt, @@ -2602,7 +2602,7 @@ func TestApplyDealSupport(t *testing.T) { }, } - bid := pbsOrtbBid{&openrtb.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} + bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} bidCategory := map[string]string{ bid.bid.ID: test.targ["hb_pb_cat_dur"], } @@ -2628,20 +2628,20 @@ func TestApplyDealSupport(t *testing.T) { func TestGetDealTiers(t *testing.T) { testCases := []struct { description string - request openrtb.BidRequest + request openrtb2.BidRequest expected map[string]openrtb_ext.DealTierBidderMap }{ { description: "None", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{}, + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{}, }, expected: map[string]openrtb_ext.DealTierBidderMap{}, }, { description: "One", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{ + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 5, "prefix": "tier"}}}`)}, }, }, @@ -2651,8 +2651,8 @@ func TestGetDealTiers(t *testing.T) { }, { description: "Many", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{ + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 5, "prefix": "tier1"}}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 8, "prefix": "tier2"}}}`)}, }, @@ -2664,8 +2664,8 @@ func TestGetDealTiers(t *testing.T) { }, { description: "Many - Skips Malformed", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{ + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 5, "prefix": "tier1"}}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"appnexus": {"dealTier": "wrong type"}}`)}, }, @@ -2769,7 +2769,7 @@ func TestUpdateHbPbCatDur(t *testing.T) { } for _, test := range testCases { - bid := pbsOrtbBid{&openrtb.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} + bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} bidCategory := map[string]string{ bid.bid.ID: test.targ["hb_pb_cat_dur"], } @@ -2795,14 +2795,14 @@ type exchangeSpec struct { } type exchangeRequest struct { - OrtbRequest openrtb.BidRequest `json:"ortbRequest"` - Usersyncs map[string]string `json:"usersyncs"` + OrtbRequest openrtb2.BidRequest `json:"ortbRequest"` + Usersyncs map[string]string `json:"usersyncs"` } type exchangeResponse struct { - Bids *openrtb.BidResponse `json:"bids"` - Error string `json:"error,omitempty"` - Ext json.RawMessage `json:"ext,omitempty"` + Bids *openrtb2.BidResponse `json:"bids"` + Error string `json:"error,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } type bidderSpec struct { @@ -2812,8 +2812,8 @@ type bidderSpec struct { } type bidderRequest struct { - OrtbRequest openrtb.BidRequest `json:"ortbRequest"` - BidAdjustment float64 `json:"bidAdjustment"` + OrtbRequest openrtb2.BidRequest `json:"ortbRequest"` + BidAdjustment float64 `json:"bidAdjustment"` } type bidderResponse struct { @@ -2832,8 +2832,8 @@ type bidderSeatBid struct { // bidderBid is basically a subset of pbsOrtbBid from exchange/bidder.go. // See the comment on bidderSeatBid for more info. type bidderBid struct { - Bid *openrtb.Bid `json:"ortbBid,omitempty"` - Type string `json:"bidType,omitempty"` + Bid *openrtb2.Bid `json:"ortbBid,omitempty"` + Type string `json:"bidType,omitempty"` } type mockIdFetcher map[string]string @@ -2857,7 +2857,7 @@ type validatingBidder struct { mockResponses map[string]bidderResponse } -func (b *validatingBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (seatBid *pbsOrtbSeatBid, errs []error) { +func (b *validatingBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (seatBid *pbsOrtbSeatBid, errs []error) { if expectedRequest, ok := b.expectations[string(name)]; ok { if expectedRequest != nil { if expectedRequest.BidAdjustment != bidAdjustment { @@ -2900,7 +2900,7 @@ func (b *validatingBidder) requestBid(ctx context.Context, request *openrtb.BidR return } -func diffOrtbRequests(t *testing.T, description string, expected *openrtb.BidRequest, actual *openrtb.BidRequest) { +func diffOrtbRequests(t *testing.T, description string, expected *openrtb2.BidRequest, actual *openrtb2.BidRequest) { t.Helper() actualJSON, err := json.Marshal(actual) if err != nil { @@ -2915,7 +2915,7 @@ func diffOrtbRequests(t *testing.T, description string, expected *openrtb.BidReq diffJson(t, description, actualJSON, expectedJSON) } -func diffOrtbResponses(t *testing.T, description string, expected *openrtb.BidResponse, actual *openrtb.BidResponse) { +func diffOrtbResponses(t *testing.T, description string, expected *openrtb2.BidResponse, actual *openrtb2.BidResponse) { t.Helper() // The OpenRTB spec is wonky here. Since "bidresponse.seatbid" is an array, order technically matters to any JSON diff or // deep equals method. However, for all intents and purposes it really *doesn't* matter. ...so this nasty logic makes compares @@ -2938,8 +2938,8 @@ func diffOrtbResponses(t *testing.T, description string, expected *openrtb.BidRe diffJson(t, description, actualJSON, expectedJSON) } -func mapifySeatBids(t *testing.T, context string, seatBids []openrtb.SeatBid) map[string]*openrtb.SeatBid { - seatMap := make(map[string]*openrtb.SeatBid, len(seatBids)) +func mapifySeatBids(t *testing.T, context string, seatBids []openrtb2.SeatBid) map[string]*openrtb2.SeatBid { + seatMap := make(map[string]*openrtb2.SeatBid, len(seatBids)) for i := 0; i < len(seatBids); i++ { seatName := seatBids[i].Seat if _, ok := seatMap[seatName]; ok { @@ -3036,7 +3036,7 @@ func (e *mockUsersync) LiveSyncCount() int { type panicingAdapter struct{} -func (panicingAdapter) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (posb *pbsOrtbSeatBid, errs []error) { +func (panicingAdapter) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (posb *pbsOrtbSeatBid, errs []error) { panic("Panic! Panic! The world is ending!") } diff --git a/exchange/gdpr.go b/exchange/gdpr.go index e861f948773..a6b4a22dc8f 100644 --- a/exchange/gdpr.go +++ b/exchange/gdpr.go @@ -3,12 +3,12 @@ package exchange import ( "encoding/json" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/gdpr" ) // ExtractGDPR will pull the gdpr flag from an openrtb request -func extractGDPR(bidRequest *openrtb.BidRequest) (gdpr.Signal, error) { +func extractGDPR(bidRequest *openrtb2.BidRequest) (gdpr.Signal, error) { var re regsExt var err error if bidRequest.Regs != nil && bidRequest.Regs.Ext != nil { @@ -21,7 +21,7 @@ func extractGDPR(bidRequest *openrtb.BidRequest) (gdpr.Signal, error) { } // ExtractConsent will pull the consent string from an openrtb request -func extractConsent(bidRequest *openrtb.BidRequest) (consent string, err error) { +func extractConsent(bidRequest *openrtb2.BidRequest) (consent string, err error) { var ue userExt if bidRequest.User != nil && bidRequest.User.Ext != nil { err = json.Unmarshal(bidRequest.User.Ext, &ue) diff --git a/exchange/gdpr_test.go b/exchange/gdpr_test.go index 351939091da..420b299f2cc 100644 --- a/exchange/gdpr_test.go +++ b/exchange/gdpr_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/gdpr" "github.com/stretchr/testify/assert" ) @@ -12,23 +12,23 @@ import ( func TestExtractGDPR(t *testing.T) { tests := []struct { description string - giveRegs *openrtb.Regs + giveRegs *openrtb2.Regs wantGDPR gdpr.Signal wantError bool }{ { description: "Regs Ext GDPR = 0", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": 0}`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"gdpr": 0}`)}, wantGDPR: gdpr.SignalNo, }, { description: "Regs Ext GDPR = 1", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": 1}`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"gdpr": 1}`)}, wantGDPR: gdpr.SignalYes, }, { description: "Regs Ext GDPR = null", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": null}`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"gdpr": null}`)}, wantGDPR: gdpr.SignalAmbiguous, }, { @@ -38,19 +38,19 @@ func TestExtractGDPR(t *testing.T) { }, { description: "Regs Ext is nil", - giveRegs: &openrtb.Regs{Ext: nil}, + giveRegs: &openrtb2.Regs{Ext: nil}, wantGDPR: gdpr.SignalAmbiguous, }, { description: "JSON unmarshal error", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"`)}, wantGDPR: gdpr.SignalAmbiguous, wantError: true, }, } for _, tt := range tests { - bidReq := openrtb.BidRequest{ + bidReq := openrtb2.BidRequest{ Regs: tt.giveRegs, } @@ -68,23 +68,23 @@ func TestExtractGDPR(t *testing.T) { func TestExtractConsent(t *testing.T) { tests := []struct { description string - giveUser *openrtb.User + giveUser *openrtb2.User wantConsent string wantError bool }{ { description: "User Ext Consent is not empty", - giveUser: &openrtb.User{Ext: json.RawMessage(`{"consent": "BOS2bx5OS2bx5ABABBAAABoAAAAAFA"}`)}, + giveUser: &openrtb2.User{Ext: json.RawMessage(`{"consent": "BOS2bx5OS2bx5ABABBAAABoAAAAAFA"}`)}, wantConsent: "BOS2bx5OS2bx5ABABBAAABoAAAAAFA", }, { description: "User Ext Consent is empty", - giveUser: &openrtb.User{Ext: json.RawMessage(`{"consent": ""}`)}, + giveUser: &openrtb2.User{Ext: json.RawMessage(`{"consent": ""}`)}, wantConsent: "", }, { description: "User Ext is nil", - giveUser: &openrtb.User{Ext: nil}, + giveUser: &openrtb2.User{Ext: nil}, wantConsent: "", }, { @@ -94,14 +94,14 @@ func TestExtractConsent(t *testing.T) { }, { description: "JSON unmarshal error", - giveUser: &openrtb.User{Ext: json.RawMessage(`{`)}, + giveUser: &openrtb2.User{Ext: json.RawMessage(`{`)}, wantConsent: "", wantError: true, }, } for _, tt := range tests { - bidReq := openrtb.BidRequest{ + bidReq := openrtb2.BidRequest{ User: tt.giveUser, } diff --git a/exchange/legacy.go b/exchange/legacy.go index b4845b76c69..ea8b65c28f0 100644 --- a/exchange/legacy.go +++ b/exchange/legacy.go @@ -6,7 +6,7 @@ import ( "errors" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" @@ -33,7 +33,7 @@ type adaptedAdapter struct { // // This is not ideal. OpenRTB provides a superset of the legacy data structures. // For requests which use those features, the best we can do is respond with "no bid". -func (bidder *adaptedAdapter) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (bidder *adaptedAdapter) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { legacyRequest, legacyBidder, errs := bidder.toLegacyAdapterInputs(request, name) if legacyRequest == nil || legacyBidder == nil { return nil, errs @@ -58,7 +58,7 @@ func (bidder *adaptedAdapter) requestBid(ctx context.Context, request *openrtb.B // toLegacyAdapterInputs is a best-effort transformation of an OpenRTB BidRequest into the args needed to run a legacy Adapter. // If the OpenRTB request is too complex, it fails with an error. // If the error is nil, then the PBSRequest and PBSBidder are valid. -func (bidder *adaptedAdapter) toLegacyAdapterInputs(req *openrtb.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSRequest, *pbs.PBSBidder, []error) { +func (bidder *adaptedAdapter) toLegacyAdapterInputs(req *openrtb2.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSRequest, *pbs.PBSBidder, []error) { legacyReq, err := bidder.toLegacyRequest(req) if err != nil { return nil, nil, []error{err} @@ -72,7 +72,7 @@ func (bidder *adaptedAdapter) toLegacyAdapterInputs(req *openrtb.BidRequest, nam return legacyReq, legacyBidder, errs } -func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb.BidRequest) (*pbs.PBSRequest, error) { +func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb2.BidRequest) (*pbs.PBSRequest, error) { acctId, err := toAccountId(req) if err != nil { return nil, err @@ -126,7 +126,7 @@ func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb.BidRequest) (*pbs.PBS App: req.App, Device: req.Device, // PBSUser is excluded because rubicon is the only adapter which reads from it, and they're supporting OpenRTB directly - // SDK is excluded because that information doesn't exist in OpenRTB. + // SDK is excluded because that information doesn't exist in openrtb2. // Bidders is excluded because no legacy adapters read from it User: req.User, Cookie: cookie, @@ -137,7 +137,7 @@ func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb.BidRequest) (*pbs.PBS }, nil } -func toAccountId(req *openrtb.BidRequest) (string, error) { +func toAccountId(req *openrtb2.BidRequest) (string, error) { if req.Site != nil && req.Site.Publisher != nil { return req.Site.Publisher.ID, nil } @@ -147,14 +147,14 @@ func toAccountId(req *openrtb.BidRequest) (string, error) { return "", errors.New("bidrequest.site.publisher.id or bidrequest.app.publisher.id required for legacy bidders.") } -func toTransactionId(req *openrtb.BidRequest) (string, error) { +func toTransactionId(req *openrtb2.BidRequest) (string, error) { if req.Source != nil { return req.Source.TID, nil } return "", errors.New("bidrequest.source.tid required for legacy bidders.") } -func toSecure(req *openrtb.BidRequest) (secure int8, err error) { +func toSecure(req *openrtb2.BidRequest) (secure int8, err error) { secure = -1 for _, imp := range req.Imp { if imp.Secure != nil { @@ -181,7 +181,7 @@ func toSecure(req *openrtb.BidRequest) (secure int8, err error) { return } -func toLegacyBidder(req *openrtb.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSBidder, []error) { +func toLegacyBidder(req *openrtb2.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSBidder, []error) { adUnits, errs := toPBSAdUnits(req) if len(adUnits) > 0 { return &pbs.PBSBidder{ @@ -202,7 +202,7 @@ func toLegacyBidder(req *openrtb.BidRequest, name openrtb_ext.BidderName) (*pbs. } } -func toPBSAdUnits(req *openrtb.BidRequest) ([]pbs.PBSAdUnit, []error) { +func toPBSAdUnits(req *openrtb2.BidRequest) ([]pbs.PBSAdUnit, []error) { adUnits := make([]pbs.PBSAdUnit, len(req.Imp)) var errs []error = nil nextAdUnit := 0 @@ -217,8 +217,8 @@ func toPBSAdUnits(req *openrtb.BidRequest) ([]pbs.PBSAdUnit, []error) { return adUnits[:nextAdUnit], errs } -func initPBSAdUnit(imp *openrtb.Imp, adUnit *pbs.PBSAdUnit) error { - var sizes []openrtb.Format = nil +func initPBSAdUnit(imp *openrtb2.Imp, adUnit *pbs.PBSAdUnit) error { + var sizes []openrtb2.Format = nil video := pbs.PBSVideo{} if imp.Video != nil { @@ -242,7 +242,7 @@ func initPBSAdUnit(imp *openrtb.Imp, adUnit *pbs.PBSAdUnit) error { } // Fixes #360 if imp.Video.W != 0 && imp.Video.H != 0 { - sizes = append(sizes, openrtb.Format{ + sizes = append(sizes, openrtb2.Format{ W: imp.Video.W, H: imp.Video.H, }) @@ -324,12 +324,12 @@ func transformBid(legacyBid *pbs.PBSBid) (*pbsOrtbBid, error) { }, nil } -func transformBidToOrtb(legacyBid *pbs.PBSBid) *openrtb.Bid { - return &openrtb.Bid{ +func transformBidToOrtb(legacyBid *pbs.PBSBid) *openrtb2.Bid { + return &openrtb2.Bid{ ID: legacyBid.BidID, ImpID: legacyBid.AdUnitCode, CrID: legacyBid.Creative_id, - // legacyBid.CreativeMediaType is handled by transformBid(), because it doesn't exist on the openrtb.Bid + // legacyBid.CreativeMediaType is handled by transformBid(), because it doesn't exist on the openrtb2.Bid // legacyBid.BidderCode is handled by the exchange, which already knows which bidder we are. // legacyBid.BidHash is ignored, because it doesn't get sent in the response anyway Price: legacyBid.Price, diff --git a/exchange/legacy_test.go b/exchange/legacy_test.go index 2cef4feae40..aa684287997 100644 --- a/exchange/legacy_test.go +++ b/exchange/legacy_test.go @@ -11,7 +11,7 @@ import ( "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" @@ -20,35 +20,35 @@ import ( ) func TestSiteVideo(t *testing.T) { - ortbRequest := &openrtb.BidRequest{ + ortbRequest := &openrtb2.BidRequest{ ID: "request-id", TMax: 1000, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Page: "http://www.site.com", Domain: "site.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "host-id", BuyerUID: "bidder-id", }, Test: 1, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: []string{"video/mp4"}, MinDuration: 20, MaxDuration: 40, - Protocols: []openrtb.Protocol{openrtb.ProtocolVAST10}, - StartDelay: openrtb.StartDelayGenericMidRoll.Ptr(), + Protocols: []openrtb2.Protocol{openrtb2.ProtocolVAST10}, + StartDelay: openrtb2.StartDelayGenericMidRoll.Ptr(), }, - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -85,7 +85,7 @@ func TestSiteVideo(t *testing.T) { func TestAppBanner(t *testing.T) { ortbRequest := newAppOrtbRequest() ortbRequest.TMax = 1000 - ortbRequest.User = &openrtb.User{ + ortbRequest.User = &openrtb2.User{ ID: "host-id", BuyerUID: "bidder-id", } @@ -187,8 +187,8 @@ func TestBidTransforms(t *testing.T) { func TestInsecureImps(t *testing.T) { insecure := int8(0) - bidReq := &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ + bidReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ Secure: &insecure, }, { Secure: &insecure, @@ -205,8 +205,8 @@ func TestInsecureImps(t *testing.T) { func TestSecureImps(t *testing.T) { secure := int8(1) - bidReq := &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ + bidReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ Secure: &secure, }, { Secure: &secure, @@ -224,8 +224,8 @@ func TestSecureImps(t *testing.T) { func TestMixedSecureImps(t *testing.T) { insecure := int8(0) secure := int8(1) - bidReq := &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ + bidReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ Secure: &insecure, }, { Secure: &secure, @@ -237,21 +237,21 @@ func TestMixedSecureImps(t *testing.T) { } } -func newAppOrtbRequest() *openrtb.BidRequest { - return &openrtb.BidRequest{ +func newAppOrtbRequest() *openrtb2.BidRequest { + return &openrtb2.BidRequest{ ID: "request-id", - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -262,20 +262,20 @@ func newAppOrtbRequest() *openrtb.BidRequest { } func TestErrorResponse(t *testing.T) { - ortbRequest := &openrtb.BidRequest{ + ortbRequest := &openrtb2.BidRequest{ ID: "request-id", - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -300,20 +300,20 @@ func TestErrorResponse(t *testing.T) { } func TestWithTargeting(t *testing.T) { - ortbRequest := &openrtb.BidRequest{ + ortbRequest := &openrtb2.BidRequest{ ID: "request-id", - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -343,7 +343,7 @@ func TestWithTargeting(t *testing.T) { // assertEquivalentFields compares the OpenRTB request with the legacy request, using the mappings defined here: // https://gist.github.com/dbemiller/68aa3387189fa17d3addfb9818dd4d97 -func assertEquivalentRequests(t *testing.T, req *openrtb.BidRequest, legacy *pbs.PBSRequest) { +func assertEquivalentRequests(t *testing.T, req *openrtb2.BidRequest, legacy *pbs.PBSRequest) { if req.Site != nil { if req.Site.Publisher.ID != legacy.AccountID { t.Errorf("Account ID did not translate. OpenRTB: %s, Legacy: %s.", req.Site.Publisher.ID, legacy.AccountID) @@ -399,7 +399,7 @@ func assertEquivalentRequests(t *testing.T, req *openrtb.BidRequest, legacy *pbs } } -func assertEquivalentBidder(t *testing.T, req *openrtb.BidRequest, legacy *pbs.PBSBidder) { +func assertEquivalentBidder(t *testing.T, req *openrtb2.BidRequest, legacy *pbs.PBSBidder) { if len(req.Imp) != len(legacy.AdUnits) { t.Errorf("Wrong number of Imps. Expected %d, got %d", len(req.Imp), len(legacy.AdUnits)) return @@ -409,7 +409,7 @@ func assertEquivalentBidder(t *testing.T, req *openrtb.BidRequest, legacy *pbs.P } } -func assertEquivalentImp(t *testing.T, index int, imp *openrtb.Imp, legacy *pbs.PBSAdUnit) { +func assertEquivalentImp(t *testing.T, index int, imp *openrtb2.Imp, legacy *pbs.PBSAdUnit) { if imp.ID != legacy.BidID { t.Errorf("imp[%d].id did not translate. OpenRTB %s, legacy %s", index, imp.ID, legacy.BidID) } diff --git a/exchange/targeting.go b/exchange/targeting.go index 87bec6f3077..f79e05be930 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -3,7 +3,7 @@ package exchange import ( "strconv" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" ) @@ -91,9 +91,9 @@ func (targData *targetData) addKeys(keys map[string]string, key openrtb_ext.Targ } } -func makeHbSize(bid *openrtb.Bid) string { +func makeHbSize(bid *openrtb2.Bid) string { if bid.W != 0 && bid.H != 0 { - return strconv.FormatUint(bid.W, 10) + "x" + strconv.FormatUint(bid.H, 10) + return strconv.FormatInt(bid.W, 10) + "x" + strconv.FormatInt(bid.H, 10) } return "" } diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index 2a77c4f7517..2cdf403439f 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -8,6 +8,7 @@ import ( "testing" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" @@ -16,14 +17,13 @@ import ( metricsConf "github.com/prebid/prebid-server/metrics/config" metricsConfig "github.com/prebid/prebid-server/metrics/config" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) // Using this set of bids in more than one test -var mockBids = map[openrtb_ext.BidderName][]*openrtb.Bid{ +var mockBids = map[openrtb_ext.BidderName][]*openrtb2.Bid{ openrtb_ext.BidderAppnexus: {{ ID: "losing-bid", ImpID: "some-imp", @@ -67,7 +67,7 @@ func TestTargetingCache(t *testing.T) { } -func assertKeyExists(t *testing.T, bid *openrtb.Bid, key string, expected bool) { +func assertKeyExists(t *testing.T, bid *openrtb2.Bid, key string, expected bool) { t.Helper() targets := parseTargets(t, bid) if _, ok := targets[key]; ok != expected { @@ -77,7 +77,7 @@ func assertKeyExists(t *testing.T, bid *openrtb.Bid, key string, expected bool) // runAuction takes a bunch of mock bids by Bidder and runs an auction. It returns a map of Bids indexed by their ImpID. // If includeCache is true, the auction will be run with cacheing as well, so the cache targeting keys should exist. -func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid, includeCache bool, includeWinners bool, includeBidderKeys bool, isApp bool) map[string]*openrtb.Bid { +func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb2.Bid, includeCache bool, includeWinners bool, includeBidderKeys bool, isApp bool) map[string]*openrtb2.Bid { server := httptest.NewServer(http.HandlerFunc(mockServer)) defer server.Close() @@ -99,14 +99,14 @@ func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*op imps := buildImps(t, mockBids) - req := &openrtb.BidRequest{ + req := &openrtb2.BidRequest{ Imp: imps, Ext: buildTargetingExt(includeCache, includeWinners, includeBidderKeys), } if isApp { - req.App = &openrtb.App{} + req.App = &openrtb2.App{} } else { - req.Site = &openrtb.Site{} + req.Site = &openrtb2.Site{} } auctionRequest := AuctionRequest{ @@ -128,7 +128,7 @@ func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*op return buildBidMap(bidResp.SeatBid, len(mockBids)) } -func buildBidderList(bids map[openrtb_ext.BidderName][]*openrtb.Bid) []openrtb_ext.BidderName { +func buildBidderList(bids map[openrtb_ext.BidderName][]*openrtb2.Bid) []openrtb_ext.BidderName { bidders := make([]openrtb_ext.BidderName, 0, len(bids)) for name := range bids { bidders = append(bidders, name) @@ -136,7 +136,7 @@ func buildBidderList(bids map[openrtb_ext.BidderName][]*openrtb.Bid) []openrtb_e return bidders } -func buildAdapterMap(bids map[openrtb_ext.BidderName][]*openrtb.Bid, mockServerURL string, client *http.Client) map[openrtb_ext.BidderName]adaptedBidder { +func buildAdapterMap(bids map[openrtb_ext.BidderName][]*openrtb2.Bid, mockServerURL string, client *http.Client) map[openrtb_ext.BidderName]adaptedBidder { adapterMap := make(map[openrtb_ext.BidderName]adaptedBidder, len(bids)) for bidder, bids := range bids { adapterMap[bidder] = adaptBidder(&mockTargetingBidder{ @@ -166,7 +166,7 @@ func buildTargetingExt(includeCache bool, includeWinners bool, includeBidderKeys return json.RawMessage(`{"prebid":{"targeting":` + targeting + `}}`) } -func buildParams(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) json.RawMessage { +func buildParams(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb2.Bid) json.RawMessage { params := make(map[string]json.RawMessage) for bidder := range mockBids { params[string(bidder)] = json.RawMessage(`{"whatever":true}`) @@ -178,7 +178,7 @@ func buildParams(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bi return ext } -func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) []openrtb.Imp { +func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb2.Bid) []openrtb2.Imp { impExt := buildParams(t, mockBids) var s struct{} @@ -189,9 +189,9 @@ func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) } } - imps := make([]openrtb.Imp, 0, len(impIds)) + imps := make([]openrtb2.Imp, 0, len(impIds)) for impId := range impIds { - imps = append(imps, openrtb.Imp{ + imps = append(imps, openrtb2.Imp{ ID: impId, Ext: impExt, }) @@ -199,8 +199,8 @@ func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) return imps } -func buildBidMap(seatBids []openrtb.SeatBid, numBids int) map[string]*openrtb.Bid { - bids := make(map[string]*openrtb.Bid, numBids) +func buildBidMap(seatBids []openrtb2.SeatBid, numBids int) map[string]*openrtb2.Bid { + bids := make(map[string]*openrtb2.Bid, numBids) for _, seatBid := range seatBids { for i := 0; i < len(seatBid.Bid); i++ { bid := seatBid.Bid[i] @@ -210,7 +210,7 @@ func buildBidMap(seatBids []openrtb.SeatBid, numBids int) map[string]*openrtb.Bi return bids } -func parseTargets(t *testing.T, bid *openrtb.Bid) map[string]string { +func parseTargets(t *testing.T, bid *openrtb2.Bid) map[string]string { t.Helper() var parsed openrtb_ext.ExtBid if err := json.Unmarshal(bid.Ext, &parsed); err != nil { @@ -221,10 +221,10 @@ func parseTargets(t *testing.T, bid *openrtb.Bid) map[string]string { type mockTargetingBidder struct { mockServerURL string - bids []*openrtb.Bid + bids []*openrtb2.Bid } -func (m *mockTargetingBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (m *mockTargetingBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return []*adapters.RequestData{{ Method: "POST", Uri: m.mockServerURL, @@ -233,7 +233,7 @@ func (m *mockTargetingBidder) MakeRequests(request *openrtb.BidRequest, reqInfo }}, nil } -func (m *mockTargetingBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (m *mockTargetingBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidResponse := &adapters.BidderResponse{ Bids: make([]*adapters.TypedBid, len(m.bids)), } @@ -259,15 +259,15 @@ type TargetingTestData struct { ExpectedBidTargetsByBidder map[string]map[openrtb_ext.BidderName]map[string]string } -var bid123 *openrtb.Bid = &openrtb.Bid{ +var bid123 *openrtb2.Bid = &openrtb2.Bid{ Price: 1.23, } -var bid111 *openrtb.Bid = &openrtb.Bid{ +var bid111 *openrtb2.Bid = &openrtb2.Bid{ Price: 1.11, DealID: "mydeal", } -var bid084 *openrtb.Bid = &openrtb.Bid{ +var bid084 *openrtb2.Bid = &openrtb2.Bid{ Price: 0.84, } @@ -396,7 +396,7 @@ var TargetingTests []TargetingTestData = []TargetingTestData{ }, }, }, - cacheIds: map[*openrtb.Bid]string{ + cacheIds: map[*openrtb2.Bid]string{ bid123: "55555", bid111: "cacheme", }, diff --git a/exchange/utils.go b/exchange/utils.go index 0d9d0e3ced8..f011669e1f2 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -6,10 +6,10 @@ import ( "fmt" "math/rand" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/go-gdpr/vendorconsent" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/gdpr" "github.com/prebid/prebid-server/metrics" @@ -153,7 +153,7 @@ func ccpaEnabled(account *config.Account, privacyConfig config.Privacy, requestT return privacyConfig.CCPA.Enforce } -func extractCCPA(orig *openrtb.BidRequest, privacyConfig config.Privacy, account *config.Account, aliases map[string]string, requestType config.IntegrationType) (privacy.PolicyEnforcer, error) { +func extractCCPA(orig *openrtb2.BidRequest, privacyConfig config.Privacy, account *config.Account, aliases map[string]string, requestType config.IntegrationType) (privacy.PolicyEnforcer, error) { ccpaPolicy, err := ccpa.ReadFromRequest(orig) if err != nil { return privacy.NilPolicyEnforcer{}, err @@ -172,7 +172,7 @@ func extractCCPA(orig *openrtb.BidRequest, privacyConfig config.Privacy, account return ccpaEnforcer, nil } -func extractLMT(orig *openrtb.BidRequest, privacyConfig config.Privacy) privacy.PolicyEnforcer { +func extractLMT(orig *openrtb2.BidRequest, privacyConfig config.Privacy) privacy.PolicyEnforcer { return privacy.EnabledPolicyEnforcer{ Enabled: privacyConfig.LMT.Enforce, PolicyEnforcer: lmt.ReadFromRequest(orig), @@ -181,7 +181,7 @@ func extractLMT(orig *openrtb.BidRequest, privacyConfig config.Privacy) privacy. func getAuctionBidderRequests(req AuctionRequest, requestExt *openrtb_ext.ExtRequest, - impsByBidder map[string][]openrtb.Imp, + impsByBidder map[string][]openrtb2.Imp, aliases map[string]string) ([]BidderRequest, []error) { bidderRequests := make([]BidderRequest, 0, len(impsByBidder)) @@ -243,7 +243,7 @@ func getAuctionBidderRequests(req AuctionRequest, return bidderRequests, errs } -func getExtJson(req *openrtb.BidRequest, unpackedExt *openrtb_ext.ExtRequest) (json.RawMessage, error) { +func getExtJson(req *openrtb2.BidRequest, unpackedExt *openrtb_ext.ExtRequest) (json.RawMessage, error) { if len(req.Ext) == 0 || unpackedExt == nil { return json.RawMessage(``), nil } @@ -253,7 +253,7 @@ func getExtJson(req *openrtb.BidRequest, unpackedExt *openrtb_ext.ExtRequest) (j return json.Marshal(extCopy) } -func prepareSource(req *openrtb.BidRequest, bidder string, sChainsByBidder map[string]*openrtb_ext.ExtRequestPrebidSChainSChain) { +func prepareSource(req *openrtb2.BidRequest, bidder string, sChainsByBidder map[string]*openrtb_ext.ExtRequestPrebidSChainSChain) { const sChainWildCard = "*" var selectedSChain *openrtb_ext.ExtRequestPrebidSChainSChain @@ -273,7 +273,7 @@ func prepareSource(req *openrtb.BidRequest, bidder string, sChainsByBidder map[s // set source if req.Source == nil { - req.Source = &openrtb.Source{} + req.Source = &openrtb2.Source{} } schain := openrtb_ext.ExtRequestPrebidSChain{ SChain: *selectedSChain, @@ -286,7 +286,7 @@ func prepareSource(req *openrtb.BidRequest, bidder string, sChainsByBidder map[s // extractBuyerUIDs parses the values from user.ext.prebid.buyeruids, and then deletes those values from the ext. // This prevents a Bidder from using these values to figure out who else is involved in the Auction. -func extractBuyerUIDs(user *openrtb.User) (map[string]string, error) { +func extractBuyerUIDs(user *openrtb2.User) (map[string]string, error) { if user == nil { return nil, nil } @@ -328,8 +328,8 @@ func extractBuyerUIDs(user *openrtb.User) (map[string]string, error) { // The "imp.ext" value of the rubicon Imp will only contain the "prebid" values, and "rubicon" value at the "bidder" key. // // The goal here is so that Bidders only get Imps and Imp.Ext values which are intended for them. -func splitImps(imps []openrtb.Imp) (map[string][]openrtb.Imp, error) { - bidderImps := make(map[string][]openrtb.Imp) +func splitImps(imps []openrtb2.Imp) (map[string][]openrtb2.Imp, error) { + bidderImps := make(map[string][]openrtb2.Imp) for i, imp := range imps { var impExt map[string]json.RawMessage @@ -433,7 +433,7 @@ func isSpecialField(bidder string) bool { // // In this function, "givenBidder" may or may not be an alias. "coreBidder" must *not* be an alias. // It returns true if a Cookie User Sync existed, and false otherwise. -func prepareUser(req *openrtb.BidRequest, givenBidder string, coreBidder openrtb_ext.BidderName, explicitBuyerUIDs map[string]string, usersyncs IdFetcher) bool { +func prepareUser(req *openrtb2.BidRequest, givenBidder string, coreBidder openrtb_ext.BidderName, explicitBuyerUIDs map[string]string, usersyncs IdFetcher) bool { cookieId, hadCookie := usersyncs.GetId(coreBidder) if id, ok := explicitBuyerUIDs[givenBidder]; ok { @@ -447,9 +447,9 @@ func prepareUser(req *openrtb.BidRequest, givenBidder string, coreBidder openrtb // copyWithBuyerUID either overwrites the BuyerUID property on user with the argument, or returns // a new (empty) User with the BuyerUID already set. -func copyWithBuyerUID(user *openrtb.User, buyerUID string) *openrtb.User { +func copyWithBuyerUID(user *openrtb2.User, buyerUID string) *openrtb2.User { if user == nil { - return &openrtb.User{ + return &openrtb2.User{ BuyerUID: buyerUID, } } @@ -462,7 +462,7 @@ func copyWithBuyerUID(user *openrtb.User, buyerUID string) *openrtb.User { } // removeUnpermissionedEids modifies the request to remove any request.user.ext.eids not permissions for the specific bidder -func removeUnpermissionedEids(request *openrtb.BidRequest, bidder string, requestExt *openrtb_ext.ExtRequest) error { +func removeUnpermissionedEids(request *openrtb2.BidRequest, bidder string, requestExt *openrtb_ext.ExtRequest) error { // ensure request might have eids (as much as we can check before unmarshalling) if request.User == nil || len(request.User.Ext) == 0 { return nil @@ -549,7 +549,7 @@ func removeUnpermissionedEids(request *openrtb.BidRequest, bidder string, reques return nil } -func setUserExtWithCopy(request *openrtb.BidRequest, userExtJSON json.RawMessage) { +func setUserExtWithCopy(request *openrtb2.BidRequest, userExtJSON json.RawMessage) { userCopy := *request.User userCopy.Ext = userExtJSON request.User = &userCopy @@ -564,7 +564,7 @@ func resolveBidder(bidder string, aliases map[string]string) openrtb_ext.BidderN } // parseAliases parses the aliases from the BidRequest -func parseAliases(orig *openrtb.BidRequest) (map[string]string, []error) { +func parseAliases(orig *openrtb2.BidRequest) (map[string]string, []error) { var aliases map[string]string if value, dataType, _, err := jsonparser.Get(orig.Ext, openrtb_ext.PrebidExtKey, "aliases"); dataType == jsonparser.Object && err == nil { if err := json.Unmarshal(value, &aliases); err != nil { @@ -597,7 +597,7 @@ func randomizeList(list []openrtb_ext.BidderName) { } } -func extractBidRequestExt(bidRequest *openrtb.BidRequest) (*openrtb_ext.ExtRequest, error) { +func extractBidRequestExt(bidRequest *openrtb2.BidRequest) (*openrtb_ext.ExtRequest, error) { requestExt := &openrtb_ext.ExtRequest{} if bidRequest == nil { @@ -660,7 +660,7 @@ func getExtTargetData(requestExt *openrtb_ext.ExtRequest, cacheInstructions *ext return targData } -func getDebugInfo(bidRequest *openrtb.BidRequest, requestExt *openrtb_ext.ExtRequest) bool { +func getDebugInfo(bidRequest *openrtb2.BidRequest, requestExt *openrtb_ext.ExtRequest) bool { return (bidRequest != nil && bidRequest.Test == 1) || (requestExt != nil && requestExt.Prebid.Debug) } diff --git a/exchange/utils_test.go b/exchange/utils_test.go index f8603f18f4f..05e22548639 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/gdpr" @@ -58,28 +58,28 @@ func assertReq(t *testing.T, bidderRequests []BidderRequest, func TestSplitImps(t *testing.T) { testCases := []struct { description string - givenImps []openrtb.Imp - expectedImps map[string][]openrtb.Imp + givenImps []openrtb2.Imp + expectedImps map[string][]openrtb2.Imp expectedError string }{ { description: "Nil", givenImps: nil, - expectedImps: map[string][]openrtb.Imp{}, + expectedImps: map[string][]openrtb2.Imp{}, expectedError: "", }, { description: "Empty", - givenImps: []openrtb.Imp{}, - expectedImps: map[string][]openrtb.Imp{}, + givenImps: []openrtb2.Imp{}, + expectedImps: map[string][]openrtb2.Imp{}, expectedError: "", }, { description: "1 Imp, 1 Bidder", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1ParamA":"imp1ValueA"}}}}`)}, }, - expectedImps: map[string][]openrtb.Imp{ + expectedImps: map[string][]openrtb2.Imp{ "bidderA": { {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamA":"imp1ValueA"}}`)}, }, @@ -88,10 +88,10 @@ func TestSplitImps(t *testing.T) { }, { description: "1 Imp, 2 Bidders", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1ParamA":"imp1ValueA"},"bidderB":{"imp1ParamB":"imp1ValueB"}}}}`)}, }, - expectedImps: map[string][]openrtb.Imp{ + expectedImps: map[string][]openrtb2.Imp{ "bidderA": { {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamA":"imp1ValueA"}}`)}, }, @@ -103,11 +103,11 @@ func TestSplitImps(t *testing.T) { }, { description: "2 Imps, 1 Bidders Each", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1ParamA":"imp1ValueA"}}}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp2ParamA":"imp2ValueA"}}}}`)}, }, - expectedImps: map[string][]openrtb.Imp{ + expectedImps: map[string][]openrtb2.Imp{ "bidderA": { {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1ParamA":"imp1ValueA"}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2ParamA":"imp2ValueA"}}`)}, @@ -117,11 +117,11 @@ func TestSplitImps(t *testing.T) { }, { description: "2 Imps, 2 Bidders Each", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1paramA":"imp1valueA"},"bidderB":{"imp1paramB":"imp1valueB"}}}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp2paramA":"imp2valueA"},"bidderB":{"imp2paramB":"imp2valueB"}}}}`)}, }, - expectedImps: map[string][]openrtb.Imp{ + expectedImps: map[string][]openrtb2.Imp{ "bidderA": { {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramA":"imp1valueA"}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramA":"imp2valueA"}}`)}, @@ -136,11 +136,11 @@ func TestSplitImps(t *testing.T) { { // This is a "happy path" integration test. Functionality is covered in detail by TestCreateSanitizedImpExt. description: "Other Fields - 2 Imps, 2 Bidders Each", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp1paramA":"imp1valueA"},"bidderB":{"imp1paramB":"imp1valueB"}}},"skadn":"imp1SkAdN"}`)}, {ID: "imp2", Ext: json.RawMessage(`{"prebid":{"bidder":{"bidderA":{"imp2paramA":"imp2valueA"},"bidderB":{"imp2paramB":"imp2valueB"}}},"skadn":"imp2SkAdN"}`)}, }, - expectedImps: map[string][]openrtb.Imp{ + expectedImps: map[string][]openrtb2.Imp{ "bidderA": { {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramA":"imp1valueA"},"skadn":"imp1SkAdN"}`)}, {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramA":"imp2valueA"},"skadn":"imp2SkAdN"}`)}, @@ -155,11 +155,11 @@ func TestSplitImps(t *testing.T) { { // This is a "happy path" integration test. Functionality is covered in detail by TestExtractBidderExts. description: "Legacy imp.ext.BIDDER - 2 Imps, 2 Bidders Each", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"bidderA":{"imp1paramA":"imp1valueA"},"bidderB":{"imp1paramB":"imp1valueB"}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"bidderA":{"imp2paramA":"imp2valueA"},"bidderB":{"imp2paramB":"imp2valueB"}}`)}, }, - expectedImps: map[string][]openrtb.Imp{ + expectedImps: map[string][]openrtb2.Imp{ "bidderA": { {ID: "imp1", Ext: json.RawMessage(`{"bidder":{"imp1paramA":"imp1valueA"}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"bidder":{"imp2paramA":"imp2valueA"}}`)}, @@ -173,21 +173,21 @@ func TestSplitImps(t *testing.T) { }, { description: "Malformed imp.ext", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`malformed`)}, }, expectedError: "invalid json for imp[0]: invalid character 'm' looking for beginning of value", }, { description: "Malformed imp.ext.prebid", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid": malformed}`)}, }, expectedError: "invalid json for imp[0]: invalid character 'm' looking for beginning of value", }, { description: "Malformed imp.ext.prebid.bidder", - givenImps: []openrtb.Imp{ + givenImps: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"prebid": {"bidder": malformed}}`)}, }, expectedError: "invalid json for imp[0]: invalid character 'm' looking for beginning of value", @@ -594,7 +594,7 @@ func TestCleanOpenRTBRequestsCCPA(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) req.Ext = test.reqExt - req.Regs = &openrtb.Regs{ + req.Regs = &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy":"` + test.ccpaConsent + `"}`), } @@ -664,7 +664,7 @@ func TestCleanOpenRTBRequestsCCPAErrors(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) req.Ext = test.reqExt - req.Regs = &openrtb.Regs{Ext: test.reqRegsExt} + req.Regs = &openrtb2.Regs{Ext: test.reqRegsExt} var reqExtStruct openrtb_ext.ExtRequest err := json.Unmarshal(req.Ext, &reqExtStruct) @@ -713,7 +713,7 @@ func TestCleanOpenRTBRequestsCOPPA(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) - req.Regs = &openrtb.Regs{COPPA: test.coppa} + req.Regs = &openrtb2.Regs{COPPA: test.coppa} auctionReq := AuctionRequest{ BidRequest: req, @@ -847,13 +847,13 @@ func TestExtractBidRequestExt(t *testing.T) { testCases := []struct { desc string - inBidRequest *openrtb.BidRequest + inBidRequest *openrtb2.BidRequest outRequestExt *openrtb_ext.ExtRequest outError error }{ { desc: "Valid vastxml.returnCreative set to false", - inBidRequest: &openrtb.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":false}}}}`)}, + inBidRequest: &openrtb2.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":false}}}}`)}, outRequestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ Debug: true, @@ -868,7 +868,7 @@ func TestExtractBidRequestExt(t *testing.T) { }, { desc: "Valid vastxml.returnCreative set to true", - inBidRequest: &openrtb.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":true}}}}`)}, + inBidRequest: &openrtb2.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":true}}}}`)}, outRequestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ Debug: true, @@ -889,13 +889,13 @@ func TestExtractBidRequestExt(t *testing.T) { }, { desc: "Non-nil bidRequest with empty Ext, we expect a blank requestExt", - inBidRequest: &openrtb.BidRequest{}, + inBidRequest: &openrtb2.BidRequest{}, outRequestExt: &openrtb_ext.ExtRequest{}, outError: nil, }, { desc: "Non-nil bidRequest with non-empty, invalid Ext, we expect unmarshaling error", - inBidRequest: &openrtb.BidRequest{Ext: json.RawMessage(`invalid`)}, + inBidRequest: &openrtb2.BidRequest{Ext: json.RawMessage(`invalid`)}, outRequestExt: &openrtb_ext.ExtRequest{}, outError: fmt.Errorf("Error decoding Request.ext : invalid character 'i' looking for beginning of value"), }, @@ -1263,7 +1263,7 @@ func TestGetExtTargetData(t *testing.T) { func TestGetDebugInfo(t *testing.T) { type inTest struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest requestExt *openrtb_ext.ExtRequest } testCases := []struct { @@ -1278,7 +1278,7 @@ func TestGetDebugInfo(t *testing.T) { }, { desc: "bid request test == 0, nil requestExt", - in: inTest{&openrtb.BidRequest{Test: 0}, nil}, + in: inTest{&openrtb2.BidRequest{Test: 0}, nil}, out: false, }, { @@ -1288,22 +1288,22 @@ func TestGetDebugInfo(t *testing.T) { }, { desc: "bid request test == 0, requestExt debug flag false", - in: inTest{&openrtb.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, + in: inTest{&openrtb2.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, out: false, }, { desc: "bid request test == 1, requestExt debug flag false", - in: inTest{&openrtb.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, + in: inTest{&openrtb2.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, out: true, }, { desc: "bid request test == 0, requestExt debug flag true", - in: inTest{&openrtb.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, + in: inTest{&openrtb2.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, out: true, }, { desc: "bid request test == 1, requestExt debug flag true", - in: inTest{&openrtb.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, + in: inTest{&openrtb2.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, out: true, }, } @@ -1593,7 +1593,7 @@ func TestCleanOpenRTBRequestsGDPR(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) req.User.Ext = json.RawMessage(`{"consent":"` + test.gdprConsent + `"}`) - req.Regs = &openrtb.Regs{ + req.Regs = &openrtb2.Regs{ Ext: json.RawMessage(`{"gdpr":` + test.gdpr + `}`), } @@ -1646,17 +1646,17 @@ func TestCleanOpenRTBRequestsGDPR(t *testing.T) { } // newAdapterAliasBidRequest builds a BidRequest with aliases -func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { +func newAdapterAliasBidRequest(t *testing.T) *openrtb2.BidRequest { dnt := int8(1) - return &openrtb.BidRequest{ - Site: &openrtb.Site{ + return &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ DIDMD5: "some device ID hash", UA: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", IFA: "ifa", @@ -1664,21 +1664,21 @@ func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { DNT: &dnt, Language: "EN", }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"gdpr":1}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1692,35 +1692,35 @@ func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { } } -func newBidRequest(t *testing.T) *openrtb.BidRequest { - return &openrtb.BidRequest{ - Site: &openrtb.Site{ +func newBidRequest(t *testing.T) *openrtb2.BidRequest { + return &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ DIDMD5: "some device ID hash", UA: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", IFA: "ifa", IP: "132.173.230.74", Language: "EN", }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Yob: 1982, Ext: json.RawMessage(`{"digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1969,8 +1969,8 @@ func TestRemoveUnpermissionedEids(t *testing.T) { } for _, test := range testCases { - request := &openrtb.BidRequest{ - User: &openrtb.User{Ext: test.userExt}, + request := &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: test.userExt}, } requestExt := &openrtb_ext.ExtRequest{ @@ -1981,8 +1981,8 @@ func TestRemoveUnpermissionedEids(t *testing.T) { }, } - expectedRequest := &openrtb.BidRequest{ - User: &openrtb.User{Ext: test.expectedUserExt}, + expectedRequest := &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: test.expectedUserExt}, } resultErr := removeUnpermissionedEids(request, bidder, requestExt) @@ -2015,8 +2015,8 @@ func TestRemoveUnpermissionedEidsUnmarshalErrors(t *testing.T) { } for _, test := range testCases { - request := &openrtb.BidRequest{ - User: &openrtb.User{Ext: test.userExt}, + request := &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: test.userExt}, } requestExt := &openrtb_ext.ExtRequest{ @@ -2037,12 +2037,12 @@ func TestRemoveUnpermissionedEidsUnmarshalErrors(t *testing.T) { func TestRemoveUnpermissionedEidsEmptyValidations(t *testing.T) { testCases := []struct { description string - request *openrtb.BidRequest + request *openrtb2.BidRequest requestExt *openrtb_ext.ExtRequest }{ { description: "Nil User", - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ User: nil, }, requestExt: &openrtb_ext.ExtRequest{ @@ -2057,8 +2057,8 @@ func TestRemoveUnpermissionedEidsEmptyValidations(t *testing.T) { }, { description: "Empty User", - request: &openrtb.BidRequest{ - User: &openrtb.User{}, + request: &openrtb2.BidRequest{ + User: &openrtb2.User{}, }, requestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ @@ -2072,15 +2072,15 @@ func TestRemoveUnpermissionedEidsEmptyValidations(t *testing.T) { }, { description: "Nil Ext", - request: &openrtb.BidRequest{ - User: &openrtb.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, + request: &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, }, requestExt: nil, }, { description: "Nil Prebid Data", - request: &openrtb.BidRequest{ - User: &openrtb.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, + request: &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, }, requestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ diff --git a/go.mod b/go.mod index 48fc6b6479b..67f95057bee 100644 --- a/go.mod +++ b/go.mod @@ -23,19 +23,16 @@ require ( github.com/influxdata/influxdb v1.6.1 github.com/julienschmidt/httprouter v1.1.0 github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect - github.com/kr/pretty v0.2.0 // indirect github.com/lib/pq v1.0.0 github.com/magiconair/properties v1.8.0 github.com/mattn/go-colorable v0.1.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/mapstructure v1.0.0 // indirect - github.com/mssola/user_agent v0.4.1 // indirect - github.com/mxmCherry/openrtb v11.0.0+incompatible + github.com/mxmCherry/openrtb/v14 v14.0.0 github.com/onsi/ginkgo v1.10.1 // indirect github.com/onsi/gomega v1.7.0 // indirect github.com/pelletier/go-toml v1.2.0 // indirect github.com/prebid/go-gdpr v0.8.3 - github.com/prebid/prebid-cache v0.0.0-20200218152159-6d6d678c1caf // indirect github.com/prometheus/client_golang v0.0.0-20180623155954-77e8f2ddcfed github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect diff --git a/go.sum b/go.sum index 6da3f8898ba..f9c9bb887da 100644 --- a/go.sum +++ b/go.sum @@ -48,11 +48,6 @@ github.com/julienschmidt/httprouter v1.1.0 h1:7wLdtIiIpzOkC9u6sXOozpBauPdskj3ru4 github.com/julienschmidt/httprouter v1.1.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= @@ -65,13 +60,13 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I= github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mssola/user_agent v0.4.1 h1:iTUaMpVrb2qWyvUw8UvK3ygWMd2lB1NGuZ1xhpBf1eg= -github.com/mssola/user_agent v0.4.1/go.mod h1:UFiKPVaShrJGW93n4uo8dpPdg1BSVpw2P9bneo0Mtp8= -github.com/mxmCherry/openrtb v11.0.0+incompatible h1:tNzh7vKwQ8lopBAadyN3QPryawXSaVXYWi1IVluXHiM= -github.com/mxmCherry/openrtb v11.0.0+incompatible/go.mod h1:zpnz6Au3bzTGplpRU0kvFPNT6g4ROAKx/GkrslFDwZk= +github.com/mxmCherry/openrtb/v14 v14.0.0 h1:7CUpdQi6Hqi9k03AaUAZVYF3Kqt6ZXryBUFQv8IA/N8= +github.com/mxmCherry/openrtb/v14 v14.0.0/go.mod h1:aAj4RuDpol+zMEVyKiDqiXPHfXevLVmyAf3f6BkRaJw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= @@ -80,12 +75,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prebid/go-gdpr v0.8.3 h1:rjCZNV0AdKygiGHpVhNB42usjEpTN3qidXUPB1yarb0= github.com/prebid/go-gdpr v0.8.3/go.mod h1:TGzgqQDGKOVUkbqmY25K4uvcwMywSddXEaY4zUFiVBQ= -github.com/prebid/prebid-cache v0.0.0-20200218152159-6d6d678c1caf h1:CcE+KN1tCtWKsUFH5IzdQxHIgP609VSIVe5Hywg2phs= -github.com/prebid/prebid-cache v0.0.0-20200218152159-6d6d678c1caf/go.mod h1:k5xrl5ZpnumN1S2x8w8cMiFYsgRuVyAeFJz+BkSi+98= github.com/prometheus/client_golang v0.0.0-20180623155954-77e8f2ddcfed h1:0dloFFFNNDG7c+8qtkYw2FdADrWy9s5cI8wHp6tK3Mg= github.com/prometheus/client_golang v0.0.0-20180623155954-77e8f2ddcfed/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= -github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrOUCzh1Y3Re6aJUUWRp2M9+Oc3eVn/54= @@ -136,7 +127,6 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9 golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/openrtb_ext/bid_request_video.go b/openrtb_ext/bid_request_video.go index 09edf51d0db..16b66fc20fc 100644 --- a/openrtb_ext/bid_request_video.go +++ b/openrtb_ext/bid_request_video.go @@ -1,8 +1,6 @@ package openrtb_ext -import ( - "github.com/mxmCherry/openrtb" -) +import "github.com/mxmCherry/openrtb/v14/openrtb2" type BidRequestVideo struct { // Attribute: @@ -27,7 +25,7 @@ type BidRequestVideo struct { // object; App or Site required // Description: // Application where the impression will be shown - App *openrtb.App `json:"app"` + App *openrtb2.App `json:"app"` // Attribute: // site @@ -35,7 +33,7 @@ type BidRequestVideo struct { // object; App or Site required // Description: // Site where the impression will be shown - Site *openrtb.Site `json:"site"` + Site *openrtb2.Site `json:"site"` // Attribute: // user @@ -43,7 +41,7 @@ type BidRequestVideo struct { // object; optional // Description: // Container object for the user of of the actual device - User *openrtb.User `json:"user,omitempty"` + User *openrtb2.User `json:"user,omitempty"` // Attribute: // device @@ -51,7 +49,7 @@ type BidRequestVideo struct { // object; optional // Description: // Device specific data - Device openrtb.Device `json:"device,omitempty"` + Device openrtb2.Device `json:"device,omitempty"` // Attribute: // includebrandcategory @@ -67,7 +65,7 @@ type BidRequestVideo struct { // object; required // Description: // Player container object - Video *openrtb.Video `json:"video,omitempty"` + Video *openrtb2.Video `json:"video,omitempty"` // Attribute: // content @@ -75,7 +73,7 @@ type BidRequestVideo struct { // object; optional // Description: // Misc content meta data that can be used for targeting the adPod(s) - Content openrtb.Content `json:"content,omitempty"` + Content openrtb2.Content `json:"content,omitempty"` // Attribute: // cacheconfig @@ -135,7 +133,7 @@ type BidRequestVideo struct { // object; optional // Description: // Contains the OpenRTB Regs object to be passed to OpenRTB request - Regs *openrtb.Regs `json:"regs,omitempty"` + Regs *openrtb2.Regs `json:"regs,omitempty"` // Attribute: // supportdeals diff --git a/openrtb_ext/deal_tier.go b/openrtb_ext/deal_tier.go index 8583c053e8f..66236e9477d 100644 --- a/openrtb_ext/deal_tier.go +++ b/openrtb_ext/deal_tier.go @@ -3,7 +3,7 @@ package openrtb_ext import ( "encoding/json" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" ) // DealTier defines the configuration of a deal tier. @@ -20,7 +20,7 @@ type DealTier struct { type DealTierBidderMap map[BidderName]DealTier // ReadDealTiersFromImp returns a map of bidder deal tiers read from the impression of an original request (not split / cleaned). -func ReadDealTiersFromImp(imp openrtb.Imp) (DealTierBidderMap, error) { +func ReadDealTiersFromImp(imp openrtb2.Imp) (DealTierBidderMap, error) { dealTiers := make(DealTierBidderMap) if len(imp.Ext) == 0 { diff --git a/openrtb_ext/deal_tier_test.go b/openrtb_ext/deal_tier_test.go index 1bb4d5648f0..607956ecb38 100644 --- a/openrtb_ext/deal_tier_test.go +++ b/openrtb_ext/deal_tier_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) @@ -83,7 +83,7 @@ func TestReadDealTiersFromImp(t *testing.T) { } for _, test := range testCases { - imp := openrtb.Imp{Ext: test.impExt} + imp := openrtb2.Imp{Ext: test.impExt} result, err := ReadDealTiersFromImp(imp) diff --git a/openrtb_ext/response.go b/openrtb_ext/response.go index d517704f44d..d61ec54a887 100644 --- a/openrtb_ext/response.go +++ b/openrtb_ext/response.go @@ -1,8 +1,6 @@ package openrtb_ext -import ( - "github.com/mxmCherry/openrtb" -) +import "github.com/mxmCherry/openrtb/v14/openrtb2" // ExtBidResponse defines the contract for bidresponse.ext type ExtBidResponse struct { @@ -27,7 +25,7 @@ type ExtResponseDebug struct { // HttpCalls defines the contract for bidresponse.ext.debug.httpcalls HttpCalls map[BidderName][]*ExtHttpCall `json:"httpcalls,omitempty"` // Request after resolution of stored requests and debug overrides - ResolvedRequest *openrtb.BidRequest `json:"resolvedrequest,omitempty"` + ResolvedRequest *openrtb2.BidRequest `json:"resolvedrequest,omitempty"` } // ExtResponseSyncData defines the contract for bidresponse.ext.usersync.{bidder} diff --git a/pbs/pbsrequest.go b/pbs/pbsrequest.go index 30f8bd25c0d..795cfaf9533 100644 --- a/pbs/pbsrequest.go +++ b/pbs/pbsrequest.go @@ -10,6 +10,7 @@ import ( "strings" "time" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/cache" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/stored_requests" @@ -20,7 +21,6 @@ import ( "github.com/blang/semver" "github.com/buger/jsonparser" "github.com/golang/glog" - "github.com/mxmCherry/openrtb" "golang.org/x/net/publicsuffix" ) @@ -84,18 +84,18 @@ type PBSVideo struct { } type AdUnit struct { - Code string `json:"code"` - TopFrame int8 `json:"is_top_frame"` - Sizes []openrtb.Format `json:"sizes"` - Bids []Bids `json:"bids"` - ConfigID string `json:"config_id"` - MediaTypes []string `json:"media_types"` - Instl int8 `json:"instl"` - Video PBSVideo `json:"video"` + Code string `json:"code"` + TopFrame int8 `json:"is_top_frame"` + Sizes []openrtb2.Format `json:"sizes"` + Bids []Bids `json:"bids"` + ConfigID string `json:"config_id"` + MediaTypes []string `json:"media_types"` + Instl int8 `json:"instl"` + Video PBSVideo `json:"video"` } type PBSAdUnit struct { - Sizes []openrtb.Format + Sizes []openrtb2.Format TopFrame int8 Code string BidID string @@ -153,27 +153,27 @@ func (bidder *PBSBidder) LookupAdUnit(Code string) (unit *PBSAdUnit) { } type PBSRequest struct { - AccountID string `json:"account_id"` - Tid string `json:"tid"` - CacheMarkup int8 `json:"cache_markup"` - SortBids int8 `json:"sort_bids"` - MaxKeyLength int8 `json:"max_key_length"` - Secure int8 `json:"secure"` - TimeoutMillis int64 `json:"timeout_millis"` - AdUnits []AdUnit `json:"ad_units"` - IsDebug bool `json:"is_debug"` - App *openrtb.App `json:"app"` - Device *openrtb.Device `json:"device"` - PBSUser json.RawMessage `json:"user"` - SDK *SDK `json:"sdk"` + AccountID string `json:"account_id"` + Tid string `json:"tid"` + CacheMarkup int8 `json:"cache_markup"` + SortBids int8 `json:"sort_bids"` + MaxKeyLength int8 `json:"max_key_length"` + Secure int8 `json:"secure"` + TimeoutMillis int64 `json:"timeout_millis"` + AdUnits []AdUnit `json:"ad_units"` + IsDebug bool `json:"is_debug"` + App *openrtb2.App `json:"app"` + Device *openrtb2.Device `json:"device"` + PBSUser json.RawMessage `json:"user"` + SDK *SDK `json:"sdk"` // internal Bidders []*PBSBidder `json:"-"` - User *openrtb.User `json:"-"` + User *openrtb2.User `json:"-"` Cookie *usersync.PBSCookie `json:"-"` Url string `json:"-"` Domain string `json:"-"` - Regs *openrtb.Regs `json:"-"` + Regs *openrtb2.Regs `json:"-"` Start time.Time } @@ -236,7 +236,7 @@ func ParsePBSRequest(r *http.Request, cfg *config.AuctionTimeouts, cache cache.C pbsReq.TimeoutMillis = int64(cfg.LimitAuctionTimeout(time.Duration(pbsReq.TimeoutMillis)*time.Millisecond) / time.Millisecond) if pbsReq.Device == nil { - pbsReq.Device = &openrtb.Device{} + pbsReq.Device = &openrtb2.Device{} } if ip, _ := httputil.FindIP(r, ipv4Validator); ip != nil { pbsReq.Device.IP = ip.String() @@ -259,7 +259,7 @@ func ParsePBSRequest(r *http.Request, cfg *config.AuctionTimeouts, cache cache.C } if pbsReq.User == nil { - pbsReq.User = &openrtb.User{} + pbsReq.User = &openrtb2.User{} } // use client-side data for web requests diff --git a/pbs/pbsresponse.go b/pbs/pbsresponse.go index 7c6cea31261..b8cf2c19ff7 100644 --- a/pbs/pbsresponse.go +++ b/pbs/pbsresponse.go @@ -32,9 +32,9 @@ type PBSBid struct { // If NURL and Adm are both defined, then Adm takes precedence. Adm string `json:"adm,omitempty"` // Width is the intended width which Adm should be shown, in pixels. - Width uint64 `json:"width,omitempty"` + Width int64 `json:"width,omitempty"` // Height is the intended width which Adm should be shown, in pixels. - Height uint64 `json:"height,omitempty"` + Height int64 `json:"height,omitempty"` // DealId is not used by prebid-server, but may be used by buyers and sellers who make special // deals with each other. We simply pass this information along with the bid. DealId string `json:"deal_id,omitempty"` diff --git a/prebid_cache_client/client.go b/prebid_cache_client/client.go index 88c197cd0b8..730d54b0acb 100644 --- a/prebid_cache_client/client.go +++ b/prebid_cache_client/client.go @@ -22,7 +22,7 @@ import ( // Client stores values in Prebid Cache. For more info, see https://github.com/prebid/prebid-cache type Client interface { - // PutJson stores JSON values for the given openrtb.Bids in the cache. Null values will be + // PutJson stores JSON values for the given openrtb2.Bids in the cache. Null values will be // // The returned string slice will always have the same number of elements as the values argument. If a // value could not be saved, the element will be an empty string. Implementations are responsible for diff --git a/prebid_cache_client/prebid_cache.go b/prebid_cache_client/prebid_cache.go index c2f682c6129..cde7ec8d951 100644 --- a/prebid_cache_client/prebid_cache.go +++ b/prebid_cache_client/prebid_cache.go @@ -22,8 +22,8 @@ type CacheObject struct { type BidCache struct { Adm string `json:"adm,omitempty"` NURL string `json:"nurl,omitempty"` - Width uint64 `json:"width,omitempty"` - Height uint64 `json:"height,omitempty"` + Width int64 `json:"width,omitempty"` + Height int64 `json:"height,omitempty"` } // internal protocol objects diff --git a/privacy/ccpa/consentwriter.go b/privacy/ccpa/consentwriter.go index 4856655402b..67b5681deca 100644 --- a/privacy/ccpa/consentwriter.go +++ b/privacy/ccpa/consentwriter.go @@ -1,8 +1,6 @@ package ccpa -import ( - "github.com/mxmCherry/openrtb" -) +import "github.com/mxmCherry/openrtb/v14/openrtb2" // ConsentWriter implements the PolicyWriter interface for CCPA. type ConsentWriter struct { @@ -10,7 +8,7 @@ type ConsentWriter struct { } // Write mutates an OpenRTB bid request with the CCPA consent string. -func (c ConsentWriter) Write(req *openrtb.BidRequest) error { +func (c ConsentWriter) Write(req *openrtb2.BidRequest) error { if req == nil { return nil } diff --git a/privacy/ccpa/consentwriter_test.go b/privacy/ccpa/consentwriter_test.go index 57a7f8f4ddf..d805936cf72 100644 --- a/privacy/ccpa/consentwriter_test.go +++ b/privacy/ccpa/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) @@ -12,8 +12,8 @@ func TestConsentWriter(t *testing.T) { consent := "anyConsent" testCases := []struct { description string - request *openrtb.BidRequest - expected *openrtb.BidRequest + request *openrtb2.BidRequest + expected *openrtb2.BidRequest expectedError bool }{ { @@ -23,19 +23,19 @@ func TestConsentWriter(t *testing.T) { }, { description: "Success", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, }, { description: "Error With Regs.Ext - Does Not Mutate", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, expectedError: true, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, }, } diff --git a/privacy/ccpa/parsedpolicy_test.go b/privacy/ccpa/parsedpolicy_test.go index 2f7e8bfd683..183a774363c 100644 --- a/privacy/ccpa/parsedpolicy_test.go +++ b/privacy/ccpa/parsedpolicy_test.go @@ -3,7 +3,7 @@ package ccpa import ( "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -385,7 +385,7 @@ type mockPolicWriter struct { mock.Mock } -func (m *mockPolicWriter) Write(req *openrtb.BidRequest) error { +func (m *mockPolicWriter) Write(req *openrtb2.BidRequest) error { args := m.Called(req) return args.Error(0) } diff --git a/privacy/ccpa/policy.go b/privacy/ccpa/policy.go index a9f1c49e47d..64250375106 100644 --- a/privacy/ccpa/policy.go +++ b/privacy/ccpa/policy.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" ) @@ -16,7 +16,7 @@ type Policy struct { } // ReadFromRequest extracts the CCPA regulatory information from an OpenRTB bid request. -func ReadFromRequest(req *openrtb.BidRequest) (Policy, error) { +func ReadFromRequest(req *openrtb2.BidRequest) (Policy, error) { var consent string var noSaleBidders []string @@ -46,7 +46,7 @@ func ReadFromRequest(req *openrtb.BidRequest) (Policy, error) { } // Write mutates an OpenRTB bid request with the CCPA regulatory information. -func (p Policy) Write(req *openrtb.BidRequest) error { +func (p Policy) Write(req *openrtb2.BidRequest) error { if req == nil { return nil } @@ -65,14 +65,14 @@ func (p Policy) Write(req *openrtb.BidRequest) error { return nil } -func buildRegs(consent string, regs *openrtb.Regs) (*openrtb.Regs, error) { +func buildRegs(consent string, regs *openrtb2.Regs) (*openrtb2.Regs, error) { if consent == "" { return buildRegsClear(regs) } return buildRegsWrite(consent, regs) } -func buildRegsClear(regs *openrtb.Regs) (*openrtb.Regs, error) { +func buildRegsClear(regs *openrtb2.Regs) (*openrtb2.Regs, error) { if regs == nil || len(regs.Ext) == 0 { return regs, nil } @@ -92,7 +92,7 @@ func buildRegsClear(regs *openrtb.Regs) (*openrtb.Regs, error) { } // Marshal ext if there are still other fields - var regsResult openrtb.Regs + var regsResult openrtb2.Regs ext, err := json.Marshal(extMap) if err == nil { regsResult = *regs @@ -101,9 +101,9 @@ func buildRegsClear(regs *openrtb.Regs) (*openrtb.Regs, error) { return ®sResult, err } -func buildRegsWrite(consent string, regs *openrtb.Regs) (*openrtb.Regs, error) { +func buildRegsWrite(consent string, regs *openrtb2.Regs) (*openrtb2.Regs, error) { if regs == nil { - return marshalRegsExt(openrtb.Regs{}, openrtb_ext.ExtRegs{USPrivacy: consent}) + return marshalRegsExt(openrtb2.Regs{}, openrtb_ext.ExtRegs{USPrivacy: consent}) } if regs.Ext == nil { @@ -119,7 +119,7 @@ func buildRegsWrite(consent string, regs *openrtb.Regs) (*openrtb.Regs, error) { return marshalRegsExt(*regs, extMap) } -func marshalRegsExt(regs openrtb.Regs, ext interface{}) (*openrtb.Regs, error) { +func marshalRegsExt(regs openrtb2.Regs, ext interface{}) (*openrtb2.Regs, error) { extJSON, err := json.Marshal(ext) if err == nil { regs.Ext = extJSON diff --git a/privacy/ccpa/policy_test.go b/privacy/ccpa/policy_test.go index 7ff896e9ebf..31eca2cca57 100644 --- a/privacy/ccpa/policy_test.go +++ b/privacy/ccpa/policy_test.go @@ -4,21 +4,21 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) func TestReadFromRequest(t *testing.T) { testCases := []struct { description string - request *openrtb.BidRequest + request *openrtb2.BidRequest expectedPolicy Policy expectedError bool }{ { description: "Success", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -36,7 +36,7 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Regs", - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ Regs: nil, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, @@ -47,8 +47,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Regs.Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -58,8 +58,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Empty Regs.Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -69,8 +69,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Missing Regs.Ext USPrivacy Value", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"anythingElse":"42"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"anythingElse":"42"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -80,24 +80,24 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Malformed Regs.Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedError: true, }, { description: "Invalid Regs.Ext Type", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":123`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":123`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedError: true, }, { description: "Nil Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: nil, }, expectedPolicy: Policy{ @@ -107,8 +107,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Empty Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{}`), }, expectedPolicy: Policy{ @@ -118,8 +118,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Missing Ext.Prebid No Sale Value", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{"anythingElse":"42"}`), }, expectedPolicy: Policy{ @@ -129,24 +129,24 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Malformed Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`malformed`), }, expectedError: true, }, { description: "Invalid Ext.Prebid.NoSale Type", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":"wrongtype"}}`), }, expectedError: true, }, { description: "Injection Attack", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"1YYY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"1YYY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`)}, }, expectedPolicy: Policy{ Consent: "1YYY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", @@ -165,8 +165,8 @@ func TestWrite(t *testing.T) { testCases := []struct { description string policy Policy - request *openrtb.BidRequest - expected *openrtb.BidRequest + request *openrtb2.BidRequest + expected *openrtb2.BidRequest expectedError bool }{ { @@ -178,31 +178,31 @@ func TestWrite(t *testing.T) { { description: "Success", policy: Policy{Consent: "anyConsent", NoSaleBidders: []string{"a", "b"}}, - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a","b"]}}`), }, }, { description: "Error Regs.Ext - No Partial Update To Request", policy: Policy{Consent: "anyConsent", NoSaleBidders: []string{"a", "b"}}, - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, expectedError: true, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, }, { description: "Error Ext - No Partial Update To Request", policy: Policy{Consent: "anyConsent", NoSaleBidders: []string{"a", "b"}}, - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ Ext: json.RawMessage(`malformed}`), }, expectedError: true, - expected: &openrtb.BidRequest{ + expected: &openrtb2.BidRequest{ Ext: json.RawMessage(`malformed}`), }, }, @@ -219,22 +219,22 @@ func TestBuildRegs(t *testing.T) { testCases := []struct { description string consent string - regs *openrtb.Regs - expected *openrtb.Regs + regs *openrtb2.Regs + expected *openrtb2.Regs expectedError bool }{ { description: "Clear", consent: "", - regs: &openrtb.Regs{ + regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy":"ABC"}`), }, - expected: &openrtb.Regs{}, + expected: &openrtb2.Regs{}, }, { description: "Clear - Error", consent: "", - regs: &openrtb.Regs{ + regs: &openrtb2.Regs{ Ext: json.RawMessage(`malformed`), }, expectedError: true, @@ -243,14 +243,14 @@ func TestBuildRegs(t *testing.T) { description: "Write", consent: "anyConsent", regs: nil, - expected: &openrtb.Regs{ + expected: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`), }, }, { description: "Write - Error", consent: "anyConsent", - regs: &openrtb.Regs{ + regs: &openrtb2.Regs{ Ext: json.RawMessage(`malformed`), }, expectedError: true, @@ -267,8 +267,8 @@ func TestBuildRegs(t *testing.T) { func TestBuildRegsClear(t *testing.T) { testCases := []struct { description string - regs *openrtb.Regs - expected *openrtb.Regs + regs *openrtb2.Regs + expected *openrtb2.Regs expectedError bool }{ { @@ -278,32 +278,32 @@ func TestBuildRegsClear(t *testing.T) { }, { description: "Nil Regs.Ext", - regs: &openrtb.Regs{Ext: nil}, - expected: &openrtb.Regs{Ext: nil}, + regs: &openrtb2.Regs{Ext: nil}, + expected: &openrtb2.Regs{Ext: nil}, }, { description: "Empty Regs.Ext", - regs: &openrtb.Regs{Ext: json.RawMessage(`{}`)}, - expected: &openrtb.Regs{}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{}`)}, + expected: &openrtb2.Regs{}, }, { description: "Removes Regs.Ext Entirely", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, - expected: &openrtb.Regs{}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + expected: &openrtb2.Regs{}, }, { description: "Leaves Other Regs.Ext Values", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC", "other":"any"}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC", "other":"any"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, }, { description: "Invalid Regs.Ext Type - Still Cleared", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, - expected: &openrtb.Regs{}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, + expected: &openrtb2.Regs{}, }, { description: "Malformed Regs.Ext", - regs: &openrtb.Regs{Ext: json.RawMessage(`malformed`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed`)}, expectedError: true, }, } @@ -319,50 +319,50 @@ func TestBuildRegsWrite(t *testing.T) { testCases := []struct { description string consent string - regs *openrtb.Regs - expected *openrtb.Regs + regs *openrtb2.Regs + expected *openrtb2.Regs expectedError bool }{ { description: "Nil Regs", consent: "anyConsent", regs: nil, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Nil Regs.Ext", consent: "anyConsent", - regs: &openrtb.Regs{Ext: nil}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: nil}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Empty Regs.Ext", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Overwrites Existing", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Leaves Other Ext Values", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"other":"any","us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"other":"any","us_privacy":"anyConsent"}`)}, }, { description: "Invalid Regs.Ext Type - Still Overwrites", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Malformed Regs.Ext", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`malformed`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed`)}, expectedError: true, }, } diff --git a/privacy/enforcement.go b/privacy/enforcement.go index 64070ae3a6a..4b946966206 100644 --- a/privacy/enforcement.go +++ b/privacy/enforcement.go @@ -1,8 +1,6 @@ package privacy -import ( - "github.com/mxmCherry/openrtb" -) +import "github.com/mxmCherry/openrtb/v14/openrtb2" // Enforcement represents the privacy policies to enforce for an OpenRTB bid request. type Enforcement struct { @@ -19,11 +17,11 @@ func (e Enforcement) Any() bool { } // Apply cleans personally identifiable information from an OpenRTB bid request. -func (e Enforcement) Apply(bidRequest *openrtb.BidRequest) { +func (e Enforcement) Apply(bidRequest *openrtb2.BidRequest) { e.apply(bidRequest, NewScrubber()) } -func (e Enforcement) apply(bidRequest *openrtb.BidRequest, scrubber Scrubber) { +func (e Enforcement) apply(bidRequest *openrtb2.BidRequest, scrubber Scrubber) { if bidRequest != nil && e.Any() { bidRequest.Device = scrubber.ScrubDevice(bidRequest.Device, e.getDeviceIDScrubStrategy(), e.getIPv4ScrubStrategy(), e.getIPv6ScrubStrategy(), e.getGeoScrubStrategy()) bidRequest.User = scrubber.ScrubUser(bidRequest.User, e.getUserScrubStrategy(), e.getGeoScrubStrategy()) diff --git a/privacy/enforcement_test.go b/privacy/enforcement_test.go index 9240aafc2c3..5080709f2cb 100644 --- a/privacy/enforcement_test.go +++ b/privacy/enforcement_test.go @@ -3,7 +3,7 @@ package privacy import ( "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -197,12 +197,12 @@ func TestApply(t *testing.T) { } for _, test := range testCases { - req := &openrtb.BidRequest{ - Device: &openrtb.Device{}, - User: &openrtb.User{}, + req := &openrtb2.BidRequest{ + Device: &openrtb2.Device{}, + User: &openrtb2.User{}, } - replacedDevice := &openrtb.Device{} - replacedUser := &openrtb.User{} + replacedDevice := &openrtb2.Device{} + replacedUser := &openrtb2.User{} m := &mockScrubber{} m.On("ScrubDevice", req.Device, test.expectedDeviceID, test.expectedDeviceIPv4, test.expectedDeviceIPv6, test.expectedDeviceGeo).Return(replacedDevice).Once() @@ -217,7 +217,7 @@ func TestApply(t *testing.T) { } func TestApplyNoneApplicable(t *testing.T) { - req := &openrtb.BidRequest{} + req := &openrtb2.BidRequest{} m := &mockScrubber{} @@ -248,12 +248,12 @@ type mockScrubber struct { mock.Mock } -func (m *mockScrubber) ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb.Device { +func (m *mockScrubber) ScrubDevice(device *openrtb2.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb2.Device { args := m.Called(device, id, ipv4, ipv6, geo) - return args.Get(0).(*openrtb.Device) + return args.Get(0).(*openrtb2.Device) } -func (m *mockScrubber) ScrubUser(user *openrtb.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb.User { +func (m *mockScrubber) ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb2.User { args := m.Called(user, strategy, geo) - return args.Get(0).(*openrtb.User) + return args.Get(0).(*openrtb2.User) } diff --git a/privacy/gdpr/consentwriter.go b/privacy/gdpr/consentwriter.go index 040bbd6c94b..53885e51d49 100644 --- a/privacy/gdpr/consentwriter.go +++ b/privacy/gdpr/consentwriter.go @@ -3,9 +3,8 @@ package gdpr import ( "encoding/json" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" - - "github.com/mxmCherry/openrtb" ) // ConsentWriter implements the PolicyWriter interface for GDPR TCF. @@ -14,13 +13,13 @@ type ConsentWriter struct { } // Write mutates an OpenRTB bid request with the GDPR TCF consent. -func (c ConsentWriter) Write(req *openrtb.BidRequest) error { +func (c ConsentWriter) Write(req *openrtb2.BidRequest) error { if c.Consent == "" { return nil } if req.User == nil { - req.User = &openrtb.User{} + req.User = &openrtb2.User{} } if req.User.Ext == nil { diff --git a/privacy/gdpr/consentwriter_test.go b/privacy/gdpr/consentwriter_test.go index 77fbdf88d92..9b23dccc6e4 100644 --- a/privacy/gdpr/consentwriter_test.go +++ b/privacy/gdpr/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) @@ -12,76 +12,76 @@ func TestConsentWriter(t *testing.T) { testCases := []struct { description string consent string - request *openrtb.BidRequest - expected *openrtb.BidRequest + request *openrtb2.BidRequest + expected *openrtb2.BidRequest expectedError bool }{ { description: "Empty", consent: "", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{}, + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{}, }, { description: "Enabled With Nil Request User Object", consent: "anyConsent", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent"}`)}}, }, { description: "Enabled With Nil Request User Ext Object", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{}}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent"}`)}}, }, { description: "Enabled With Existing Request User Ext Object - Doesn't Overwrite", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"existing":"any"}`)}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent","existing":"any"}`)}}, }, { description: "Enabled With Existing Request User Ext Object - Overwrites", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"existing":"any","consent":"toBeOverwritten"}`)}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent","existing":"any"}`)}}, }, { description: "Enabled With Existing Malformed Request User Ext Object", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`malformed`)}}, expectedError: true, }, { description: "Injection Attack With Nil Request User Object", consent: "BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`), }}, }, { description: "Injection Attack With Nil Request User Ext Object", consent: "BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", - request: &openrtb.BidRequest{User: &openrtb.User{}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{}}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`), }}, }, { description: "Injection Attack With Existing Request User Ext Object", consent: "BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"existing":"any"}`), }}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"","existing":"any"}`), }}, }, diff --git a/privacy/lmt/ios.go b/privacy/lmt/ios.go index cac9418643e..07bd7ce0a70 100644 --- a/privacy/lmt/ios.go +++ b/privacy/lmt/ios.go @@ -3,7 +3,7 @@ package lmt import ( "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/util/iosutil" ) @@ -14,7 +14,7 @@ var ( ) // ModifyForIOS modifies the request's LMT flag based on iOS version and identity. -func ModifyForIOS(req *openrtb.BidRequest) { +func ModifyForIOS(req *openrtb2.BidRequest) { modifiers := map[iosutil.VersionClassification]modifier{ iosutil.Version140: modifyForIOS14X, iosutil.Version141: modifyForIOS14X, @@ -23,7 +23,7 @@ func ModifyForIOS(req *openrtb.BidRequest) { modifyForIOS(req, modifiers) } -func modifyForIOS(req *openrtb.BidRequest, modifiers map[iosutil.VersionClassification]modifier) { +func modifyForIOS(req *openrtb2.BidRequest, modifiers map[iosutil.VersionClassification]modifier) { if !isRequestForIOS(req) { return } @@ -34,13 +34,13 @@ func modifyForIOS(req *openrtb.BidRequest, modifiers map[iosutil.VersionClassifi } } -func isRequestForIOS(req *openrtb.BidRequest) bool { +func isRequestForIOS(req *openrtb2.BidRequest) bool { return req != nil && req.App != nil && req.Device != nil && strings.EqualFold(req.Device.OS, "ios") } -type modifier func(req *openrtb.BidRequest) +type modifier func(req *openrtb2.BidRequest) -func modifyForIOS14X(req *openrtb.BidRequest) { +func modifyForIOS14X(req *openrtb2.BidRequest) { if req.Device.IFA == "" || req.Device.IFA == "00000000-0000-0000-0000-000000000000" { req.Device.Lmt = &int8One } else { @@ -48,7 +48,7 @@ func modifyForIOS14X(req *openrtb.BidRequest) { } } -func modifyForIOS142OrGreater(req *openrtb.BidRequest) { +func modifyForIOS142OrGreater(req *openrtb2.BidRequest) { atts, err := openrtb_ext.ParseDeviceExtATTS(req.Device.Ext) if err != nil || atts == nil { return diff --git a/privacy/lmt/ios_test.go b/privacy/lmt/ios_test.go index 1c860be33bd..5071adf4d04 100644 --- a/privacy/lmt/ios_test.go +++ b/privacy/lmt/ios_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/util/iosutil" "github.com/stretchr/testify/assert" ) @@ -13,24 +13,24 @@ import ( func TestModifyForIOS(t *testing.T) { testCases := []struct { description string - givenRequest *openrtb.BidRequest + givenRequest *openrtb2.BidRequest expectedLMT *int8 }{ { description: "13.0", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "iOS", OSV: "13.0", IFA: "", Lmt: nil}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "iOS", OSV: "13.0", IFA: "", Lmt: nil}, }, expectedLMT: nil, }, { description: "14.0", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "iOS", OSV: "14.0", IFA: "", Lmt: nil}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "iOS", OSV: "14.0", IFA: "", Lmt: nil}, }, - expectedLMT: openrtb.Int8Ptr(1), + expectedLMT: openrtb2.Int8Ptr(1), }, } @@ -43,50 +43,50 @@ func TestModifyForIOS(t *testing.T) { func TestModifyForIOSHelper(t *testing.T) { testCases := []struct { description string - givenRequest *openrtb.BidRequest + givenRequest *openrtb2.BidRequest expectedModifier140Called bool expectedModifier142Called bool }{ { description: "Valid 14.0", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "iOS", OSV: "14.0"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "iOS", OSV: "14.0"}, }, expectedModifier140Called: true, expectedModifier142Called: false, }, { description: "Valid 14.2 Or Greater", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "iOS", OSV: "14.2"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "iOS", OSV: "14.2"}, }, expectedModifier140Called: false, expectedModifier142Called: true, }, { description: "Invalid Version", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "iOS", OSV: "invalid"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "iOS", OSV: "invalid"}, }, expectedModifier140Called: false, expectedModifier142Called: false, }, { description: "Invalid OS", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "invalid", OSV: "14.0"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "invalid", OSV: "14.0"}, }, expectedModifier140Called: false, expectedModifier142Called: false, }, { description: "Invalid Nil Device", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, Device: nil, }, expectedModifier140Called: false, @@ -96,10 +96,10 @@ func TestModifyForIOSHelper(t *testing.T) { for _, test := range testCases { modifierIOS140Called := false - modifierIOS140 := func(req *openrtb.BidRequest) { modifierIOS140Called = true } + modifierIOS140 := func(req *openrtb2.BidRequest) { modifierIOS140Called = true } modifierIOS142Called := false - modifierIOS142 := func(req *openrtb.BidRequest) { modifierIOS142Called = true } + modifierIOS142 := func(req *openrtb2.BidRequest) { modifierIOS142Called = true } modifiers := map[iosutil.VersionClassification]modifier{ iosutil.Version140: modifierIOS140, @@ -116,22 +116,22 @@ func TestModifyForIOSHelper(t *testing.T) { func TestIsRequestForIOS(t *testing.T) { testCases := []struct { description string - givenRequest *openrtb.BidRequest + givenRequest *openrtb2.BidRequest expected bool }{ { description: "Valid", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "iOS"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "iOS"}, }, expected: true, }, { description: "Valid - OS Case Insensitive", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "IOS"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "IOS"}, }, expected: true, }, @@ -142,33 +142,33 @@ func TestIsRequestForIOS(t *testing.T) { }, { description: "Invalid - Nil App", - givenRequest: &openrtb.BidRequest{ + givenRequest: &openrtb2.BidRequest{ App: nil, - Device: &openrtb.Device{OS: "iOS"}, + Device: &openrtb2.Device{OS: "iOS"}, }, expected: false, }, { description: "Invalid - Nil Device", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, Device: nil, }, expected: false, }, { description: "Invalid - Empty OS", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: ""}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: ""}, }, expected: false, }, { description: "Invalid - Wrong OS", - givenRequest: &openrtb.BidRequest{ - App: &openrtb.App{}, - Device: &openrtb.Device{OS: "Android"}, + givenRequest: &openrtb2.BidRequest{ + App: &openrtb2.App{}, + Device: &openrtb2.Device{OS: "Android"}, }, expected: false, }, @@ -183,33 +183,33 @@ func TestIsRequestForIOS(t *testing.T) { func TestModifyForIOS14X(t *testing.T) { testCases := []struct { description string - givenDevice openrtb.Device + givenDevice openrtb2.Device expectedLMT *int8 }{ { description: "IFA Empty", - givenDevice: openrtb.Device{IFA: "", Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(1), + givenDevice: openrtb2.Device{IFA: "", Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(1), }, { description: "IFA Zero UUID", - givenDevice: openrtb.Device{IFA: "00000000-0000-0000-0000-000000000000", Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(1), + givenDevice: openrtb2.Device{IFA: "00000000-0000-0000-0000-000000000000", Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(1), }, { description: "IFA Populated", - givenDevice: openrtb.Device{IFA: "any-real-value", Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(0), + givenDevice: openrtb2.Device{IFA: "any-real-value", Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(0), }, { description: "Overwrites Existing", - givenDevice: openrtb.Device{IFA: "", Lmt: openrtb.Int8Ptr(0)}, - expectedLMT: openrtb.Int8Ptr(1), + givenDevice: openrtb2.Device{IFA: "", Lmt: openrtb2.Int8Ptr(0)}, + expectedLMT: openrtb2.Int8Ptr(1), }, } for _, test := range testCases { - request := &openrtb.BidRequest{Device: &test.givenDevice} + request := &openrtb2.BidRequest{Device: &test.givenDevice} modifyForIOS14X(request) assert.Equal(t, test.expectedLMT, request.Device.Lmt, test.description) } @@ -218,58 +218,58 @@ func TestModifyForIOS14X(t *testing.T) { func TestModifyForIOS142OrGreater(t *testing.T) { testCases := []struct { description string - givenDevice openrtb.Device + givenDevice openrtb2.Device expectedLMT *int8 }{ { description: "Not Determined", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":0}`), Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(0), + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":0}`), Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(0), }, { description: "Restricted", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":1}`), Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(1), + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":1}`), Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(1), }, { description: "Denied", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":2}`), Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(1), + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":2}`), Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(1), }, { description: "Authorized", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":3}`), Lmt: nil}, - expectedLMT: openrtb.Int8Ptr(0), + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":3}`), Lmt: nil}, + expectedLMT: openrtb2.Int8Ptr(0), }, { description: "Overwrites Existing", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":3}`), Lmt: openrtb.Int8Ptr(1)}, - expectedLMT: openrtb.Int8Ptr(0), + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":3}`), Lmt: openrtb2.Int8Ptr(1)}, + expectedLMT: openrtb2.Int8Ptr(0), }, { description: "Invalid Value - Unknown", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":4}`), Lmt: nil}, + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":4}`), Lmt: nil}, expectedLMT: nil, }, { description: "Invalid Value - Unknown - Does Not Overwrite Existing", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":4}`), Lmt: openrtb.Int8Ptr(1)}, - expectedLMT: openrtb.Int8Ptr(1), + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":4}`), Lmt: openrtb2.Int8Ptr(1)}, + expectedLMT: openrtb2.Int8Ptr(1), }, { description: "Invalid Value - Missing", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{}`), Lmt: nil}, + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{}`), Lmt: nil}, expectedLMT: nil, }, { description: "Invalid Value - Wrong Type", - givenDevice: openrtb.Device{Ext: json.RawMessage(`{"atts":"wrong type"}`), Lmt: nil}, + givenDevice: openrtb2.Device{Ext: json.RawMessage(`{"atts":"wrong type"}`), Lmt: nil}, expectedLMT: nil, }, } for _, test := range testCases { - request := &openrtb.BidRequest{Device: &test.givenDevice} + request := &openrtb2.BidRequest{Device: &test.givenDevice} modifyForIOS142OrGreater(request) assert.Equal(t, test.expectedLMT, request.Device.Lmt, test.description) } diff --git a/privacy/lmt/policy.go b/privacy/lmt/policy.go index 295dcc46469..e115dc3802f 100644 --- a/privacy/lmt/policy.go +++ b/privacy/lmt/policy.go @@ -1,8 +1,6 @@ package lmt -import ( - "github.com/mxmCherry/openrtb" -) +import "github.com/mxmCherry/openrtb/v14/openrtb2" const ( trackingUnrestricted = 0 @@ -16,7 +14,7 @@ type Policy struct { } // ReadFromRequest extracts the LMT (Limit Ad Tracking) policy from an OpenRTB bid request. -func ReadFromRequest(req *openrtb.BidRequest) (policy Policy) { +func ReadFromRequest(req *openrtb2.BidRequest) (policy Policy) { if req != nil && req.Device != nil && req.Device.Lmt != nil { policy.Signal = int(*req.Device.Lmt) policy.SignalProvided = true diff --git a/privacy/lmt/policy_test.go b/privacy/lmt/policy_test.go index 3027414fd02..e36f30230d8 100644 --- a/privacy/lmt/policy_test.go +++ b/privacy/lmt/policy_test.go @@ -3,7 +3,7 @@ package lmt import ( "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) @@ -12,7 +12,7 @@ func TestReadFromRequest(t *testing.T) { testCases := []struct { description string - request *openrtb.BidRequest + request *openrtb2.BidRequest expectedPolicy Policy }{ { @@ -25,7 +25,7 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Device", - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ Device: nil, }, expectedPolicy: Policy{ @@ -35,8 +35,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Device.Lmt", - request: &openrtb.BidRequest{ - Device: &openrtb.Device{ + request: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ Lmt: nil, }, }, @@ -47,8 +47,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Enabled", - request: &openrtb.BidRequest{ - Device: &openrtb.Device{ + request: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ Lmt: &one, }, }, diff --git a/privacy/scrubber.go b/privacy/scrubber.go index 8771c8b3282..d656168ae12 100644 --- a/privacy/scrubber.go +++ b/privacy/scrubber.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strings" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" ) // ScrubStrategyIPV4 defines the approach to scrub PII from an IPV4 address. @@ -73,8 +73,8 @@ const ( // Scrubber removes PII from parts of an OpenRTB request. type Scrubber interface { - ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb.Device - ScrubUser(user *openrtb.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb.User + ScrubDevice(device *openrtb2.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb2.Device + ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb2.User } type scrubber struct{} @@ -84,7 +84,7 @@ func NewScrubber() Scrubber { return scrubber{} } -func (scrubber) ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb.Device { +func (scrubber) ScrubDevice(device *openrtb2.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb2.Device { if device == nil { return nil } @@ -124,7 +124,7 @@ func (scrubber) ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ip return &deviceCopy } -func (scrubber) ScrubUser(user *openrtb.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb.User { +func (scrubber) ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb2.User { if user == nil { return nil } @@ -194,15 +194,15 @@ func removeLowestIPV6Segment(ip string) string { return ip[0:i] } -func scrubGeoFull(geo *openrtb.Geo) *openrtb.Geo { +func scrubGeoFull(geo *openrtb2.Geo) *openrtb2.Geo { if geo == nil { return nil } - return &openrtb.Geo{} + return &openrtb2.Geo{} } -func scrubGeoPrecision(geo *openrtb.Geo) *openrtb.Geo { +func scrubGeoPrecision(geo *openrtb2.Geo) *openrtb2.Geo { if geo == nil { return nil } diff --git a/privacy/scrubber_test.go b/privacy/scrubber_test.go index e0a2cb86f64..2d352e71821 100644 --- a/privacy/scrubber_test.go +++ b/privacy/scrubber_test.go @@ -4,12 +4,12 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) func TestScrubDevice(t *testing.T) { - device := &openrtb.Device{ + device := &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -19,7 +19,7 @@ func TestScrubDevice(t *testing.T) { IFA: "anyIFA", IP: "1.2.3.4", IPv6: "2001:0db8:0000:0000:0000:ff00:0042:8329", - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -30,7 +30,7 @@ func TestScrubDevice(t *testing.T) { testCases := []struct { description string - expected *openrtb.Device + expected *openrtb2.Device id ScrubStrategyDeviceID ipv4 ScrubStrategyIPV4 ipv6 ScrubStrategyIPV6 @@ -46,7 +46,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "All Strageties - Strictest", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "", DIDSHA1: "", DPIDMD5: "", @@ -56,7 +56,7 @@ func TestScrubDevice(t *testing.T) { IFA: "", IP: "1.2.3.0", IPv6: "2001:0db8:0000:0000:0000:ff00:0:0", - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, id: ScrubStrategyDeviceIDAll, ipv4: ScrubStrategyIPV4Lowest8, @@ -65,7 +65,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - ID - All", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "", DIDSHA1: "", DPIDMD5: "", @@ -84,7 +84,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - IPv4 - Lowest 8", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -103,7 +103,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - IPv6 - Lowest 16", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -122,7 +122,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - IPv6 - Lowest 32", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -141,7 +141,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - Geo - Reduced Precision", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -151,7 +151,7 @@ func TestScrubDevice(t *testing.T) { IFA: "anyIFA", IP: "1.2.3.4", IPv6: "2001:0db8:0000:0000:0000:ff00:0042:8329", - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -166,7 +166,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - Geo - Full", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -176,7 +176,7 @@ func TestScrubDevice(t *testing.T) { IFA: "anyIFA", IP: "1.2.3.4", IPv6: "2001:0db8:0000:0000:0000:ff00:0042:8329", - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, id: ScrubStrategyDeviceIDNone, ipv4: ScrubStrategyIPV4None, @@ -197,13 +197,13 @@ func TestScrubDeviceNil(t *testing.T) { } func TestScrubUser(t *testing.T) { - user := &openrtb.User{ + user := &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -214,32 +214,32 @@ func TestScrubUser(t *testing.T) { testCases := []struct { description string - expected *openrtb.User + expected *openrtb2.User scrubUser ScrubStrategyUser scrubGeo ScrubStrategyGeo }{ { description: "User ID And Demographic & Geo Full", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 0, Gender: "", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, scrubUser: ScrubStrategyUserIDAndDemographic, scrubGeo: ScrubStrategyGeoFull, }, { description: "User ID And Demographic & Geo Reduced", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 0, Gender: "", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -252,13 +252,13 @@ func TestScrubUser(t *testing.T) { }, { description: "User ID And Demographic & Geo None", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 0, Gender: "", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -271,26 +271,26 @@ func TestScrubUser(t *testing.T) { }, { description: "User ID & Geo Full", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, scrubUser: ScrubStrategyUserID, scrubGeo: ScrubStrategyGeoFull, }, { description: "User ID & Geo Reduced", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -303,13 +303,13 @@ func TestScrubUser(t *testing.T) { }, { description: "User ID & Geo None", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -322,26 +322,26 @@ func TestScrubUser(t *testing.T) { }, { description: "User None & Geo Full", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, scrubUser: ScrubStrategyUserNone, scrubGeo: ScrubStrategyGeoFull, }, { description: "User None & Geo Reduced", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -354,13 +354,13 @@ func TestScrubUser(t *testing.T) { }, { description: "User None & Geo None", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -503,14 +503,14 @@ func TestScrubIPV6Lowest32Bits(t *testing.T) { } func TestScrubGeoFull(t *testing.T) { - geo := &openrtb.Geo{ + geo := &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", City: "some city", ZIP: "some zip", } - geoExpected := &openrtb.Geo{ + geoExpected := &openrtb2.Geo{ Lat: 0, Lon: 0, Metro: "", @@ -529,14 +529,14 @@ func TestScrubGeoFullWhenNil(t *testing.T) { } func TestScrubGeoPrecision(t *testing.T) { - geo := &openrtb.Geo{ + geo := &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", City: "some city", ZIP: "some zip", } - geoExpected := &openrtb.Geo{ + geoExpected := &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", diff --git a/privacy/writer.go b/privacy/writer.go index c61767f16c8..610508f812c 100644 --- a/privacy/writer.go +++ b/privacy/writer.go @@ -1,18 +1,16 @@ package privacy -import ( - "github.com/mxmCherry/openrtb" -) +import "github.com/mxmCherry/openrtb/v14/openrtb2" // PolicyWriter mutates an OpenRTB bid request with a policy's regulatory information. type PolicyWriter interface { - Write(req *openrtb.BidRequest) error + Write(req *openrtb2.BidRequest) error } // NilPolicyWriter implements the PolicyWriter interface but performs no action. type NilPolicyWriter struct{} // Write is hardcoded to perform no action with the OpenRTB bid request. -func (NilPolicyWriter) Write(req *openrtb.BidRequest) error { +func (NilPolicyWriter) Write(req *openrtb2.BidRequest) error { return nil } diff --git a/privacy/writer_test.go b/privacy/writer_test.go index 79170cfc451..b419e3c6783 100644 --- a/privacy/writer_test.go +++ b/privacy/writer_test.go @@ -4,16 +4,16 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb" + "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/stretchr/testify/assert" ) func TestNilWriter(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "anyID", Ext: json.RawMessage(`{"anyJson":"anyValue"}`), } - expectedRequest := &openrtb.BidRequest{ + expectedRequest := &openrtb2.BidRequest{ ID: "anyID", Ext: json.RawMessage(`{"anyJson":"anyValue"}`), } diff --git a/router/router.go b/router/router.go index 0920f1d61b6..3b51d0730c1 100644 --- a/router/router.go +++ b/router/router.go @@ -261,7 +261,7 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R openrtbEndpoint, err := openrtb2.NewEndpoint(theExchange, paramsValidator, fetcher, accounts, cfg, r.MetricsEngine, pbsAnalytics, disabledBidders, defReqJSON, activeBidders) if err != nil { - glog.Fatalf("Failed to create the openrtb endpoint handler. %v", err) + glog.Fatalf("Failed to create the openrtb2 endpoint handler. %v", err) } ampEndpoint, err := openrtb2.NewAmpEndpoint(theExchange, paramsValidator, ampFetcher, accounts, cfg, r.MetricsEngine, pbsAnalytics, disabledBidders, defReqJSON, activeBidders) From 690fe2d5c2391b1617ec6d85fb2c15b090c3dd9f Mon Sep 17 00:00:00 2001 From: prebidtappx <77485538+prebidtappx@users.noreply.github.com> Date: Tue, 30 Mar 2021 19:31:43 +0200 Subject: [PATCH 49/91] Tappx changes - Backward compatible change of version (#1777) Co-authored-by: ubuntu Co-authored-by: Albert Grandes --- adapters/tappx/tappx.go | 7 +- adapters/tappx/tappx_test.go | 2 +- ...ngle-banner-impression-future-feature.json | 116 ++++++++++++++++++ .../exemplary/single-banner-impression.json | 2 +- .../exemplary/single-banner-site.json | 2 +- .../exemplary/single-video-impression.json | 2 +- .../exemplary/single-video-site.json | 2 +- .../tappxtest/supplemental/204status.json | 2 +- .../tappxtest/supplemental/bidfloor.json | 2 +- .../supplemental/http-err-status.json | 2 +- .../supplemental/http-err-status2.json | 2 +- 11 files changed, 130 insertions(+), 11 deletions(-) create mode 100644 adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index abe2d90b8a6..57abee63923 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -6,6 +6,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "text/template" "time" @@ -17,7 +18,7 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) -const TAPPX_BIDDER_VERSION = "1.1" +const TAPPX_BIDDER_VERSION = "1.2" const TYPE_CNN = "prebid" type TappxAdapter struct { @@ -126,7 +127,9 @@ func (a *TappxAdapter) buildEndpointURL(params *openrtb_ext.ExtImpTappx, test in } } - thisURI.Path += params.Endpoint + if !(strings.Contains(strings.ToLower(thisURI.Host), strings.ToLower(params.Endpoint))) { + thisURI.Path += params.Endpoint //Now version is backward compatible. In future, this condition and content will be delete + } queryParams := url.Values{} diff --git a/adapters/tappx/tappx_test.go b/adapters/tappx/tappx_test.go index 187190862ea..10e57d12132 100644 --- a/adapters/tappx/tappx_test.go +++ b/adapters/tappx/tappx_test.go @@ -47,7 +47,7 @@ func TestTsValue(t *testing.T) { url, err := bidderTappx.buildEndpointURL(&tappxExt, test) - match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.1`, url) + match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.2`, url) if err != nil { t.Errorf("Error while running regex validation: %s", err.Error()) return diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json b/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json new file mode 100644 index 00000000000..3c3037afefb --- /dev/null +++ b/adapters/tappx/tappxtest/exemplary/single-banner-impression-future-feature.json @@ -0,0 +1,116 @@ +{ + "mockBidRequest": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "adunit-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876", + "endpoint": "ZZ123456PS", + "host": "ZZ123456PS.ssp.tappx.com/rtb/" + } + } + } + ], + "app": { + "id": "app_001", + "bundle": "com.rovio.angrybirds", + "publisher": { + "id": "2" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ZZ123456PS.ssp.tappx.com/rtb/?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", + "body": { + "id": "0000000000001", + "test": 1, + "imp": [ + { + "id": "adunit-1", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tappxkey": "pub-12345-android-9876", + "endpoint": "ZZ123456PS", + "host": "ZZ123456PS.ssp.tappx.com/rtb/" + } + } + } + ], + "app": { + "bundle": "com.rovio.angrybirds", + "id": "app_001", + "publisher": { + "id": "2" + } + }, + "user": { + "buyeruid": "A-38327932832" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "75472df2-1cb3-4f8e-9a28-10cb95fe05a4", + "seatbid": [{ + "bid": [{ + "id": "wehM-93KGr0_0_0", + "impid": "adunit-1", + "price": 0.5, + "cid": "3706", + "crid": "19005", + "adid": "19005", + "adm": "", + "cat": ["IAB2"], + "adomain": ["test.com"], + "h": 250, + "w": 300 + }] + }], + "bidid": "wehM-93KGr0" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "wehM-93KGr0_0_0", + "impid": "adunit-1", + "price": 0.5, + "adm": "", + "adid": "19005", + "adomain": ["test.com"], + "cid": "3706", + "crid": "19005", + "w": 300, + "h": 250, + "cat": ["IAB2"] + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-impression.json b/adapters/tappx/tappxtest/exemplary/single-banner-impression.json index 4f5b792fe4f..54f472d9fff 100644 --- a/adapters/tappx/tappxtest/exemplary/single-banner-impression.json +++ b/adapters/tappx/tappxtest/exemplary/single-banner-impression.json @@ -33,7 +33,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/exemplary/single-banner-site.json b/adapters/tappx/tappxtest/exemplary/single-banner-site.json index ef61b0e2567..58490233ede 100644 --- a/adapters/tappx/tappxtest/exemplary/single-banner-site.json +++ b/adapters/tappx/tappxtest/exemplary/single-banner-site.json @@ -37,7 +37,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/exemplary/single-video-impression.json b/adapters/tappx/tappxtest/exemplary/single-video-impression.json index 7a469b07fb6..d6ce0554c5f 100644 --- a/adapters/tappx/tappxtest/exemplary/single-video-impression.json +++ b/adapters/tappx/tappxtest/exemplary/single-video-impression.json @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/exemplary/single-video-site.json b/adapters/tappx/tappxtest/exemplary/single-video-site.json index 9ee2f8f4187..f151151e776 100644 --- a/adapters/tappx/tappxtest/exemplary/single-video-site.json +++ b/adapters/tappx/tappxtest/exemplary/single-video-site.json @@ -39,7 +39,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/supplemental/204status.json b/adapters/tappx/tappxtest/supplemental/204status.json index 6172da59cbd..1c72cc90f24 100644 --- a/adapters/tappx/tappxtest/supplemental/204status.json +++ b/adapters/tappx/tappxtest/supplemental/204status.json @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/supplemental/bidfloor.json b/adapters/tappx/tappxtest/supplemental/bidfloor.json index 48c1b0fbfa7..093f77adfc6 100644 --- a/adapters/tappx/tappxtest/supplemental/bidfloor.json +++ b/adapters/tappx/tappxtest/supplemental/bidfloor.json @@ -34,7 +34,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/supplemental/http-err-status.json b/adapters/tappx/tappxtest/supplemental/http-err-status.json index 045695046ff..a80a5eaa675 100644 --- a/adapters/tappx/tappxtest/supplemental/http-err-status.json +++ b/adapters/tappx/tappxtest/supplemental/http-err-status.json @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, diff --git a/adapters/tappx/tappxtest/supplemental/http-err-status2.json b/adapters/tappx/tappxtest/supplemental/http-err-status2.json index 0cb5fd4a400..41dcc26d653 100644 --- a/adapters/tappx/tappxtest/supplemental/http-err-status2.json +++ b/adapters/tappx/tappxtest/supplemental/http-err-status2.json @@ -30,7 +30,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.1", + "uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2", "body": { "id": "0000000000001", "test": 1, From 056b7cc357708c61490ab6cfbb1d82b53ea59415 Mon Sep 17 00:00:00 2001 From: Steve Alliance Date: Wed, 31 Mar 2021 17:19:03 -0400 Subject: [PATCH 50/91] DMX: Enforcing w and h in imp (#1778) Co-authored-by: steve-a-districtm --- adapters/dmx/dmx.go | 50 ++++-- .../dmx/dmxtest/exemplary/idfa-to-app-id.json | 148 ++++++++++++++++++ .../exemplary/missing-width-height.json | 143 +++++++++++++++++ 3 files changed, 331 insertions(+), 10 deletions(-) create mode 100644 adapters/dmx/dmxtest/exemplary/idfa-to-app-id.json create mode 100644 adapters/dmx/dmxtest/exemplary/missing-width-height.json diff --git a/adapters/dmx/dmx.go b/adapters/dmx/dmx.go index 79e1d751712..280c7187ca8 100644 --- a/adapters/dmx/dmx.go +++ b/adapters/dmx/dmx.go @@ -48,6 +48,8 @@ type dmxParams struct { Bidfloor float64 `json:"bidfloor,omitempty"` } +var protocols = []openrtb2.Protocol{2, 3, 5, 6, 7, 8} + func UserSellerOrPubId(str1, str2 string) string { if str1 != "" { return str1 @@ -100,6 +102,12 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt if dmxReq.App.ID != "" { anyHasId = true } + if anyHasId == false { + if idfa, valid := getIdfa(request); valid { + dmxReq.App.ID = idfa + anyHasId = true + } + } } else { dmxReq.App = nil } @@ -147,13 +155,7 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt } } - if anyHasId == false { - return nil, []error{errors.New("This request contained no identifier")} - } - for _, inst := range dmxReq.Imp { - var banner *openrtb2.Banner - var video *openrtb2.Video var ins openrtb2.Imp var params dmxExt const intVal int8 = 1 @@ -164,9 +166,9 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt if isDmxParams(params.Bidder) { if inst.Banner != nil { if len(inst.Banner.Format) != 0 { - banner = inst.Banner + bannerCopy := *inst.Banner if params.Bidder.PublisherId != "" || params.Bidder.MemberId != "" { - imps = fetchParams(params, inst, ins, imps, banner, nil, intVal) + imps = fetchParams(params, inst, ins, imps, &bannerCopy, nil, intVal) } else { return nil, []error{errors.New("Missing Params for auction to be send")} } @@ -174,9 +176,9 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt } if inst.Video != nil { - video = inst.Video + videoCopy := *inst.Video if params.Bidder.PublisherId != "" || params.Bidder.MemberId != "" { - imps = fetchParams(params, inst, ins, imps, nil, video, intVal) + imps = fetchParams(params, inst, ins, imps, nil, &videoCopy, intVal) } else { return nil, []error{errors.New("Missing Params for auction to be send")} } @@ -187,6 +189,10 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt dmxReq.Imp = imps + if anyHasId == false { + return nil, []error{errors.New("This request contained no identifier")} + } + oJson, err := json.Marshal(dmxReq) if err != nil { @@ -271,10 +277,15 @@ func fetchParams(params dmxExt, inst openrtb2.Imp, ins openrtb2.Imp, imps []open tempimp.Secure = &intVal } if banner != nil { + if banner.H == nil || banner.W == nil { + banner.H = &banner.Format[0].H + banner.W = &banner.Format[0].W + } tempimp.Banner = banner } if video != nil { + video.Protocols = checkProtocols(video) tempimp.Video = video } @@ -327,3 +338,22 @@ func isDmxParams(t interface{}) bool { return false } } + +func getIdfa(request *openrtb2.BidRequest) (string, bool) { + if request.Device == nil { + return "", false + } + + device := request.Device + + if device.IFA != "" { + return device.IFA, true + } + return "", false +} +func checkProtocols(imp *openrtb2.Video) []openrtb2.Protocol { + if len(imp.Protocols) > 0 { + return imp.Protocols + } + return protocols +} diff --git a/adapters/dmx/dmxtest/exemplary/idfa-to-app-id.json b/adapters/dmx/dmxtest/exemplary/idfa-to-app-id.json new file mode 100644 index 00000000000..2fcf9179796 --- /dev/null +++ b/adapters/dmx/dmxtest/exemplary/idfa-to-app-id.json @@ -0,0 +1,148 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app":{ + "bundle":"302324249", + "name":"Skout - iOS Match Buy", + "publisher":{ + "id":"10400" + }, + "storeurl":"https://itunes.apple.com/app/id302324249" + }, + "device": { + "ifa": "ed6207cefff74c14878963566683c070" + }, + "imp": [ + { + + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250, + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "dmxid": "123454", + "publisher_id": "10400" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "", + "body": { + "id": "test-request-id", + "app":{ + "bundle":"302324249", + "id":"ed6207cefff74c14878963566683c070", + "name":"Skout - iOS Match Buy", + "publisher":{ + "id":"10400", + "ext": { + "dmx": { + "id": "10400" + } + } + }, + "storeurl":"https://itunes.apple.com/app/id302324249" + }, + "device": { + "ifa": "ed6207cefff74c14878963566683c070" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "123454", + "secure": 1, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisher_id": "10400", + "dmxid": "123454" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 1.75, + "adid": "29681110", + "adm": "
banner-ads
", + "adomain": ["dmx.districtm.io"], + "iurl": "https://dmx.districtm.io/b/v2", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300 + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 1.75, + "adm": "
banner-ads
", + "adid": "29681110", + "adomain": ["dmx.districtm.io"], + "iurl": "https://dmx.districtm.io/b/v2", + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250 + + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/dmx/dmxtest/exemplary/missing-width-height.json b/adapters/dmx/dmxtest/exemplary/missing-width-height.json new file mode 100644 index 00000000000..b7eeec68fcf --- /dev/null +++ b/adapters/dmx/dmxtest/exemplary/missing-width-height.json @@ -0,0 +1,143 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app":{ + "bundle":"302324249", + "id":"ed6207cefff74c14878963566683c070", + "name":"Skout - iOS Match Buy", + "publisher":{ + "id":"10400" + }, + "storeurl":"https://itunes.apple.com/app/id302324249" + }, + "imp": [ + { + "bidfloor": 0.35, + "id": "test-imp-id", + "banner": { + + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "dmxid": "123454", + "publisher_id": "10400" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "", + "body": { + "id": "test-request-id", + "app":{ + "bundle":"302324249", + "id":"ed6207cefff74c14878963566683c070", + "name":"Skout - iOS Match Buy", + "publisher":{ + "id":"10400", + "ext": { + "dmx": { + "id": "10400" + } + } + }, + "storeurl":"https://itunes.apple.com/app/id302324249" + }, + "imp": [ + { + "bidfloor": 0.35, + "id": "test-imp-id", + "tagid": "123454", + "secure": 1, + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "publisher_id": "10400", + "dmxid": "123454" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [{ + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 1.75, + "adid": "29681110", + "adm": "
banner-ads
", + "adomain": ["dmx.districtm.io"], + "iurl": "https://dmx.districtm.io/b/v2", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300 + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 1.75, + "adm": "
banner-ads
", + "adid": "29681110", + "adomain": ["dmx.districtm.io"], + "iurl": "https://dmx.districtm.io/b/v2", + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250 + + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file From cbc3e84b1e008d25d914bff91147608a2acf44cd Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Thu, 1 Apr 2021 16:34:34 -0400 Subject: [PATCH 51/91] Remove Authorization Headers From Debug Response (#1779) * Hide Authorization Headers In Debug Response * MakeExtHeaders Tests * Add Empty Test * Use http.Header Methods * Updates From Code Review * Fix Merge Conflict --- exchange/bidder.go | 38 +++--- exchange/bidder_test.go | 255 +++++++++++++++++++++++++++++----------- 2 files changed, 208 insertions(+), 85 deletions(-) diff --git a/exchange/bidder.go b/exchange/bidder.go index d6b8028c2e9..5b6da499093 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -167,6 +167,10 @@ func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb2.B if debugInfo := ctx.Value(DebugContextKey); debugInfo != nil && debugInfo.(bool) { if accountDebugAllowed { if bidder.config.DebugInfo.Allow { + // it's safe to mutate the request headers since from this point on the + // information is only used for debugging. + removeSensitiveHeaders(httpInfo.request.Headers) + seatBid.httpCalls = append(seatBid.httpCalls, makeExt(httpInfo)) } else { debugDisabledWarning := errortypes.Warning{ @@ -325,25 +329,29 @@ func getAssetByID(id int64, assets []nativeRequests.Asset) (nativeRequests.Asset return nativeRequests.Asset{}, fmt.Errorf("Unable to find asset with ID:%d in the request", id) } +var authorizationHeader = http.CanonicalHeaderKey("authorization") + +// removeSensitiveHeaders mutates the http header object to remove sensitive information. +func removeSensitiveHeaders(h http.Header) { + h.Del(authorizationHeader) +} + // makeExt transforms information about the HTTP call into the contract class for the PBS response. func makeExt(httpInfo *httpCallInfo) *openrtb_ext.ExtHttpCall { - if httpInfo.err == nil { - return &openrtb_ext.ExtHttpCall{ - Uri: httpInfo.request.Uri, - RequestBody: string(httpInfo.request.Body), - ResponseBody: string(httpInfo.response.Body), - Status: httpInfo.response.StatusCode, - RequestHeaders: httpInfo.request.Headers, - } - } else if httpInfo.request == nil { - return &openrtb_ext.ExtHttpCall{} - } else { - return &openrtb_ext.ExtHttpCall{ - Uri: httpInfo.request.Uri, - RequestBody: string(httpInfo.request.Body), - RequestHeaders: httpInfo.request.Headers, + ext := &openrtb_ext.ExtHttpCall{} + + if httpInfo != nil && httpInfo.request != nil { + ext.Uri = httpInfo.request.Uri + ext.RequestBody = string(httpInfo.request.Body) + ext.RequestHeaders = httpInfo.request.Headers + + if httpInfo.err == nil && httpInfo.response != nil { + ext.ResponseBody = string(httpInfo.response.Body) + ext.Status = httpInfo.response.StatusCode } } + + return ext } // doRequest makes a request, handles the response, and returns the data needed by the diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index 8cc5b5e9383..7c01cd84c83 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -71,7 +71,6 @@ func TestSingleBidder(t *testing.T) { ctx = context.WithValue(ctx, DebugContextKey, true) for _, test := range testCases { - mockBidderResponse := &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { @@ -142,6 +141,48 @@ func TestSingleBidder(t *testing.T) { } } +func TestRequestBidRemovesSensitiveHeaders(t *testing.T) { + server := httptest.NewServer(mockHandler(200, "getBody", "responseJson")) + defer server.Close() + + requestHeaders := http.Header{} + requestHeaders.Add("Content-Type", "application/json") + requestHeaders.Add("Authorization", "anySecret") + + bidderImpl := &goodSingleBidder{ + httpRequest: &adapters.RequestData{ + Method: "POST", + Uri: server.URL, + Body: []byte("requestJson"), + Headers: requestHeaders, + }, + bidResponse: &adapters.BidderResponse{ + Bids: []*adapters.TypedBid{}, + }, + } + + debugInfo := &config.DebugInfo{Allow: true} + ctx := context.Background() + ctx = context.WithValue(ctx, DebugContextKey, true) + + bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, debugInfo) + currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) + seatBid, errs := bidder.requestBid(ctx, &openrtb2.BidRequest{}, "test", 1, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + + expectedHttpCalls := []*openrtb_ext.ExtHttpCall{ + { + Uri: server.URL, + RequestBody: "requestJson", + RequestHeaders: map[string][]string{"Content-Type": {"application/json"}}, + ResponseBody: "responseJson", + Status: 200, + }, + } + + assert.Empty(t, errs) + assert.ElementsMatch(t, seatBid.httpCalls, expectedHttpCalls) +} + // TestMultiBidder makes sure all the requests get sent, and the responses processed. // Because this is done in parallel, it should be run under the race detector. func TestMultiBidder(t *testing.T) { @@ -891,86 +932,160 @@ func TestMultiCurrencies_RequestCurrencyPick(t *testing.T) { } } -// TestBadResponseLogging makes sure that openrtb_ext works properly on malformed HTTP requests. -func TestBadRequestLogging(t *testing.T) { - info := &httpCallInfo{ - err: errors.New("Bad request"), - } - ext := makeExt(info) - if ext.Uri != "" { - t.Errorf("The URI should be empty. Got %s", ext.Uri) - } - if ext.RequestBody != "" { - t.Errorf("The request body should be empty. Got %s", ext.RequestBody) - } - if ext.ResponseBody != "" { - t.Errorf("The response body should be empty. Got %s", ext.ResponseBody) - } - if ext.Status != 0 { - t.Errorf("The Status code should be 0. Got %d", ext.Status) - } - if len(ext.RequestHeaders) > 0 { - t.Errorf("The request headers should be empty. Got %s", ext.RequestHeaders) - } -} - -// TestBadResponseLogging makes sure that openrtb_ext works properly if we don't get a sensible HTTP response. -func TestBadResponseLogging(t *testing.T) { - info := &httpCallInfo{ - request: &adapters.RequestData{ - Uri: "test.com", - Body: []byte("request body"), - Headers: http.Header{ - "header-1": []string{"value-1"}, +func TestMakeExt(t *testing.T) { + testCases := []struct { + description string + given *httpCallInfo + expected *openrtb_ext.ExtHttpCall + }{ + { + description: "Nil", + given: nil, + expected: &openrtb_ext.ExtHttpCall{}, + }, + { + description: "Empty", + given: &httpCallInfo{ + err: nil, + response: nil, + request: nil, }, + expected: &openrtb_ext.ExtHttpCall{}, + }, + { + description: "Request & Response - No Error", + given: &httpCallInfo{ + err: nil, + request: &adapters.RequestData{ + Uri: "requestUri", + Body: []byte("requestBody"), + Headers: makeHeader(map[string][]string{"Key1": {"value1", "value2"}}), + }, + response: &adapters.ResponseData{ + Body: []byte("responseBody"), + StatusCode: 999, + }, + }, + expected: &openrtb_ext.ExtHttpCall{ + Uri: "requestUri", + RequestBody: "requestBody", + RequestHeaders: map[string][]string{"Key1": {"value1", "value2"}}, + ResponseBody: "responseBody", + Status: 999, + }, + }, + { + description: "Request & Response - Error", + given: &httpCallInfo{ + err: errors.New("error"), + request: &adapters.RequestData{ + Uri: "requestUri", + Body: []byte("requestBody"), + Headers: makeHeader(map[string][]string{"Key1": {"value1", "value2"}}), + }, + response: &adapters.ResponseData{ + Body: []byte("responseBody"), + StatusCode: 999, + }, + }, + expected: &openrtb_ext.ExtHttpCall{ + Uri: "requestUri", + RequestBody: "requestBody", + RequestHeaders: map[string][]string{"Key1": {"value1", "value2"}}, + }, + }, + { + description: "Request Only", + given: &httpCallInfo{ + err: nil, + request: &adapters.RequestData{ + Uri: "requestUri", + Body: []byte("requestBody"), + Headers: makeHeader(map[string][]string{"Key1": {"value1", "value2"}}), + }, + response: nil, + }, + expected: &openrtb_ext.ExtHttpCall{ + Uri: "requestUri", + RequestBody: "requestBody", + RequestHeaders: map[string][]string{"Key1": {"value1", "value2"}}, + }, + }, { + description: "Response Only", + given: &httpCallInfo{ + err: nil, + response: &adapters.ResponseData{ + Body: []byte("responseBody"), + StatusCode: 999, + }, + }, + expected: &openrtb_ext.ExtHttpCall{}, }, - err: errors.New("Bad response"), - } - ext := makeExt(info) - if ext.Uri != info.request.Uri { - t.Errorf("The URI should be test.com. Got %s", ext.Uri) - } - if ext.RequestBody != string(info.request.Body) { - t.Errorf("The request body should be empty. Got %s", ext.RequestBody) - } - if ext.ResponseBody != "" { - t.Errorf("The response body should be empty. Got %s", ext.ResponseBody) } - if ext.Status != 0 { - t.Errorf("The Status code should be 0. Got %d", ext.Status) + + for _, test := range testCases { + result := makeExt(test.given) + assert.Equal(t, test.expected, result, test.description) } - assert.Equal(t, info.request.Headers, http.Header(ext.RequestHeaders), "The request headers should be \"header-1:value-1\"") } -// TestSuccessfulResponseLogging makes sure that openrtb_ext works properly if the HTTP request is successful. -func TestSuccessfulResponseLogging(t *testing.T) { - info := &httpCallInfo{ - request: &adapters.RequestData{ - Uri: "test.com", - Body: []byte("request body"), - Headers: http.Header{ - "header-1": []string{"value-1", "value-2"}, - }, +func TestRemoveSensitiveHeaders(t *testing.T) { + testCases := []struct { + description string + given http.Header + expected http.Header + }{ + { + description: "Nil", + given: nil, + expected: nil, }, - response: &adapters.ResponseData{ - StatusCode: 200, - Body: []byte("response body"), + { + description: "Empty", + given: http.Header{}, + expected: map[string][]string{}, + }, + { + description: "One", + given: makeHeader(map[string][]string{"Key1": {"value1"}}), + expected: makeHeader(map[string][]string{"Key1": {"value1"}}), + }, + { + description: "Many", + given: makeHeader(map[string][]string{"Key1": {"value1"}, "Key2": {"value2a", "value2b"}}), + expected: makeHeader(map[string][]string{"Key1": {"value1"}, "Key2": {"value2a", "value2b"}}), + }, + { + description: "Authorization Header Omitted", + given: makeHeader(map[string][]string{"authorization": {"secret"}}), + expected: http.Header{}, + }, + { + description: "Authorization Header Omitted - Case Insensitive", + given: makeHeader(map[string][]string{"AuThOrIzAtIoN": {"secret"}}), + expected: http.Header{}, + }, + { + description: "Authorization Header Omitted + Other Keys", + given: makeHeader(map[string][]string{"authorization": {"secret"}, "Key1": {"value1"}}), + expected: makeHeader(map[string][]string{"Key1": {"value1"}}), }, } - ext := makeExt(info) - if ext.Uri != info.request.Uri { - t.Errorf("The URI should be test.com. Got %s", ext.Uri) - } - if ext.RequestBody != string(info.request.Body) { - t.Errorf("The request body should be \"request body\". Got %s", ext.RequestBody) - } - if ext.ResponseBody != string(info.response.Body) { - t.Errorf("The response body should be \"response body\". Got %s", ext.ResponseBody) + + for _, test := range testCases { + removeSensitiveHeaders(test.given) + assert.Equal(t, test.expected, test.given, test.description) } - if ext.Status != info.response.StatusCode { - t.Errorf("The Status code should be 0. Got %d", ext.Status) +} + +func makeHeader(v map[string][]string) http.Header { + h := http.Header{} + for key, values := range v { + for _, value := range values { + h.Add(key, value) + } } - assert.Equal(t, info.request.Headers, http.Header(ext.RequestHeaders), "The request headers should be \"%s\". Got %s", info.request.Headers, ext.RequestHeaders) + return h } func TestMobileNativeTypes(t *testing.T) { From 6fa5771c0e380f5c9864434f0cfae517361a9507 Mon Sep 17 00:00:00 2001 From: Pavel Dunyashev Date: Thu, 1 Apr 2021 23:57:11 +0300 Subject: [PATCH 52/91] New Adapter: Bidmachine (#1769) --- adapters/bidmachine/bidmachine.go | 219 ++++++++++++++++++ adapters/bidmachine/bidmachine_test.go | 28 +++ .../rewarded_interstitial_no_battr.json | 128 ++++++++++ .../rewarded_interstitial_w_battr.json | 128 ++++++++++ .../exemplary/rewarded_video_no_battr.json | 132 +++++++++++ .../exemplary/rewarded_video_w_battr.json | 132 +++++++++++ .../exemplary/simple_banner.json | 118 ++++++++++ .../exemplary/simple_interstitial.json | 120 ++++++++++ .../exemplary/simple_video.json | 124 ++++++++++ .../bidmachinetest/params/race/banner.json | 5 + .../bidmachinetest/params/race/video.json | 5 + .../supplemental/empty-banner-format .json | 19 ++ .../supplemental/missing-banner-format.json | 26 +++ .../supplemental/status-204.json | 66 ++++++ .../supplemental/status-400.json | 69 ++++++ .../supplemental/status-403.json | 69 ++++++ .../supplemental/status-408.json | 69 ++++++ .../supplemental/status-500.json | 69 ++++++ .../supplemental/status-502.json | 69 ++++++ .../supplemental/status-503.json | 69 ++++++ .../supplemental/status-504.json | 69 ++++++ .../supplemental/wrong-host.json | 35 +++ adapters/bidmachine/params_test.go | 78 +++++++ config/config.go | 1 + exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_bidmachine.go | 7 + static/bidder-info/bidmachine.yaml | 8 + static/bidder-params/bidmachine.json | 31 +++ usersync/usersyncers/syncer_test.go | 1 + 30 files changed, 1898 insertions(+) create mode 100644 adapters/bidmachine/bidmachine.go create mode 100644 adapters/bidmachine/bidmachine_test.go create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_no_battr.json create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_w_battr.json create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_no_battr.json create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_w_battr.json create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/simple_banner.json create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/simple_interstitial.json create mode 100644 adapters/bidmachine/bidmachinetest/exemplary/simple_video.json create mode 100644 adapters/bidmachine/bidmachinetest/params/race/banner.json create mode 100644 adapters/bidmachine/bidmachinetest/params/race/video.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/empty-banner-format .json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/missing-banner-format.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-204.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-400.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-403.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-408.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-500.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-502.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-503.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/status-504.json create mode 100644 adapters/bidmachine/bidmachinetest/supplemental/wrong-host.json create mode 100644 adapters/bidmachine/params_test.go create mode 100644 openrtb_ext/imp_bidmachine.go create mode 100644 static/bidder-info/bidmachine.yaml create mode 100644 static/bidder-params/bidmachine.json diff --git a/adapters/bidmachine/bidmachine.go b/adapters/bidmachine/bidmachine.go new file mode 100644 index 00000000000..3c9a5b679e2 --- /dev/null +++ b/adapters/bidmachine/bidmachine.go @@ -0,0 +1,219 @@ +package bidmachine + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "path" + "strconv" + "text/template" + + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" +) + +type adapter struct { + endpoint template.Template +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + headers := http.Header{} + headers.Add("Content-Type", "application/json") + headers.Add("Accept", "application/json") + headers.Add("X-Openrtb-Version", "2.5") + + impressions := request.Imp + result := make([]*adapters.RequestData, 0, len(impressions)) + errs := make([]error, 0, len(impressions)) + + for _, impression := range impressions { + if impression.Banner != nil { + banner := impression.Banner + if banner.W == nil && banner.H == nil { + if banner.Format == nil { + errs = append(errs, &errortypes.BadInput{ + Message: "Impression with id: " + impression.ID + " has following error: Banner width and height is not provided and banner format is missing. At least one is required", + }) + continue + } + if len(banner.Format) == 0 { + errs = append(errs, &errortypes.BadInput{ + Message: "Impression with id: " + impression.ID + " has following error: Banner width and height is not provided and banner format array is empty. At least one is required", + }) + continue + } + } + + } + + var bidderExt adapters.ExtImpBidder + err := json.Unmarshal(impression.Ext, &bidderExt) + if err != nil { + errs = append(errs, err) + continue + } + + var impressionExt openrtb_ext.ExtImpBidmachine + err = json.Unmarshal(bidderExt.Bidder, &impressionExt) + if err != nil { + errs = append(errs, err) + continue + } + url, err := a.buildEndpointURL(impressionExt) + if err != nil { + errs = append(errs, err) + continue + } + if bidderExt.Prebid != nil && bidderExt.Prebid.IsRewardedInventory == 1 { + if impression.Banner != nil && !hasRewardedBattr(impression.Banner.BAttr) { + bannerCopy := *impression.Banner + bannerCopy.BAttr = copyBAttrWithRewardedInventory(bannerCopy.BAttr) + impression.Banner = &bannerCopy + } + if impression.Video != nil && !hasRewardedBattr(impression.Video.BAttr) { + videoCopy := *impression.Video + videoCopy.BAttr = copyBAttrWithRewardedInventory(videoCopy.BAttr) + impression.Video = &videoCopy + } + } + request.Imp = []openrtb2.Imp{impression} + body, err := json.Marshal(request) + if err != nil { + errs = append(errs, err) + continue + } + result = append(result, &adapters.RequestData{ + Method: "POST", + Uri: url, + Body: body, + Headers: headers, + }) + } + + request.Imp = impressions + + return result, errs +} + +func hasRewardedBattr(attr []openrtb2.CreativeAttribute) bool { + for i := 0; i < len(attr); i++ { + if attr[i] == openrtb2.CreativeAttribute(16) { + return true + } + } + return false +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + var errs []error + + switch responseData.StatusCode { + case http.StatusNoContent: + return nil, nil + case http.StatusServiceUnavailable: + fallthrough + case http.StatusBadRequest: + fallthrough + case http.StatusUnauthorized: + fallthrough + case http.StatusForbidden: + return nil, []error{&errortypes.BadInput{ + Message: "unexpected status code: " + strconv.Itoa(responseData.StatusCode) + " " + string(responseData.Body), + }} + case http.StatusOK: + break + default: + return nil, []error{&errortypes.BadServerResponse{ + Message: "unexpected status code: " + strconv.Itoa(responseData.StatusCode) + " " + string(responseData.Body), + }} + } + + var bidResponse openrtb2.BidResponse + err := json.Unmarshal(responseData.Body, &bidResponse) + if err != nil { + return nil, []error{&errortypes.BadServerResponse{ + Message: err.Error(), + }} + } + + response := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + + for _, seatBid := range bidResponse.SeatBid { + for _, bid := range seatBid.Bid { + thisBid := bid + bidType := GetMediaTypeForImp(bid.ImpID, request.Imp) + if bidType == UndefinedMediaType { + errs = append(errs, &errortypes.BadServerResponse{ + Message: "ignoring bid id=" + bid.ID + ", request doesn't contain any valid impression with id=" + bid.ImpID, + }) + continue + } + response.Bids = append(response.Bids, &adapters.TypedBid{ + Bid: &thisBid, + BidType: bidType, + }) + } + } + + return response, errs +} + +// Builder builds a new instance of the Bidmachine adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + template, err := template.New("endpointTemplate").Parse(config.Endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + } + + bidder := &adapter{ + endpoint: *template, + } + + return bidder, nil +} + +const UndefinedMediaType = openrtb_ext.BidType("") + +func (a *adapter) buildEndpointURL(params openrtb_ext.ExtImpBidmachine) (string, error) { + endpointParams := macros.EndpointTemplateParams{Host: params.Host} + uriString, errMacros := macros.ResolveMacros(a.endpoint, endpointParams) + if errMacros != nil { + return "", &errortypes.BadInput{ + Message: "Failed to resolve host macros", + } + } + uri, errUrl := url.Parse(uriString) + if errUrl != nil || uri.Scheme == "" || uri.Host == "" { + return "", &errortypes.BadInput{ + Message: "Failed to create final URL with provided host", + } + } + uri.Path = path.Join(uri.Path, params.Path) + uri.Path = path.Join(uri.Path, params.SellerID) + return uri.String(), nil +} + +func copyBAttrWithRewardedInventory(src []openrtb2.CreativeAttribute) []openrtb2.CreativeAttribute { + dst := make([]openrtb2.CreativeAttribute, len(src)) + copy(dst, src) + dst = append(dst, openrtb2.CreativeAttribute(16)) + return dst +} + +func GetMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { + mediaType := openrtb_ext.BidTypeBanner + for _, imp := range imps { + if imp.ID == impID { + if imp.Banner == nil && imp.Video != nil { + mediaType = openrtb_ext.BidTypeVideo + } + return mediaType + } + } + return UndefinedMediaType +} diff --git a/adapters/bidmachine/bidmachine_test.go b/adapters/bidmachine/bidmachine_test.go new file mode 100644 index 00000000000..9dc82150a82 --- /dev/null +++ b/adapters/bidmachine/bidmachine_test.go @@ -0,0 +1,28 @@ +package bidmachine + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/stretchr/testify/assert" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderBidmachine, config.Adapter{ + Endpoint: "https://{{.Host}}.bidmachine.io"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "bidmachinetest", bidder) +} + +func TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderBidmachine, config.Adapter{ + Endpoint: "{{Malformed}}"}) + + assert.Error(t, buildErr) +} diff --git a/adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_no_battr.json b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_no_battr.json new file mode 100644 index 00000000000..96bf06be015 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_no_battr.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": + { + "battr": [1], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": + { + "battr": [1, 16], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "banner" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_w_battr.json b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_w_battr.json new file mode 100644 index 00000000000..08b187e5710 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_interstitial_w_battr.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": + { + "battr": [1, 16], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": + { + "battr": [1, 16], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "banner" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_no_battr.json b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_no_battr.json new file mode 100644 index 00000000000..72bf59d7d1e --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_no_battr.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": + { + "battr": [1], + "mimes": [ + "video/mp4", + "video/3gpp" + ], + "protocols": [ + 1, + 2, + 3 + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": + { + "battr": [1, 16], + "mimes": [ + "video/mp4", + "video/3gpp" + ], + "protocols": [ + 1, + 2, + 3 + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "video" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_w_battr.json b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_w_battr.json new file mode 100644 index 00000000000..0d681e160a8 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/rewarded_video_w_battr.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": + { + "battr": [1, 16], + "mimes": [ + "video/mp4", + "video/3gpp" + ], + "protocols": [ + 1, + 2, + 3 + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": + { + "battr": [1, 16], + "mimes": [ + "video/mp4", + "video/3gpp" + ], + "protocols": [ + 1, + 2, + 3 + ], + "w": 320, + "h": 480 + }, + "ext": + { + "prebid": + { + "is_rewarded_inventory": 1 + }, + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "video" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/exemplary/simple_banner.json b/adapters/bidmachine/bidmachinetest/exemplary/simple_banner.json new file mode 100644 index 00000000000..bde25edc92a --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/simple_banner.json @@ -0,0 +1,118 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": + { + "battr": [1], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 50 + }, + "ext": + { + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": + { + "battr": [1], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 50 + }, + "ext": + { + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "banner" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/exemplary/simple_interstitial.json b/adapters/bidmachine/bidmachinetest/exemplary/simple_interstitial.json new file mode 100644 index 00000000000..b49c85e54af --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/simple_interstitial.json @@ -0,0 +1,120 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": + { + "battr": [1], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 480 + }, + "ext": + { + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "instl": 1, + "banner": + { + "battr": [1], + "mimes": [ + "image/jpeg", + "image/jpg", + "image/gif", + "image/png" + ], + "w": 320, + "h": 480 + }, + "ext": + { + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "banner" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/exemplary/simple_video.json b/adapters/bidmachine/bidmachinetest/exemplary/simple_video.json new file mode 100644 index 00000000000..e6e1d2dc70f --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/exemplary/simple_video.json @@ -0,0 +1,124 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": + { + "battr": [1], + "mimes": [ + "video/mp4", + "video/3gpp" + ], + "protocols": [ + 1, + 2, + 3 + ], + "w": 320, + "h": 480 + }, + "ext": + { + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-us.bidmachine.io/auction/rtb/v2/1", + "headers": + { + "Content-Type": [ + "application/json" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ] + }, + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": + { + "battr": [1], + "mimes": [ + "video/mp4", + "video/3gpp" + ], + "protocols": [ + 1, + 2, + 3 + ], + "w": 320, + "h": 480 + }, + "ext": + { + "bidder": + { + "host": "api-us", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + }] + } + }, + "mockResponse": + { + "status": 200, + "body": + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }], + "seat": "bidmachine" + }], + "cur": "USD" + } + } + }], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 100, + "adm": "test-adm", + "cid": "test-cid", + "crid": "test-crid" + }, + "type": "video" + }] + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/params/race/banner.json b/adapters/bidmachine/bidmachinetest/params/race/banner.json new file mode 100644 index 00000000000..0402e4a129b --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/params/race/banner.json @@ -0,0 +1,5 @@ +{ + "seller_id": "1", + "path": "auction/rtb/v2", + "host": "api-eu" +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/params/race/video.json b/adapters/bidmachine/bidmachinetest/params/race/video.json new file mode 100644 index 00000000000..0402e4a129b --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/params/race/video.json @@ -0,0 +1,5 @@ +{ + "seller_id": "1", + "path": "auction/rtb/v2", + "host": "api-eu" +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/empty-banner-format .json b/adapters/bidmachine/bidmachinetest/supplemental/empty-banner-format .json new file mode 100644 index 00000000000..b454ce3d7ad --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/empty-banner-format .json @@ -0,0 +1,19 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": { + "format": [] + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Impression with id: test-impression-id-1 has following error: Banner width and height is not provided and banner format array is empty. At least one is required", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/missing-banner-format.json b/adapters/bidmachine/bidmachinetest/supplemental/missing-banner-format.json new file mode 100644 index 00000000000..563737e1126 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/missing-banner-format.json @@ -0,0 +1,26 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + {}, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Impression with id: test-impression-id-1 has following error: Banner width and height is not provided and banner format is missing. At least one is required", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-204.json b/adapters/bidmachine/bidmachinetest/supplemental/status-204.json new file mode 100644 index 00000000000..daa7f00a8e0 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-204.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 204, + "body": + {} + } + }], + "expectedBidResponses": [] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-400.json b/adapters/bidmachine/bidmachinetest/supplemental/status-400.json new file mode 100644 index 00000000000..5eb4ccfcebf --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-400.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 400, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 400 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-403.json b/adapters/bidmachine/bidmachinetest/supplemental/status-403.json new file mode 100644 index 00000000000..3434275bf06 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-403.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 403, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 403 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-408.json b/adapters/bidmachine/bidmachinetest/supplemental/status-408.json new file mode 100644 index 00000000000..51965461a81 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-408.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 408, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 408 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-500.json b/adapters/bidmachine/bidmachinetest/supplemental/status-500.json new file mode 100644 index 00000000000..f7abfb0fdc4 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-500.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 500, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 500 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-502.json b/adapters/bidmachine/bidmachinetest/supplemental/status-502.json new file mode 100644 index 00000000000..44dabb052a2 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-502.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 502, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 502 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-503.json b/adapters/bidmachine/bidmachinetest/supplemental/status-503.json new file mode 100644 index 00000000000..979ac4f642a --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-503.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 503, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 503 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/status-504.json b/adapters/bidmachine/bidmachinetest/supplemental/status-504.json new file mode 100644 index 00000000000..918ada2c150 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/status-504.json @@ -0,0 +1,69 @@ +{ + "mockBidRequest": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + }, + "httpCalls": [ + { + "expectedRequest": + { + "uri": "https://api-eu.bidmachine.io/auction/rtb/v2/1", + "body": + { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": + { + "format": [ + { + "h": 250, + "w": 300 + }] + }, + "ext": + { + "bidder": + { + "seller_id": "1", + "host": "api-eu", + "path": "auction/rtb/v2" + } + } + }] + } + }, + "mockResponse": + { + "status": 504, + "body": "server text here" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "unexpected status code: 504 \"server text here\"", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/bidmachine/bidmachinetest/supplemental/wrong-host.json b/adapters/bidmachine/bidmachinetest/supplemental/wrong-host.json new file mode 100644 index 00000000000..82ee3269f46 --- /dev/null +++ b/adapters/bidmachine/bidmachinetest/supplemental/wrong-host.json @@ -0,0 +1,35 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-impression-id-1", + "banner": { + "format": [ + { + "w": 320, + "h": 50 + } + ] + }, + "ext": { + "bidder": { + "host": "`", + "path": "auction/rtb/v2", + "seller_id": "1" + } + } + } + ] + }, + "httpCalls": [], + "expectedBidResponses": [], + "expectedMakeRequestsErrors": [ + { + "value": "Failed to create final URL with provided host", + "comparison": "literal" + } + ], + "expectedMakeBidsErrors": [] +} + diff --git a/adapters/bidmachine/params_test.go b/adapters/bidmachine/params_test.go new file mode 100644 index 00000000000..15ebbcbf128 --- /dev/null +++ b/adapters/bidmachine/params_test.go @@ -0,0 +1,78 @@ +package bidmachine + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderBidmachine, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Bidmachine params: %s \n Error: %s", validParam, err) + } + } +} + +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.BidderBidmachine, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"seller_id":"1", "host":"api-eu", "path":"auction/rtb/v2"}`, + `{"seller_id":"1", "host":"api-us", "path":"auction/rtb/v2"}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"some_random_field":""}`, + `{"seller_id":""}`, + `{"seller_id": 1}`, + `{"seller_id": 1.2}`, + `{"seller_id": null}`, + `{"seller_id": true}`, + `{"seller_id": []}`, + `{"seller_id": {}}`, + `{"host":""}`, + `{"host": 1}`, + `{"host": 1.2}`, + `{"host": null}`, + `{"host": true}`, + `{"host": []}`, + `{"host": {}}`, + `{"path":""}`, + `{"path": 1}`, + `{"path": 1.2}`, + `{"path": null}`, + `{"path": true}`, + `{"path": []}`, + `{"path": {}}`, + `{"seller_id":"", "path": "", host: ""}`, + `{"seller_id": 1, "path": 2, host: 3}`, + `{"seller_id": 1.2}, "path": 5.5, host: 3.3`, + `{"seller_id": null, "path": null, host: null}`, + `{"seller_id": true, "path": false, host: true}`, + `{"seller_id": [], "path": [], host: []}`, + `{"seller_id": {}, "path": {}, host: {}}`, +} diff --git a/config/config.go b/config/config.go index bc15a947c7e..e22080fe602 100644 --- a/config/config.go +++ b/config/config.go @@ -829,6 +829,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.beachfront.extra_info", "{\"video_endpoint\":\"https://reachms.bfmio.com/bid.json?exchange_id\"}") v.SetDefault("adapters.beintoo.endpoint", "https://ib.beintoo.com/um") v.SetDefault("adapters.between.endpoint", "http://{{.Host}}.betweendigital.com/openrtb_bid?sspId={{.PublisherID}}") + v.SetDefault("adapters.bidmachine.endpoint", "https://{{.Host}}.bidmachine.io") v.SetDefault("adapters.brightroll.endpoint", "http://east-bid.ybp.yahoo.com/bid/appnexuspbs") v.SetDefault("adapters.colossus.endpoint", "http://colossusssp.com/?c=o&m=rtb") v.SetDefault("adapters.connectad.endpoint", "http://bidder.connectad.io/API?src=pbs") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 46c967065cb..6c649fde5c8 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -29,6 +29,7 @@ import ( "github.com/prebid/prebid-server/adapters/beachfront" "github.com/prebid/prebid-server/adapters/beintoo" "github.com/prebid/prebid-server/adapters/between" + "github.com/prebid/prebid-server/adapters/bidmachine" "github.com/prebid/prebid-server/adapters/brightroll" "github.com/prebid/prebid-server/adapters/colossus" "github.com/prebid/prebid-server/adapters/connectad" @@ -137,6 +138,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderBeachfront: beachfront.Builder, openrtb_ext.BidderBeintoo: beintoo.Builder, openrtb_ext.BidderBetween: between.Builder, + openrtb_ext.BidderBidmachine: bidmachine.Builder, openrtb_ext.BidderBrightroll: brightroll.Builder, openrtb_ext.BidderColossus: colossus.Builder, openrtb_ext.BidderConnectAd: connectad.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index e03c234b257..66dcbebcaff 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -100,6 +100,7 @@ const ( BidderBeachfront BidderName = "beachfront" BidderBeintoo BidderName = "beintoo" BidderBetween BidderName = "between" + BidderBidmachine BidderName = "bidmachine" BidderBrightroll BidderName = "brightroll" BidderColossus BidderName = "colossus" BidderConnectAd BidderName = "connectad" @@ -208,6 +209,7 @@ func CoreBidderNames() []BidderName { BidderBeachfront, BidderBeintoo, BidderBetween, + BidderBidmachine, BidderBrightroll, BidderColossus, BidderConnectAd, diff --git a/openrtb_ext/imp_bidmachine.go b/openrtb_ext/imp_bidmachine.go new file mode 100644 index 00000000000..20491d25aca --- /dev/null +++ b/openrtb_ext/imp_bidmachine.go @@ -0,0 +1,7 @@ +package openrtb_ext + +type ExtImpBidmachine struct { + Host string `json:"host"` + Path string `json:"path"` + SellerID string `json:"seller_id"` +} diff --git a/static/bidder-info/bidmachine.yaml b/static/bidder-info/bidmachine.yaml new file mode 100644 index 00000000000..6868125b6e6 --- /dev/null +++ b/static/bidder-info/bidmachine.yaml @@ -0,0 +1,8 @@ +maintainer: + email: hi@bidmachine.io +gvlVendorID: 736 +capabilities: + app: + mediaTypes: + - banner + - video \ No newline at end of file diff --git a/static/bidder-params/bidmachine.json b/static/bidder-params/bidmachine.json new file mode 100644 index 00000000000..f3971c00274 --- /dev/null +++ b/static/bidder-params/bidmachine.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Bidmachine Adapter Params", + "description": "A schema which validates params accepted by the Kidoz adapter", + "type": "object", + "properties": { + "host": { + "$ref": "#/definitions/non-empty-string", + "description": "Host" + }, + "path": { + "$ref": "#/definitions/non-empty-string", + "description": "URL path" + }, + "seller_id": { + "$ref": "#/definitions/non-empty-string", + "description": "Seller Identifier" + } + }, + "definitions": { + "non-empty-string": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "host", + "path", + "seller_id" + ] +} \ No newline at end of file diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 5b2e80463ac..51ea19d7577 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -106,6 +106,7 @@ func TestNewSyncerMap(t *testing.T) { openrtb_ext.BidderAdot: true, openrtb_ext.BidderAdprime: true, openrtb_ext.BidderApplogy: true, + openrtb_ext.BidderBidmachine: true, openrtb_ext.BidderEpom: true, openrtb_ext.BidderDecenterAds: true, openrtb_ext.BidderInMobi: true, From 8193e30d8f8e6175b8cb4884bcdbc83b3cddcd20 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Thu, 1 Apr 2021 23:12:20 +0200 Subject: [PATCH 53/91] New Adapter: Criteo (#1775) --- adapters/criteo/criteo.go | 114 +++++ adapters/criteo/criteo_test.go | 28 ++ .../exemplary/simple-banner-cookie-uid.json | 115 +++++ .../exemplary/simple-banner-inapp.json | 110 +++++ .../exemplary/simple-banner-uid.json | 132 +++++ .../204-response-from-target.json | 81 ++++ .../400-response-from-target.json | 86 ++++ .../500-response-from-target.json | 86 ++++ ...ccpa-with-consent-simple-banner-inapp.json | 115 +++++ .../ccpa-with-consent-simple-banner-uid.json | 139 ++++++ ...a-without-consent-simple-banner-inapp.json | 85 ++++ ...cpa-without-consent-simple-banner-uid.json | 105 ++++ ...gdpr-with-consent-simple-banner-inapp.json | 126 +++++ .../gdpr-with-consent-simple-banner-uid.json | 142 ++++++ ...r-without-consent-simple-banner-inapp.json | 92 ++++ ...dpr-without-consent-simple-banner-uid.json | 108 +++++ .../multislots-simple-banner-inapp.json | 213 +++++++++ ...mple-banner-uid-different-network-ids.json | 84 ++++ .../multislots-simple-banner-uid.json | 233 +++++++++ ...-direct-size-and-formats-not-included.json | 132 +++++ ...e-banner-with-direct-size-and-formats.json | 132 +++++ .../simple-banner-with-direct-size.json | 126 +++++ .../supplemental/simple-banner-with-ipv6.json | 126 +++++ adapters/criteo/generators.go | 36 ++ adapters/criteo/models.go | 299 ++++++++++++ adapters/criteo/models_test.go | 452 ++++++++++++++++++ adapters/criteo/params_test.go | 63 +++ adapters/criteo/usersync.go | 14 + adapters/criteo/usersync_test.go | 26 + config/config.go | 1 + exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_criteo.go | 7 + static/bidder-info/criteo.yaml | 10 + static/bidder-params/criteo.json | 30 ++ usersync/usersyncers/syncer.go | 2 + usersync/usersyncers/syncer_test.go | 1 + 37 files changed, 3655 insertions(+) create mode 100644 adapters/criteo/criteo.go create mode 100644 adapters/criteo/criteo_test.go create mode 100755 adapters/criteo/criteotest/exemplary/simple-banner-cookie-uid.json create mode 100755 adapters/criteo/criteotest/exemplary/simple-banner-inapp.json create mode 100755 adapters/criteo/criteotest/exemplary/simple-banner-uid.json create mode 100755 adapters/criteo/criteotest/supplemental/204-response-from-target.json create mode 100755 adapters/criteo/criteotest/supplemental/400-response-from-target.json create mode 100755 adapters/criteo/criteotest/supplemental/500-response-from-target.json create mode 100755 adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-inapp.json create mode 100755 adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-uid.json create mode 100755 adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-inapp.json create mode 100755 adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-uid.json create mode 100755 adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-inapp.json create mode 100755 adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-uid.json create mode 100755 adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-inapp.json create mode 100755 adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-uid.json create mode 100755 adapters/criteo/criteotest/supplemental/multislots-simple-banner-inapp.json create mode 100755 adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid-different-network-ids.json create mode 100755 adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid.json create mode 100755 adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats-not-included.json create mode 100755 adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats.json create mode 100755 adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size.json create mode 100755 adapters/criteo/criteotest/supplemental/simple-banner-with-ipv6.json create mode 100644 adapters/criteo/generators.go create mode 100644 adapters/criteo/models.go create mode 100644 adapters/criteo/models_test.go create mode 100644 adapters/criteo/params_test.go create mode 100644 adapters/criteo/usersync.go create mode 100644 adapters/criteo/usersync_test.go create mode 100644 openrtb_ext/imp_criteo.go create mode 100644 static/bidder-info/criteo.yaml create mode 100644 static/bidder-params/criteo.json diff --git a/adapters/criteo/criteo.go b/adapters/criteo/criteo.go new file mode 100644 index 00000000000..f045c9f009b --- /dev/null +++ b/adapters/criteo/criteo.go @@ -0,0 +1,114 @@ +package criteo + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/mxmCherry/openrtb/v14/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 { + uri string + slotIDGenerator slotIDGenerator +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, extraRequestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + criteoRequest, errs := newCriteoRequest(a.slotIDGenerator, request) + if len(errs) > 0 { + return nil, errs + } + + jsonRequest, err := json.Marshal(criteoRequest) + if err != nil { + return nil, []error{err} + } + + rqData := adapters.RequestData{ + Method: "POST", + Uri: a.uri, + Body: jsonRequest, + Headers: getCriteoRequestHeaders(&criteoRequest), + } + + return []*adapters.RequestData{&rqData}, nil +} + +func getCriteoRequestHeaders(criteoRequest *criteoRequest) http.Header { + headers := http.Header{} + + // criteoRequest is known not to be nil + // If there was an error generating it from newCriteoRequest, the errors will be returned immediately + // and this method won't be called + + if criteoRequest.User.CookieID != "" { + headers.Add("Cookie", "uid="+criteoRequest.User.CookieID) + } + + if criteoRequest.User.IP != "" { + headers.Add("X-Forwarded-For", criteoRequest.User.IP) + } + + if criteoRequest.User.IPv6 != "" { + headers.Add("X-Forwarded-For", criteoRequest.User.IPv6) + } + + if criteoRequest.User.UA != "" { + headers.Add("User-Agent", criteoRequest.User.UA) + } + + return headers +} + +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.StatusOK { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), + }} + } + + bidResponse, err := newCriteoResponseFromBytes(response.Body) + if err != nil { + return nil, []error{err} + } + + bidderResponse := adapters.NewBidderResponse() + bidderResponse.Bids = make([]*adapters.TypedBid, len(bidResponse.Slots)) + + for i := 0; i < len(bidResponse.Slots); i++ { + bidderResponse.Bids[i] = &adapters.TypedBid{ + Bid: &openrtb2.Bid{ + ID: bidResponse.Slots[i].ID, + ImpID: bidResponse.Slots[i].ImpID, + Price: bidResponse.Slots[i].CPM, + AdM: bidResponse.Slots[i].Creative, + W: bidResponse.Slots[i].Width, + H: bidResponse.Slots[i].Height, + CrID: bidResponse.Slots[i].CreativeID, + }, + BidType: openrtb_ext.BidTypeBanner, + } + } + + return bidderResponse, nil +} + +// Builder builds a new instance of the Criteo adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + return builderWithGuidGenerator(bidderName, config, newRandomSlotIDGenerator()) +} + +func builderWithGuidGenerator(bidderName openrtb_ext.BidderName, config config.Adapter, slotIDGenerator slotIDGenerator) (adapters.Bidder, error) { + return &adapter{ + uri: config.Endpoint, + slotIDGenerator: slotIDGenerator, + }, nil +} diff --git a/adapters/criteo/criteo_test.go b/adapters/criteo/criteo_test.go new file mode 100644 index 00000000000..0a700734538 --- /dev/null +++ b/adapters/criteo/criteo_test.go @@ -0,0 +1,28 @@ +package criteo + +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) { + + // Setup: + bidder, buildErr := builderWithGuidGenerator( + openrtb_ext.BidderCriteo, + config.Adapter{ + Endpoint: "https://bidder.criteo.com/cdb?profileId=230", + }, + newFakeGuidGenerator("00000000-0000-0000-00000000"), + ) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + // Execute & Verify: + adapterstest.RunJSONBidderTest(t, "criteotest", bidder) +} diff --git a/adapters/criteo/criteotest/exemplary/simple-banner-cookie-uid.json b/adapters/criteo/criteotest/exemplary/simple-banner-cookie-uid.json new file mode 100755 index 00000000000..cb152f47c41 --- /dev/null +++ b/adapters/criteo/criteotest/exemplary/simple-banner-cookie-uid.json @@ -0,0 +1,115 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "buyeruid": "criteo-user-id" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"], + "Cookie": ["uid=criteo-user-id"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "cookieuid": "criteo-user-id", + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/criteotest/exemplary/simple-banner-inapp.json b/adapters/criteo/criteotest/exemplary/simple-banner-inapp.json new file mode 100755 index 00000000000..0ec1b7f87a5 --- /dev/null +++ b/adapters/criteo/criteotest/exemplary/simple-banner-inapp.json @@ -0,0 +1,110 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/criteotest/exemplary/simple-banner-uid.json b/adapters/criteo/criteotest/exemplary/simple-banner-uid.json new file mode 100755 index 00000000000..2499790bf5a --- /dev/null +++ b/adapters/criteo/criteotest/exemplary/simple-banner-uid.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/criteotest/supplemental/204-response-from-target.json b/adapters/criteo/criteotest/supplemental/204-response-from-target.json new file mode 100755 index 00000000000..9ac14ff674d --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/204-response-from-target.json @@ -0,0 +1,81 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YYY", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedMakeBidsErrors": [] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/400-response-from-target.json b/adapters/criteo/criteotest/supplemental/400-response-from-target.json new file mode 100755 index 00000000000..ce3a4b628f3 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/400-response-from-target.json @@ -0,0 +1,86 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YYY", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 400 + } + } + ], + "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/criteo/criteotest/supplemental/500-response-from-target.json b/adapters/criteo/criteotest/supplemental/500-response-from-target.json new file mode 100755 index 00000000000..db6c16a38b7 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/500-response-from-target.json @@ -0,0 +1,86 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YYY", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 500 + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-inapp.json b/adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-inapp.json new file mode 100755 index 00000000000..b047fa183d3 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-inapp.json @@ -0,0 +1,115 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YYY", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-uid.json b/adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-uid.json new file mode 100755 index 00000000000..f839624af1e --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/ccpa-with-consent-simple-banner-uid.json @@ -0,0 +1,139 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "regs": { + "ext": { + "us_privacy": "1YYY" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YYY" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-inapp.json b/adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-inapp.json new file mode 100755 index 00000000000..77a37361141 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-inapp.json @@ -0,0 +1,85 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "ip": "91.199.242.236", + "ua": "random user agent", + "os": "android" + }, + "regs": { + "ext": { + "us_privacy": "1YNN" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YNN", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-uid.json b/adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-uid.json new file mode 100755 index 00000000000..31c14fc4213 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/ccpa-without-consent-simple-banner-uid.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "regs": { + "ext": { + "us_privacy": "1YNN" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid", + "uspIab": "1YNN" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-inapp.json b/adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-inapp.json new file mode 100755 index 00000000000..416053dbc67 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-inapp.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "consent": "iabconsentstringwithconsent" + } + }, + "regs": { + "ext": { + "gdpr": 1 + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": { + "consentdata": "iabconsentstringwithconsent", + "gdprapplies": true + }, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-uid.json b/adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-uid.json new file mode 100755 index 00000000000..e8374616db3 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/gdpr-with-consent-simple-banner-uid.json @@ -0,0 +1,142 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "consent": "iabconsentstringwithconsent", + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "regs": { + "ext": { + "gdpr": 1 + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": { + "consentdata": "iabconsentstringwithconsent", + "gdprapplies": true + }, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-inapp.json b/adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-inapp.json new file mode 100755 index 00000000000..7385b93752f --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-inapp.json @@ -0,0 +1,92 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ifa": "test-ifa-123456", + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "consent": "iabconsentstringwithnoconsent" + } + }, + "regs": { + "ext": { + "gdpr": 1 + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": { + "consentdata": "iabconsentstringwithnoconsent", + "gdprapplies": true + }, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-uid.json b/adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-uid.json new file mode 100755 index 00000000000..dbc5fb32848 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/gdpr-without-consent-simple-banner-uid.json @@ -0,0 +1,108 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "consent": "iabconsentstringwithoutconsent", + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "regs": { + "ext": { + "gdpr": 1 + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": { + "consentdata": "iabconsentstringwithoutconsent", + "gdprapplies": true + }, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ], + "expectedBidResponses": [] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/multislots-simple-banner-inapp.json b/adapters/criteo/criteotest/supplemental/multislots-simple-banner-inapp.json new file mode 100755 index 00000000000..75f4118eb93 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/multislots-simple-banner-inapp.json @@ -0,0 +1,213 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "bundle": "test.app.bundle" + }, + "device": { + "ip": "91.199.242.236", + "ua": "random user agent", + "ifa": "test-ifa-123456", + "os": "android" + }, + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 7891011, + "networkid": 78910 + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 121314, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "bundleid": "test.app.bundle", + "networkid": 78910 + }, + "user": { + "deviceid": "test-ifa-123456", + "deviceos": "android", + "deviceidtype": "gaid", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id-1", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + }, + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id-2", + "zoneid": 7891011, + "networkid": 78910, + "sizes": [ + "300x250" + ] + }, + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id-3", + "zoneid": 121314, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "slots": [ + { + "id": "test-slot-id-1", + "impid": "test-imp-id-1", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + }, + { + "id": "test-slot-id-2", + "impid": "test-imp-id-2", + "zoneid": 7891011, + "networkid": 78910, + "cpm": 0.2, + "currency": "USD", + "width": 320, + "height": 50, + "creativeid": "creative-123", + "creative": "" + }, + { + "id": "test-slot-id-3", + "impid": "test-imp-id-3", + "zoneid": 121314, + "networkid": 78910, + "cpm": 0.3, + "currency": "USD", + "width": 300, + "height": 600, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id-1", + "impid": "test-imp-id-1", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-slot-id-2", + "impid": "test-imp-id-2", + "price": 0.2, + "crid": "creative-123", + "adm": "", + "w": 320, + "h": 50 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-slot-id-3", + "impid": "test-imp-id-3", + "price": 0.3, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 600 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid-different-network-ids.json b/adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid-different-network-ids.json new file mode 100755 index 00000000000..dcb51825058 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid-different-network-ids.json @@ -0,0 +1,84 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 7891011, + "networkid": 123456 + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 121314, + "networkid": 467890 + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "Bid request has slots coming with several network IDs which is not allowed", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid.json b/adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid.json new file mode 100755 index 00000000000..e5de75e04c0 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/multislots-simple-banner-uid.json @@ -0,0 +1,233 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 7891011, + "networkid": 78910 + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 121314, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": [ + "91.199.242.236" + ], + "User-Agent": [ + "random user agent" + ] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id-1", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + }, + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id-2", + "zoneid": 7891011, + "networkid": 78910, + "sizes": [ + "300x250" + ] + }, + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id-3", + "zoneid": 121314, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "slots": [ + { + "id": "test-slot-id-1", + "impid": "test-imp-id-1", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + }, + { + "id": "test-slot-id-2", + "impid": "test-imp-id-2", + "zoneid": 7891011, + "networkid": 78910, + "cpm": 0.2, + "currency": "USD", + "width": 320, + "height": 50, + "creativeid": "creative-123", + "creative": "" + }, + { + "id": "test-slot-id-3", + "impid": "test-imp-id-3", + "zoneid": 121314, + "networkid": 78910, + "cpm": 0.3, + "currency": "USD", + "width": 300, + "height": 600, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id-1", + "impid": "test-imp-id-1", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-slot-id-2", + "impid": "test-imp-id-2", + "price": 0.2, + "crid": "creative-123", + "adm": "", + "w": 320, + "h": 50 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-slot-id-3", + "impid": "test-imp-id-3", + "price": 0.3, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 600 + }, + "type": "banner" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats-not-included.json b/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats-not-included.json new file mode 100755 index 00000000000..a0cc53d00f3 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats-not-included.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250, + "format": [ + { + "w": 250, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "250x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats.json b/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats.json new file mode 100755 index 00000000000..016c16a866f --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size-and-formats.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250, + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size.json b/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size.json new file mode 100755 index 00000000000..68e45da9fb3 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/simple-banner-with-direct-size.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ip": "91.199.242.236", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["91.199.242.236"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ip": "91.199.242.236", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/criteotest/supplemental/simple-banner-with-ipv6.json b/adapters/criteo/criteotest/supplemental/simple-banner-with-ipv6.json new file mode 100755 index 00000000000..e248db9bc30 --- /dev/null +++ b/adapters/criteo/criteotest/supplemental/simple-banner-with-ipv6.json @@ -0,0 +1,126 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "id": "site-id", + "page": "criteo.com" + }, + "device": { + "os": "android", + "ipv6": "fd36:ce97:0fa1:dec0:0000:0000:0000:0000", + "ua": "random user agent" + }, + "user": { + "ext": { + "eids": [{ + "source": "criteo.com", + "uids": [{ + "id": "criteo-eid" + }] + }] + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "zoneid": 123456, + "networkid": 78910 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://bidder.criteo.com/cdb?profileId=230", + "headers": { + "X-Forwarded-For": ["fd36:ce97:0fa1:dec0:0000:0000:0000:0000"], + "User-Agent": ["random user agent"] + }, + "body": { + "id": "test-request-id", + "publisher": { + "siteid": "site-id", + "url": "criteo.com", + "networkid": 78910 + }, + "user": { + "ipv6": "fd36:ce97:0fa1:dec0:0000:0000:0000:0000", + "ua": "random user agent", + "deviceos": "android", + "deviceidtype": "gaid" + }, + "gdprconsent": {}, + "slots": [ + { + "slotid": "00000000-0000-0000-00000000", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "sizes": [ + "300x250" + ] + } + ], + "eids": [ + { + "source": "criteo.com", + "uids": [ + { + "id": "criteo-eid" + } + ] + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "slots": [ + { + "id": "test-slot-id", + "impid": "test-imp-id", + "zoneid": 123456, + "networkid": 78910, + "cpm": 0.1, + "currency": "USD", + "width": 300, + "height": 250, + "creativeid": "creative-123", + "creative": "" + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-slot-id", + "impid": "test-imp-id", + "price": 0.1, + "crid": "creative-123", + "adm": "", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/criteo/generators.go b/adapters/criteo/generators.go new file mode 100644 index 00000000000..0ae0cecac78 --- /dev/null +++ b/adapters/criteo/generators.go @@ -0,0 +1,36 @@ +package criteo + +import "github.com/gofrs/uuid" + +type slotIDGenerator interface { + NewSlotID() (string, error) +} + +type randomSlotIDGenerator struct{} + +func newRandomSlotIDGenerator() randomSlotIDGenerator { + return randomSlotIDGenerator{} +} + +func (g randomSlotIDGenerator) NewSlotID() (string, error) { + guid, err := uuid.NewV4() + if err != nil { + return "", err + } + + return guid.String(), nil +} + +type fakeSlotIDGenerator struct { + fakeSlotID string +} + +func newFakeGuidGenerator(fakeSlotID string) fakeSlotIDGenerator { + return fakeSlotIDGenerator{ + fakeSlotID, + } +} + +func (f fakeSlotIDGenerator) NewSlotID() (string, error) { + return f.fakeSlotID, nil +} diff --git a/adapters/criteo/models.go b/adapters/criteo/models.go new file mode 100644 index 00000000000..64f6081d781 --- /dev/null +++ b/adapters/criteo/models.go @@ -0,0 +1,299 @@ +package criteo + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" +) + +type criteoRequest struct { + ID string `json:"id,omitempty"` + Publisher criteoPublisher `json:"publisher,omitempty"` + User criteoUser `json:"user,omitempty"` + GdprConsent criteoGdprConsent `json:"gdprconsent,omitempty"` + Slots []criteoRequestSlot `json:"slots,omitempty"` + Eids []openrtb_ext.ExtUserEid `json:"eids,omitempty"` +} + +func newCriteoRequest(slotIDGenerator slotIDGenerator, request *openrtb2.BidRequest) (criteoRequest, []error) { + var errs []error + + // request cannot be nil by design + + criteoRequest := criteoRequest{} + + criteoRequest.ID = request.ID + + // Extracting request slots + if len(request.Imp) > 0 { + criteoSlots, slotsErr := newCriteoRequestSlots(slotIDGenerator, request.Imp) + if len(slotsErr) > 0 { + return criteoRequest, slotsErr + } + criteoRequest.Slots = criteoSlots + } + + var networkId *int64 + for _, criteoSlot := range criteoRequest.Slots { + if networkId == nil && criteoSlot.NetworkID != nil && *criteoSlot.NetworkID > 0 { + networkId = criteoSlot.NetworkID + } else if networkId != nil && criteoSlot.NetworkID != nil && *criteoSlot.NetworkID != *networkId { + return criteoRequest, []error{&errortypes.BadInput{ + Message: "Bid request has slots coming with several network IDs which is not allowed", + }} + } + } + + criteoRequest.Publisher = newCriteoPublisher(networkId, request.App, request.Site) + + var regsExt *openrtb_ext.ExtRegs + if request.Regs != nil && request.Regs.Ext != nil { + if err := json.Unmarshal(request.Regs.Ext, ®sExt); err != nil { + errs = append(errs, err) + } + } + + criteoRequest.User = newCriteoUser(request.User, request.Device, regsExt) + + if gdprConsent, err := newCriteoGdprConsent(request.User, regsExt); err != nil { + errs = append(errs, err) + } else { + criteoRequest.GdprConsent = gdprConsent + } + + if request.User != nil && request.User.Ext != nil { + var extUser openrtb_ext.ExtUser + if err := json.Unmarshal(request.User.Ext, &extUser); err != nil { + errs = append(errs, err) + } else { + criteoRequest.Eids = extUser.Eids + } + } + + return criteoRequest, errs +} + +type criteoPublisher struct { + SiteID string `json:"siteid,omitempty"` + BundleID string `json:"bundleid,omitempty"` + URL string `json:"url,omitempty"` + NetworkID *int64 `json:"networkid,omitempty"` +} + +func newCriteoPublisher(networkId *int64, app *openrtb2.App, site *openrtb2.Site) criteoPublisher { + // Both app and site cannot be nil at the same time by design in PBS + + criteoPublisher := criteoPublisher{} + + if networkId != nil && *networkId > 0 { + criteoPublisher.NetworkID = networkId + } + + if app != nil { + criteoPublisher.BundleID = app.Bundle + } + + if site != nil { + criteoPublisher.SiteID = site.ID + criteoPublisher.URL = site.Page + } + + return criteoPublisher +} + +type criteoUser struct { + DeviceID string `json:"deviceid,omitempty"` + DeviceOS string `json:"deviceos,omitempty"` + DeviceIDType string `json:"deviceidtype,omitempty"` + CookieID string `json:"cookieuid,omitempty"` + UID string `json:"uid,omitempty"` + IP string `json:"ip,omitempty"` + IPv6 string `json:"ipv6,omitempty"` + UA string `json:"ua,omitempty"` + UspIab string `json:"uspIab,omitempty"` +} + +func newCriteoUser(user *openrtb2.User, device *openrtb2.Device, regsExt *openrtb_ext.ExtRegs) criteoUser { + criteoUser := criteoUser{} + + if user == nil && device == nil { + return criteoUser + } + + if user != nil { + criteoUser.CookieID = user.BuyerUID + } + + if device != nil { + deviceType := getDeviceType(device.OS) + criteoUser.DeviceIDType = deviceType + + criteoUser.DeviceOS = device.OS + criteoUser.DeviceID = device.IFA + criteoUser.IP = device.IP + criteoUser.IPv6 = device.IPv6 + criteoUser.UA = device.UA + } + + if regsExt != nil { + criteoUser.UspIab = regsExt.USPrivacy // CCPA + } + + return criteoUser +} + +type criteoGdprConsent struct { + GdprApplies *bool `json:"gdprapplies,omitempty"` + ConsentData string `json:"consentdata,omitempty"` +} + +func newCriteoGdprConsent(user *openrtb2.User, regsExt *openrtb_ext.ExtRegs) (criteoGdprConsent, error) { + consent := criteoGdprConsent{} + + if user == nil && regsExt == nil { + return consent, nil + } + + if user != nil && user.Ext != nil { + var userExt *openrtb_ext.ExtUser + if err := json.Unmarshal(user.Ext, &userExt); err != nil { + return consent, err + } + consent.ConsentData = userExt.Consent + } + + if regsExt != nil { + if regsExt.GDPR != nil { + gdprApplies := bool((*regsExt.GDPR & 1) == 1) + consent.GdprApplies = &gdprApplies + } + } + + return consent, nil +} + +type criteoRequestSlot struct { + SlotID string `json:"slotid,omitempty"` + ImpID string `json:"impid,omitempty"` + ZoneID *int64 `json:"zoneid,omitempty"` + NetworkID *int64 `json:"networkid,omitempty"` + Sizes []criteoRequestSize `json:"sizes,omitempty"` +} + +func newCriteoRequestSlots(slotIDGenerator slotIDGenerator, impressions []openrtb2.Imp) ([]criteoRequestSlot, []error) { + var errs []error + + // `impressions` known not to be nil or empty by design, PBS checks it upstream. + + // Criteo slot should comes with any of (both are ok as well): + // - `zoneid` + // - `networkid`, `slotid`, `sizes` + // + // if not, criteo will reject the slot. + + var criteoSlots = make([]criteoRequestSlot, len(impressions)) + + for i := 0; i < len(impressions); i++ { + criteoSlots[i] = criteoRequestSlot{} + + criteoSlots[i].ImpID = impressions[i].ID + + // Generating a random slot ID + generatedSlotID, err := slotIDGenerator.NewSlotID() + if err != nil { + errs = append(errs, err) + continue + } + criteoSlots[i].SlotID = generatedSlotID + + if impressions[i].Banner != nil { + if impressions[i].Banner.Format != nil { + criteoSlots[i].Sizes = make([]criteoRequestSize, len(impressions[i].Banner.Format)) + for idx, format := range impressions[i].Banner.Format { + criteoSlots[i].Sizes[idx] = newCriteoRequestSize(format.W, format.H) + } + } else if impressions[i].Banner.W != nil && *impressions[i].Banner.W > 0 && impressions[i].Banner.H != nil && *impressions[i].Banner.H > 0 { + criteoSlots[i].Sizes = make([]criteoRequestSize, 1) + criteoSlots[i].Sizes[0] = newCriteoRequestSize(*impressions[i].Banner.W, *impressions[i].Banner.H) + } + } + + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(impressions[i].Ext, &bidderExt); err != nil { + errs = append(errs, err) + continue + } + + if bidderExt.Bidder != nil { + var criteoExt openrtb_ext.ExtImpCriteo + if err := json.Unmarshal(bidderExt.Bidder, &criteoExt); err != nil { + errs = append(errs, err) + continue + } + if criteoExt.ZoneID > 0 { + criteoSlots[i].ZoneID = &criteoExt.ZoneID + } + if criteoExt.NetworkID > 0 { + criteoSlots[i].NetworkID = &criteoExt.NetworkID + } + } + } + + return criteoSlots, errs +} + +type criteoRequestSize = string + +func newCriteoRequestSize(width int64, height int64) criteoRequestSize { + return fmt.Sprintf("%dx%d", width, height) +} + +var deviceType = map[string]string{ + "ios": "idfa", + "android": "gaid", + "unknown": "unknown", +} + +func getDeviceType(os string) string { + if os != "" { + if dtype, ok := deviceType[strings.ToLower(os)]; ok { + return dtype + } + } + + return deviceType["unknown"] +} + +type criteoResponse struct { + ID string `json:"id,omitempty"` + Slots []criteoResponseSlot `json:"slots,omitempty"` +} + +func newCriteoResponseFromBytes(bytes []byte) (criteoResponse, error) { + var err error + var bidResponse criteoResponse + + if err = json.Unmarshal(bytes, &bidResponse); err != nil { + return bidResponse, err + } + + return bidResponse, nil +} + +type criteoResponseSlot struct { + ID string `json:"id,omitempty"` + ImpID string `json:"impid,omitempty"` + ZoneID int64 `json:"zoneid,omitempty"` + NetworkID int64 `json:"networkid,omitempty"` + CPM float64 `json:"cpm,omitempty"` + Currency string `json:"currency,omitempty"` + Width int64 `json:"width,omitempty"` + Height int64 `json:"height,omitempty"` + Creative string `json:"creative,omitempty"` + CreativeID string `json:"creativeid,omitempty"` +} diff --git a/adapters/criteo/models_test.go b/adapters/criteo/models_test.go new file mode 100644 index 00000000000..9da7bda210b --- /dev/null +++ b/adapters/criteo/models_test.go @@ -0,0 +1,452 @@ +package criteo + +import ( + "encoding/json" + "reflect" + "testing" + + "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestGetDeviceType(t *testing.T) { + + // Setup: + deviceTypeCases := []struct { + deviceType string + expected string + }{ + {"ios", "idfa"}, + {"Ios", "idfa"}, + {"IOS", "idfa"}, + {"android", "gaid"}, + {"unknown", "unknown"}, + {"", "unknown"}, + {"qwerty", "unknown"}, + {"qWerty", "unknown"}, + {"abc", "unknown"}, + } + + for _, uc := range deviceTypeCases { + // Execute: + result := getDeviceType(uc.deviceType) + + // Verify: + if uc.expected != result { + t.Errorf("Bad getDeviceType for '%s'. Expected: %s, got %s", uc.deviceType, uc.expected, result) + } + } +} + +func TestNewCriteoRequest(t *testing.T) { + // Setup: + var ( + dummyRequestID = "random request ID" + dummyPublisherBundleID = "bundleid" + dummyPublisherURL = "test.com" + dummyPublisherSiteID = "siteid" + dummyUserDeviceID = "random-device-id" + dummyUserDeviceOS = "android" + dummyUserDeviceIDType = "gaid" + dummyUserCookieID = "random-cookie-id" + dummyUserIP = "1.1.1.1" + dummyUserUA = "random UA" + dummyGdprApplies = true + dummyGdprAppliesUint = int8(1) + dummyGdprConsentData = "randomconsentdata" + dummySlotID = "11111111-1111-1111-11111111" + dummySlotImpID = "fake-imp-id-1" + dummySlotZoneID = int64(1) + ) + + fakeSlotIDGenerator := newFakeGuidGenerator(dummySlotID) + + // The request doesn't make any sense but aims to fill every single criteo request fields + expectedCriteoRequest := criteoRequest{ + ID: dummyRequestID, + Publisher: criteoPublisher{ + SiteID: dummyPublisherSiteID, + BundleID: dummyPublisherBundleID, + URL: dummyPublisherURL, + }, + User: criteoUser{ + DeviceID: dummyUserDeviceID, + DeviceOS: dummyUserDeviceOS, + DeviceIDType: dummyUserDeviceIDType, + CookieID: dummyUserCookieID, + IP: dummyUserIP, + UA: dummyUserUA, + }, + GdprConsent: criteoGdprConsent{ + GdprApplies: &dummyGdprApplies, + ConsentData: dummyGdprConsentData, + }, + Slots: []criteoRequestSlot{ + { + SlotID: dummySlotID, + ImpID: dummySlotImpID, + ZoneID: &dummySlotZoneID, + }, + }, + } + + userExtJSON, _ := json.Marshal(&openrtb_ext.ExtUser{ + Consent: dummyGdprConsentData, + }) + regsExtJSON, _ := json.Marshal(&openrtb_ext.ExtRegs{ + GDPR: &dummyGdprAppliesUint, + }) + bidderExtJSON, _ := json.Marshal(&openrtb_ext.ExtImpCriteo{ + ZoneID: dummySlotZoneID, + }) + impExtJSON, _ := json.Marshal(&adapters.ExtImpBidder{ + Bidder: bidderExtJSON, + }) + incomingRequest := &openrtb2.BidRequest{ + ID: dummyRequestID, + App: &openrtb2.App{ + Bundle: dummyPublisherBundleID, + }, + Site: &openrtb2.Site{ + ID: dummyPublisherSiteID, + Page: dummyPublisherURL, + }, + User: &openrtb2.User{ + BuyerUID: dummyUserCookieID, + Ext: userExtJSON, + }, + Regs: &openrtb2.Regs{ + Ext: regsExtJSON, + }, + Device: &openrtb2.Device{ + IFA: dummyUserDeviceID, + OS: dummyUserDeviceOS, + IP: dummyUserIP, + UA: dummyUserUA, + }, + Imp: []openrtb2.Imp{ + { + ID: dummySlotImpID, + Ext: impExtJSON, + }, + }, + } + + // Execute: + result, err := newCriteoRequest(fakeSlotIDGenerator, incomingRequest) + + // Verify: + if err != nil { + t.Errorf("newCriteoRequest has errors: %s", err) + } + + if expectedCriteoRequest.ID != result.ID || + !reflect.DeepEqual(expectedCriteoRequest, result) || + !reflect.DeepEqual(expectedCriteoRequest.Publisher, result.Publisher) || + !reflect.DeepEqual(expectedCriteoRequest.User, result.User) || + !reflect.DeepEqual(expectedCriteoRequest.GdprConsent, result.GdprConsent) || + len(expectedCriteoRequest.Slots) != len(result.Slots) || + !reflect.DeepEqual(expectedCriteoRequest.Slots[0], result.Slots[0]) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("newCriteoRequest was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} + +func TestGetGdprConsent(t *testing.T) { + // Setup: + var ( + dummyGdprApplies = true + dummyGdprConsentData = "randomconsentdata" + dummyGdprAppliesUint = int8(1) + ) + + expectedCriteoRequest := criteoRequest{ + GdprConsent: criteoGdprConsent{ + GdprApplies: &dummyGdprApplies, + ConsentData: dummyGdprConsentData, + }, + } + + userExtJSON, _ := json.Marshal(&openrtb_ext.ExtUser{ + Consent: dummyGdprConsentData, + }) + regsExtJSON, _ := json.Marshal(&openrtb_ext.ExtRegs{ + GDPR: &dummyGdprAppliesUint, + }) + incomingRequest := &openrtb2.BidRequest{ + User: &openrtb2.User{ + Ext: userExtJSON, + }, + Regs: &openrtb2.Regs{ + Ext: regsExtJSON, + }, + } + + var regsExt *openrtb_ext.ExtRegs + if incomingRequest.Regs != nil { + json.Unmarshal(incomingRequest.Regs.Ext, ®sExt) + } + + // Execute: + gdprConsent, _ := newCriteoGdprConsent(incomingRequest.User, regsExt) + result := criteoRequest{ + GdprConsent: gdprConsent, + } + + // Verify: + if !reflect.DeepEqual(expectedCriteoRequest, result) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("getGdprConsent was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} + +func TestGetUser(t *testing.T) { + // Setup: + var ( + dummyUserDeviceID = "random-device-id" + dummyUserDeviceOS = "android" + dummyUserDeviceIDType = "gaid" + dummyUserCookieID = "random-cookie-id" + dummyUserIP = "1.1.1.1" + dummyUserUA = "random UA" + dummyCcpaString = "1YYY" + ) + expectedCriteoRequest := &criteoRequest{ + User: criteoUser{ + DeviceID: dummyUserDeviceID, + DeviceOS: dummyUserDeviceOS, + DeviceIDType: dummyUserDeviceIDType, + CookieID: dummyUserCookieID, + IP: dummyUserIP, + UA: dummyUserUA, + UspIab: dummyCcpaString, + }, + } + + regsExt := &openrtb_ext.ExtRegs{ + USPrivacy: dummyCcpaString, + } + regsExtData, err := json.Marshal(regsExt) + if err != nil { + t.Errorf("cannot marshal regsExt data") + } + + incomingRequest := &openrtb2.BidRequest{ + User: &openrtb2.User{ + BuyerUID: dummyUserCookieID, + }, + Device: &openrtb2.Device{ + IFA: dummyUserDeviceID, + OS: dummyUserDeviceOS, + IP: dummyUserIP, + UA: dummyUserUA, + }, + Regs: &openrtb2.Regs{ + Ext: regsExtData, + }, + } + + // Execute: + result := &criteoRequest{ + User: newCriteoUser(incomingRequest.User, incomingRequest.Device, regsExt), + } + + // Verify: + if !reflect.DeepEqual(expectedCriteoRequest.User, result.User) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("getUser was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} + +func TestGetUser_NilUserAndDevice(t *testing.T) { + // Setup: + var dummyCcpaString = "1YYY" + + expectedCriteoRequest := &criteoRequest{} + + regsExt := &openrtb_ext.ExtRegs{ + USPrivacy: dummyCcpaString, + } + regsExtData, err := json.Marshal(regsExt) + if err != nil { + t.Errorf("cannot marshal regsExt data") + } + + incomingRequest := &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ + Ext: regsExtData, + }, + } + + // Execute: + result := &criteoRequest{ + User: newCriteoUser(incomingRequest.User, incomingRequest.Device, regsExt), + } + + // Verify: + if !reflect.DeepEqual(expectedCriteoRequest.User, result.User) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("getUser was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} + +func TestPublisher(t *testing.T) { + // Setup: + var ( + dummyPublisherSiteID = "siteid" + dummyPublisherBundleID = "bundleid" + dummyPublisherURL = "test.com" + dummyNetworkID int64 = 1234567 + ) + expectedCriteoRequest := &criteoRequest{ + Publisher: criteoPublisher{ + SiteID: dummyPublisherSiteID, + BundleID: dummyPublisherBundleID, + URL: dummyPublisherURL, + NetworkID: &dummyNetworkID, + }, + } + + incomingRequest := &openrtb2.BidRequest{ + App: &openrtb2.App{ + Bundle: dummyPublisherBundleID, + }, + Site: &openrtb2.Site{ + ID: dummyPublisherSiteID, + Page: dummyPublisherURL, + }, + } + + // Execute: + result := &criteoRequest{ + Publisher: newCriteoPublisher(&dummyNetworkID, incomingRequest.App, incomingRequest.Site), + } + + // Verify: + if !reflect.DeepEqual(expectedCriteoRequest.Publisher, result.Publisher) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("getPublisher was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} + +func TestGetRequestSlots(t *testing.T) { + // Setup: + var ( + dummySlotImpID = "fake-imp-id-1" + dummySlotZoneID = int64(1) + dummySlotID = "22222222-2222-2222-22222222" + ) + + fakeSlotIDGenerator := newFakeGuidGenerator(dummySlotID) + + expectedCriteoRequest := &criteoRequest{ + Slots: []criteoRequestSlot{ + { + SlotID: dummySlotID, + ImpID: dummySlotImpID, + ZoneID: &dummySlotZoneID, + }, + }, + } + + bidderExtJSON, _ := json.Marshal(&openrtb_ext.ExtImpCriteo{ + ZoneID: dummySlotZoneID, + }) + impExtJSON, _ := json.Marshal(&adapters.ExtImpBidder{ + Bidder: bidderExtJSON, + }) + incomingRequest := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + { + ID: dummySlotImpID, + Ext: impExtJSON, + }, + }, + } + + // Execute: + slots, err := newCriteoRequestSlots(fakeSlotIDGenerator, incomingRequest.Imp) + result := &criteoRequest{ + Slots: slots, + } + + // Verify: + if err != nil { + t.Errorf("newCriteoRequestSlots has errors: %s", err) + } + + if len(expectedCriteoRequest.Slots) != len(result.Slots) || + !reflect.DeepEqual(expectedCriteoRequest.Slots[0], result.Slots[0]) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("newCriteoRequest was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} + +func TestGetRequestMultipleSlots(t *testing.T) { + // Setup: + dummySlots := []struct { + ID string + ZoneID int64 + }{ + {"fake-imp-id-1", 1}, + {"fake-imp-id-2", 2}, + {"fake-imp-id-3", 3}, + {"fake-imp-id-4", 4}, + {"fake-imp-id-5", 5}, + } + + incomingRequest := &openrtb2.BidRequest{ + Imp: make([]openrtb2.Imp, len(dummySlots)), + } + slots := make([]criteoRequestSlot, len(dummySlots)) + + for i := range dummySlots { + // Build expected slots + slots[i] = criteoRequestSlot{ + ImpID: dummySlots[i].ID, + ZoneID: &dummySlots[i].ZoneID, + } + + // Build incoming request imps + bidderExtJSON, _ := json.Marshal(&openrtb_ext.ExtImpCriteo{ + ZoneID: dummySlots[i].ZoneID, + }) + impExtJSON, _ := json.Marshal(&adapters.ExtImpBidder{ + Bidder: bidderExtJSON, + }) + incomingRequest.Imp[i] = openrtb2.Imp{ + ID: dummySlots[i].ID, + Ext: impExtJSON, + } + } + + expectedCriteoRequestSlots, err := newCriteoRequestSlots(newFakeGuidGenerator(""), incomingRequest.Imp) + expectedCriteoRequest := &criteoRequest{ + Slots: expectedCriteoRequestSlots, + } + + // Execute: + slotsResult, err := newCriteoRequestSlots(newFakeGuidGenerator(""), incomingRequest.Imp) + result := &criteoRequest{ + Slots: slotsResult, + } + + // Verify: + if err != nil { + t.Errorf("newCriteoRequestSlots has errors: %s", err) + } + + if len(expectedCriteoRequest.Slots) != len(result.Slots) || + !reflect.DeepEqual(expectedCriteoRequest.Slots, result.Slots) { + actualResultJSON, _ := json.Marshal(result) + expectedResultJSON, _ := json.Marshal(expectedCriteoRequest) + t.Errorf("newCriteoRequest was incorrect, got '%s', want '%s'.", actualResultJSON, expectedResultJSON) + } +} diff --git a/adapters/criteo/params_test.go b/adapters/criteo/params_test.go new file mode 100644 index 00000000000..73ace617b2d --- /dev/null +++ b/adapters/criteo/params_test.go @@ -0,0 +1,63 @@ +package criteo + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +// This file actually intends to test static/bidder-params/criteo.json +// +// These also validate the format of the external API: request.imp[i].ext.criteo + +// TestValidParams makes sure that the criteo schema accepts all imp.ext fields which we intend to support. +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.BidderCriteo, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected criteo params: %s", validParam) + } + } +} + +// TestInvalidParams makes sure that the criteo schema rejects all the imp.ext fields we don't support. +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.BidderCriteo, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"zoneid": 123456}`, + `{"networkid": 78910}`, + `{"zoneid": 123456, "networkid": 78910}`, + `{"zoneid": 0, "networkid": 0}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"zoneid": -123}`, + `{"networkid": -321}`, + `{"zoneid": -123, "networkid": -321}`, + `{"zoneid": -1}`, + `{"networkid": -1}`, + `{"zoneid": -1, "networkid": -1}`, +} diff --git a/adapters/criteo/usersync.go b/adapters/criteo/usersync.go new file mode 100644 index 00000000000..3deba085ac4 --- /dev/null +++ b/adapters/criteo/usersync.go @@ -0,0 +1,14 @@ +package criteo + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +// NewCriteoSyncer user syncer for Criteo +// Criteo doesn't need user synchronization yet. +func NewCriteoSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("criteo", temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/criteo/usersync_test.go b/adapters/criteo/usersync_test.go new file mode 100644 index 00000000000..9010d8bb450 --- /dev/null +++ b/adapters/criteo/usersync_test.go @@ -0,0 +1,26 @@ +package criteo + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestCriteoSyncer(t *testing.T) { + url := "//prebidserver/getuid?https%3A%2F%2Fprebidserver%2Fpbs%2Fv1%2Fsetuid%3Fbidder%3Dcriteo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID" + temp := template.Must(template.New("sync-template").Parse(url)) + syncer := NewCriteoSyncer(temp) + info, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "1", + }, + }) + assert.NoError(t, err) + assert.EqualValues(t, adapters.SyncTypeRedirect, info.Type) + assert.Equal(t, false, info.SupportCORS) + assert.Equal(t, "//prebidserver/getuid?https%3A%2F%2Fprebidserver%2Fpbs%2Fv1%2Fsetuid%3Fbidder%3Dcriteo%26gdpr%3D1%26gdpr_consent%3D%26uid%3D%24UID", info.URL) +} diff --git a/config/config.go b/config/config.go index e22080fe602..00aceba98cd 100644 --- a/config/config.go +++ b/config/config.go @@ -836,6 +836,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.consumable.endpoint", "https://e.serverbid.com/api/v2") v.SetDefault("adapters.conversant.endpoint", "http://api.hb.ad.cpe.dotomi.com/cvx/server/hb/ortb/25") v.SetDefault("adapters.cpmstar.endpoint", "https://server.cpmstar.com/openrtbbidrq.aspx") + v.SetDefault("adapters.criteo.endpoint", "https://bidder.criteo.com/cdb?profileId=230") v.SetDefault("adapters.datablocks.endpoint", "http://{{.Host}}/openrtb2?sid={{.SourceId}}") v.SetDefault("adapters.decenterads.endpoint", "http://supply.decenterads.com/?c=o&m=rtb") v.SetDefault("adapters.deepintent.endpoint", "https://prebid.deepintent.com/prebid") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 6c649fde5c8..0ea28f8a610 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -36,6 +36,7 @@ import ( "github.com/prebid/prebid-server/adapters/consumable" "github.com/prebid/prebid-server/adapters/conversant" "github.com/prebid/prebid-server/adapters/cpmstar" + "github.com/prebid/prebid-server/adapters/criteo" "github.com/prebid/prebid-server/adapters/datablocks" "github.com/prebid/prebid-server/adapters/decenterads" "github.com/prebid/prebid-server/adapters/deepintent" @@ -145,6 +146,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderConsumable: consumable.Builder, openrtb_ext.BidderConversant: conversant.Builder, openrtb_ext.BidderCpmstar: cpmstar.Builder, + openrtb_ext.BidderCriteo: criteo.Builder, openrtb_ext.BidderDatablocks: datablocks.Builder, openrtb_ext.BidderDecenterAds: decenterads.Builder, openrtb_ext.BidderDeepintent: deepintent.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 66dcbebcaff..4d95babc988 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -107,6 +107,7 @@ const ( BidderConsumable BidderName = "consumable" BidderConversant BidderName = "conversant" BidderCpmstar BidderName = "cpmstar" + BidderCriteo BidderName = "criteo" BidderDatablocks BidderName = "datablocks" BidderDmx BidderName = "dmx" BidderDecenterAds BidderName = "decenterads" @@ -216,6 +217,7 @@ func CoreBidderNames() []BidderName { BidderConsumable, BidderConversant, BidderCpmstar, + BidderCriteo, BidderDatablocks, BidderDecenterAds, BidderDeepintent, diff --git a/openrtb_ext/imp_criteo.go b/openrtb_ext/imp_criteo.go new file mode 100644 index 00000000000..e200aace496 --- /dev/null +++ b/openrtb_ext/imp_criteo.go @@ -0,0 +1,7 @@ +package openrtb_ext + +// ExtImpCriteo defines the contract for bidrequest.imp[i].ext.criteo +type ExtImpCriteo struct { + ZoneID int64 `json:"zoneId"` + NetworkID int64 `json:"networkId"` +} diff --git a/static/bidder-info/criteo.yaml b/static/bidder-info/criteo.yaml new file mode 100644 index 00000000000..b27e1fae369 --- /dev/null +++ b/static/bidder-info/criteo.yaml @@ -0,0 +1,10 @@ +maintainer: + email: "pi-direct@criteo.com" +gvlVendorID: 91 +capabilities: + app: + mediaTypes: + - banner + site: + mediaTypes: + - banner \ No newline at end of file diff --git a/static/bidder-params/criteo.json b/static/bidder-params/criteo.json new file mode 100644 index 00000000000..9d348a7eded --- /dev/null +++ b/static/bidder-params/criteo.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Criteo adapter params", + "description": "The schema to validate Criteo specific params accepted by Criteo adapter", + "type": "object", + "properties": { + "zoneid": { + "type": "number", + "description": "Impression's zone ID.", + "minimum": 0 + }, + "networkid": { + "type": "number", + "description": "Impression's network ID.", + "minimum": 0 + } + }, + "anyOf": [ + { + "required": [ + "zoneid" + ] + }, + { + "required": [ + "networkid" + ] + } + ] +} \ No newline at end of file diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 7467eb261fa..f01e4e4b917 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -32,6 +32,7 @@ import ( "github.com/prebid/prebid-server/adapters/consumable" "github.com/prebid/prebid-server/adapters/conversant" "github.com/prebid/prebid-server/adapters/cpmstar" + "github.com/prebid/prebid-server/adapters/criteo" "github.com/prebid/prebid-server/adapters/datablocks" "github.com/prebid/prebid-server/adapters/deepintent" "github.com/prebid/prebid-server/adapters/dmx" @@ -122,6 +123,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderConnectAd, connectad.NewConnectAdSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderConsumable, consumable.NewConsumableSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderConversant, conversant.NewConversantSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderCriteo, criteo.NewCriteoSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderCpmstar, cpmstar.NewCpmstarSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderDatablocks, datablocks.NewDatablocksSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderDeepintent, deepintent.NewDeepintentSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 51ea19d7577..a389a007306 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -41,6 +41,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderConsumable): syncConfig, string(openrtb_ext.BidderConversant): syncConfig, string(openrtb_ext.BidderCpmstar): syncConfig, + string(openrtb_ext.BidderCriteo): syncConfig, string(openrtb_ext.BidderDatablocks): syncConfig, string(openrtb_ext.BidderDmx): syncConfig, string(openrtb_ext.BidderDeepintent): syncConfig, From 7cf60db6c0b60c50d7336c8a0befa1d9a41382e7 Mon Sep 17 00:00:00 2001 From: Brian Sardo <1168933+bsardo@users.noreply.github.com> Date: Tue, 6 Apr 2021 10:56:38 -0400 Subject: [PATCH 54/91] Fix shared memory issue when stripping authorization header from bid requests (#1790) --- exchange/bidder.go | 13 ++++------- exchange/bidder_test.go | 52 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/exchange/bidder.go b/exchange/bidder.go index 5b6da499093..9707ddcb4fe 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -167,10 +167,6 @@ func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb2.B if debugInfo := ctx.Value(DebugContextKey); debugInfo != nil && debugInfo.(bool) { if accountDebugAllowed { if bidder.config.DebugInfo.Allow { - // it's safe to mutate the request headers since from this point on the - // information is only used for debugging. - removeSensitiveHeaders(httpInfo.request.Headers) - seatBid.httpCalls = append(seatBid.httpCalls, makeExt(httpInfo)) } else { debugDisabledWarning := errortypes.Warning{ @@ -331,9 +327,10 @@ func getAssetByID(id int64, assets []nativeRequests.Asset) (nativeRequests.Asset var authorizationHeader = http.CanonicalHeaderKey("authorization") -// removeSensitiveHeaders mutates the http header object to remove sensitive information. -func removeSensitiveHeaders(h http.Header) { - h.Del(authorizationHeader) +func filterHeader(h http.Header) http.Header { + clone := h.Clone() + clone.Del(authorizationHeader) + return clone } // makeExt transforms information about the HTTP call into the contract class for the PBS response. @@ -343,7 +340,7 @@ func makeExt(httpInfo *httpCallInfo) *openrtb_ext.ExtHttpCall { if httpInfo != nil && httpInfo.request != nil { ext.Uri = httpInfo.request.Uri ext.RequestBody = string(httpInfo.request.Body) - ext.RequestHeaders = httpInfo.request.Headers + ext.RequestHeaders = filterHeader(httpInfo.request.Headers) if httpInfo.err == nil && httpInfo.response != nil { ext.ResponseBody = string(httpInfo.response.Body) diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index 7c01cd84c83..41ca420a433 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -974,6 +974,50 @@ func TestMakeExt(t *testing.T) { Status: 999, }, }, + { + description: "Request & Response - No Error with Authorization removal", + given: &httpCallInfo{ + err: nil, + request: &adapters.RequestData{ + Uri: "requestUri", + Body: []byte("requestBody"), + Headers: makeHeader(map[string][]string{"Key1": {"value1", "value2"}, "Authorization": {"secret"}}), + }, + response: &adapters.ResponseData{ + Body: []byte("responseBody"), + StatusCode: 999, + }, + }, + expected: &openrtb_ext.ExtHttpCall{ + Uri: "requestUri", + RequestBody: "requestBody", + RequestHeaders: map[string][]string{"Key1": {"value1", "value2"}}, + ResponseBody: "responseBody", + Status: 999, + }, + }, + { + description: "Request & Response - No Error with nil header", + given: &httpCallInfo{ + err: nil, + request: &adapters.RequestData{ + Uri: "requestUri", + Body: []byte("requestBody"), + Headers: nil, + }, + response: &adapters.ResponseData{ + Body: []byte("responseBody"), + StatusCode: 999, + }, + }, + expected: &openrtb_ext.ExtHttpCall{ + Uri: "requestUri", + RequestBody: "requestBody", + RequestHeaders: nil, + ResponseBody: "responseBody", + Status: 999, + }, + }, { description: "Request & Response - Error", given: &httpCallInfo{ @@ -1029,7 +1073,7 @@ func TestMakeExt(t *testing.T) { } } -func TestRemoveSensitiveHeaders(t *testing.T) { +func TestFilterHeader(t *testing.T) { testCases := []struct { description string given http.Header @@ -1043,7 +1087,7 @@ func TestRemoveSensitiveHeaders(t *testing.T) { { description: "Empty", given: http.Header{}, - expected: map[string][]string{}, + expected: http.Header{}, }, { description: "One", @@ -1073,8 +1117,8 @@ func TestRemoveSensitiveHeaders(t *testing.T) { } for _, test := range testCases { - removeSensitiveHeaders(test.given) - assert.Equal(t, test.expected, test.given, test.description) + result := filterHeader(test.given) + assert.Equal(t, test.expected, result, test.description) } } From 245accfc87dabe51f88b1b373c8332761e8a0ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Iwa=C5=84czak?= <36727380+piwanczak@users.noreply.github.com> Date: Wed, 7 Apr 2021 20:47:12 +0200 Subject: [PATCH 55/91] RTB House: update parameters (#1785) * update parameters required by RTB House adapter * tabs to spaces Co-authored-by: Przemyslaw Iwanczak --- static/bidder-params/rtbhouse.json | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/static/bidder-params/rtbhouse.json b/static/bidder-params/rtbhouse.json index e8f6bd03cff..00732bedd2f 100644 --- a/static/bidder-params/rtbhouse.json +++ b/static/bidder-params/rtbhouse.json @@ -1,8 +1,13 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "RTB House Adapter Params", - "description": "A schema which validates params accepted by the RTB House adapter", - "type": "object", - "properties": {}, - "required": [] + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "RTB House Adapter Params", + "description": "A schema which validates params accepted by the RTB House adapter", + "type": "object", + "properties": { + "publisherId": { + "type": "string", + "description": "The publisher’s ID provided by RTB House" + } + }, + "required": ["publisherId"] } From 570894372767189391eb67eb03c972680587032b Mon Sep 17 00:00:00 2001 From: Veronika Solovei Date: Thu, 8 Apr 2021 11:34:27 -0700 Subject: [PATCH 56/91] Generate seatbid[].bid[].ext.prebid.bidid (#1772) --- config/config.go | 3 + config/config_test.go | 3 + exchange/bidder.go | 2 + exchange/events.go | 14 +- exchange/events_test.go | 42 +++-- exchange/exchange.go | 33 ++++ exchange/exchange_test.go | 105 +++++++----- exchange/exchangetest/bid-id-invalid.json | 161 ++++++++++++++++++ exchange/exchangetest/bid-id-valid.json | 154 +++++++++++++++++ .../events-vast-account-off-request-on.json | 11 +- exchange/targeting_test.go | 1 + openrtb_ext/bid.go | 1 + 12 files changed, 472 insertions(+), 58 deletions(-) create mode 100644 exchange/exchangetest/bid-id-invalid.json create mode 100644 exchange/exchangetest/bid-id-valid.json diff --git a/config/config.go b/config/config.go index 00aceba98cd..7b78fb26bde 100644 --- a/config/config.go +++ b/config/config.go @@ -80,6 +80,8 @@ type Configuration struct { RequestValidation RequestValidation `mapstructure:"request_validation"` // When true, PBS will assign a randomly generated UUID to req.Source.TID if it is empty AutoGenSourceTID bool `mapstructure:"auto_gen_source_tid"` + //When true, new bid id will be generated in seatbid[].bid[].ext.prebid.bidid and used in event urls instead + GenerateBidID bool `mapstructure:"generate_bid_id"` } const MIN_COOKIE_SIZE_BYTES = 500 @@ -958,6 +960,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("account_defaults.debug_allow", true) v.SetDefault("certificates_file", "") v.SetDefault("auto_gen_source_tid", true) + v.SetDefault("generate_bid_id", false) v.SetDefault("request_timeout_headers.request_time_in_queue", "") v.SetDefault("request_timeout_headers.request_timeout_in_queue", "") diff --git a/config/config_test.go b/config/config_test.go index 7ff5f0fafa1..43ee8fa21df 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -139,6 +139,7 @@ func TestDefaults(t *testing.T) { cmpBools(t, "stored_requests.filesystem.enabled", false, cfg.StoredRequests.Files.Enabled) cmpStrings(t, "stored_requests.filesystem.directorypath", "./stored_requests/data/by_id", cfg.StoredRequests.Files.Path) cmpBools(t, "auto_gen_source_tid", cfg.AutoGenSourceTID, true) + cmpBools(t, "generate_bid_id", cfg.GenerateBidID, false) } var fullConfig = []byte(` @@ -230,6 +231,7 @@ certificates_file: /etc/ssl/cert.pem request_validation: ipv4_private_networks: ["1.1.1.0/24"] ipv6_private_networks: ["1111::/16", "2222::/16"] +generate_bid_id: true `) var adapterExtraInfoConfig = []byte(` @@ -415,6 +417,7 @@ func TestFullConfig(t *testing.T) { cmpStrings(t, "request_validation.ipv4_private_networks", cfg.RequestValidation.IPv4PrivateNetworks[0], "1.1.1.0/24") cmpStrings(t, "request_validation.ipv6_private_networks", cfg.RequestValidation.IPv6PrivateNetworks[0], "1111::/16") cmpStrings(t, "request_validation.ipv6_private_networks", cfg.RequestValidation.IPv6PrivateNetworks[1], "2222::/16") + cmpBools(t, "generate_bid_id", cfg.GenerateBidID, true) } func TestUnmarshalAdapterExtraInfo(t *testing.T) { diff --git a/exchange/bidder.go b/exchange/bidder.go index 9707ddcb4fe..23b42d2a9d7 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -61,6 +61,7 @@ type adaptedBidder interface { // pbsOrtbBid.bidEvents is set by exchange when event tracking is enabled // pbsOrtbBid.dealPriority is optionally provided by adapters and used internally by the exchange to support deal targeted campaigns. // pbsOrtbBid.dealTierSatisfied is set to true by exchange.updateHbPbCatDur if deal tier satisfied otherwise it will be set to false +// pbsOrtbBid.generatedBidID is unique bid id generated by prebid server if generate bid id option is enabled in config type pbsOrtbBid struct { bid *openrtb2.Bid bidType openrtb_ext.BidType @@ -69,6 +70,7 @@ type pbsOrtbBid struct { bidEvents *openrtb_ext.ExtBidPrebidEvents dealPriority int dealTierSatisfied bool + generatedBidID string } // pbsOrtbSeatBid is a SeatBid returned by an adaptedBidder. diff --git a/exchange/events.go b/exchange/events.go index f15579c6d25..bedafddf5a0 100644 --- a/exchange/events.go +++ b/exchange/events.go @@ -4,7 +4,7 @@ import ( "encoding/json" "time" - jsonpatch "github.com/evanphx/json-patch" + "github.com/evanphx/json-patch" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/endpoints/events" @@ -62,7 +62,11 @@ func (ev *eventTracking) modifyBidVAST(pbsBid *pbsOrtbBid, bidderName openrtb_ex return } vastXML := makeVAST(bid) - if newVastXML, ok := events.ModifyVastXmlString(ev.externalURL, vastXML, bid.ID, bidderName.String(), ev.accountID, ev.auctionTimestampMs); ok { + bidID := bid.ID + if len(pbsBid.generatedBidID) > 0 { + bidID = pbsBid.generatedBidID + } + if newVastXML, ok := events.ModifyVastXmlString(ev.externalURL, vastXML, bidID, bidderName.String(), ev.accountID, ev.auctionTimestampMs); ok { bid.AdM = newVastXML } } @@ -103,10 +107,14 @@ func (ev *eventTracking) makeBidExtEvents(pbsBid *pbsOrtbBid, bidderName openrtb // makeEventURL returns an analytics event url for the requested type (win or imp) func (ev *eventTracking) makeEventURL(evType analytics.EventType, pbsBid *pbsOrtbBid, bidderName openrtb_ext.BidderName) string { + bidId := pbsBid.bid.ID + if len(pbsBid.generatedBidID) > 0 { + bidId = pbsBid.generatedBidID + } return events.EventRequestToUrl(ev.externalURL, &analytics.EventRequest{ Type: evType, - BidID: pbsBid.bid.ID, + BidID: bidId, Bidder: string(bidderName), AccountID: ev.accountID, Timestamp: ev.auctionTimestampMs, diff --git a/exchange/events_test.go b/exchange/events_test.go index 6685918ee6e..bde2b235987 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -13,6 +13,7 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { enabledForAccount bool enabledForRequest bool bidType openrtb_ext.BidType + generatedBidId string } tests := []struct { name string @@ -21,7 +22,7 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { }{ { name: "banner: events enabled for request, disabled for account", - args: args{enabledForAccount: false, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: false, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, want: &openrtb_ext.ExtBidPrebidEvents{ Win: "http://localhost/event?t=win&b=BID-1&a=123456&bidder=openx&ts=1234567890", Imp: "http://localhost/event?t=imp&b=BID-1&a=123456&bidder=openx&ts=1234567890", @@ -29,7 +30,7 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { }, { name: "banner: events enabled for account, disabled for request", - args: args{enabledForAccount: true, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: true, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, want: &openrtb_ext.ExtBidPrebidEvents{ Win: "http://localhost/event?t=win&b=BID-1&a=123456&bidder=openx&ts=1234567890", Imp: "http://localhost/event?t=imp&b=BID-1&a=123456&bidder=openx&ts=1234567890", @@ -37,19 +38,27 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { }, { name: "banner: events disabled for account and request", - args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, want: nil, }, { name: "video: events enabled for account and request", - args: args{enabledForAccount: true, enabledForRequest: true, bidType: openrtb_ext.BidTypeVideo}, + args: args{enabledForAccount: true, enabledForRequest: true, bidType: openrtb_ext.BidTypeVideo, generatedBidId: ""}, want: nil, }, { name: "video: events disabled for account and request", - args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeVideo}, + args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeVideo, generatedBidId: ""}, want: nil, }, + { + name: "banner: use generated bid id", + args: args{enabledForAccount: false, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner, generatedBidId: "randomId"}, + want: &openrtb_ext.ExtBidPrebidEvents{ + Win: "http://localhost/event?t=win&b=randomId&a=123456&bidder=openx&ts=1234567890", + Imp: "http://localhost/event?t=imp&b=randomId&a=123456&bidder=openx&ts=1234567890", + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -60,7 +69,7 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { auctionTimestampMs: 1234567890, externalURL: "http://localhost", } - bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType} + bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType, generatedBidID: tt.args.generatedBidId} assert.Equal(t, tt.want, evData.makeBidExtEvents(bid, openrtb_ext.BidderOpenx)) }) } @@ -71,6 +80,7 @@ func Test_eventsData_modifyBidJSON(t *testing.T) { enabledForAccount bool enabledForRequest bool bidType openrtb_ext.BidType + generatedBidId string } tests := []struct { name string @@ -80,40 +90,46 @@ func Test_eventsData_modifyBidJSON(t *testing.T) { }{ { name: "banner: events enabled for request, disabled for account", - args: args{enabledForAccount: false, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: false, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, jsonBytes: []byte(`{"ID": "something"}`), want: []byte(`{"ID": "something", "wurl": "http://localhost/event?t=win&b=BID-1&a=123456&bidder=openx&ts=1234567890"}`), }, { name: "banner: events enabled for account, disabled for request", - args: args{enabledForAccount: true, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: true, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, jsonBytes: []byte(`{"ID": "something"}`), want: []byte(`{"ID": "something", "wurl": "http://localhost/event?t=win&b=BID-1&a=123456&bidder=openx&ts=1234567890"}`), }, { name: "banner: events disabled for account and request", - args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, jsonBytes: []byte(`{"ID": "something"}`), want: []byte(`{"ID": "something"}`), }, { name: "video: events disabled for account and request", - args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeVideo}, + args: args{enabledForAccount: false, enabledForRequest: false, bidType: openrtb_ext.BidTypeVideo, generatedBidId: ""}, jsonBytes: []byte(`{"ID": "something"}`), want: []byte(`{"ID": "something"}`), }, { name: "video: events enabled for account and request", - args: args{enabledForAccount: true, enabledForRequest: true, bidType: openrtb_ext.BidTypeVideo}, + args: args{enabledForAccount: true, enabledForRequest: true, bidType: openrtb_ext.BidTypeVideo, generatedBidId: ""}, jsonBytes: []byte(`{"ID": "something"}`), want: []byte(`{"ID": "something"}`), }, { name: "banner: broken json expected to fail patching", - args: args{enabledForAccount: true, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner}, + args: args{enabledForAccount: true, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner, generatedBidId: ""}, jsonBytes: []byte(`broken json`), want: nil, }, + { + name: "banner: generate bid id enabled", + args: args{enabledForAccount: false, enabledForRequest: true, bidType: openrtb_ext.BidTypeBanner, generatedBidId: "randomID"}, + jsonBytes: []byte(`{"ID": "something"}`), + want: []byte(`{"ID": "something", "wurl":"http://localhost/event?t=win&b=randomID&a=123456&bidder=openx&ts=1234567890"}`), + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -124,7 +140,7 @@ func Test_eventsData_modifyBidJSON(t *testing.T) { auctionTimestampMs: 1234567890, externalURL: "http://localhost", } - bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType} + bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType, generatedBidID: tt.args.generatedBidId} modifiedJSON, err := evData.modifyBidJSON(bid, openrtb_ext.BidderOpenx, tt.jsonBytes) if tt.want != nil { assert.NoError(t, err, "Unexpected error") diff --git a/exchange/exchange.go b/exchange/exchange.go index e06f87bf677..8dd6a06b480 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -17,6 +17,7 @@ import ( "github.com/mxmCherry/openrtb/v14/openrtb2" "github.com/prebid/prebid-server/stored_requests" + "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" @@ -61,6 +62,7 @@ type exchange struct { UsersyncIfAmbiguous bool privacyConfig config.Privacy categoriesFetcher stored_requests.CategoryFetcher + bidIDGenerator BidIDGenerator } // Container to pass out response ext data from the GetAllBids goroutines back into the main thread @@ -79,6 +81,24 @@ type bidResponseWrapper struct { bidder openrtb_ext.BidderName } +type BidIDGenerator interface { + New() (string, error) + Enabled() bool +} + +type bidIDGenerator struct { + enabled bool +} + +func (big *bidIDGenerator) Enabled() bool { + return big.enabled +} + +func (big *bidIDGenerator) New() (string, error) { + rawUuid, err := uuid.NewV4() + return rawUuid.String(), err +} + func NewExchange(adapters map[openrtb_ext.BidderName]adaptedBidder, cache prebid_cache_client.Client, cfg *config.Configuration, metricsEngine metrics.MetricsEngine, infos config.BidderInfos, gDPR gdpr.Permissions, currencyConverter *currency.RateConverter, categoriesFetcher stored_requests.CategoryFetcher) Exchange { return &exchange{ adapterMap: adapters, @@ -96,6 +116,7 @@ func NewExchange(adapters map[openrtb_ext.BidderName]adaptedBidder, cache prebid GDPR: cfg.GDPR, LMT: cfg.LMT, }, + bidIDGenerator: &bidIDGenerator{cfg.GenerateBidID}, } } @@ -192,6 +213,17 @@ func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog * } } + if e.bidIDGenerator.Enabled() { + for _, seatBid := range adapterBids { + for _, pbsBid := range seatBid.bids { + pbsBid.generatedBidID, err = e.bidIDGenerator.New() + if err != nil { + errs = append(errs, errors.New("Error generating bid.ext.prebid.bidid")) + } + } + } + } + evTracking := getEventTracking(&requestExt.Prebid, r.StartTime, &r.Account, e.bidderInfo, e.externalURL) adapterBids = evTracking.modifyBidsForEvents(adapterBids) @@ -852,6 +884,7 @@ func (e *exchange) makeBid(bids []*pbsOrtbBid, auc *auction, returnCreative bool Targeting: bid.bidTargets, Type: bid.bidType, Video: bid.bidVideo, + BidId: bid.generatedBidID, } if cacheInfo, found := e.getBidCacheInfo(bid, auc); found { diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 1cffa79b127..beaa823d320 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -652,6 +652,7 @@ func TestReturnCreativeEndToEnd(t *testing.T) { e.gDPR = gdpr.AlwaysAllow{} e.currencyConverter = currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) e.categoriesFetcher = categoriesFetcher + e.bidIDGenerator = &mockBidIDGenerator{false, false} // Define mock incoming bid requeset mockBidRequest := &openrtb2.BidRequest{ @@ -910,9 +911,10 @@ func TestBidReturnsCreative(t *testing.T) { // Test set up sampleBids := []*pbsOrtbBid{ { - bid: sampleOpenrtbBid, - bidType: openrtb_ext.BidTypeBanner, - bidTargets: map[string]string{}, + bid: sampleOpenrtbBid, + bidType: openrtb_ext.BidTypeBanner, + bidTargets: map[string]string{}, + generatedBidID: "randomId", }, } sampleAuction := &auction{cacheIds: map[*openrtb2.Bid]string{sampleOpenrtbBid: "CACHE_UUID_1234"}} @@ -1625,8 +1627,11 @@ func runSpec(t *testing.T, filename string, spec *exchangeSpec) { EEACountriesMap: eeac, }, } - - ex := newExchangeForTests(t, filename, spec.OutgoingRequests, aliases, privacyConfig) + bidIdGenerator := &mockBidIDGenerator{} + if spec.BidIDGenerator != nil { + *bidIdGenerator = *spec.BidIDGenerator + } + ex := newExchangeForTests(t, filename, spec.OutgoingRequests, aliases, privacyConfig, bidIdGenerator) biddersInAuction := findBiddersInAuction(t, filename, &spec.IncomingRequest.OrtbRequest) debugLog := &DebugLog{} if spec.DebugLog != nil { @@ -1722,7 +1727,7 @@ func extractResponseTimes(t *testing.T, context string, bid *openrtb2.BidRespons } } -func newExchangeForTests(t *testing.T, filename string, expectations map[string]*bidderSpec, aliases map[string]string, privacyConfig config.Privacy) Exchange { +func newExchangeForTests(t *testing.T, filename string, expectations map[string]*bidderSpec, aliases map[string]string, privacyConfig config.Privacy, bidIDGenerator BidIDGenerator) Exchange { bidderAdapters := make(map[openrtb_ext.BidderName]adaptedBidder, len(expectations)) bidderInfos := make(config.BidderInfos, len(expectations)) for _, bidderName := range openrtb_ext.CoreBidderNames() { @@ -1772,7 +1777,27 @@ func newExchangeForTests(t *testing.T, filename string, expectations map[string] categoriesFetcher: categoriesFetcher, bidderInfo: bidderInfos, externalURL: "http://localhost", + bidIDGenerator: bidIDGenerator, + } +} + +type mockBidIDGenerator struct { + GenerateBidID bool `json:"generateBidID"` + ReturnError bool `json:"returnError"` +} + +func (big *mockBidIDGenerator) Enabled() bool { + return big.GenerateBidID +} + +func (big *mockBidIDGenerator) New() (string, error) { + + if big.ReturnError { + err := errors.New("Test error generating bid.ext.prebid.bidid") + return "", err } + return "mock_uuid", nil + } func newExtRequest() openrtb_ext.ExtRequest { @@ -1857,10 +1882,10 @@ func TestCategoryMapping(t *testing.T) { bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} - bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30, PrimaryCategory: "AdapterOverride"}, nil, 0, false} - bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false, ""} + bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30, PrimaryCategory: "AdapterOverride"}, nil, 0, false, ""} + bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} innerBids := []*pbsOrtbBid{ &bid1_1, @@ -1912,10 +1937,10 @@ func TestCategoryMappingNoIncludeBrandCategory(t *testing.T) { bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} - bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30, PrimaryCategory: "AdapterOverride"}, nil, 0, false} - bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 50}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false, ""} + bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30, PrimaryCategory: "AdapterOverride"}, nil, 0, false, ""} + bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 50}, nil, 0, false, ""} innerBids := []*pbsOrtbBid{ &bid1_1, @@ -1966,9 +1991,9 @@ func TestCategoryMappingTranslateCategoriesNil(t *testing.T) { bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} - bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false, ""} + bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} innerBids := []*pbsOrtbBid{ &bid1_1, @@ -2048,9 +2073,9 @@ func TestCategoryMappingTranslateCategoriesFalse(t *testing.T) { bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} - bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false, ""} + bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} innerBids := []*pbsOrtbBid{ &bid1_1, @@ -2100,11 +2125,11 @@ func TestCategoryDedupe(t *testing.T) { bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} bid5 := openrtb2.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 20.0000, Cat: cats1, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 50}, nil, 0, false} - bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_5 := pbsOrtbBid{&bid5, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 50}, nil, 0, false, ""} + bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_5 := pbsOrtbBid{&bid5, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} selectedBids := make(map[string]int) expectedCategories := map[string]string{ @@ -2179,11 +2204,11 @@ func TestNoCategoryDedupe(t *testing.T) { bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} bid5 := openrtb2.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_5 := pbsOrtbBid{&bid5, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_3 := pbsOrtbBid{&bid3, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_4 := pbsOrtbBid{&bid4, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_5 := pbsOrtbBid{&bid5, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} selectedBids := make(map[string]int) expectedCategories := map[string]string{ @@ -2259,8 +2284,8 @@ func TestCategoryMappingBidderName(t *testing.T) { bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 10.0000, Cat: cats2, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} innerBids1 := []*pbsOrtbBid{ &bid1_1, @@ -2313,8 +2338,8 @@ func TestCategoryMappingBidderNameNoCategories(t *testing.T) { bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 12.0000, Cat: cats2, W: 1, H: 1} - bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} innerBids1 := []*pbsOrtbBid{ &bid1_1, @@ -2425,8 +2450,7 @@ func TestBidRejectionErrors(t *testing.T) { innerBids := []*pbsOrtbBid{} for _, bid := range test.bids { currentBid := pbsOrtbBid{ - bid, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: test.duration}, nil, 0, false, - } + bid, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: test.duration}, nil, 0, false, ""} innerBids = append(innerBids, ¤tBid) } @@ -2474,8 +2498,8 @@ func TestCategoryMappingTwoBiddersOneBidEachNoCategorySamePrice(t *testing.T) { bidApn1 := openrtb2.Bid{ID: "bid_idApn1", ImpID: "imp_idApn1", Price: 10.0000, Cat: cats1, W: 1, H: 1} bidApn2 := openrtb2.Bid{ID: "bid_idApn2", ImpID: "imp_idApn2", Price: 10.0000, Cat: cats2, W: 1, H: 1} - bid1_Apn1 := pbsOrtbBid{&bidApn1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} - bid1_Apn2 := pbsOrtbBid{&bidApn2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} + bid1_Apn1 := pbsOrtbBid{&bidApn1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} + bid1_Apn2 := pbsOrtbBid{&bidApn2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false, ""} innerBidsApn1 := []*pbsOrtbBid{ &bid1_Apn1, @@ -2602,7 +2626,7 @@ func TestApplyDealSupport(t *testing.T) { }, } - bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} + bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false, ""} bidCategory := map[string]string{ bid.bid.ID: test.targ["hb_pb_cat_dur"], } @@ -2769,7 +2793,7 @@ func TestUpdateHbPbCatDur(t *testing.T) { } for _, test := range testCases { - bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} + bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false, ""} bidCategory := map[string]string{ bid.bid.ID: test.targ["hb_pb_cat_dur"], } @@ -2792,6 +2816,7 @@ type exchangeSpec struct { DebugLog *DebugLog `json:"debuglog,omitempty"` EventsEnabled bool `json:"events_enabled,omitempty"` StartTime int64 `json:"start_time_ms,omitempty"` + BidIDGenerator *mockBidIDGenerator `json:"bidIDGenerator,omitempty"` } type exchangeRequest struct { diff --git a/exchange/exchangetest/bid-id-invalid.json b/exchange/exchangetest/bid-id-invalid.json new file mode 100644 index 00000000000..17d3a3ec4d8 --- /dev/null +++ b/exchange/exchangetest/bid-id-invalid.json @@ -0,0 +1,161 @@ +{ + "bidIDGenerator": { + "generateBidID": true, + "returnError": true + }, + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [ + { + "id": "my-imp-id", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "appnexus": { + "placementId": 1 + } + } + } + ], + "test": 1, + "ext": { + "prebid": { + "targeting": { + "includebrandcategory": { + "primaryadserver": 1, + "publisher": "", + "withcategory": true + }, + "appendbiddernames": true + } + } + } + }, + "usersyncs": { + "appnexus": "123" + } + }, + "outgoingRequests": { + "appnexus": { + "mockResponse": { + "pbsSeatBid": { + "pbsBids": [ + { + "ortbBid": { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ] + }, + "bidType": "video", + "bidVideo": { + "duration": 30, + "PrimaryCategory": "" + } + } + ] + } + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [ + { + "seat": "appnexus", + "bid": [ + { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ], + "ext": { + "prebid": { + "type": "video", + "targeting": { + "hb_bidder": "appnexus", + "hb_bidder_appnexus": "appnexus", + "hb_cache_host": "www.pbcserver.com", + "hb_cache_host_appnex": "www.pbcserver.com", + "hb_cache_path": "/pbcache/endpoint", + "hb_cache_path_appnex": "/pbcache/endpoint", + "hb_pb": "0.20", + "hb_pb_appnexus": "0.20", + "hb_pb_cat_dur": "0.20_VideoGames_0s_appnexus", + "hb_pb_cat_dur_appnex": "0.20_VideoGames_0s_appnexus", + "hb_size": "200x250", + "hb_size_appnexus": "200x250" + } + } + } + } + ] + } + ] + }, + "ext": { + "debug": { + "resolvedrequest": { + "id": "some-request-id", + "imp": [ + { + "id": "my-imp-id", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "appnexus": { + "placementId": 1 + } + } + } + ], + "site": { + "page": "test.somepage.com" + }, + "test": 1, + "ext": { + "prebid": { + "targeting": { + "includebrandcategory": { + "primaryadserver": 1, + "publisher": "", + "withcategory": true + }, + "appendbiddernames": true + } + } + } + } + }, + "errors": { + "prebid": [ + { + "code": 999, + "message": "Error generating bid.ext.prebid.bidid" + } + ] + } + } + } +} \ No newline at end of file diff --git a/exchange/exchangetest/bid-id-valid.json b/exchange/exchangetest/bid-id-valid.json new file mode 100644 index 00000000000..8da6410e8d8 --- /dev/null +++ b/exchange/exchangetest/bid-id-valid.json @@ -0,0 +1,154 @@ +{ + "bidIDGenerator": { + "generateBidID": true, + "returnError": false + }, + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [ + { + "id": "my-imp-id", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "appnexus": { + "placementId": 1 + } + } + } + ], + "test": 1, + "ext": { + "prebid": { + "targeting": { + "includebrandcategory": { + "primaryadserver": 1, + "publisher": "", + "withcategory": true + }, + "appendbiddernames": true + } + } + } + }, + "usersyncs": { + "appnexus": "123" + } + }, + "outgoingRequests": { + "appnexus": { + "mockResponse": { + "pbsSeatBid": { + "pbsBids": [ + { + "ortbBid": { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ] + }, + "bidType": "video", + "bidVideo": { + "duration": 30, + "PrimaryCategory": "" + } + } + ] + } + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [ + { + "seat": "appnexus", + "bid": [ + { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ], + "ext": { + "prebid": { + "bidid": "mock_uuid", + "type": "video", + "targeting": { + "hb_bidder": "appnexus", + "hb_bidder_appnexus": "appnexus", + "hb_cache_host": "www.pbcserver.com", + "hb_cache_host_appnex": "www.pbcserver.com", + "hb_cache_path": "/pbcache/endpoint", + "hb_cache_path_appnex": "/pbcache/endpoint", + "hb_pb": "0.20", + "hb_pb_appnexus": "0.20", + "hb_pb_cat_dur": "0.20_VideoGames_0s_appnexus", + "hb_pb_cat_dur_appnex": "0.20_VideoGames_0s_appnexus", + "hb_size": "200x250", + "hb_size_appnexus": "200x250" + } + } + } + } + ] + } + ] + }, + "ext": { + "debug": { + "resolvedrequest": { + "id": "some-request-id", + "imp": [ + { + "id": "my-imp-id", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "appnexus": { + "placementId": 1 + } + } + } + ], + "site": { + "page": "test.somepage.com" + }, + "test": 1, + "ext": { + "prebid": { + "targeting": { + "includebrandcategory": { + "primaryadserver": 1, + "publisher": "", + "withcategory": true + }, + "appendbiddernames": true + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/exchange/exchangetest/events-vast-account-off-request-on.json b/exchange/exchangetest/events-vast-account-off-request-on.json index 6e29ccdf749..13afb8409af 100644 --- a/exchange/exchangetest/events-vast-account-off-request-on.json +++ b/exchange/exchangetest/events-vast-account-off-request-on.json @@ -1,6 +1,10 @@ { "events_enabled": false, "start_time_ms": 1234567890, + "bidIDGenerator": { + "generateBidID": true, + "returnError": false + }, "incomingRequest": { "ortbRequest": { "id": "some-request-id", @@ -105,6 +109,7 @@ "crid": "creative-4", "ext": { "prebid": { + "bidid": "mock_uuid", "type": "video" } } @@ -116,7 +121,7 @@ "bid": [ { "id": "winning-bid", - "adm": "prebid.org wrapper", + "adm": "prebid.org wrapper", "nurl": "http://domain.com/winning-bid", "impid": "my-imp-id", "price": 0.71, @@ -125,6 +130,7 @@ "crid": "creative-1", "ext": { "prebid": { + "bidid": "mock_uuid", "type": "video", "targeting": { "hb_bidder": "appnexus", @@ -139,7 +145,7 @@ }, { "id": "losing-bid", - "adm": "prebid.org wrapper", + "adm": "prebid.org wrapper", "nurl": "http://domain.com/losing-bid", "impid": "my-imp-id", "price": 0.21, @@ -148,6 +154,7 @@ "crid": "creative-2", "ext": { "prebid": { + "bidid": "mock_uuid", "type": "video" } } diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index 2cdf403439f..add3b19e0b2 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -95,6 +95,7 @@ func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*op currencyConverter: currency.NewRateConverter(&http.Client{}, "", time.Duration(0)), UsersyncIfAmbiguous: false, categoriesFetcher: categoriesFetcher, + bidIDGenerator: &mockBidIDGenerator{false, false}, } imps := buildImps(t, mockBids) diff --git a/openrtb_ext/bid.go b/openrtb_ext/bid.go index 7d787cf83a6..535ac76be04 100644 --- a/openrtb_ext/bid.go +++ b/openrtb_ext/bid.go @@ -21,6 +21,7 @@ type ExtBidPrebid struct { Type BidType `json:"type"` Video *ExtBidPrebidVideo `json:"video,omitempty"` Events *ExtBidPrebidEvents `json:"events,omitempty"` + BidId string `json:"bidid,omitempty"` } // ExtBidPrebidCache defines the contract for bidresponse.seatbid.bid[i].ext.prebid.cache From adb404499fd82fcba5affef8171edb674b669297 Mon Sep 17 00:00:00 2001 From: hhhjort <31041505+hhhjort@users.noreply.github.com> Date: Thu, 8 Apr 2021 15:07:41 -0400 Subject: [PATCH 57/91] Basic GDPR enforcement for specific publisher-vendors. (#1782) --- config/accounts.go | 5 ++-- endpoints/auction_test.go | 2 +- endpoints/cookie_sync_test.go | 2 +- endpoints/setuid_test.go | 2 +- exchange/exchange.go | 2 +- exchange/exchange_test.go | 2 +- exchange/utils.go | 14 ++++++++-- exchange/utils_test.go | 18 +++++++------ gdpr/gdpr.go | 2 +- gdpr/impl.go | 39 ++++++++++++++++------------ gdpr/impl_test.go | 49 +++++++++++++++++++++-------------- 11 files changed, 83 insertions(+), 54 deletions(-) diff --git a/config/accounts.go b/config/accounts.go index 548092451c3..f7b380fca48 100644 --- a/config/accounts.go +++ b/config/accounts.go @@ -39,8 +39,9 @@ func (a *AccountCCPA) EnabledForIntegrationType(integrationType IntegrationType) // AccountGDPR represents account-specific GDPR configuration type AccountGDPR struct { - Enabled *bool `mapstructure:"enabled" json:"enabled,omitempty"` - IntegrationEnabled AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"` + Enabled *bool `mapstructure:"enabled" json:"enabled,omitempty"` + IntegrationEnabled AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"` + BasicEnforcementVendors []string `mapstructure:"basic_enforcement_vendors" json:"basic_enforcement_vendors"` } // EnabledForIntegrationType indicates whether GDPR is turned on at the account level for the specified integration type diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index e99856129f7..d806c937ee4 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -454,7 +454,7 @@ func (m *auctionMockPermissions) BidderSyncAllowed(ctx context.Context, bidder o return m.allowBidderSync, nil } -func (m *auctionMockPermissions) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string) (bool, bool, bool, error) { +func (m *auctionMockPermissions) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { return m.allowPI, m.allowGeo, m.allowID, nil } diff --git a/endpoints/cookie_sync_test.go b/endpoints/cookie_sync_test.go index a6352387786..d4b89a15118 100644 --- a/endpoints/cookie_sync_test.go +++ b/endpoints/cookie_sync_test.go @@ -254,6 +254,6 @@ func (g *gdprPerms) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.Bi return ok, nil } -func (g *gdprPerms) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string) (bool, bool, bool, error) { +func (g *gdprPerms) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { return true, true, true, nil } diff --git a/endpoints/setuid_test.go b/endpoints/setuid_test.go index 87c98f23ad1..0d68c15bea8 100644 --- a/endpoints/setuid_test.go +++ b/endpoints/setuid_test.go @@ -439,7 +439,7 @@ func (g *mockPermsSetUID) BidderSyncAllowed(ctx context.Context, bidder openrtb_ return false, nil } -func (g *mockPermsSetUID) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string) (bool, bool, bool, error) { +func (g *mockPermsSetUID) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { return g.allowPI, g.allowPI, g.allowPI, nil } diff --git a/exchange/exchange.go b/exchange/exchange.go index 8dd6a06b480..433c1214ccf 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -178,7 +178,7 @@ func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog * usersyncIfAmbiguous := e.parseUsersyncIfAmbiguous(r.BidRequest) // Slice of BidRequests, each a copy of the original cleaned to only contain bidder data for the named bidder - bidderRequests, privacyLabels, errs := cleanOpenRTBRequests(ctx, r, requestExt, e.gDPR, usersyncIfAmbiguous, e.privacyConfig) + bidderRequests, privacyLabels, errs := cleanOpenRTBRequests(ctx, r, requestExt, e.gDPR, usersyncIfAmbiguous, e.privacyConfig, &r.Account) e.me.RecordRequestPrivacy(privacyLabels) diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index beaa823d320..5c47fdb6052 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/prebid/prebid-server/errortypes" "io/ioutil" "net/http" "net/http/httptest" @@ -20,6 +19,7 @@ import ( "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/gdpr" "github.com/prebid/prebid-server/metrics" metricsConf "github.com/prebid/prebid-server/metrics/config" diff --git a/exchange/utils.go b/exchange/utils.go index f011669e1f2..039f9cb5395 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -57,7 +57,8 @@ func cleanOpenRTBRequests(ctx context.Context, requestExt *openrtb_ext.ExtRequest, gDPR gdpr.Permissions, usersyncIfAmbiguous bool, - privacyConfig config.Privacy) (bidderRequests []BidderRequest, privacyLabels metrics.PrivacyLabels, errs []error) { + privacyConfig config.Privacy, + account *config.Account) (bidderRequests []BidderRequest, privacyLabels metrics.PrivacyLabels, errs []error) { impsByBidder, err := splitImps(req.BidRequest.Imp) if err != nil { @@ -122,8 +123,17 @@ func cleanOpenRTBRequests(ctx context.Context, // GDPR if gdprEnforced { + weakVendorEnforcement := false + if account != nil { + for _, vendor := range account.GDPR.BasicEnforcementVendors { + if vendor == string(bidderRequest.BidderCoreName) { + weakVendorEnforcement = true + break + } + } + } var publisherID = req.LegacyLabels.PubID - _, geo, id, err := gDPR.PersonalInfoAllowed(ctx, bidderRequest.BidderCoreName, publisherID, gdprSignal, consent) + _, geo, id, err := gDPR.PersonalInfoAllowed(ctx, bidderRequest.BidderCoreName, publisherID, gdprSignal, consent, weakVendorEnforcement) if err == nil { privacyEnforcement.GDPRGeo = !geo privacyEnforcement.GDPRID = !id diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 05e22548639..5f72c39c702 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -32,7 +32,7 @@ func (p *permissionsMock) BidderSyncAllowed(ctx context.Context, bidder openrtb_ return true, nil } -func (p *permissionsMock) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdpr gdpr.Signal, consent string) (bool, bool, bool, error) { +func (p *permissionsMock) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdpr gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { return p.personalInfoAllowed, p.personalInfoAllowed, p.personalInfoAllowed, p.personalInfoAllowedError } @@ -465,7 +465,7 @@ func TestCleanOpenRTBRequests(t *testing.T) { } for _, test := range testCases { - bidderRequests, _, err := cleanOpenRTBRequests(context.Background(), test.req, nil, &permissionsMock{personalInfoAllowed: true}, true, privacyConfig) + bidderRequests, _, err := cleanOpenRTBRequests(context.Background(), test.req, nil, &permissionsMock{personalInfoAllowed: true}, true, privacyConfig, nil) if test.hasError { assert.NotNil(t, err, "Error shouldn't be nil") } else { @@ -622,7 +622,8 @@ func TestCleanOpenRTBRequestsCCPA(t *testing.T) { nil, &permissionsMock{personalInfoAllowed: true}, true, - privacyConfig) + privacyConfig, + nil) result := bidderRequests[0] assert.Nil(t, errs) @@ -680,7 +681,7 @@ func TestCleanOpenRTBRequestsCCPAErrors(t *testing.T) { Enforce: true, }, } - _, _, errs := cleanOpenRTBRequests(context.Background(), auctionReq, &reqExtStruct, &permissionsMock{personalInfoAllowed: true}, true, privacyConfig) + _, _, errs := cleanOpenRTBRequests(context.Background(), auctionReq, &reqExtStruct, &permissionsMock{personalInfoAllowed: true}, true, privacyConfig, nil) assert.ElementsMatch(t, []error{test.expectError}, errs, test.description) } @@ -720,7 +721,7 @@ func TestCleanOpenRTBRequestsCOPPA(t *testing.T) { UserSyncs: &emptyUsersync{}, } - bidderRequests, privacyLabels, errs := cleanOpenRTBRequests(context.Background(), auctionReq, nil, &permissionsMock{personalInfoAllowed: true}, true, config.Privacy{}) + bidderRequests, privacyLabels, errs := cleanOpenRTBRequests(context.Background(), auctionReq, nil, &permissionsMock{personalInfoAllowed: true}, true, config.Privacy{}, nil) result := bidderRequests[0] assert.Nil(t, errs) @@ -827,7 +828,7 @@ func TestCleanOpenRTBRequestsSChain(t *testing.T) { UserSyncs: &emptyUsersync{}, } - bidderRequests, _, errs := cleanOpenRTBRequests(context.Background(), auctionReq, extRequest, &permissionsMock{}, true, config.Privacy{}) + bidderRequests, _, errs := cleanOpenRTBRequests(context.Background(), auctionReq, extRequest, &permissionsMock{}, true, config.Privacy{}, nil) if test.hasError == true { assert.NotNil(t, errs) assert.Len(t, bidderRequests, 0) @@ -1408,7 +1409,7 @@ func TestCleanOpenRTBRequestsLMT(t *testing.T) { }, } - results, privacyLabels, errs := cleanOpenRTBRequests(context.Background(), auctionReq, nil, &permissionsMock{personalInfoAllowed: true}, true, privacyConfig) + results, privacyLabels, errs := cleanOpenRTBRequests(context.Background(), auctionReq, nil, &permissionsMock{personalInfoAllowed: true}, true, privacyConfig, nil) result := results[0] assert.Nil(t, errs) @@ -1625,7 +1626,8 @@ func TestCleanOpenRTBRequestsGDPR(t *testing.T) { nil, &permissionsMock{personalInfoAllowed: !test.gdprScrub, personalInfoAllowedError: test.permissionsError}, test.userSyncIfAmbiguous, - privacyConfig) + privacyConfig, + nil) result := results[0] if test.expectError { diff --git a/gdpr/gdpr.go b/gdpr/gdpr.go index 36dac06c0ab..616d0f0ae07 100644 --- a/gdpr/gdpr.go +++ b/gdpr/gdpr.go @@ -25,7 +25,7 @@ type Permissions interface { // Determines whether or not to send PI information to a bidder, or mask it out. // // If the consent string was nonsensical, the returned error will be an ErrorMalformedConsent. - PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string) (bool, bool, bool, error) + PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) } // Versions of the GDPR TCF technical specification. diff --git a/gdpr/impl.go b/gdpr/impl.go index 5b1349ffe60..55d1cd4aeb0 100644 --- a/gdpr/impl.go +++ b/gdpr/impl.go @@ -58,7 +58,12 @@ func (p *permissionsImpl) BidderSyncAllowed(ctx context.Context, bidder openrtb_ return false, nil } -func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string) (allowPI bool, allowGeo bool, allowID bool, err error) { +func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, + bidder openrtb_ext.BidderName, + PublisherID string, + gdprSignal Signal, + consent string, + weakVendorEnforcement bool) (allowPI bool, allowGeo bool, allowID bool, err error) { if _, ok := p.cfg.NonStandardPublisherMap[PublisherID]; ok { return true, true, true, nil } @@ -74,7 +79,7 @@ func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, bidder openrt } if id, ok := p.vendorIDs[bidder]; ok { - return p.allowPI(ctx, id, consent) + return p.allowPI(ctx, id, consent, weakVendorEnforcement) } return p.defaultVendorPermissions() @@ -122,7 +127,7 @@ func (p *permissionsImpl) allowSync(ctx context.Context, vendorID uint16, consen err := fmt.Errorf("Unable to access TCF2 parsed consent") return false, err } - return p.checkPurpose(consent, vendor, vendorID, consentconstants.InfoStorageAccess), nil + return p.checkPurpose(consent, vendor, vendorID, consentconstants.InfoStorageAccess, false), nil } if vendor.Purpose(consentconstants.InfoStorageAccess) && parsedConsent.PurposeAllowed(consentconstants.InfoStorageAccess) && parsedConsent.VendorConsent(vendorID) { return true, nil @@ -130,7 +135,7 @@ func (p *permissionsImpl) allowSync(ctx context.Context, vendorID uint16, consen return false, nil } -func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent string) (bool, bool, bool, error) { +func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { parsedConsent, vendor, err := p.parseVendor(ctx, vendorID, consent) if err != nil { return false, false, false, err @@ -142,9 +147,9 @@ func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent if parsedConsent.Version() == 2 { if p.cfg.TCF2.Enabled { - return p.allowPITCF2(parsedConsent, vendor, vendorID) + return p.allowPITCF2(parsedConsent, vendor, vendorID, weakVendorEnforcement) } - if (vendor.Purpose(consentconstants.InfoStorageAccess) || vendor.LegitimateInterest(consentconstants.InfoStorageAccess)) && parsedConsent.PurposeAllowed(consentconstants.InfoStorageAccess) && (vendor.Purpose(consentconstants.PersonalizationProfile) || vendor.LegitimateInterest(consentconstants.PersonalizationProfile)) && parsedConsent.PurposeAllowed(consentconstants.PersonalizationProfile) && parsedConsent.VendorConsent(vendorID) { + if (vendor.Purpose(consentconstants.InfoStorageAccess) || vendor.LegitimateInterest(consentconstants.InfoStorageAccess) || weakVendorEnforcement) && parsedConsent.PurposeAllowed(consentconstants.InfoStorageAccess) && (vendor.Purpose(consentconstants.PersonalizationProfile) || vendor.LegitimateInterest(consentconstants.PersonalizationProfile) || weakVendorEnforcement) && parsedConsent.PurposeAllowed(consentconstants.PersonalizationProfile) && (parsedConsent.VendorConsent(vendorID) || weakVendorEnforcement) { return true, true, true, nil } } else { @@ -155,7 +160,7 @@ func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent return false, false, false, nil } -func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor api.Vendor, vendorID uint16) (allowPI bool, allowGeo bool, allowID bool, err error) { +func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor api.Vendor, vendorID uint16, weakVendorEnforcement bool) (allowPI bool, allowGeo bool, allowID bool, err error) { consent, ok := parsedConsent.(tcf2.ConsentMetadata) err = nil allowPI = false @@ -166,12 +171,12 @@ func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor a return } if p.cfg.TCF2.SpecialPurpose1.Enabled { - allowGeo = consent.SpecialFeatureOptIn(1) && vendor.SpecialPurpose(1) + allowGeo = consent.SpecialFeatureOptIn(1) && (vendor.SpecialPurpose(1) || weakVendorEnforcement) } else { allowGeo = true } for i := 2; i <= 10; i++ { - if p.checkPurpose(consent, vendor, vendorID, tcf1constants.Purpose(i)) { + if p.checkPurpose(consent, vendor, vendorID, tcf1constants.Purpose(i), weakVendorEnforcement) { allowID = true break } @@ -179,13 +184,13 @@ func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor a // Set to true so any purpose check can flip it to false allowPI = true if p.cfg.TCF2.Purpose1.Enabled { - allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.InfoStorageAccess) + allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.InfoStorageAccess, weakVendorEnforcement) } if p.cfg.TCF2.Purpose2.Enabled { - allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.BasicAdserving) + allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.BasicAdserving, weakVendorEnforcement) } if p.cfg.TCF2.Purpose7.Enabled { - allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.AdPerformance) + allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.AdPerformance, weakVendorEnforcement) } return } @@ -194,7 +199,7 @@ const pubRestrictNotAllowed = 0 const pubRestrictRequireConsent = 1 const pubRestrictRequireLegitInterest = 2 -func (p *permissionsImpl) checkPurpose(consent tcf2.ConsentMetadata, vendor api.Vendor, vendorID uint16, purpose tcf1constants.Purpose) bool { +func (p *permissionsImpl) checkPurpose(consent tcf2.ConsentMetadata, vendor api.Vendor, vendorID uint16, purpose tcf1constants.Purpose, weakVendorEnforcement bool) bool { if purpose == consentconstants.InfoStorageAccess && p.cfg.TCF2.PurposeOneTreatment.Enabled && consent.PurposeOneTreatment() { return p.cfg.TCF2.PurposeOneTreatment.AccessAllowed } @@ -202,8 +207,8 @@ func (p *permissionsImpl) checkPurpose(consent tcf2.ConsentMetadata, vendor api. return false } - purposeAllowed := vendor.Purpose(purpose) && consent.PurposeAllowed(purpose) && consent.VendorConsent(vendorID) - legitInterest := vendor.LegitimateInterest(purpose) && consent.PurposeLITransparency(purpose) && consent.VendorLegitInterest(vendorID) + purposeAllowed := consent.PurposeAllowed(purpose) && (weakVendorEnforcement || (vendor.Purpose(purpose) && consent.VendorConsent(vendorID))) + legitInterest := consent.PurposeLITransparency(purpose) && (weakVendorEnforcement || (vendor.LegitimateInterest(purpose) && consent.VendorLegitInterest(vendorID))) if consent.CheckPubRestriction(uint8(purpose), pubRestrictRequireConsent, vendorID) { return purposeAllowed @@ -260,7 +265,7 @@ func (a AlwaysAllow) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.B return true, nil } -func (a AlwaysAllow) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string) (bool, bool, bool, error) { +func (a AlwaysAllow) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { return true, true, true, nil } @@ -275,6 +280,6 @@ func (a AlwaysFail) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.Bi return false, nil } -func (a AlwaysFail) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string) (bool, bool, bool, error) { +func (a AlwaysFail) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { return false, false, false, nil } diff --git a/gdpr/impl_test.go b/gdpr/impl_test.go index 737ed14a300..b13d469a955 100644 --- a/gdpr/impl_test.go +++ b/gdpr/impl_test.go @@ -175,13 +175,14 @@ func TestAllowPersonalInfo(t *testing.T) { consent := "BOS2bx5OS2bx5ABABBAAABoAAAABBwAA" tests := []struct { - description string - bidderName openrtb_ext.BidderName - publisherID string - userSyncIfAmbiguous bool - gdpr Signal - consent string - allowPI bool + description string + bidderName openrtb_ext.BidderName + publisherID string + userSyncIfAmbiguous bool + gdpr Signal + consent string + allowPI bool + weakVendorEnforcement bool }{ { description: "Allow PI - Non standard publisher", @@ -285,7 +286,7 @@ func TestAllowPersonalInfo(t *testing.T) { for _, tt := range tests { perms.cfg.UsersyncIfAmbiguous = tt.userSyncIfAmbiguous - allowPI, _, _, err := perms.PersonalInfoAllowed(context.Background(), tt.bidderName, tt.publisherID, tt.gdpr, tt.consent) + allowPI, _, _, err := perms.PersonalInfoAllowed(context.Background(), tt.bidderName, tt.publisherID, tt.gdpr, tt.consent, tt.weakVendorEnforcement) assert.Nil(t, err, tt.description) assert.Equal(t, tt.allowPI, allowPI, tt.description) @@ -343,12 +344,13 @@ var tcf2Config = config.GDPR{ } type tcf2TestDef struct { - description string - bidder openrtb_ext.BidderName - consent string - allowPI bool - allowGeo bool - allowID bool + description string + bidder openrtb_ext.BidderName + consent string + allowPI bool + allowGeo bool + allowID bool + weakVendorEnforcement bool } func TestAllowPersonalInfoTCF2(t *testing.T) { @@ -381,6 +383,15 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { allowGeo: false, allowID: false, }, + { + description: "Appnexus vendor test, insufficient purposes claimed, basic enforcement", + bidder: openrtb_ext.BidderAppnexus, + consent: "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", + allowPI: true, + allowGeo: true, + allowID: true, + weakVendorEnforcement: true, + }, { description: "Pubmatic vendor test, flex purposes claimed", bidder: openrtb_ext.BidderPubmatic, @@ -411,7 +422,7 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent) + allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) @@ -437,7 +448,7 @@ func TestAllowPersonalInfoWhitelistTCF2(t *testing.T) { } // Assert that an item that otherwise would not be allowed PI access, gets approved because it is found in the GDPR.NonStandardPublishers array perms.cfg.NonStandardPublisherMap = map[string]struct{}{"appNexusAppID": {}} - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), openrtb_ext.BidderAppnexus, "appNexusAppID", SignalYes, "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA") + allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), openrtb_ext.BidderAppnexus, "appNexusAppID", SignalYes, "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", false) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed") assert.EqualValuesf(t, true, allowPI, "AllowPI failure") assert.EqualValuesf(t, true, allowGeo, "AllowGeo failure") @@ -491,7 +502,7 @@ func TestAllowPersonalInfoTCF2PubRestrict(t *testing.T) { } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent) + allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) @@ -547,7 +558,7 @@ func TestAllowPersonalInfoTCF2PurposeOneTrue(t *testing.T) { } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent) + allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) @@ -604,7 +615,7 @@ func TestAllowPersonalInfoTCF2PurposeOneFalse(t *testing.T) { } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent) + allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) From 28de9fd0bcc0ec208bd142132a1cfe776386fb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Su=C5=A1nik?= Date: Thu, 8 Apr 2021 21:41:58 +0200 Subject: [PATCH 58/91] New Adapter: Zemanta (#1774) * add zemanta adapter * update openrtb package for zemanta * fix loop iterator reference bug * fix getMediaTypeForImp to match server behavior --- adapters/zemanta/params_test.go | 50 ++++++ adapters/zemanta/usersync.go | 12 ++ adapters/zemanta/usersync_test.go | 33 ++++ adapters/zemanta/zemanta.go | 147 +++++++++++++++++ adapters/zemanta/zemanta_test.go | 20 +++ .../zemanta/zemantatest/exemplary/banner.json | 133 ++++++++++++++++ .../zemanta/zemantatest/exemplary/native.json | 125 +++++++++++++++ .../zemantatest/params/race/banner.json | 10 ++ .../zemantatest/params/race/native.json | 10 ++ .../zemantatest/supplemental/app_request.json | 144 +++++++++++++++++ .../supplemental/optional_params.json | 148 ++++++++++++++++++ .../zemantatest/supplemental/status_204.json | 62 ++++++++ .../zemantatest/supplemental/status_400.json | 67 ++++++++ .../zemantatest/supplemental/status_418.json | 67 ++++++++ config/config.go | 2 + exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_zemanta.go | 15 ++ static/bidder-info/zemanta.yaml | 12 ++ static/bidder-params/zemanta.json | 40 +++++ usersync/usersyncers/syncer.go | 2 + usersync/usersyncers/syncer_test.go | 1 + 22 files changed, 1104 insertions(+) create mode 100644 adapters/zemanta/params_test.go create mode 100644 adapters/zemanta/usersync.go create mode 100644 adapters/zemanta/usersync_test.go create mode 100644 adapters/zemanta/zemanta.go create mode 100644 adapters/zemanta/zemanta_test.go create mode 100644 adapters/zemanta/zemantatest/exemplary/banner.json create mode 100644 adapters/zemanta/zemantatest/exemplary/native.json create mode 100644 adapters/zemanta/zemantatest/params/race/banner.json create mode 100644 adapters/zemanta/zemantatest/params/race/native.json create mode 100644 adapters/zemanta/zemantatest/supplemental/app_request.json create mode 100644 adapters/zemanta/zemantatest/supplemental/optional_params.json create mode 100644 adapters/zemanta/zemantatest/supplemental/status_204.json create mode 100644 adapters/zemanta/zemantatest/supplemental/status_400.json create mode 100644 adapters/zemanta/zemantatest/supplemental/status_418.json create mode 100644 openrtb_ext/imp_zemanta.go create mode 100644 static/bidder-info/zemanta.yaml create mode 100644 static/bidder-params/zemanta.json diff --git a/adapters/zemanta/params_test.go b/adapters/zemanta/params_test.go new file mode 100644 index 00000000000..54e67c57bf1 --- /dev/null +++ b/adapters/zemanta/params_test.go @@ -0,0 +1,50 @@ +package zemanta + +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.BidderZemanta, 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.BidderZemanta, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{"publisher": {"id": "publisher-id"}}`, + `{"publisher": {"id": "publisher-id", "name": "publisher-name", "domain": "publisher-domain.com"}, "tagid": "tag-id", "bcat": ["bad-category"], "badv": ["bad-advertiser"]}`, +} + +var invalidParams = []string{ + `{"publisher": {"id": 1234}}`, + `{"publisher": {"id": "pub-id", "name": 1234}}`, + `{"publisher": {"id": "pub-id", "domain": 1234}}`, + `{"publisher": {"id": "pub-id"}, "tagid": 1234}`, + `{"publisher": {"id": "pub-id"}, "bcat": "not-array"}`, + `{"publisher": {"id": "pub-id"}, "bcat": [1234]}`, + `{"publisher": {"id": "pub-id"}, "badv": "not-array"}`, + `{"publisher": {"id": "pub-id"}, "badv": [1234]}`, +} diff --git a/adapters/zemanta/usersync.go b/adapters/zemanta/usersync.go new file mode 100644 index 00000000000..fec8a2feda8 --- /dev/null +++ b/adapters/zemanta/usersync.go @@ -0,0 +1,12 @@ +package zemanta + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewZemantaSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("zemanta", temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/zemanta/usersync_test.go b/adapters/zemanta/usersync_test.go new file mode 100644 index 00000000000..e56851be821 --- /dev/null +++ b/adapters/zemanta/usersync_test.go @@ -0,0 +1,33 @@ +package zemanta + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestSyncer(t *testing.T) { + syncURL := "http://prebidtest.zemanta.com/usersync/prebidtest?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb=host%2Fsetuid%3Fbidder%3Dzemanta%26uid%3D__ZUID__" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewZemantaSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "A", + Consent: "B", + }, + CCPA: ccpa.Policy{ + Consent: "C", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "http://prebidtest.zemanta.com/usersync/prebidtest?gdpr=A&gdpr_consent=B&us_privacy=C&cb=host%2Fsetuid%3Fbidder%3Dzemanta%26uid%3D__ZUID__", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) +} diff --git a/adapters/zemanta/zemanta.go b/adapters/zemanta/zemanta.go new file mode 100644 index 00000000000..ae547eb91aa --- /dev/null +++ b/adapters/zemanta/zemanta.go @@ -0,0 +1,147 @@ +package zemanta + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/mxmCherry/openrtb/v14/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 Zemanta adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + reqCopy := *request + + var errs []error + var zemantaExt openrtb_ext.ExtImpZemanta + for i := 0; i < len(reqCopy.Imp); i++ { + imp := reqCopy.Imp[i] + + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + errs = append(errs, err) + continue + } + if err := json.Unmarshal(bidderExt.Bidder, &zemantaExt); err != nil { + errs = append(errs, err) + continue + } + imp.TagID = zemantaExt.TagId + reqCopy.Imp[i] = imp + } + + publisher := &openrtb2.Publisher{ + ID: zemantaExt.Publisher.Id, + Name: zemantaExt.Publisher.Name, + Domain: zemantaExt.Publisher.Domain, + } + if reqCopy.Site != nil { + siteCopy := *reqCopy.Site + siteCopy.Publisher = publisher + reqCopy.Site = &siteCopy + } else if reqCopy.App != nil { + appCopy := *reqCopy.App + appCopy.Publisher = publisher + reqCopy.App = &appCopy + } + + if zemantaExt.BCat != nil { + reqCopy.BCat = zemantaExt.BCat + } + if zemantaExt.BAdv != nil { + reqCopy.BAdv = zemantaExt.BAdv + } + + requestJSON, err := json.Marshal(reqCopy) + if err != nil { + errs = append(errs, err) + return nil, errs + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + } + + return []*adapters.RequestData{requestData}, nil +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if responseData.StatusCode == http.StatusNoContent { + return nil, nil + } + + if responseData.StatusCode == http.StatusBadRequest { + err := &errortypes.BadInput{ + Message: "Unexpected status code: 400. Bad request from publisher. Run with request.debug = 1 for more info.", + } + return nil, []error{err} + } + + if responseData.StatusCode != http.StatusOK { + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode), + } + return nil, []error{err} + } + + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur + + var errs []error + for _, seatBid := range response.SeatBid { + for i := range seatBid.Bid { + bid := seatBid.Bid[i] + bidType, err := getMediaTypeForImp(bid.ImpID, request.Imp) + if err != nil { + errs = append(errs, err) + continue + } + + b := &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + + return bidResponse, errs +} + +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { + for _, imp := range imps { + if imp.ID == impID { + if imp.Native != nil { + return openrtb_ext.BidTypeNative, nil + } else if imp.Banner != nil { + return openrtb_ext.BidTypeBanner, nil + } + } + } + + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Failed to find native/banner impression \"%s\" ", impID), + } +} diff --git a/adapters/zemanta/zemanta_test.go b/adapters/zemanta/zemanta_test.go new file mode 100644 index 00000000000..e63eb51005c --- /dev/null +++ b/adapters/zemanta/zemanta_test.go @@ -0,0 +1,20 @@ +package zemanta + +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.BidderZemanta, config.Adapter{ + Endpoint: "http://example.com/bid"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "zemantatest", bidder) +} diff --git a/adapters/zemanta/zemantatest/exemplary/banner.json b/adapters/zemanta/zemantatest/exemplary/banner.json new file mode 100644 index 00000000000..16d52cf1c0f --- /dev/null +++ b/adapters/zemanta/zemantatest/exemplary/banner.json @@ -0,0 +1,133 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ], + "site": { + "page": "http://example.com" + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + "h": 500, + "w": 1000 + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ], + "site": { + "page": "http://example.com", + "publisher": { + "id": "publisher-id" + } + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + "h": 500, + "w": 1000 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5095a742-1c27-402b-ab6f-66b1bd53383b", + "seatbid": [ + { + "bid": [ + { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "
ad
", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + } + ], + "seat": "acc-1876" + } + ], + "bidid": "43ccadf2-8b2e-11eb-b294-de4c49e99ff6", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "
ad
", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/zemanta/zemantatest/exemplary/native.json b/adapters/zemanta/zemantatest/exemplary/native.json new file mode 100644 index 00000000000..d32fd60382e --- /dev/null +++ b/adapters/zemanta/zemantatest/exemplary/native.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"context\":1,\"plcmttype\":1,\"assets\":[{\"id\":0,\"required\":1,\"img\":{\"type\":3,\"w\":120,\"h\":100}},{\"id\":1,\"required\":1,\"title\":{\"len\":140}},{\"id\":2,\"data\":{\"type\":1}}],\"eventtrackers\":[{\"event\":1,\"methods\":[1]}]}", + "ver": "1.2" + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ], + "site": { + "page": "http://example.com" + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + "h": 500, + "w": 1000 + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"context\":1,\"plcmttype\":1,\"assets\":[{\"id\":0,\"required\":1,\"img\":{\"type\":3,\"w\":120,\"h\":100}},{\"id\":1,\"required\":1,\"title\":{\"len\":140}},{\"id\":2,\"data\":{\"type\":1}}],\"eventtrackers\":[{\"event\":1,\"methods\":[1]}]}", + "ver": "1.2" + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ], + "site": { + "page": "http://example.com", + "publisher": { + "id": "publisher-id" + } + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + "h": 500, + "w": 1000 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5095a742-1c27-402b-ab6f-66b1bd53383b", + "seatbid": [ + { + "bid": [ + { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":3,\"required\":1,\"img\":{\"url\":\"http://example.com/img/url\",\"w\":120,\"h\":100}},{\"id\":0,\"required\":1,\"title\":{\"text\":\"Test title\"}},{\"id\":5,\"data\":{\"value\":\"Test sponsor\"}}],\"link\":{\"url\":\"http://example.com/click/url\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"http://example.com/impression\"}]}", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + } + ], + "seat": "acc-1876" + } + ], + "bidid": "43ccadf2-8b2e-11eb-b294-de4c49e99ff6", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":3,\"required\":1,\"img\":{\"url\":\"http://example.com/img/url\",\"w\":120,\"h\":100}},{\"id\":0,\"required\":1,\"title\":{\"text\":\"Test title\"}},{\"id\":5,\"data\":{\"value\":\"Test sponsor\"}}],\"link\":{\"url\":\"http://example.com/click/url\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"http://example.com/impression\"}]}", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/zemanta/zemantatest/params/race/banner.json b/adapters/zemanta/zemantatest/params/race/banner.json new file mode 100644 index 00000000000..05577a78e8b --- /dev/null +++ b/adapters/zemanta/zemantatest/params/race/banner.json @@ -0,0 +1,10 @@ +{ + "publisher": { + "id": "publisher-id", + "name": "publisher-name", + "domain": "publisher-domain.com" + }, + "tagid": "tag-id", + "bcat": ["bad-category"], + "badv": ["bad-advertiser"] +} \ No newline at end of file diff --git a/adapters/zemanta/zemantatest/params/race/native.json b/adapters/zemanta/zemantatest/params/race/native.json new file mode 100644 index 00000000000..05577a78e8b --- /dev/null +++ b/adapters/zemanta/zemantatest/params/race/native.json @@ -0,0 +1,10 @@ +{ + "publisher": { + "id": "publisher-id", + "name": "publisher-name", + "domain": "publisher-domain.com" + }, + "tagid": "tag-id", + "bcat": ["bad-category"], + "badv": ["bad-advertiser"] +} \ No newline at end of file diff --git a/adapters/zemanta/zemantatest/supplemental/app_request.json b/adapters/zemanta/zemantatest/supplemental/app_request.json new file mode 100644 index 00000000000..c8e7c4cf69f --- /dev/null +++ b/adapters/zemanta/zemantatest/supplemental/app_request.json @@ -0,0 +1,144 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ], + "app": { + "name": "test-app", + "bundle": "org.test", + "ver": "1.10", + "publisher": { + "id": "pub-id" + } + }, + "device": { + "ua": "Mozilla/5.0 (Linux; Android 11; sdk_gphone_x86_arm Build/RSR1.201013.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36", + "model": "sdk_gphone_x86_arm", + "os": "android", + "h": 735, + "w": 392 + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ], + "app": { + "name": "test-app", + "bundle": "org.test", + "ver": "1.10", + "publisher": { + "id": "publisher-id" + } + }, + "device": { + "ua": "Mozilla/5.0 (Linux; Android 11; sdk_gphone_x86_arm Build/RSR1.201013.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36", + "model": "sdk_gphone_x86_arm", + "os": "android", + "h": 735, + "w": 392 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5095a742-1c27-402b-ab6f-66b1bd53383b", + "seatbid": [ + { + "bid": [ + { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "
ad
", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + } + ], + "seat": "acc-1876" + } + ], + "bidid": "43ccadf2-8b2e-11eb-b294-de4c49e99ff6", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "
ad
", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/zemanta/zemantatest/supplemental/optional_params.json b/adapters/zemanta/zemantatest/supplemental/optional_params.json new file mode 100644 index 00000000000..a69ceaa0c85 --- /dev/null +++ b/adapters/zemanta/zemantatest/supplemental/optional_params.json @@ -0,0 +1,148 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id", + "name": "publisher-name", + "domain": "publisher-domain.com" + }, + "tagid": "tag-id", + "bcat": ["bad-category"], + "badv": ["bad-advertiser"] + } + } + } + ], + "site": { + "page": "http://example.com" + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + "h": 500, + "w": 1000 + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "tagid": "tag-id", + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id", + "name": "publisher-name", + "domain": "publisher-domain.com" + }, + "tagid": "tag-id", + "bcat": ["bad-category"], + "badv": ["bad-advertiser"] + } + } + } + ], + "bcat": ["bad-category"], + "badv": ["bad-advertiser"], + "site": { + "page": "http://example.com", + "publisher": { + "id": "publisher-id", + "name": "publisher-name", + "domain": "publisher-domain.com" + } + }, + "device": { + "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + "h": 500, + "w": 1000 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "5095a742-1c27-402b-ab6f-66b1bd53383b", + "seatbid": [ + { + "bid": [ + { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "
ad
", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + } + ], + "seat": "acc-1876" + } + ], + "bidid": "43ccadf2-8b2e-11eb-b294-de4c49e99ff6", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-request-id", + "impid": "test-imp-id", + "price": 1000, + "nurl": "http://example.com/win/1000", + "adm": "
ad
", + "adomain": [ + "example.com" + ], + "cid": "test-cid", + "crid": "test-crid", + "cat": [ + "IAB13-4" + ], + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/zemanta/zemantatest/supplemental/status_204.json b/adapters/zemanta/zemantatest/supplemental/status_204.json new file mode 100644 index 00000000000..9f668736953 --- /dev/null +++ b/adapters/zemanta/zemantatest/supplemental/status_204.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + + "expectedBidResponses": [] +} diff --git a/adapters/zemanta/zemantatest/supplemental/status_400.json b/adapters/zemanta/zemantatest/supplemental/status_400.json new file mode 100644 index 00000000000..441162070d8 --- /dev/null +++ b/adapters/zemanta/zemantatest/supplemental/status_400.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Bad request from publisher. Run with request.debug = 1 for more info.", + "comparison": "literal" + } + ] +} diff --git a/adapters/zemanta/zemantatest/supplemental/status_418.json b/adapters/zemanta/zemantatest/supplemental/status_418.json new file mode 100644 index 00000000000..08e26804806 --- /dev/null +++ b/adapters/zemanta/zemantatest/supplemental/status_418.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com/bid", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher": { + "id": "publisher-id" + } + } + } + } + ] + } + }, + "mockResponse": { + "status": 418, + "body": {} + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 418. Run with request.debug = 1 for more info.", + "comparison": "literal" + } + ] +} diff --git a/config/config.go b/config/config.go index 7b78fb26bde..bda531f2460 100644 --- a/config/config.go +++ b/config/config.go @@ -649,6 +649,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldlab, "https://ad.yieldlab.net/mr?t=2&pid=9140838&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldlab%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25YL_UID%25%25") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldone, "https://y.one.impact-ad.jp/hbs_cs?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderZemanta, "http://prebidtest.zemanta.com/usersync/prebidtest?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dzemanta%26uid%3D__ZUID__") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderZeroClickFraud, "https://s.0cf.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dzeroclickfraud%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBetween, "https://ads.betweendigital.com/match?bidder_id=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&callback_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbetween%26gdpr%3D0%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUSER_ID%7D") } @@ -912,6 +913,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.yieldlab.endpoint", "https://ad.yieldlab.net/yp/") v.SetDefault("adapters.yieldmo.endpoint", "https://ads.yieldmo.com/exchange/prebid-server") v.SetDefault("adapters.yieldone.endpoint", "https://y.one.impact-ad.jp/hbs_imp") + v.SetDefault("adapters.zemanta.endpoint", "https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/") v.SetDefault("adapters.zeroclickfraud.endpoint", "http://{{.Host}}/openrtb2?sid={{.SourceId}}") v.SetDefault("max_request_size", 1024*256) diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 0ea28f8a610..801d4023d02 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -103,6 +103,7 @@ import ( "github.com/prebid/prebid-server/adapters/yieldlab" "github.com/prebid/prebid-server/adapters/yieldmo" "github.com/prebid/prebid-server/adapters/yieldone" + "github.com/prebid/prebid-server/adapters/zemanta" "github.com/prebid/prebid-server/adapters/zeroclickfraud" "github.com/prebid/prebid-server/openrtb_ext" ) @@ -215,6 +216,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderYieldlab: yieldlab.Builder, openrtb_ext.BidderYieldmo: yieldmo.Builder, openrtb_ext.BidderYieldone: yieldone.Builder, + openrtb_ext.BidderZemanta: zemanta.Builder, openrtb_ext.BidderZeroClickFraud: zeroclickfraud.Builder, } } diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 4d95babc988..8cc1bbd9547 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -177,6 +177,7 @@ const ( BidderYieldlab BidderName = "yieldlab" BidderYieldmo BidderName = "yieldmo" BidderYieldone BidderName = "yieldone" + BidderZemanta BidderName = "zemanta" BidderZeroClickFraud BidderName = "zeroclickfraud" ) @@ -287,6 +288,7 @@ func CoreBidderNames() []BidderName { BidderYieldlab, BidderYieldmo, BidderYieldone, + BidderZemanta, BidderZeroClickFraud, } } diff --git a/openrtb_ext/imp_zemanta.go b/openrtb_ext/imp_zemanta.go new file mode 100644 index 00000000000..5baab6d2fd4 --- /dev/null +++ b/openrtb_ext/imp_zemanta.go @@ -0,0 +1,15 @@ +package openrtb_ext + +// ExtImpZemanta defines the contract for bidrequest.imp[i].ext.zemanta +type ExtImpZemanta struct { + Publisher ExtImpZemantaPublisher `json:"publisher"` + TagId string `json:"tagid"` + BCat []string `json:"bcat"` + BAdv []string `json:"badv"` +} + +type ExtImpZemantaPublisher struct { + Id string `json:"id"` + Name string `json:"name"` + Domain string `json:"domain"` +} diff --git a/static/bidder-info/zemanta.yaml b/static/bidder-info/zemanta.yaml new file mode 100644 index 00000000000..e38ec915f49 --- /dev/null +++ b/static/bidder-info/zemanta.yaml @@ -0,0 +1,12 @@ +maintainer: + email: prog-ops-team@outbrain.com +gvlVendorID: 164 +capabilities: + app: + mediaTypes: + - banner + - native + site: + mediaTypes: + - banner + - native diff --git a/static/bidder-params/zemanta.json b/static/bidder-params/zemanta.json new file mode 100644 index 00000000000..b122c7dea4b --- /dev/null +++ b/static/bidder-params/zemanta.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Zemanta Adapter Params", + "description": "A schema which validates params accepted by the Zemanta adapter", + + "type": "object", + "properties": { + "publisher": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "domain": { + "type": "string" + } + }, + "required": ["id"] + }, + "tagid": { + "type": "string" + }, + "bcat": { + "type": "array", + "items": { + "type": "string" + } + }, + "badv": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["publisher"] +} diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index f01e4e4b917..30c0ebf5f37 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -87,6 +87,7 @@ import ( "github.com/prebid/prebid-server/adapters/yieldlab" "github.com/prebid/prebid-server/adapters/yieldmo" "github.com/prebid/prebid-server/adapters/yieldone" + "github.com/prebid/prebid-server/adapters/zemanta" "github.com/prebid/prebid-server/adapters/zeroclickfraud" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -180,6 +181,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldlab, yieldlab.NewYieldlabSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldmo, yieldmo.NewYieldmoSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldone, yieldone.NewYieldoneSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderZemanta, zemanta.NewZemantaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderZeroClickFraud, zeroclickfraud.NewZeroClickFraudSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderBetween, between.NewBetweenSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index a389a007306..325fd9b551c 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -96,6 +96,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderYieldlab): syncConfig, string(openrtb_ext.BidderYieldmo): syncConfig, string(openrtb_ext.BidderYieldone): syncConfig, + string(openrtb_ext.BidderZemanta): syncConfig, string(openrtb_ext.BidderZeroClickFraud): syncConfig, }, } From aad97984cce29249caea5b1cbe4b05ca0c8e892b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Su=C5=A1nik?= Date: Fri, 9 Apr 2021 20:29:45 +0200 Subject: [PATCH 59/91] Zemanta: Rename Adapter To Outbrain (#1797) --- .../zemanta.go => outbrain/outbrain.go} | 24 +++++++++---------- .../outbrain_test.go} | 6 ++--- .../outbraintest}/exemplary/banner.json | 0 .../outbraintest}/exemplary/native.json | 0 .../outbraintest}/params/race/banner.json | 0 .../outbraintest}/params/race/native.json | 0 .../supplemental/app_request.json | 0 .../supplemental/optional_params.json | 0 .../supplemental/status_204.json | 0 .../supplemental/status_400.json | 0 .../supplemental/status_418.json | 0 adapters/{zemanta => outbrain}/params_test.go | 6 ++--- adapters/outbrain/usersync.go | 12 ++++++++++ .../{zemanta => outbrain}/usersync_test.go | 4 ++-- adapters/zemanta/usersync.go | 12 ---------- config/config.go | 4 ++-- exchange/adapter_builders.go | 4 ++-- openrtb_ext/bidders.go | 4 ++-- openrtb_ext/imp_outbrain.go | 15 ++++++++++++ openrtb_ext/imp_zemanta.go | 15 ------------ .../{zemanta.yaml => outbrain.yaml} | 0 .../{zemanta.json => outbrain.json} | 4 ++-- usersync/usersyncers/syncer.go | 4 ++-- usersync/usersyncers/syncer_test.go | 2 +- 24 files changed, 58 insertions(+), 58 deletions(-) rename adapters/{zemanta/zemanta.go => outbrain/outbrain.go} (86%) rename adapters/{zemanta/zemanta_test.go => outbrain/outbrain_test.go} (69%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/exemplary/banner.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/exemplary/native.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/params/race/banner.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/params/race/native.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/supplemental/app_request.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/supplemental/optional_params.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/supplemental/status_204.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/supplemental/status_400.json (100%) rename adapters/{zemanta/zemantatest => outbrain/outbraintest}/supplemental/status_418.json (100%) rename adapters/{zemanta => outbrain}/params_test.go (87%) create mode 100644 adapters/outbrain/usersync.go rename adapters/{zemanta => outbrain}/usersync_test.go (93%) delete mode 100644 adapters/zemanta/usersync.go create mode 100644 openrtb_ext/imp_outbrain.go delete mode 100644 openrtb_ext/imp_zemanta.go rename static/bidder-info/{zemanta.yaml => outbrain.yaml} (100%) rename static/bidder-params/{zemanta.json => outbrain.json} (92%) diff --git a/adapters/zemanta/zemanta.go b/adapters/outbrain/outbrain.go similarity index 86% rename from adapters/zemanta/zemanta.go rename to adapters/outbrain/outbrain.go index ae547eb91aa..c270dcf2e84 100644 --- a/adapters/zemanta/zemanta.go +++ b/adapters/outbrain/outbrain.go @@ -1,4 +1,4 @@ -package zemanta +package outbrain import ( "encoding/json" @@ -16,7 +16,7 @@ type adapter struct { endpoint string } -// Builder builds a new instance of the Zemanta adapter for the given bidder with the given config. +// Builder builds a new instance of the Outbrain adapter for the given bidder with the given config. func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { bidder := &adapter{ endpoint: config.Endpoint, @@ -28,7 +28,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte reqCopy := *request var errs []error - var zemantaExt openrtb_ext.ExtImpZemanta + var outbrainExt openrtb_ext.ExtImpOutbrain for i := 0; i < len(reqCopy.Imp); i++ { imp := reqCopy.Imp[i] @@ -37,18 +37,18 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte errs = append(errs, err) continue } - if err := json.Unmarshal(bidderExt.Bidder, &zemantaExt); err != nil { + if err := json.Unmarshal(bidderExt.Bidder, &outbrainExt); err != nil { errs = append(errs, err) continue } - imp.TagID = zemantaExt.TagId + imp.TagID = outbrainExt.TagId reqCopy.Imp[i] = imp } publisher := &openrtb2.Publisher{ - ID: zemantaExt.Publisher.Id, - Name: zemantaExt.Publisher.Name, - Domain: zemantaExt.Publisher.Domain, + ID: outbrainExt.Publisher.Id, + Name: outbrainExt.Publisher.Name, + Domain: outbrainExt.Publisher.Domain, } if reqCopy.Site != nil { siteCopy := *reqCopy.Site @@ -60,11 +60,11 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte reqCopy.App = &appCopy } - if zemantaExt.BCat != nil { - reqCopy.BCat = zemantaExt.BCat + if outbrainExt.BCat != nil { + reqCopy.BCat = outbrainExt.BCat } - if zemantaExt.BAdv != nil { - reqCopy.BAdv = zemantaExt.BAdv + if outbrainExt.BAdv != nil { + reqCopy.BAdv = outbrainExt.BAdv } requestJSON, err := json.Marshal(reqCopy) diff --git a/adapters/zemanta/zemanta_test.go b/adapters/outbrain/outbrain_test.go similarity index 69% rename from adapters/zemanta/zemanta_test.go rename to adapters/outbrain/outbrain_test.go index e63eb51005c..533bad388ce 100644 --- a/adapters/zemanta/zemanta_test.go +++ b/adapters/outbrain/outbrain_test.go @@ -1,4 +1,4 @@ -package zemanta +package outbrain import ( "testing" @@ -9,12 +9,12 @@ import ( ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderZemanta, config.Adapter{ + bidder, buildErr := Builder(openrtb_ext.BidderOutbrain, config.Adapter{ Endpoint: "http://example.com/bid"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } - adapterstest.RunJSONBidderTest(t, "zemantatest", bidder) + adapterstest.RunJSONBidderTest(t, "outbraintest", bidder) } diff --git a/adapters/zemanta/zemantatest/exemplary/banner.json b/adapters/outbrain/outbraintest/exemplary/banner.json similarity index 100% rename from adapters/zemanta/zemantatest/exemplary/banner.json rename to adapters/outbrain/outbraintest/exemplary/banner.json diff --git a/adapters/zemanta/zemantatest/exemplary/native.json b/adapters/outbrain/outbraintest/exemplary/native.json similarity index 100% rename from adapters/zemanta/zemantatest/exemplary/native.json rename to adapters/outbrain/outbraintest/exemplary/native.json diff --git a/adapters/zemanta/zemantatest/params/race/banner.json b/adapters/outbrain/outbraintest/params/race/banner.json similarity index 100% rename from adapters/zemanta/zemantatest/params/race/banner.json rename to adapters/outbrain/outbraintest/params/race/banner.json diff --git a/adapters/zemanta/zemantatest/params/race/native.json b/adapters/outbrain/outbraintest/params/race/native.json similarity index 100% rename from adapters/zemanta/zemantatest/params/race/native.json rename to adapters/outbrain/outbraintest/params/race/native.json diff --git a/adapters/zemanta/zemantatest/supplemental/app_request.json b/adapters/outbrain/outbraintest/supplemental/app_request.json similarity index 100% rename from adapters/zemanta/zemantatest/supplemental/app_request.json rename to adapters/outbrain/outbraintest/supplemental/app_request.json diff --git a/adapters/zemanta/zemantatest/supplemental/optional_params.json b/adapters/outbrain/outbraintest/supplemental/optional_params.json similarity index 100% rename from adapters/zemanta/zemantatest/supplemental/optional_params.json rename to adapters/outbrain/outbraintest/supplemental/optional_params.json diff --git a/adapters/zemanta/zemantatest/supplemental/status_204.json b/adapters/outbrain/outbraintest/supplemental/status_204.json similarity index 100% rename from adapters/zemanta/zemantatest/supplemental/status_204.json rename to adapters/outbrain/outbraintest/supplemental/status_204.json diff --git a/adapters/zemanta/zemantatest/supplemental/status_400.json b/adapters/outbrain/outbraintest/supplemental/status_400.json similarity index 100% rename from adapters/zemanta/zemantatest/supplemental/status_400.json rename to adapters/outbrain/outbraintest/supplemental/status_400.json diff --git a/adapters/zemanta/zemantatest/supplemental/status_418.json b/adapters/outbrain/outbraintest/supplemental/status_418.json similarity index 100% rename from adapters/zemanta/zemantatest/supplemental/status_418.json rename to adapters/outbrain/outbraintest/supplemental/status_418.json diff --git a/adapters/zemanta/params_test.go b/adapters/outbrain/params_test.go similarity index 87% rename from adapters/zemanta/params_test.go rename to adapters/outbrain/params_test.go index 54e67c57bf1..a8d81d6234d 100644 --- a/adapters/zemanta/params_test.go +++ b/adapters/outbrain/params_test.go @@ -1,4 +1,4 @@ -package zemanta +package outbrain import ( "encoding/json" @@ -14,7 +14,7 @@ func TestValidParams(t *testing.T) { } for _, p := range validParams { - if err := validator.Validate(openrtb_ext.BidderZemanta, json.RawMessage(p)); err != nil { + if err := validator.Validate(openrtb_ext.BidderOutbrain, json.RawMessage(p)); err != nil { t.Errorf("Schema rejected valid params: %s", p) } } @@ -27,7 +27,7 @@ func TestInvalidParams(t *testing.T) { } for _, p := range invalidParams { - if err := validator.Validate(openrtb_ext.BidderZemanta, json.RawMessage(p)); err == nil { + if err := validator.Validate(openrtb_ext.BidderOutbrain, json.RawMessage(p)); err == nil { t.Errorf("Schema allowed invalid params: %s", p) } } diff --git a/adapters/outbrain/usersync.go b/adapters/outbrain/usersync.go new file mode 100644 index 00000000000..7dd60306c60 --- /dev/null +++ b/adapters/outbrain/usersync.go @@ -0,0 +1,12 @@ +package outbrain + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewOutbrainSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("outbrain", temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/zemanta/usersync_test.go b/adapters/outbrain/usersync_test.go similarity index 93% rename from adapters/zemanta/usersync_test.go rename to adapters/outbrain/usersync_test.go index e56851be821..f531834fc48 100644 --- a/adapters/zemanta/usersync_test.go +++ b/adapters/outbrain/usersync_test.go @@ -1,4 +1,4 @@ -package zemanta +package outbrain import ( "testing" @@ -16,7 +16,7 @@ func TestSyncer(t *testing.T) { template.New("sync-template").Parse(syncURL), ) - syncer := NewZemantaSyncer(syncURLTemplate) + syncer := NewOutbrainSyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ Signal: "A", diff --git a/adapters/zemanta/usersync.go b/adapters/zemanta/usersync.go deleted file mode 100644 index fec8a2feda8..00000000000 --- a/adapters/zemanta/usersync.go +++ /dev/null @@ -1,12 +0,0 @@ -package zemanta - -import ( - "text/template" - - "github.com/prebid/prebid-server/adapters" - "github.com/prebid/prebid-server/usersync" -) - -func NewZemantaSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("zemanta", temp, adapters.SyncTypeRedirect) -} diff --git a/config/config.go b/config/config.go index bda531f2460..b300bc58e49 100644 --- a/config/config.go +++ b/config/config.go @@ -622,6 +622,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderNoBid, "https://ads.servenobid.com/getsync?tek=pbs&ver=1&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dnobid%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOpenx, "https://rtb.openx.net/sync/prebid?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dopenx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOneTag, "https://onetag-sys.com/usync/?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Donetag%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUSER_TOKEN%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOutbrain, "https://prebidtest.zemanta.com/usersync/prebidtest?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Doutbrain%26uid%3D__ZUID__") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPubmatic, "https://ads.pubmatic.com/AdServer/js/user_sync.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&predirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPulsepoint, "https://bh.contextweb.com/rtset?pid=561205&ev=1&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpulsepoint%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25VGUID%25%25") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderRhythmone, "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D") @@ -649,7 +650,6 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldlab, "https://ad.yieldlab.net/mr?t=2&pid=9140838&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldlab%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25YL_UID%25%25") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldone, "https://y.one.impact-ad.jp/hbs_cs?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderZemanta, "http://prebidtest.zemanta.com/usersync/prebidtest?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dzemanta%26uid%3D__ZUID__") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderZeroClickFraud, "https://s.0cf.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dzeroclickfraud%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBetween, "https://ads.betweendigital.com/match?bidder_id=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&callback_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbetween%26gdpr%3D0%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUSER_ID%7D") } @@ -876,6 +876,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.onetag.endpoint", "https://prebid-server.onetag-sys.com/prebid-server/{{.PublisherID}}") v.SetDefault("adapters.openx.endpoint", "http://rtb.openx.net/prebid") v.SetDefault("adapters.orbidder.endpoint", "https://orbidder.otto.de/openrtb2") + v.SetDefault("adapters.outbrain.endpoint", "https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/") v.SetDefault("adapters.pangle.disabled", true) v.SetDefault("adapters.pubmatic.endpoint", "https://hbopenbid.pubmatic.com/translator?source=prebid-server") v.SetDefault("adapters.pubnative.endpoint", "http://dsp.pubnative.net/bid/v1/request") @@ -913,7 +914,6 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.yieldlab.endpoint", "https://ad.yieldlab.net/yp/") v.SetDefault("adapters.yieldmo.endpoint", "https://ads.yieldmo.com/exchange/prebid-server") v.SetDefault("adapters.yieldone.endpoint", "https://y.one.impact-ad.jp/hbs_imp") - v.SetDefault("adapters.zemanta.endpoint", "https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/") v.SetDefault("adapters.zeroclickfraud.endpoint", "http://{{.Host}}/openrtb2?sid={{.SourceId}}") v.SetDefault("max_request_size", 1024*256) diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 801d4023d02..307a07fafd7 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -70,6 +70,7 @@ import ( "github.com/prebid/prebid-server/adapters/onetag" "github.com/prebid/prebid-server/adapters/openx" "github.com/prebid/prebid-server/adapters/orbidder" + "github.com/prebid/prebid-server/adapters/outbrain" "github.com/prebid/prebid-server/adapters/pangle" "github.com/prebid/prebid-server/adapters/pubmatic" "github.com/prebid/prebid-server/adapters/pubnative" @@ -103,7 +104,6 @@ import ( "github.com/prebid/prebid-server/adapters/yieldlab" "github.com/prebid/prebid-server/adapters/yieldmo" "github.com/prebid/prebid-server/adapters/yieldone" - "github.com/prebid/prebid-server/adapters/zemanta" "github.com/prebid/prebid-server/adapters/zeroclickfraud" "github.com/prebid/prebid-server/openrtb_ext" ) @@ -182,6 +182,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderOneTag: onetag.Builder, openrtb_ext.BidderOpenx: openx.Builder, openrtb_ext.BidderOrbidder: orbidder.Builder, + openrtb_ext.BidderOutbrain: outbrain.Builder, openrtb_ext.BidderPangle: pangle.Builder, openrtb_ext.BidderPubmatic: pubmatic.Builder, openrtb_ext.BidderPubnative: pubnative.Builder, @@ -216,7 +217,6 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderYieldlab: yieldlab.Builder, openrtb_ext.BidderYieldmo: yieldmo.Builder, openrtb_ext.BidderYieldone: yieldone.Builder, - openrtb_ext.BidderZemanta: zemanta.Builder, openrtb_ext.BidderZeroClickFraud: zeroclickfraud.Builder, } } diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 8cc1bbd9547..f48cb23047a 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -143,6 +143,7 @@ const ( BidderOneTag BidderName = "onetag" BidderOpenx BidderName = "openx" BidderOrbidder BidderName = "orbidder" + BidderOutbrain BidderName = "outbrain" BidderPangle BidderName = "pangle" BidderPubmatic BidderName = "pubmatic" BidderPubnative BidderName = "pubnative" @@ -177,7 +178,6 @@ const ( BidderYieldlab BidderName = "yieldlab" BidderYieldmo BidderName = "yieldmo" BidderYieldone BidderName = "yieldone" - BidderZemanta BidderName = "zemanta" BidderZeroClickFraud BidderName = "zeroclickfraud" ) @@ -254,6 +254,7 @@ func CoreBidderNames() []BidderName { BidderOneTag, BidderOpenx, BidderOrbidder, + BidderOutbrain, BidderPangle, BidderPubmatic, BidderPubnative, @@ -288,7 +289,6 @@ func CoreBidderNames() []BidderName { BidderYieldlab, BidderYieldmo, BidderYieldone, - BidderZemanta, BidderZeroClickFraud, } } diff --git a/openrtb_ext/imp_outbrain.go b/openrtb_ext/imp_outbrain.go new file mode 100644 index 00000000000..634f29481c1 --- /dev/null +++ b/openrtb_ext/imp_outbrain.go @@ -0,0 +1,15 @@ +package openrtb_ext + +// ExtImpOutbrain defines the contract for bidrequest.imp[i].ext.outbrain +type ExtImpOutbrain struct { + Publisher ExtImpOutbrainPublisher `json:"publisher"` + TagId string `json:"tagid"` + BCat []string `json:"bcat"` + BAdv []string `json:"badv"` +} + +type ExtImpOutbrainPublisher struct { + Id string `json:"id"` + Name string `json:"name"` + Domain string `json:"domain"` +} diff --git a/openrtb_ext/imp_zemanta.go b/openrtb_ext/imp_zemanta.go deleted file mode 100644 index 5baab6d2fd4..00000000000 --- a/openrtb_ext/imp_zemanta.go +++ /dev/null @@ -1,15 +0,0 @@ -package openrtb_ext - -// ExtImpZemanta defines the contract for bidrequest.imp[i].ext.zemanta -type ExtImpZemanta struct { - Publisher ExtImpZemantaPublisher `json:"publisher"` - TagId string `json:"tagid"` - BCat []string `json:"bcat"` - BAdv []string `json:"badv"` -} - -type ExtImpZemantaPublisher struct { - Id string `json:"id"` - Name string `json:"name"` - Domain string `json:"domain"` -} diff --git a/static/bidder-info/zemanta.yaml b/static/bidder-info/outbrain.yaml similarity index 100% rename from static/bidder-info/zemanta.yaml rename to static/bidder-info/outbrain.yaml diff --git a/static/bidder-params/zemanta.json b/static/bidder-params/outbrain.json similarity index 92% rename from static/bidder-params/zemanta.json rename to static/bidder-params/outbrain.json index b122c7dea4b..8cfb8bbdf28 100644 --- a/static/bidder-params/zemanta.json +++ b/static/bidder-params/outbrain.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Zemanta Adapter Params", - "description": "A schema which validates params accepted by the Zemanta adapter", + "title": "Outbrain Adapter Params", + "description": "A schema which validates params accepted by the Outbrain adapter", "type": "object", "properties": { diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 30c0ebf5f37..104312cc164 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -60,6 +60,7 @@ import ( "github.com/prebid/prebid-server/adapters/nobid" "github.com/prebid/prebid-server/adapters/onetag" "github.com/prebid/prebid-server/adapters/openx" + "github.com/prebid/prebid-server/adapters/outbrain" "github.com/prebid/prebid-server/adapters/pubmatic" "github.com/prebid/prebid-server/adapters/pulsepoint" "github.com/prebid/prebid-server/adapters/rhythmone" @@ -87,7 +88,6 @@ import ( "github.com/prebid/prebid-server/adapters/yieldlab" "github.com/prebid/prebid-server/adapters/yieldmo" "github.com/prebid/prebid-server/adapters/yieldone" - "github.com/prebid/prebid-server/adapters/zemanta" "github.com/prebid/prebid-server/adapters/zeroclickfraud" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -153,6 +153,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderNinthDecimal, ninthdecimal.NewNinthDecimalSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderNoBid, nobid.NewNoBidSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderOneTag, onetag.NewSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderOutbrain, outbrain.NewOutbrainSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderOpenx, openx.NewOpenxSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderPubmatic, pubmatic.NewPubmaticSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderPulsepoint, pulsepoint.NewPulsepointSyncer) @@ -181,7 +182,6 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldlab, yieldlab.NewYieldlabSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldmo, yieldmo.NewYieldmoSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldone, yieldone.NewYieldoneSyncer) - insertIntoMap(cfg, syncers, openrtb_ext.BidderZemanta, zemanta.NewZemantaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderZeroClickFraud, zeroclickfraud.NewZeroClickFraudSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderBetween, between.NewBetweenSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 325fd9b551c..e0dc3dd2896 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -69,6 +69,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderNoBid): syncConfig, string(openrtb_ext.BidderOneTag): syncConfig, string(openrtb_ext.BidderOpenx): syncConfig, + string(openrtb_ext.BidderOutbrain): syncConfig, string(openrtb_ext.BidderPubmatic): syncConfig, string(openrtb_ext.BidderPulsepoint): syncConfig, string(openrtb_ext.BidderRhythmone): syncConfig, @@ -96,7 +97,6 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderYieldlab): syncConfig, string(openrtb_ext.BidderYieldmo): syncConfig, string(openrtb_ext.BidderYieldone): syncConfig, - string(openrtb_ext.BidderZemanta): syncConfig, string(openrtb_ext.BidderZeroClickFraud): syncConfig, }, } From c0a85f747534005ddf3944606c0419c8674f8330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Su=C5=A1nik?= Date: Wed, 14 Apr 2021 17:38:02 +0200 Subject: [PATCH 60/91] Update openrtb library to v15 (#1802) --- adapters/33across/33across.go | 2 +- adapters/acuityads/acuityads.go | 2 +- adapters/adapterstest/adapter_test_util.go | 2 +- adapters/adapterstest/test_json.go | 2 +- adapters/adform/adform.go | 2 +- adapters/adform/adform_test.go | 2 +- adapters/adgeneration/adgeneration.go | 2 +- adapters/adgeneration/adgeneration_test.go | 2 +- adapters/adhese/adhese.go | 2 +- adapters/adhese/utils.go | 2 +- adapters/adkernel/adkernel.go | 2 +- adapters/adkernelAdn/adkernelAdn.go | 2 +- adapters/adman/adman.go | 2 +- adapters/admixer/admixer.go | 2 +- adapters/adocean/adocean.go | 2 +- adapters/adoppler/adoppler.go | 2 +- adapters/adot/adot.go | 2 +- adapters/adot/adot_test.go | 2 +- adapters/adpone/adpone.go | 2 +- adapters/adprime/adprime.go | 2 +- adapters/adtarget/adtarget.go | 2 +- adapters/adtelligent/adtelligent.go | 2 +- adapters/advangelists/advangelists.go | 2 +- adapters/adyoulike/adyoulike.go | 2 +- adapters/aja/aja.go | 2 +- adapters/amx/amx.go | 2 +- adapters/amx/amx_test.go | 2 +- adapters/applogy/applogy.go | 2 +- adapters/appnexus/appnexus.go | 2 +- adapters/appnexus/appnexus_test.go | 2 +- adapters/audienceNetwork/facebook.go | 2 +- adapters/avocet/avocet.go | 2 +- adapters/avocet/avocet_test.go | 2 +- adapters/beachfront/beachfront.go | 2 +- adapters/beintoo/beintoo.go | 2 +- adapters/between/between.go | 2 +- adapters/bidder.go | 2 +- adapters/bidmachine/bidmachine.go | 2 +- adapters/brightroll/brightroll.go | 2 +- adapters/colossus/colossus.go | 2 +- adapters/connectad/connectad.go | 2 +- adapters/consumable/adtypes.go | 2 +- adapters/consumable/consumable.go | 2 +- adapters/conversant/cnvr_legacy.go | 2 +- adapters/conversant/cnvr_legacy_test.go | 2 +- adapters/conversant/conversant.go | 2 +- adapters/cpmstar/cpmstar.go | 2 +- adapters/criteo/criteo.go | 2 +- adapters/criteo/models.go | 2 +- adapters/criteo/models_test.go | 2 +- adapters/datablocks/datablocks.go | 2 +- adapters/decenterads/decenterads.go | 2 +- adapters/deepintent/deepintent.go | 2 +- adapters/dmx/dmx.go | 2 +- adapters/dmx/dmx_test.go | 2 +- adapters/emx_digital/emx_digital.go | 2 +- adapters/engagebdr/engagebdr.go | 2 +- adapters/eplanning/eplanning.go | 2 +- adapters/epom/epom.go | 2 +- adapters/gamma/gamma.go | 2 +- adapters/gamoshi/gamoshi.go | 2 +- adapters/grid/grid.go | 2 +- adapters/gumgum/gumgum.go | 2 +- adapters/improvedigital/improvedigital.go | 2 +- adapters/infoawarebidder.go | 2 +- adapters/infoawarebidder_test.go | 2 +- adapters/inmobi/inmobi.go | 2 +- adapters/invibes/invibes.go | 2 +- adapters/ix/ix.go | 2 +- adapters/ix/ix_test.go | 2 +- adapters/jixie/jixie.go | 2 +- adapters/kidoz/kidoz.go | 2 +- adapters/kidoz/kidoz_test.go | 2 +- adapters/krushmedia/krushmedia.go | 2 +- adapters/kubient/kubient.go | 2 +- adapters/lifestreet/lifestreet.go | 2 +- adapters/lifestreet/lifestreet_test.go | 2 +- adapters/lockerdome/lockerdome.go | 2 +- adapters/logicad/logicad.go | 2 +- adapters/lunamedia/lunamedia.go | 2 +- adapters/marsmedia/marsmedia.go | 2 +- adapters/mgid/mgid.go | 2 +- adapters/mobfoxpb/mobfoxpb.go | 2 +- adapters/mobilefuse/mobilefuse.go | 2 +- adapters/nanointeractive/nanointeractive.go | 2 +- adapters/ninthdecimal/ninthdecimal.go | 2 +- adapters/nobid/nobid.go | 2 +- adapters/onetag/onetag.go | 2 +- adapters/openrtb_util.go | 2 +- adapters/openrtb_util_test.go | 2 +- adapters/openx/openx.go | 2 +- adapters/openx/openx_test.go | 2 +- adapters/orbidder/orbidder.go | 2 +- adapters/outbrain/outbrain.go | 2 +- adapters/pangle/pangle.go | 2 +- adapters/pubmatic/pubmatic.go | 2 +- adapters/pubmatic/pubmatic_test.go | 2 +- adapters/pubnative/pubnative.go | 2 +- adapters/pulsepoint/pulsepoint.go | 2 +- adapters/pulsepoint/pulsepoint_test.go | 2 +- adapters/revcontent/revcontent.go | 2 +- adapters/rhythmone/rhythmone.go | 2 +- adapters/rtbhouse/rtbhouse.go | 2 +- adapters/rubicon/rubicon.go | 2 +- adapters/rubicon/rubicon_test.go | 2 +- adapters/sharethrough/butler.go | 2 +- adapters/sharethrough/butler_test.go | 2 +- adapters/sharethrough/sharethrough.go | 2 +- adapters/sharethrough/sharethrough_test.go | 2 +- adapters/sharethrough/utils.go | 2 +- adapters/sharethrough/utils_test.go | 2 +- adapters/silvermob/silvermob.go | 2 +- adapters/smaato/smaato.go | 2 +- adapters/smartadserver/smartadserver.go | 2 +- adapters/smartrtb/smartrtb.go | 2 +- adapters/smartyads/smartyads.go | 2 +- adapters/somoaudience/somoaudience.go | 2 +- adapters/sonobi/sonobi.go | 2 +- adapters/sovrn/sovrn.go | 2 +- adapters/sovrn/sovrn_test.go | 2 +- adapters/synacormedia/synacormedia.go | 2 +- adapters/tappx/tappx.go | 2 +- adapters/telaria/telaria.go | 2 +- adapters/triplelift/triplelift.go | 2 +- .../triplelift_native/triplelift_native.go | 2 +- adapters/ucfunnel/ucfunnel.go | 2 +- adapters/ucfunnel/ucfunnel_test.go | 2 +- adapters/unicorn/unicorn.go | 2 +- adapters/unruly/unruly.go | 2 +- adapters/unruly/unruly_test.go | 2 +- adapters/valueimpression/valueimpression.go | 2 +- adapters/verizonmedia/verizonmedia.go | 2 +- adapters/visx/visx.go | 2 +- adapters/vrtcal/vrtcal.go | 2 +- adapters/yeahmobi/yeahmobi.go | 2 +- adapters/yieldlab/yieldlab.go | 2 +- adapters/yieldmo/yieldmo.go | 2 +- adapters/yieldone/yieldone.go | 2 +- adapters/zeroclickfraud/zeroclickfraud.go | 2 +- amp/parse.go | 2 +- amp/parse_test.go | 2 +- analytics/config/config_test.go | 2 +- analytics/core.go | 2 +- analytics/filesystem/file_module_test.go | 2 +- analytics/pubstack/helpers/json_test.go | 2 +- analytics/pubstack/pubstack_module_test.go | 2 +- endpoints/auction_test.go | 2 +- endpoints/openrtb2/amp_auction.go | 2 +- endpoints/openrtb2/amp_auction_test.go | 2 +- endpoints/openrtb2/auction.go | 6 +- endpoints/openrtb2/auction_test.go | 2 +- endpoints/openrtb2/interstitial.go | 2 +- endpoints/openrtb2/interstitial_test.go | 2 +- endpoints/openrtb2/video_auction.go | 2 +- endpoints/openrtb2/video_auction_test.go | 2 +- exchange/adapter_util_test.go | 2 +- exchange/auction.go | 2 +- exchange/auction_test.go | 2 +- exchange/bidder.go | 20 +++-- exchange/bidder_test.go | 54 ++++++++++-- exchange/bidder_validate_bids.go | 2 +- exchange/bidder_validate_bids_test.go | 2 +- exchange/events_test.go | 2 +- exchange/exchange.go | 2 +- exchange/exchange_test.go | 2 +- exchange/gdpr.go | 2 +- exchange/gdpr_test.go | 2 +- exchange/legacy.go | 2 +- exchange/legacy_test.go | 2 +- exchange/targeting.go | 2 +- exchange/targeting_test.go | 2 +- exchange/utils.go | 2 +- exchange/utils_test.go | 2 +- go.mod | 12 +-- go.sum | 84 +++++++++++++++---- openrtb_ext/bid_request_video.go | 2 +- openrtb_ext/deal_tier.go | 2 +- openrtb_ext/deal_tier_test.go | 2 +- openrtb_ext/response.go | 2 +- pbs/pbsrequest.go | 2 +- privacy/ccpa/consentwriter.go | 2 +- privacy/ccpa/consentwriter_test.go | 2 +- privacy/ccpa/parsedpolicy_test.go | 2 +- privacy/ccpa/policy.go | 2 +- privacy/ccpa/policy_test.go | 2 +- privacy/enforcement.go | 2 +- privacy/enforcement_test.go | 2 +- privacy/gdpr/consentwriter.go | 2 +- privacy/gdpr/consentwriter_test.go | 2 +- privacy/lmt/ios.go | 2 +- privacy/lmt/ios_test.go | 2 +- privacy/lmt/policy.go | 2 +- privacy/lmt/policy_test.go | 2 +- privacy/scrubber.go | 2 +- privacy/scrubber_test.go | 2 +- privacy/writer.go | 2 +- privacy/writer_test.go | 2 +- 197 files changed, 326 insertions(+), 234 deletions(-) diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index bc7229eda99..fb329a76f21 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/acuityads/acuityads.go b/adapters/acuityads/acuityads.go index a461dada391..da1cda3da77 100644 --- a/adapters/acuityads/acuityads.go +++ b/adapters/acuityads/acuityads.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adapterstest/adapter_test_util.go b/adapters/adapterstest/adapter_test_util.go index 0c51a74e6b6..25d43a138fb 100644 --- a/adapters/adapterstest/adapter_test_util.go +++ b/adapters/adapterstest/adapter_test_util.go @@ -8,7 +8,7 @@ import ( "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // OrtbMockService Represents a scaffolded OpenRTB service. diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index e33dbddaecf..95319f1e328 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" diff --git a/adapters/adform/adform.go b/adapters/adform/adform.go index df294b56154..225c7af35d4 100644 --- a/adapters/adform/adform.go +++ b/adapters/adform/adform.go @@ -14,7 +14,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index f2056c499c5..70cd6883a4d 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/pbs" diff --git a/adapters/adgeneration/adgeneration.go b/adapters/adgeneration/adgeneration.go index fd87c6f4034..110ec5ce98a 100644 --- a/adapters/adgeneration/adgeneration.go +++ b/adapters/adgeneration/adgeneration.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adgeneration/adgeneration_test.go b/adapters/adgeneration/adgeneration_test.go index 01fff96ede1..d5d93ac4e0b 100644 --- a/adapters/adgeneration/adgeneration_test.go +++ b/adapters/adgeneration/adgeneration_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index 773b3b98fd6..8b4d8c98afe 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -11,7 +11,7 @@ import ( "text/template" "github.com/golang/glog" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adhese/utils.go b/adapters/adhese/utils.go index c83f9ef1480..5a81bb83bd5 100644 --- a/adapters/adhese/utils.go +++ b/adapters/adhese/utils.go @@ -1,6 +1,6 @@ package adhese -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" type AdheseOriginData struct { Priority string `json:"priority"` diff --git a/adapters/adkernel/adkernel.go b/adapters/adkernel/adkernel.go index 93fb3c6f93d..362307cce79 100644 --- a/adapters/adkernel/adkernel.go +++ b/adapters/adkernel/adkernel.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adkernelAdn/adkernelAdn.go b/adapters/adkernelAdn/adkernelAdn.go index 01024baad61..f6075f865e7 100644 --- a/adapters/adkernelAdn/adkernelAdn.go +++ b/adapters/adkernelAdn/adkernelAdn.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adman/adman.go b/adapters/adman/adman.go index 0eab6204b6d..808951d3aba 100644 --- a/adapters/adman/adman.go +++ b/adapters/adman/adman.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index 86d7bfd9d5f..ec49950a17e 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adocean/adocean.go b/adapters/adocean/adocean.go index 97ace405ab0..635cba8c9bc 100644 --- a/adapters/adocean/adocean.go +++ b/adapters/adocean/adocean.go @@ -13,7 +13,7 @@ import ( "strings" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index 56fae4295b4..015f31c7d01 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -8,7 +8,7 @@ import ( "net/url" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adot/adot.go b/adapters/adot/adot.go index f4fd6c23bdb..f41beed8d21 100644 --- a/adapters/adot/adot.go +++ b/adapters/adot/adot.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adot/adot_test.go b/adapters/adot/adot_test.go index 3cb3d680ebd..fbc7def4a74 100644 --- a/adapters/adot/adot_test.go +++ b/adapters/adot/adot_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/adpone/adpone.go b/adapters/adpone/adpone.go index ffc36cc5aba..972f1576ac1 100644 --- a/adapters/adpone/adpone.go +++ b/adapters/adpone/adpone.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/adprime/adprime.go b/adapters/adprime/adprime.go index 6489c543d56..70fbd6b399b 100644 --- a/adapters/adprime/adprime.go +++ b/adapters/adprime/adprime.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index b43e7e51b07..24befbfec0f 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index 6c7bc1f3378..244742db504 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/advangelists/advangelists.go b/adapters/advangelists/advangelists.go index 8a12089df90..b5b385f6c06 100644 --- a/adapters/advangelists/advangelists.go +++ b/adapters/advangelists/advangelists.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/adyoulike/adyoulike.go b/adapters/adyoulike/adyoulike.go index 4797341e7b5..4cccd5dc5bc 100644 --- a/adapters/adyoulike/adyoulike.go +++ b/adapters/adyoulike/adyoulike.go @@ -9,7 +9,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" ) diff --git a/adapters/aja/aja.go b/adapters/aja/aja.go index 1ff942ce4de..6e77fdd5685 100644 --- a/adapters/aja/aja.go +++ b/adapters/aja/aja.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index 68f4ecdfbb4..737fac421f0 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -7,7 +7,7 @@ import ( "net/url" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index 77947c068d0..229889db7cf 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go index 6edc8135516..b144c6b836f 100644 --- a/adapters/applogy/applogy.go +++ b/adapters/applogy/applogy.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index a384257d47b..046f5d312d7 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/pbs" diff --git a/adapters/appnexus/appnexus_test.go b/adapters/appnexus/appnexus_test.go index 076d93eacb6..ead45280aec 100644 --- a/adapters/appnexus/appnexus_test.go +++ b/adapters/appnexus/appnexus_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/cache/dummycache" diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index f2aaaed8f88..5cbdbc90561 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/avocet/avocet.go b/adapters/avocet/avocet.go index b3cda3a1bdd..7ec4788e858 100644 --- a/adapters/avocet/avocet.go +++ b/adapters/avocet/avocet.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/avocet/avocet_test.go b/adapters/avocet/avocet_test.go index b256adc6f17..8dc3c333147 100644 --- a/adapters/avocet/avocet_test.go +++ b/adapters/avocet/avocet_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index ea4ff2c83e5..6bcabf4a39c 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/beintoo/beintoo.go b/adapters/beintoo/beintoo.go index 8b5698750e6..60022e73316 100644 --- a/adapters/beintoo/beintoo.go +++ b/adapters/beintoo/beintoo.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/between/between.go b/adapters/between/between.go index f1be7db5fc2..9d77a0413fd 100644 --- a/adapters/between/between.go +++ b/adapters/between/between.go @@ -8,7 +8,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/bidder.go b/adapters/bidder.go index a389299f888..fe40184e40f 100644 --- a/adapters/bidder.go +++ b/adapters/bidder.go @@ -5,7 +5,7 @@ import ( "encoding/json" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/metrics" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/bidmachine/bidmachine.go b/adapters/bidmachine/bidmachine.go index 3c9a5b679e2..14b72cc6c56 100644 --- a/adapters/bidmachine/bidmachine.go +++ b/adapters/bidmachine/bidmachine.go @@ -9,7 +9,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/brightroll/brightroll.go b/adapters/brightroll/brightroll.go index fe770b07d16..9a64db45f0b 100644 --- a/adapters/brightroll/brightroll.go +++ b/adapters/brightroll/brightroll.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/colossus/colossus.go b/adapters/colossus/colossus.go index 801b338478a..4308edb704e 100644 --- a/adapters/colossus/colossus.go +++ b/adapters/colossus/colossus.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/connectad/connectad.go b/adapters/connectad/connectad.go index 9192a520a05..9827ebcea7b 100644 --- a/adapters/connectad/connectad.go +++ b/adapters/connectad/connectad.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/consumable/adtypes.go b/adapters/consumable/adtypes.go index 20b89bdfe7f..5c5bd425bbf 100644 --- a/adapters/consumable/adtypes.go +++ b/adapters/consumable/adtypes.go @@ -3,7 +3,7 @@ package consumable import ( "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) /* Turn array of openrtb formats into consumable's code*/ diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index d81bc20b0d3..c2e0c201187 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/conversant/cnvr_legacy.go b/adapters/conversant/cnvr_legacy.go index e29fb7c019b..eff1afc5d32 100644 --- a/adapters/conversant/cnvr_legacy.go +++ b/adapters/conversant/cnvr_legacy.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/pbs" diff --git a/adapters/conversant/cnvr_legacy_test.go b/adapters/conversant/cnvr_legacy_test.go index ef8a780c746..e2000bc0dd1 100644 --- a/adapters/conversant/cnvr_legacy_test.go +++ b/adapters/conversant/cnvr_legacy_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/config" diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index d742033437a..cdcf75665f3 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/cpmstar/cpmstar.go b/adapters/cpmstar/cpmstar.go index b3100222e98..86c87c4ccb6 100644 --- a/adapters/cpmstar/cpmstar.go +++ b/adapters/cpmstar/cpmstar.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/criteo/criteo.go b/adapters/criteo/criteo.go index f045c9f009b..9f6ca4d74ec 100644 --- a/adapters/criteo/criteo.go +++ b/adapters/criteo/criteo.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/criteo/models.go b/adapters/criteo/models.go index 64f6081d781..1ae51c12f8b 100644 --- a/adapters/criteo/models.go +++ b/adapters/criteo/models.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/criteo/models_test.go b/adapters/criteo/models_test.go index 9da7bda210b..e85fa4c1a5c 100644 --- a/adapters/criteo/models_test.go +++ b/adapters/criteo/models_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/openrtb_ext" ) diff --git a/adapters/datablocks/datablocks.go b/adapters/datablocks/datablocks.go index 28b9c36360e..fbed456ace9 100644 --- a/adapters/datablocks/datablocks.go +++ b/adapters/datablocks/datablocks.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/decenterads/decenterads.go b/adapters/decenterads/decenterads.go index ac60a4042ae..c94c461e367 100644 --- a/adapters/decenterads/decenterads.go +++ b/adapters/decenterads/decenterads.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/deepintent/deepintent.go b/adapters/deepintent/deepintent.go index 17168ae05f8..b5b0fd54c5d 100644 --- a/adapters/deepintent/deepintent.go +++ b/adapters/deepintent/deepintent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/dmx/dmx.go b/adapters/dmx/dmx.go index 280c7187ca8..7124d229347 100644 --- a/adapters/dmx/dmx.go +++ b/adapters/dmx/dmx.go @@ -8,7 +8,7 @@ import ( "net/url" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/dmx/dmx_test.go b/adapters/dmx/dmx_test.go index 4288f2fa940..a9f1e8bbc79 100644 --- a/adapters/dmx/dmx_test.go +++ b/adapters/dmx/dmx_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/emx_digital/emx_digital.go b/adapters/emx_digital/emx_digital.go index 98a8b6eb943..75d74cf6cd3 100644 --- a/adapters/emx_digital/emx_digital.go +++ b/adapters/emx_digital/emx_digital.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index 6c55b99987b..645773fe735 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/eplanning/eplanning.go b/adapters/eplanning/eplanning.go index 2aa066ba2b2..1e593fb7d93 100644 --- a/adapters/eplanning/eplanning.go +++ b/adapters/eplanning/eplanning.go @@ -11,7 +11,7 @@ import ( "fmt" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/epom/epom.go b/adapters/epom/epom.go index b15c7b1cc04..a8336b64da6 100644 --- a/adapters/epom/epom.go +++ b/adapters/epom/epom.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/gamma/gamma.go b/adapters/gamma/gamma.go index 1408fdeeede..a99a4643632 100644 --- a/adapters/gamma/gamma.go +++ b/adapters/gamma/gamma.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/gamoshi/gamoshi.go b/adapters/gamoshi/gamoshi.go index 50b7e9d58a5..c3219c1b59d 100644 --- a/adapters/gamoshi/gamoshi.go +++ b/adapters/gamoshi/gamoshi.go @@ -7,7 +7,7 @@ import ( "strconv" "github.com/golang/glog" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/grid/grid.go b/adapters/grid/grid.go index 69bc1500bf9..2c2b291bab8 100644 --- a/adapters/grid/grid.go +++ b/adapters/grid/grid.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index 0334aad9d43..00927b9bf80 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/improvedigital/improvedigital.go b/adapters/improvedigital/improvedigital.go index b942336b410..9b2d571d903 100644 --- a/adapters/improvedigital/improvedigital.go +++ b/adapters/improvedigital/improvedigital.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/infoawarebidder.go b/adapters/infoawarebidder.go index 67227d822b3..6a07bda3a4d 100644 --- a/adapters/infoawarebidder.go +++ b/adapters/infoawarebidder.go @@ -3,7 +3,7 @@ package adapters import ( "fmt" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/infoawarebidder_test.go b/adapters/infoawarebidder_test.go index 60e5af041da..375248137ad 100644 --- a/adapters/infoawarebidder_test.go +++ b/adapters/infoawarebidder_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go index 5034f01d77b..a23472e8892 100644 --- a/adapters/inmobi/inmobi.go +++ b/adapters/inmobi/inmobi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/invibes/invibes.go b/adapters/invibes/invibes.go index fb4d7641d79..d29750c84bf 100644 --- a/adapters/invibes/invibes.go +++ b/adapters/invibes/invibes.go @@ -9,7 +9,7 @@ import ( "strings" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 038a2c146b9..38294cc587b 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 4c0515b4c6b..27d9370e1b7 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/jixie/jixie.go b/adapters/jixie/jixie.go index 565f8a588c3..b158dbba58e 100644 --- a/adapters/jixie/jixie.go +++ b/adapters/jixie/jixie.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/kidoz/kidoz.go b/adapters/kidoz/kidoz.go index 670bfb80b49..43372dc2f39 100644 --- a/adapters/kidoz/kidoz.go +++ b/adapters/kidoz/kidoz.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/kidoz/kidoz_test.go b/adapters/kidoz/kidoz_test.go index 0de06392bba..3fd807ea454 100644 --- a/adapters/kidoz/kidoz_test.go +++ b/adapters/kidoz/kidoz_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index 54e89200844..f1b80da701f 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/kubient/kubient.go b/adapters/kubient/kubient.go index 8b011b7f795..a99e9005105 100644 --- a/adapters/kubient/kubient.go +++ b/adapters/kubient/kubient.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/lifestreet/lifestreet.go b/adapters/lifestreet/lifestreet.go index 7114a9bbaac..14f6931751a 100644 --- a/adapters/lifestreet/lifestreet.go +++ b/adapters/lifestreet/lifestreet.go @@ -9,7 +9,7 @@ import ( "net/http" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/adapters" diff --git a/adapters/lifestreet/lifestreet_test.go b/adapters/lifestreet/lifestreet_test.go index 215f137ccf4..5c4f47fdff9 100644 --- a/adapters/lifestreet/lifestreet_test.go +++ b/adapters/lifestreet/lifestreet_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/pbs" "github.com/prebid/prebid-server/usersync" diff --git a/adapters/lockerdome/lockerdome.go b/adapters/lockerdome/lockerdome.go index 483ffbd5bd6..28c966be6de 100644 --- a/adapters/lockerdome/lockerdome.go +++ b/adapters/lockerdome/lockerdome.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/logicad/logicad.go b/adapters/logicad/logicad.go index bc45652d127..982723d0d0a 100644 --- a/adapters/logicad/logicad.go +++ b/adapters/logicad/logicad.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/lunamedia/lunamedia.go b/adapters/lunamedia/lunamedia.go index a8040365964..899269e661f 100644 --- a/adapters/lunamedia/lunamedia.go +++ b/adapters/lunamedia/lunamedia.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/marsmedia/marsmedia.go b/adapters/marsmedia/marsmedia.go index 20d0d1fc645..a63db09e208 100644 --- a/adapters/marsmedia/marsmedia.go +++ b/adapters/marsmedia/marsmedia.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/mgid/mgid.go b/adapters/mgid/mgid.go index 0917003ab82..95ede0ab5c4 100644 --- a/adapters/mgid/mgid.go +++ b/adapters/mgid/mgid.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/mobfoxpb/mobfoxpb.go b/adapters/mobfoxpb/mobfoxpb.go index d39fbfb74e9..7fcf416a480 100644 --- a/adapters/mobfoxpb/mobfoxpb.go +++ b/adapters/mobfoxpb/mobfoxpb.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/mobilefuse/mobilefuse.go b/adapters/mobilefuse/mobilefuse.go index 217f0f24b7b..47ee1cab743 100644 --- a/adapters/mobilefuse/mobilefuse.go +++ b/adapters/mobilefuse/mobilefuse.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/nanointeractive/nanointeractive.go b/adapters/nanointeractive/nanointeractive.go index afe80bcbfee..a2ec89b0d5b 100644 --- a/adapters/nanointeractive/nanointeractive.go +++ b/adapters/nanointeractive/nanointeractive.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/ninthdecimal/ninthdecimal.go b/adapters/ninthdecimal/ninthdecimal.go index e819a2787a2..fc29b38cdab 100755 --- a/adapters/ninthdecimal/ninthdecimal.go +++ b/adapters/ninthdecimal/ninthdecimal.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/nobid/nobid.go b/adapters/nobid/nobid.go index 7fc7669b7c4..f8db812d9ca 100644 --- a/adapters/nobid/nobid.go +++ b/adapters/nobid/nobid.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/onetag/onetag.go b/adapters/onetag/onetag.go index 6069682bc2a..1721d76df6a 100644 --- a/adapters/onetag/onetag.go +++ b/adapters/onetag/onetag.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/openrtb_util.go b/adapters/openrtb_util.go index bc18b9ebf17..6aa07c6b764 100644 --- a/adapters/openrtb_util.go +++ b/adapters/openrtb_util.go @@ -3,7 +3,7 @@ package adapters import ( "encoding/json" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/pbs" ) diff --git a/adapters/openrtb_util_test.go b/adapters/openrtb_util_test.go index d859114b646..b7d03fbfc6c 100644 --- a/adapters/openrtb_util_test.go +++ b/adapters/openrtb_util_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/pbs" "github.com/prebid/prebid-server/usersync" "github.com/stretchr/testify/assert" diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index c8c0de8d9d2..d53d405ba24 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/openx/openx_test.go b/adapters/openx/openx_test.go index aaf7ecf85a2..ea90dc875da 100644 --- a/adapters/openx/openx_test.go +++ b/adapters/openx/openx_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/orbidder/orbidder.go b/adapters/orbidder/orbidder.go index b0b3bcfbb7a..5e8ea3db84f 100644 --- a/adapters/orbidder/orbidder.go +++ b/adapters/orbidder/orbidder.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/outbrain/outbrain.go b/adapters/outbrain/outbrain.go index c270dcf2e84..02a9784303c 100644 --- a/adapters/outbrain/outbrain.go +++ b/adapters/outbrain/outbrain.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/pangle/pangle.go b/adapters/pangle/pangle.go index cc215412a5f..a4694c71559 100644 --- a/adapters/pangle/pangle.go +++ b/adapters/pangle/pangle.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index f3f5785492d..afc9263af4e 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/golang/glog" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/pubmatic/pubmatic_test.go b/adapters/pubmatic/pubmatic_test.go index 7e8f177a1ba..032a324d18a 100644 --- a/adapters/pubmatic/pubmatic_test.go +++ b/adapters/pubmatic/pubmatic_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/cache/dummycache" diff --git a/adapters/pubnative/pubnative.go b/adapters/pubnative/pubnative.go index 35bc7553db3..8093c841fb2 100644 --- a/adapters/pubnative/pubnative.go +++ b/adapters/pubnative/pubnative.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/pulsepoint/pulsepoint.go b/adapters/pulsepoint/pulsepoint.go index 35297d795a6..6b6b4305607 100644 --- a/adapters/pulsepoint/pulsepoint.go +++ b/adapters/pulsepoint/pulsepoint.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/pulsepoint/pulsepoint_test.go b/adapters/pulsepoint/pulsepoint_test.go index a16f9a0e470..fac0bfd4de8 100644 --- a/adapters/pulsepoint/pulsepoint_test.go +++ b/adapters/pulsepoint/pulsepoint_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/revcontent/revcontent.go b/adapters/revcontent/revcontent.go index f3b24436d63..173917c2314 100644 --- a/adapters/revcontent/revcontent.go +++ b/adapters/revcontent/revcontent.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/rhythmone/rhythmone.go b/adapters/rhythmone/rhythmone.go index 096e9190622..de43537e55b 100644 --- a/adapters/rhythmone/rhythmone.go +++ b/adapters/rhythmone/rhythmone.go @@ -6,7 +6,7 @@ import ( "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index b2eccd76305..44adddee8fd 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index dff961cc79f..89d69522fe8 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/golang/glog" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index 747758bc820..dc5b3a90423 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/adapters/adapterstest" diff --git a/adapters/sharethrough/butler.go b/adapters/sharethrough/butler.go index c9b9726ff4e..b34ae0844ab 100644 --- a/adapters/sharethrough/butler.go +++ b/adapters/sharethrough/butler.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/sharethrough/butler_test.go b/adapters/sharethrough/butler_test.go index 3b1f2159bb7..fbef417e530 100644 --- a/adapters/sharethrough/butler_test.go +++ b/adapters/sharethrough/butler_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/sharethrough/sharethrough.go b/adapters/sharethrough/sharethrough.go index 65afb21adb7..410ca391bd4 100644 --- a/adapters/sharethrough/sharethrough.go +++ b/adapters/sharethrough/sharethrough.go @@ -5,7 +5,7 @@ import ( "net/http" "regexp" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/sharethrough/sharethrough_test.go b/adapters/sharethrough/sharethrough_test.go index 194894fd893..1cf45d1fde2 100644 --- a/adapters/sharethrough/sharethrough_test.go +++ b/adapters/sharethrough/sharethrough_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/sharethrough/utils.go b/adapters/sharethrough/utils.go index 4f27e738b99..e10a8f90b7b 100644 --- a/adapters/sharethrough/utils.go +++ b/adapters/sharethrough/utils.go @@ -13,7 +13,7 @@ import ( "time" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" ) diff --git a/adapters/sharethrough/utils_test.go b/adapters/sharethrough/utils_test.go index fb199369e59..b842cf0b0c0 100644 --- a/adapters/sharethrough/utils_test.go +++ b/adapters/sharethrough/utils_test.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/silvermob/silvermob.go b/adapters/silvermob/silvermob.go index 47a762ecc04..8a5c6b259b6 100644 --- a/adapters/silvermob/silvermob.go +++ b/adapters/silvermob/silvermob.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 41229574f9e..9aea2e1e614 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/smartadserver/smartadserver.go b/adapters/smartadserver/smartadserver.go index 1e1eeac4f95..3954a00b4d5 100644 --- a/adapters/smartadserver/smartadserver.go +++ b/adapters/smartadserver/smartadserver.go @@ -8,7 +8,7 @@ import ( "path" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/smartrtb/smartrtb.go b/adapters/smartrtb/smartrtb.go index 548d4f36db5..e123d4eb6d2 100644 --- a/adapters/smartrtb/smartrtb.go +++ b/adapters/smartrtb/smartrtb.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/smartyads/smartyads.go b/adapters/smartyads/smartyads.go index e02ba4200f3..b5a09223eb0 100644 --- a/adapters/smartyads/smartyads.go +++ b/adapters/smartyads/smartyads.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/somoaudience/somoaudience.go b/adapters/somoaudience/somoaudience.go index d799b5bb5f7..1e807bb2370 100644 --- a/adapters/somoaudience/somoaudience.go +++ b/adapters/somoaudience/somoaudience.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/sonobi/sonobi.go b/adapters/sonobi/sonobi.go index c3527a6a73e..690d5f59f67 100644 --- a/adapters/sonobi/sonobi.go +++ b/adapters/sonobi/sonobi.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/sovrn/sovrn.go b/adapters/sovrn/sovrn.go index fd2acc1fcbd..be1c2221ae5 100644 --- a/adapters/sovrn/sovrn.go +++ b/adapters/sovrn/sovrn.go @@ -12,7 +12,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/sovrn/sovrn_test.go b/adapters/sovrn/sovrn_test.go index a7bd2a204b9..c3290c30a2b 100644 --- a/adapters/sovrn/sovrn_test.go +++ b/adapters/sovrn/sovrn_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/pbs" "github.com/prebid/prebid-server/usersync" diff --git a/adapters/synacormedia/synacormedia.go b/adapters/synacormedia/synacormedia.go index f6ead542d2e..aec3169fe54 100644 --- a/adapters/synacormedia/synacormedia.go +++ b/adapters/synacormedia/synacormedia.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index 57abee63923..5970ccb6cfe 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -10,7 +10,7 @@ import ( "text/template" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/telaria/telaria.go b/adapters/telaria/telaria.go index cda22e06937..e0a451a9e6c 100644 --- a/adapters/telaria/telaria.go +++ b/adapters/telaria/telaria.go @@ -6,7 +6,7 @@ import ( "net/http" "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 2e2b525ea50..3cd651cee5c 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 3a4d0588e7a..d412def437f 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/ucfunnel/ucfunnel.go b/adapters/ucfunnel/ucfunnel.go index f1d4fa9f175..1d3efc04451 100644 --- a/adapters/ucfunnel/ucfunnel.go +++ b/adapters/ucfunnel/ucfunnel.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/ucfunnel/ucfunnel_test.go b/adapters/ucfunnel/ucfunnel_test.go index c735cb567ce..95ac5985f56 100644 --- a/adapters/ucfunnel/ucfunnel_test.go +++ b/adapters/ucfunnel/ucfunnel_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/adapters/unicorn/unicorn.go b/adapters/unicorn/unicorn.go index b9741c8c9e3..8d1413f43dd 100644 --- a/adapters/unicorn/unicorn.go +++ b/adapters/unicorn/unicorn.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index 871af6df46d..0077fae4df5 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/unruly/unruly_test.go b/adapters/unruly/unruly_test.go index b7c9a28eb47..445745c102d 100644 --- a/adapters/unruly/unruly_test.go +++ b/adapters/unruly/unruly_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/config" diff --git a/adapters/valueimpression/valueimpression.go b/adapters/valueimpression/valueimpression.go index 1397f6e020d..aac8faab52c 100644 --- a/adapters/valueimpression/valueimpression.go +++ b/adapters/valueimpression/valueimpression.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/verizonmedia/verizonmedia.go b/adapters/verizonmedia/verizonmedia.go index edbb05a3a62..aa215c01691 100644 --- a/adapters/verizonmedia/verizonmedia.go +++ b/adapters/verizonmedia/verizonmedia.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/visx/visx.go b/adapters/visx/visx.go index 1f1fae0a484..8e2b10f7c32 100644 --- a/adapters/visx/visx.go +++ b/adapters/visx/visx.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index ff5bc2dc733..e4986b2f6fb 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/yeahmobi/yeahmobi.go b/adapters/yeahmobi/yeahmobi.go index 74208ca4c30..8a692d4ff2e 100644 --- a/adapters/yeahmobi/yeahmobi.go +++ b/adapters/yeahmobi/yeahmobi.go @@ -8,7 +8,7 @@ import ( "text/template" "github.com/golang/glog" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/yieldlab/yieldlab.go b/adapters/yieldlab/yieldlab.go index 447f8aa55fd..ee9170c25cf 100644 --- a/adapters/yieldlab/yieldlab.go +++ b/adapters/yieldlab/yieldlab.go @@ -11,7 +11,7 @@ import ( "golang.org/x/text/currency" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/yieldmo/yieldmo.go b/adapters/yieldmo/yieldmo.go index 6c9524a8823..7d7a8f22b01 100644 --- a/adapters/yieldmo/yieldmo.go +++ b/adapters/yieldmo/yieldmo.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/yieldone/yieldone.go b/adapters/yieldone/yieldone.go index 813746e1d99..4e22b1446a7 100644 --- a/adapters/yieldone/yieldone.go +++ b/adapters/yieldone/yieldone.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/adapters/zeroclickfraud/zeroclickfraud.go b/adapters/zeroclickfraud/zeroclickfraud.go index ab1938fa518..cf27c83d4a7 100644 --- a/adapters/zeroclickfraud/zeroclickfraud.go +++ b/adapters/zeroclickfraud/zeroclickfraud.go @@ -7,7 +7,7 @@ import ( "strconv" "text/template" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" diff --git a/amp/parse.go b/amp/parse.go index 40604c774be..05e43aca1e2 100644 --- a/amp/parse.go +++ b/amp/parse.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Params defines the paramters of an AMP request. diff --git a/amp/parse_test.go b/amp/parse_test.go index 3a15e81ab46..91027f8e67c 100644 --- a/amp/parse_test.go +++ b/amp/parse_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/analytics/config/config_test.go b/analytics/config/config_test.go index 1ec0c27e923..310dbe1a481 100644 --- a/analytics/config/config_test.go +++ b/analytics/config/config_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/prebid/prebid-server/analytics" diff --git a/analytics/core.go b/analytics/core.go index e9403968c27..38c4f779327 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -3,7 +3,7 @@ package analytics import ( "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/usersync" diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index cfb72f487b0..0c3d3c9e6ac 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/analytics" diff --git a/analytics/pubstack/helpers/json_test.go b/analytics/pubstack/helpers/json_test.go index ba97d60da18..7673b067f8a 100644 --- a/analytics/pubstack/helpers/json_test.go +++ b/analytics/pubstack/helpers/json_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/usersync" ) diff --git a/analytics/pubstack/pubstack_module_test.go b/analytics/pubstack/pubstack_module_test.go index 8cc572022ef..cb8f088d0bf 100644 --- a/analytics/pubstack/pubstack_module_test.go +++ b/analytics/pubstack/pubstack_module_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/analytics" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index d806c937ee4..17ed7f74f45 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -10,7 +10,7 @@ import ( "net/http/httptest" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/gdpr" diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index cc8df0bf1b2..6767151f15f 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -14,7 +14,7 @@ import ( "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" accountService "github.com/prebid/prebid-server/account" "github.com/prebid/prebid-server/amp" "github.com/prebid/prebid-server/analytics" diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index 45bbb2dd3e5..079b9adb6d4 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -11,7 +11,7 @@ import ( "strconv" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index 91acab33ea1..bc8946fa90c 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -18,9 +18,9 @@ import ( "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mxmCherry/openrtb/v14/native1" - nativeRequests "github.com/mxmCherry/openrtb/v14/native1/request" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/native1" + nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" + "github.com/mxmCherry/openrtb/v15/openrtb2" accountService "github.com/prebid/prebid-server/account" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index 2deb5d1b762..75d0610cb34 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -17,7 +17,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/stored_requests" "github.com/buger/jsonparser" diff --git a/endpoints/openrtb2/interstitial.go b/endpoints/openrtb2/interstitial.go index 67f9bc37b28..1aa2a7fc890 100644 --- a/endpoints/openrtb2/interstitial.go +++ b/endpoints/openrtb2/interstitial.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/endpoints/openrtb2/interstitial_test.go b/endpoints/openrtb2/interstitial_test.go index 7691a6672e0..1d7ad9e3d6b 100644 --- a/endpoints/openrtb2/interstitial_test.go +++ b/endpoints/openrtb2/interstitial_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index f46a8c2a1d5..2ab3bbb0829 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -17,7 +17,7 @@ import ( "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" "github.com/gofrs/uuid" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/util/iputil" diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index 16dc02ee97b..9ede7147686 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -12,7 +12,7 @@ import ( "strings" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/analytics" analyticsConf "github.com/prebid/prebid-server/analytics/config" "github.com/prebid/prebid-server/config" diff --git a/exchange/adapter_util_test.go b/exchange/adapter_util_test.go index 73a456f54b1..c9f1907d314 100644 --- a/exchange/adapter_util_test.go +++ b/exchange/adapter_util_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/appnexus" "github.com/prebid/prebid-server/adapters/lifestreet" diff --git a/exchange/auction.go b/exchange/auction.go index b3878709c29..3d733daaff8 100644 --- a/exchange/auction.go +++ b/exchange/auction.go @@ -11,7 +11,7 @@ import ( "time" uuid "github.com/gofrs/uuid" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/prebid_cache_client" diff --git a/exchange/auction_test.go b/exchange/auction_test.go index bd32607bdf3..54f67eb8177 100644 --- a/exchange/auction_test.go +++ b/exchange/auction_test.go @@ -11,7 +11,7 @@ import ( "strconv" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/prebid_cache_client" diff --git a/exchange/bidder.go b/exchange/bidder.go index 23b42d2a9d7..59ef92cbff4 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -16,9 +16,9 @@ import ( "github.com/prebid/prebid-server/config/util" "github.com/prebid/prebid-server/currency" - nativeRequests "github.com/mxmCherry/openrtb/v14/native1/request" - nativeResponse "github.com/mxmCherry/openrtb/v14/native1/response" - "github.com/mxmCherry/openrtb/v14/openrtb2" + nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" + nativeResponse "github.com/mxmCherry/openrtb/v15/native1/response" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -280,13 +280,16 @@ func addNativeTypes(bid *openrtb2.Bid, request *openrtb2.BidRequest) (*nativeRes func setAssetTypes(asset nativeResponse.Asset, nativePayload nativeRequests.Request) error { if asset.Img != nil { - if tempAsset, err := getAssetByID(asset.ID, nativePayload.Assets); err == nil { + if asset.ID == nil { + return errors.New("Response Image asset doesn't have an ID") + } + if tempAsset, err := getAssetByID(*asset.ID, nativePayload.Assets); err == nil { if tempAsset.Img != nil { if tempAsset.Img.Type != 0 { asset.Img.Type = tempAsset.Img.Type } } else { - return fmt.Errorf("Response has an Image asset with ID:%d present that doesn't exist in the request", asset.ID) + return fmt.Errorf("Response has an Image asset with ID:%d present that doesn't exist in the request", *asset.ID) } } else { return err @@ -294,13 +297,16 @@ func setAssetTypes(asset nativeResponse.Asset, nativePayload nativeRequests.Requ } if asset.Data != nil { - if tempAsset, err := getAssetByID(asset.ID, nativePayload.Assets); err == nil { + if asset.ID == nil { + return errors.New("Response Data asset doesn't have an ID") + } + if tempAsset, err := getAssetByID(*asset.ID, nativePayload.Assets); err == nil { if tempAsset.Data != nil { if tempAsset.Data.Type != 0 { asset.Data.Type = tempAsset.Data.Type } } else { - return fmt.Errorf("Response has a Data asset with ID:%d present that doesn't exist in the request", asset.ID) + return fmt.Errorf("Response has a Data asset with ID:%d present that doesn't exist in the request", *asset.ID) } } else { return err diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index 41ca420a433..6db249ec6ed 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -16,9 +16,9 @@ import ( "time" "github.com/golang/glog" - nativeRequests "github.com/mxmCherry/openrtb/v14/native1/request" - nativeResponse "github.com/mxmCherry/openrtb/v14/native1/response" - "github.com/mxmCherry/openrtb/v14/openrtb2" + nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" + nativeResponse "github.com/mxmCherry/openrtb/v15/native1/response" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" @@ -1258,7 +1258,7 @@ func TestSetAssetTypes(t *testing.T) { }{ { respAsset: nativeResponse.Asset{ - ID: 1, + ID: openrtb2.Int64Ptr(1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1284,7 +1284,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 2, + ID: openrtb2.Int64Ptr(2), Data: &nativeResponse.Data{ Label: "some label", }, @@ -1310,7 +1310,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 1, + ID: openrtb2.Int64Ptr(1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1330,7 +1330,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 2, + ID: openrtb2.Int64Ptr(2), Data: &nativeResponse.Data{ Label: "some label", }, @@ -1350,7 +1350,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 1, + ID: openrtb2.Int64Ptr(1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1368,6 +1368,44 @@ func TestSetAssetTypes(t *testing.T) { expectedErr: "Response has an Image asset with ID:1 present that doesn't exist in the request", desc: "Assets with same ID in the req and resp are of different types", }, + { + respAsset: nativeResponse.Asset{ + Img: &nativeResponse.Image{ + URL: "http://some-url", + }, + }, + nativeReq: nativeRequests.Request{ + Assets: []nativeRequests.Asset{ + { + ID: 1, + Img: &nativeRequests.Image{ + Type: 2, + }, + }, + }, + }, + expectedErr: "Response Image asset doesn't have an ID", + desc: "Response Image without an ID", + }, + { + respAsset: nativeResponse.Asset{ + Data: &nativeResponse.Data{ + Label: "some label", + }, + }, + nativeReq: nativeRequests.Request{ + Assets: []nativeRequests.Asset{ + { + ID: 1, + Data: &nativeRequests.Data{ + Type: 2, + }, + }, + }, + }, + expectedErr: "Response Data asset doesn't have an ID", + desc: "Response Data asset without an ID", + }, } for _, test := range testCases { diff --git a/exchange/bidder_validate_bids.go b/exchange/bidder_validate_bids.go index ad387cf4fcc..3d2eb0b8e42 100644 --- a/exchange/bidder_validate_bids.go +++ b/exchange/bidder_validate_bids.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/exchange/bidder_validate_bids_test.go b/exchange/bidder_validate_bids_test.go index 97a11a6b743..3bb43559856 100644 --- a/exchange/bidder_validate_bids_test.go +++ b/exchange/bidder_validate_bids_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/exchange/events_test.go b/exchange/events_test.go index bde2b235987..887122a687e 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -3,7 +3,7 @@ package exchange import ( "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/exchange/exchange.go b/exchange/exchange.go index 433c1214ccf..eaff759f619 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/stored_requests" "github.com/gofrs/uuid" diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 5c47fdb6052..c18f4533966 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" diff --git a/exchange/gdpr.go b/exchange/gdpr.go index a6b4a22dc8f..208ce0fdb0b 100644 --- a/exchange/gdpr.go +++ b/exchange/gdpr.go @@ -3,7 +3,7 @@ package exchange import ( "encoding/json" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/gdpr" ) diff --git a/exchange/gdpr_test.go b/exchange/gdpr_test.go index 420b299f2cc..e44dc9702fb 100644 --- a/exchange/gdpr_test.go +++ b/exchange/gdpr_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/exchange/legacy.go b/exchange/legacy.go index ea8b65c28f0..3983ce132ed 100644 --- a/exchange/legacy.go +++ b/exchange/legacy.go @@ -6,7 +6,7 @@ import ( "errors" "github.com/buger/jsonparser" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/exchange/legacy_test.go b/exchange/legacy_test.go index aa684287997..cbb5fda4fcc 100644 --- a/exchange/legacy_test.go +++ b/exchange/legacy_test.go @@ -11,7 +11,7 @@ import ( "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/currency" "github.com/prebid/prebid-server/openrtb_ext" diff --git a/exchange/targeting.go b/exchange/targeting.go index f79e05be930..f00e43d200c 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -3,7 +3,7 @@ package exchange import ( "strconv" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" ) diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index add3b19e0b2..aa07ed0c77b 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/currency" diff --git a/exchange/utils.go b/exchange/utils.go index 039f9cb5395..5bde1bd7889 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -6,7 +6,7 @@ import ( "fmt" "math/rand" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/go-gdpr/vendorconsent" "github.com/buger/jsonparser" diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 5f72c39c702..55a0950aac6 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/gdpr" diff --git a/go.mod b/go.mod index 67f95057bee..585798cbe66 100644 --- a/go.mod +++ b/go.mod @@ -28,9 +28,7 @@ require ( github.com/mattn/go-colorable v0.1.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/mapstructure v1.0.0 // indirect - github.com/mxmCherry/openrtb/v14 v14.0.0 - github.com/onsi/ginkgo v1.10.1 // indirect - github.com/onsi/gomega v1.7.0 // indirect + github.com/mxmCherry/openrtb/v15 v15.0.0 github.com/pelletier/go-toml v1.2.0 // indirect github.com/prebid/go-gdpr v0.8.3 github.com/prometheus/client_golang v0.0.0-20180623155954-77e8f2ddcfed @@ -55,9 +53,7 @@ require ( github.com/yudai/gojsondiff v0.0.0-20170107030110-7b1b7adf999d github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/yudai/pp v2.0.1+incompatible // indirect - golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 - golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect - golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect - golang.org/x/text v0.3.0 - gopkg.in/yaml.v2 v2.2.2 + golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb + golang.org/x/text v0.3.3 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index f9c9bb887da..7a38c2f1dd5 100644 --- a/go.sum +++ b/go.sum @@ -32,12 +32,27 @@ github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd h1:biTJQdqouE5b github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -60,15 +75,19 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I= github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mxmCherry/openrtb/v14 v14.0.0 h1:7CUpdQi6Hqi9k03AaUAZVYF3Kqt6ZXryBUFQv8IA/N8= -github.com/mxmCherry/openrtb/v14 v14.0.0/go.mod h1:aAj4RuDpol+zMEVyKiDqiXPHfXevLVmyAf3f6BkRaJw= +github.com/mxmCherry/openrtb/v15 v15.0.0 h1:inLuQ3Bsima9HLB2v6WjbtEFF69SWOT5Dux4QZtYdrw= +github.com/mxmCherry/openrtb/v15 v15.0.0/go.mod h1:TVgncsz6MOzbL7lhun1lNuUBzVBlVDbxf9Fyy1TyhZA= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.1 h1:foqVmeWDD6yYpK+Yz3fHyNIxFYNxswxqNFjSKe+vI54= +github.com/onsi/ginkgo v1.16.1/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.11.0 h1:+CqWgvj0OZycCaqclBD1pxKHAU+tOkHmQIWvDHq2aug= +github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -122,30 +141,63 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3Ifn github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/openrtb_ext/bid_request_video.go b/openrtb_ext/bid_request_video.go index 16b66fc20fc..29e62da3d35 100644 --- a/openrtb_ext/bid_request_video.go +++ b/openrtb_ext/bid_request_video.go @@ -1,6 +1,6 @@ package openrtb_ext -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" type BidRequestVideo struct { // Attribute: diff --git a/openrtb_ext/deal_tier.go b/openrtb_ext/deal_tier.go index 66236e9477d..8aeedb81a5e 100644 --- a/openrtb_ext/deal_tier.go +++ b/openrtb_ext/deal_tier.go @@ -3,7 +3,7 @@ package openrtb_ext import ( "encoding/json" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // DealTier defines the configuration of a deal tier. diff --git a/openrtb_ext/deal_tier_test.go b/openrtb_ext/deal_tier_test.go index 607956ecb38..29d58d6c071 100644 --- a/openrtb_ext/deal_tier_test.go +++ b/openrtb_ext/deal_tier_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/openrtb_ext/response.go b/openrtb_ext/response.go index d61ec54a887..1c7177daf49 100644 --- a/openrtb_ext/response.go +++ b/openrtb_ext/response.go @@ -1,6 +1,6 @@ package openrtb_ext -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" // ExtBidResponse defines the contract for bidresponse.ext type ExtBidResponse struct { diff --git a/pbs/pbsrequest.go b/pbs/pbsrequest.go index 795cfaf9533..52840d95d9c 100644 --- a/pbs/pbsrequest.go +++ b/pbs/pbsrequest.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/cache" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/stored_requests" diff --git a/privacy/ccpa/consentwriter.go b/privacy/ccpa/consentwriter.go index 67b5681deca..41f1c39447b 100644 --- a/privacy/ccpa/consentwriter.go +++ b/privacy/ccpa/consentwriter.go @@ -1,6 +1,6 @@ package ccpa -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" // ConsentWriter implements the PolicyWriter interface for CCPA. type ConsentWriter struct { diff --git a/privacy/ccpa/consentwriter_test.go b/privacy/ccpa/consentwriter_test.go index d805936cf72..d59428626b8 100644 --- a/privacy/ccpa/consentwriter_test.go +++ b/privacy/ccpa/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/ccpa/parsedpolicy_test.go b/privacy/ccpa/parsedpolicy_test.go index 183a774363c..33563b50567 100644 --- a/privacy/ccpa/parsedpolicy_test.go +++ b/privacy/ccpa/parsedpolicy_test.go @@ -3,7 +3,7 @@ package ccpa import ( "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/privacy/ccpa/policy.go b/privacy/ccpa/policy.go index 64250375106..d57ba8deaa4 100644 --- a/privacy/ccpa/policy.go +++ b/privacy/ccpa/policy.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" ) diff --git a/privacy/ccpa/policy_test.go b/privacy/ccpa/policy_test.go index 31eca2cca57..416ebffa31a 100644 --- a/privacy/ccpa/policy_test.go +++ b/privacy/ccpa/policy_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/enforcement.go b/privacy/enforcement.go index 4b946966206..ab2f64a691b 100644 --- a/privacy/enforcement.go +++ b/privacy/enforcement.go @@ -1,6 +1,6 @@ package privacy -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" // Enforcement represents the privacy policies to enforce for an OpenRTB bid request. type Enforcement struct { diff --git a/privacy/enforcement_test.go b/privacy/enforcement_test.go index 5080709f2cb..61899e4d60e 100644 --- a/privacy/enforcement_test.go +++ b/privacy/enforcement_test.go @@ -3,7 +3,7 @@ package privacy import ( "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/privacy/gdpr/consentwriter.go b/privacy/gdpr/consentwriter.go index 53885e51d49..ca784b7a5c1 100644 --- a/privacy/gdpr/consentwriter.go +++ b/privacy/gdpr/consentwriter.go @@ -3,7 +3,7 @@ package gdpr import ( "encoding/json" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" ) diff --git a/privacy/gdpr/consentwriter_test.go b/privacy/gdpr/consentwriter_test.go index 9b23dccc6e4..5753442fa01 100644 --- a/privacy/gdpr/consentwriter_test.go +++ b/privacy/gdpr/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/lmt/ios.go b/privacy/lmt/ios.go index 07bd7ce0a70..55e1764c8c2 100644 --- a/privacy/lmt/ios.go +++ b/privacy/lmt/ios.go @@ -3,7 +3,7 @@ package lmt import ( "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/util/iosutil" ) diff --git a/privacy/lmt/ios_test.go b/privacy/lmt/ios_test.go index 5071adf4d04..2caec1be64c 100644 --- a/privacy/lmt/ios_test.go +++ b/privacy/lmt/ios_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/util/iosutil" "github.com/stretchr/testify/assert" ) diff --git a/privacy/lmt/policy.go b/privacy/lmt/policy.go index e115dc3802f..0f2829254a2 100644 --- a/privacy/lmt/policy.go +++ b/privacy/lmt/policy.go @@ -1,6 +1,6 @@ package lmt -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" const ( trackingUnrestricted = 0 diff --git a/privacy/lmt/policy_test.go b/privacy/lmt/policy_test.go index e36f30230d8..f475d2fb702 100644 --- a/privacy/lmt/policy_test.go +++ b/privacy/lmt/policy_test.go @@ -3,7 +3,7 @@ package lmt import ( "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/scrubber.go b/privacy/scrubber.go index d656168ae12..edaa5bb07c6 100644 --- a/privacy/scrubber.go +++ b/privacy/scrubber.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strings" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // ScrubStrategyIPV4 defines the approach to scrub PII from an IPV4 address. diff --git a/privacy/scrubber_test.go b/privacy/scrubber_test.go index 2d352e71821..9207315f593 100644 --- a/privacy/scrubber_test.go +++ b/privacy/scrubber_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/privacy/writer.go b/privacy/writer.go index 610508f812c..0f04a52f292 100644 --- a/privacy/writer.go +++ b/privacy/writer.go @@ -1,6 +1,6 @@ package privacy -import "github.com/mxmCherry/openrtb/v14/openrtb2" +import "github.com/mxmCherry/openrtb/v15/openrtb2" // PolicyWriter mutates an OpenRTB bid request with a policy's regulatory information. type PolicyWriter interface { diff --git a/privacy/writer_test.go b/privacy/writer_test.go index b419e3c6783..f5b02387124 100644 --- a/privacy/writer_test.go +++ b/privacy/writer_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/mxmCherry/openrtb/v14/openrtb2" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) From cc84f0234c3a30ed1599bb32d151074f81f9b50a Mon Sep 17 00:00:00 2001 From: ixjohnny <75964135+ixjohnny@users.noreply.github.com> Date: Wed, 14 Apr 2021 11:51:27 -0400 Subject: [PATCH 61/91] IX: Set bidVideo when category and duration is available (#1794) --- adapters/ix/ix.go | 18 ++++++++-- adapters/ix/ix_test.go | 77 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 38294cc587b..f8903008328 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -402,9 +402,23 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalReque if !ok { errs = append(errs, fmt.Errorf("Unmatched impression id: %s.", bid.ImpID)) } + + var bidExtVideo *openrtb_ext.ExtBidPrebidVideo + var bidExt openrtb_ext.ExtBid + if bidType == openrtb_ext.BidTypeVideo { + unmarshalExtErr := json.Unmarshal(bid.Ext, &bidExt) + if unmarshalExtErr == nil && bidExt.Prebid != nil && bidExt.Prebid.Video != nil { + bidExtVideo = &openrtb_ext.ExtBidPrebidVideo{ + Duration: bidExt.Prebid.Video.Duration, + PrimaryCategory: bidExt.Prebid.Video.PrimaryCategory, + } + } + } + bidderResponse.Bids = append(bidderResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: bidType, + Bid: &bid, + BidType: bidType, + BidVideo: bidExtVideo, }) } } diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 27d9370e1b7..bc70f3999df 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -722,3 +722,80 @@ func TestIxMaxRequests(t *testing.T) { t.Fatalf("Should have received %d bid", adapter.maxRequests) } } + +func TestIxMakeBidsWithCategoryDuration(t *testing.T) { + bidder := &IxAdapter{} + + mockedReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ + ID: "1_1", + Video: &openrtb2.Video{ + W: 640, + H: 360, + MIMEs: []string{"video/mp4"}, + MaxDuration: 60, + Protocols: []openrtb2.Protocol{2, 3, 5, 6}, + }, + Ext: json.RawMessage( + `{ + "prebid": {}, + "bidder": { + "siteID": 123456 + } + }`, + )}, + }, + } + mockedExtReq := &adapters.RequestData{} + mockedBidResponse := &openrtb2.BidResponse{ + ID: "test-1", + SeatBid: []openrtb2.SeatBid{{ + Seat: "Buyer", + Bid: []openrtb2.Bid{{ + ID: "1", + ImpID: "1_1", + Price: 1.23, + AdID: "123", + Ext: json.RawMessage( + `{ + "prebid": { + "video": { + "duration": 60, + "primary_category": "IAB18-1" + } + } + }`, + ), + }}, + }}, + } + body, _ := json.Marshal(mockedBidResponse) + mockedRes := &adapters.ResponseData{ + StatusCode: 200, + Body: body, + } + + expectedBidCount := 1 + expectedBidType := openrtb_ext.BidTypeVideo + expectedBidDuration := 60 + expectedBidCategory := "IAB18-1" + expectedErrorCount := 0 + + bidResponse, errors := bidder.MakeBids(mockedReq, mockedExtReq, mockedRes) + + if len(bidResponse.Bids) != expectedBidCount { + t.Errorf("should have 1 bid, bids=%v", bidResponse.Bids) + } + if bidResponse.Bids[0].BidType != expectedBidType { + t.Errorf("bid type should be video, bidType=%s", bidResponse.Bids[0].BidType) + } + if bidResponse.Bids[0].BidVideo.Duration != expectedBidDuration { + t.Errorf("video duration should be set") + } + if bidResponse.Bids[0].BidVideo.PrimaryCategory != expectedBidCategory { + t.Errorf("video category should be set") + } + if len(errors) != expectedErrorCount { + t.Errorf("should not have any errors, errors=%v", errors) + } +} From 22191e6c2ca3ea2c1acf20fe2d4cabe1eb104d54 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Wed, 14 Apr 2021 12:02:05 -0400 Subject: [PATCH 62/91] Update IX defaults (#1799) Co-authored-by: Mike Burns --- config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index b300bc58e49..18a8c29d9a9 100644 --- a/config/config.go +++ b/config/config.go @@ -606,7 +606,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGrid, "https://x.bidswitch.net/check_uuid/"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BBSW_UUID%7D?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGumGum, "https://rtb.gumgum.com/usync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderImprovedigital, "https://ad.360yield.com/server_match?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D") - // openrtb_ext.BidderIx doesn't have a good default. + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderIx, "https://ssum.casalemedia.com/usermatchredir?s=184674&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dix%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") // openrtb_ext.BidderInvibes doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderJixie, "https://id.jixie.io/api/sync?pid=&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Djixie%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25JXUID%25%25") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderKrushmedia, "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dkrushmedia%26uid%3D%5BUID%5D") @@ -855,7 +855,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.gumgum.endpoint", "https://g2.gumgum.com/providers/prbds2s/bid") v.SetDefault("adapters.improvedigital.endpoint", "http://ad.360yield.com/pbs") v.SetDefault("adapters.inmobi.endpoint", "https://api.w.inmobi.com/showad/openrtb/bidder/prebid") - v.SetDefault("adapters.ix.endpoint", "http://exchange.indexww.com/pbs?p=192919") + v.SetDefault("adapters.ix.disabled", true) v.SetDefault("adapters.jixie.endpoint", "https://hb.jixie.io/v2/hbsvrpost") v.SetDefault("adapters.krushmedia.endpoint", "http://ads4.krushmedia.com/?c=rtb&m=req&key={{.AccountID}}") v.SetDefault("adapters.invibes.endpoint", "https://{{.Host}}/bid/ServerBidAdContent") From bdfbc32ca73a71d77d9ce6f91cde87efd71491d3 Mon Sep 17 00:00:00 2001 From: guiann Date: Wed, 14 Apr 2021 19:19:36 +0200 Subject: [PATCH 63/91] Update Adyoulike endpoint to hit production servers (#1805) --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 18a8c29d9a9..8d53a4668f1 100644 --- a/config/config.go +++ b/config/config.go @@ -819,7 +819,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.adtarget.endpoint", "http://ghb.console.adtarget.com.tr/pbs/ortb") v.SetDefault("adapters.adtelligent.endpoint", "http://ghb.adtelligent.com/pbs/ortb") v.SetDefault("adapters.advangelists.endpoint", "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}") - v.SetDefault("adapters.adyoulike.endpoint", "https://broker-preprod.omnitagjs.com/broker/bid?partnerId=19340f4f097d16f41f34fc0274981ca4") + v.SetDefault("adapters.adyoulike.endpoint", "https://broker.omnitagjs.com/broker/bid?partnerId=19340f4f097d16f41f34fc0274981ca4") v.SetDefault("adapters.aja.endpoint", "https://ad.as.amanad.adtdp.com/v1/bid/4") v.SetDefault("adapters.amx.endpoint", "http://pbs.amxrtb.com/auction/openrtb") v.SetDefault("adapters.applogy.endpoint", "http://rtb.applogy.com/v1/prebid") From 5bec86b74bcb7b2214ec453cc01d8b38913f2b6e Mon Sep 17 00:00:00 2001 From: Laurentiu Badea Date: Wed, 14 Apr 2021 12:43:26 -0700 Subject: [PATCH 64/91] Openx: use bidfloor if set - prebid.js adapter behavior (#1795) --- adapters/openx/openx.go | 4 +++- .../openxtest/exemplary/optional-params.json | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index d53d405ba24..208b06f7c86 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -130,7 +130,9 @@ func preprocess(imp *openrtb2.Imp, reqExt *openxReqExt) error { reqExt.Platform = openxExt.Platform imp.TagID = openxExt.Unit - imp.BidFloor = openxExt.CustomFloor + if imp.BidFloor == 0 && openxExt.CustomFloor > 0 { + imp.BidFloor = openxExt.CustomFloor + } imp.Ext = nil if openxExt.CustomParams != nil { diff --git a/adapters/openx/openxtest/exemplary/optional-params.json b/adapters/openx/openxtest/exemplary/optional-params.json index b2fd9c2f4fb..93dbafc5bfb 100644 --- a/adapters/openx/openxtest/exemplary/optional-params.json +++ b/adapters/openx/openxtest/exemplary/optional-params.json @@ -16,6 +16,21 @@ "customParams": {"foo": "bar"} } } + }, + { + "bidfloor": 0.5, + "id": "test-imp-id", + "banner": { + "format": [{"w": 728, "h": 90}] + }, + "ext": { + "bidder": { + "unit": "539439964", + "delDomain": "se-demo-d.openx.net", + "platform": "PLATFORM", + "customFloor": 0.1 + } + } } ] }, @@ -37,6 +52,14 @@ "ext": { "customParams": {"foo": "bar"} } + }, + { + "id":"test-imp-id", + "banner": { + "format": [{"w": 728, "h": 90}] + }, + "tagid": "539439964", + "bidfloor": 0.5 } ], "ext": { From 398e1ca3c311d90f0da7a142850659a6ca296df7 Mon Sep 17 00:00:00 2001 From: Arne Schulz Date: Wed, 14 Apr 2021 22:55:42 +0200 Subject: [PATCH 65/91] [ORBIDDER] add gvlVendorID and set bid response currency (#1798) --- adapters/orbidder/orbidder.go | 4 +++- static/bidder-info/orbidder.yaml | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adapters/orbidder/orbidder.go b/adapters/orbidder/orbidder.go index 5e8ea3db84f..77985c8dae0 100644 --- a/adapters/orbidder/orbidder.go +++ b/adapters/orbidder/orbidder.go @@ -110,7 +110,6 @@ func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb2.BidRequest, extern } bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) - for _, seatBid := range bidResp.SeatBid { for _, bid := range seatBid.Bid { bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ @@ -119,6 +118,9 @@ func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb2.BidRequest, extern }) } } + if bidResp.Cur != "" { + bidResponse.Currency = bidResp.Cur + } return bidResponse, nil } diff --git a/static/bidder-info/orbidder.yaml b/static/bidder-info/orbidder.yaml index c683087d197..467093c1256 100644 --- a/static/bidder-info/orbidder.yaml +++ b/static/bidder-info/orbidder.yaml @@ -1,9 +1,7 @@ maintainer: email: "realtime-siggi@otto.de" +gvlVendorID: 559 capabilities: app: mediaTypes: - banner - site: - mediaTypes: - - banner \ No newline at end of file From 1628e1af0ffb64b7f2545e57f55103b678422e5c Mon Sep 17 00:00:00 2001 From: adxcgcom <31470944+adxcgcom@users.noreply.github.com> Date: Thu, 15 Apr 2021 02:45:07 +0000 Subject: [PATCH 66/91] New Adapter: ADXCG (#1803) --- adapters/adxcg/adxcg.go | 125 ++++++++++++++++++ adapters/adxcg/adxcg_test.go | 23 ++++ .../adxcgtest/exemplary/simple-banner.json | 83 ++++++++++++ .../adxcgtest/exemplary/simple-native.json | 73 ++++++++++ .../adxcgtest/exemplary/simple-video.json | 105 +++++++++++++++ .../adxcg/adxcgtest/params/race/banner.json | 1 + .../adxcgtest/supplemental/bad_response.json | 61 +++++++++ .../adxcgtest/supplemental/status_204.json | 56 ++++++++ .../adxcgtest/supplemental/status_400.json | 61 +++++++++ .../adxcgtest/supplemental/status_418.json | 61 +++++++++ adapters/adxcg/usersync.go | 12 ++ adapters/adxcg/usersync_test.go | 29 ++++ config/config.go | 2 + exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + static/bidder-info/adxcg.yaml | 13 ++ static/bidder-params/adxcg.json | 14 ++ usersync/usersyncers/syncer.go | 2 + usersync/usersyncers/syncer_test.go | 1 + 19 files changed, 726 insertions(+) create mode 100644 adapters/adxcg/adxcg.go create mode 100644 adapters/adxcg/adxcg_test.go create mode 100644 adapters/adxcg/adxcgtest/exemplary/simple-banner.json create mode 100644 adapters/adxcg/adxcgtest/exemplary/simple-native.json create mode 100644 adapters/adxcg/adxcgtest/exemplary/simple-video.json create mode 100644 adapters/adxcg/adxcgtest/params/race/banner.json create mode 100644 adapters/adxcg/adxcgtest/supplemental/bad_response.json create mode 100644 adapters/adxcg/adxcgtest/supplemental/status_204.json create mode 100644 adapters/adxcg/adxcgtest/supplemental/status_400.json create mode 100644 adapters/adxcg/adxcgtest/supplemental/status_418.json create mode 100644 adapters/adxcg/usersync.go create mode 100644 adapters/adxcg/usersync_test.go create mode 100644 static/bidder-info/adxcg.yaml create mode 100644 static/bidder-params/adxcg.json diff --git a/adapters/adxcg/adxcg.go b/adapters/adxcg/adxcg.go new file mode 100644 index 00000000000..e9f6c94bc40 --- /dev/null +++ b/adapters/adxcg/adxcg.go @@ -0,0 +1,125 @@ +package adxcg + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" +) + +// Builder builds a new instance of the Adxcg adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +type adapter struct { + endpoint string +} + +// MakeRequests prepares the HTTP requests which should be made to fetch bids. +func (adapter *adapter) MakeRequests( + openRTBRequest *openrtb2.BidRequest, + reqInfo *adapters.ExtraRequestInfo, +) ( + requestsToBidder []*adapters.RequestData, + errs []error, +) { + openRTBRequestJSON, err := json.Marshal(openRTBRequest) + if err != nil { + errs = append(errs, err) + return nil, errs + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + requestToBidder := &adapters.RequestData{ + Method: "POST", + Uri: adapter.endpoint, + Body: openRTBRequestJSON, + Headers: headers, + } + requestsToBidder = append(requestsToBidder, requestToBidder) + + return requestsToBidder, errs +} + +const unexpectedStatusCodeFormat = "Unexpected status code: %d. Run with request.debug = 1 for more info" + +// MakeBids unpacks the server's response into Bids. +func (adapter *adapter) MakeBids( + openRTBRequest *openrtb2.BidRequest, + requestToBidder *adapters.RequestData, + bidderRawResponse *adapters.ResponseData, +) ( + bidderResponse *adapters.BidderResponse, + errs []error, +) { + switch bidderRawResponse.StatusCode { + case http.StatusOK: + break + case http.StatusNoContent: + return nil, nil + case http.StatusBadRequest: + err := &errortypes.BadInput{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, bidderRawResponse.StatusCode), + } + return nil, []error{err} + default: + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, bidderRawResponse.StatusCode), + } + return nil, []error{err} + } + + var openRTBBidderResponse openrtb2.BidResponse + if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { + return nil, []error{err} + } + + bidsCapacity := len(openRTBBidderResponse.SeatBid[0].Bid) + bidderResponse = adapters.NewBidderResponseWithBidsCapacity(bidsCapacity) + var typedBid *adapters.TypedBid + for _, seatBid := range openRTBBidderResponse.SeatBid { + for _, bid := range seatBid.Bid { + activeBid := bid + bidType, err := getMediaTypeForImp(activeBid.ImpID, openRTBRequest.Imp) + if err != nil { + errs = append(errs, err) + continue + } + + typedBid = &adapters.TypedBid{Bid: &activeBid, BidType: bidType} + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + } + } + + return bidderResponse, nil + +} + +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { + for _, imp := range imps { + if imp.ID == impID { + if imp.Native != nil { + return openrtb_ext.BidTypeNative, nil + } else if imp.Banner != nil { + return openrtb_ext.BidTypeBanner, nil + } else if imp.Video != nil { + return openrtb_ext.BidTypeVideo, nil + } + + } + } + + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Failed to find native/banner/video impression \"%s\" ", impID), + } +} diff --git a/adapters/adxcg/adxcg_test.go b/adapters/adxcg/adxcg_test.go new file mode 100644 index 00000000000..d01e62f670c --- /dev/null +++ b/adapters/adxcg/adxcg_test.go @@ -0,0 +1,23 @@ +package adxcg + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +const testsDir = "adxcgtest" +const testsBidderEndpoint = "http://localhost/prebid_server" + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderAdxcg, config.Adapter{ + Endpoint: testsBidderEndpoint}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, testsDir, bidder) +} diff --git a/adapters/adxcg/adxcgtest/exemplary/simple-banner.json b/adapters/adxcg/adxcgtest/exemplary/simple-banner.json new file mode 100644 index 00000000000..85ed18ff1a3 --- /dev/null +++ b/adapters/adxcg/adxcgtest/exemplary/simple-banner.json @@ -0,0 +1,83 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [{ + "id": "test-imp-id", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": {} + } + }] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [{ + "id": "test-imp-id", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": {} + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "adxcg", + "bid": [{ + "id": "randomid", + "impid": "test-imp-id", + "price": 0.500000, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300 + }] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "12345678", + "cid": "987", + "crid": "12345678", + "w": 300, + "h": 250 + }, + "type": "banner" + }] + }] +} diff --git a/adapters/adxcg/adxcgtest/exemplary/simple-native.json b/adapters/adxcg/adxcgtest/exemplary/simple-native.json new file mode 100644 index 00000000000..1a449e601a2 --- /dev/null +++ b/adapters/adxcg/adxcgtest/exemplary/simple-native.json @@ -0,0 +1,73 @@ +{ + "mockBidRequest": { + "id": "test-request-native-id", + "imp": [ + { + "id": "test-imp-native-id", + "native": { + "request": "test-native", + "ver": "1.2" + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-native-id", + "imp": [ + { + "id": "test-imp-native-id", + "native": { + "request": "test-native", + "ver": "1.2" + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "adxcg", + "bid": [ + { + "id": "test-request-native-id", + "impid": "test-imp-native-id", + "price": 1.16, + "adm": "native-ad", + "w": 1, + "h": 1 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-request-native-id", + "impid": "test-imp-native-id", + "price": 1.16, + "adm": "native-ad", + "w": 1, + "h": 1 + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/adxcg/adxcgtest/exemplary/simple-video.json b/adapters/adxcg/adxcgtest/exemplary/simple-video.json new file mode 100644 index 00000000000..b5f54b9bc44 --- /dev/null +++ b/adapters/adxcg/adxcgtest/exemplary/simple-video.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-video-id", + "imp": [ + { + "id": "test-imp-video-id", + "video": { + "w": 300, + "h": 250, + "maxduration": 60, + "minduration": 1, + "api": [ + 1, + 2, + 5, + 6, + 7 + ], + "mimes": [ + "video\/mp4" + ], + "placement": 4, + "protocols": [ + 2 + ] + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-video-id", + "imp": [ + { + "id": "test-imp-video-id", + "video": { + "w": 300, + "h": 250, + "maxduration": 60, + "minduration": 1, + "api": [ + 1, + 2, + 5, + 6, + 7 + ], + "mimes": [ + "video\/mp4" + ], + "placement": 4, + "protocols": [ + 2 + ] + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "adxcg", + "bid": [ + { + "id": "test-request-video-id", + "impid": "test-imp-video-id", + "price": 1.16, + "adm": "some-test-ad", + "w": 300, + "h": 250 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-request-video-id", + "impid": "test-imp-video-id", + "price": 1.16, + "adm": "some-test-ad", + "w": 300, + "h": 250 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/adxcg/adxcgtest/params/race/banner.json b/adapters/adxcg/adxcgtest/params/race/banner.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/adapters/adxcg/adxcgtest/params/race/banner.json @@ -0,0 +1 @@ +{} diff --git a/adapters/adxcg/adxcgtest/supplemental/bad_response.json b/adapters/adxcg/adxcgtest/supplemental/bad_response.json new file mode 100644 index 00000000000..f84f5555259 --- /dev/null +++ b/adapters/adxcg/adxcgtest/supplemental/bad_response.json @@ -0,0 +1,61 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": "{\"id\"data.lost" + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", + "comparison": "literal" + } + ] +} diff --git a/adapters/adxcg/adxcgtest/supplemental/status_204.json b/adapters/adxcg/adxcgtest/supplemental/status_204.json new file mode 100644 index 00000000000..0702c103332 --- /dev/null +++ b/adapters/adxcg/adxcgtest/supplemental/status_204.json @@ -0,0 +1,56 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + + "expectedBidResponses": [] +} diff --git a/adapters/adxcg/adxcgtest/supplemental/status_400.json b/adapters/adxcg/adxcgtest/supplemental/status_400.json new file mode 100644 index 00000000000..65d21406bf0 --- /dev/null +++ b/adapters/adxcg/adxcgtest/supplemental/status_400.json @@ -0,0 +1,61 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/adxcg/adxcgtest/supplemental/status_418.json b/adapters/adxcg/adxcgtest/supplemental/status_418.json new file mode 100644 index 00000000000..4c5dd576aa6 --- /dev/null +++ b/adapters/adxcg/adxcgtest/supplemental/status_418.json @@ -0,0 +1,61 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + } + } + } + ] + } + }, + "mockResponse": { + "status": 418, + "body": {} + } + } + ], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 418. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/adxcg/usersync.go b/adapters/adxcg/usersync.go new file mode 100644 index 00000000000..c6627059703 --- /dev/null +++ b/adapters/adxcg/usersync.go @@ -0,0 +1,12 @@ +package adxcg + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewAdxcgSyncer(urlTemplate *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("adxcg", urlTemplate, adapters.SyncTypeRedirect) +} diff --git a/adapters/adxcg/usersync_test.go b/adapters/adxcg/usersync_test.go new file mode 100644 index 00000000000..53a757f2732 --- /dev/null +++ b/adapters/adxcg/usersync_test.go @@ -0,0 +1,29 @@ +package adxcg + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestAdxcgSyncer(t *testing.T) { + syncURL := "https://app.adxcg.net/cma/cm-notify?pi=prebidsrvtst&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewAdxcgSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "0", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "https://app.adxcg.net/cma/cm-notify?pi=prebidsrvtst&gdpr=0&gdpr_consent=", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index 8d53a4668f1..14a801aef88 100644 --- a/config/config.go +++ b/config/config.go @@ -579,6 +579,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdman, "https://sync.admanmedia.com/pbs.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadman%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") // openrtb_ext.BidderAdOcean doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdvangelists, "https://nep.advangelists.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadvangelists%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + // openrtb_ext.BidderAdxcg doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdyoulike, "http://visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadyoulike%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BBUYER_USERID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAJA, "https://ad.as.amanad.adtdp.com/v1/sync/ssp?ssp=4&gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Daja%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25s") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAMX, "https://prebid.a-mo.net/cchain/0?gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Damx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") @@ -819,6 +820,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.adtarget.endpoint", "http://ghb.console.adtarget.com.tr/pbs/ortb") v.SetDefault("adapters.adtelligent.endpoint", "http://ghb.adtelligent.com/pbs/ortb") v.SetDefault("adapters.advangelists.endpoint", "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}") + v.SetDefault("adapters.adxcg.disabled", true) v.SetDefault("adapters.adyoulike.endpoint", "https://broker.omnitagjs.com/broker/bid?partnerId=19340f4f097d16f41f34fc0274981ca4") v.SetDefault("adapters.aja.endpoint", "https://ad.as.amanad.adtdp.com/v1/bid/4") v.SetDefault("adapters.amx.endpoint", "http://pbs.amxrtb.com/auction/openrtb") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 307a07fafd7..51e5b4cd0fe 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -19,6 +19,7 @@ import ( "github.com/prebid/prebid-server/adapters/adtarget" "github.com/prebid/prebid-server/adapters/adtelligent" "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/adxcg" "github.com/prebid/prebid-server/adapters/adyoulike" "github.com/prebid/prebid-server/adapters/aja" "github.com/prebid/prebid-server/adapters/amx" @@ -130,6 +131,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderAdtarget: adtarget.Builder, openrtb_ext.BidderAdtelligent: adtelligent.Builder, openrtb_ext.BidderAdvangelists: advangelists.Builder, + openrtb_ext.BidderAdxcg: adxcg.Builder, openrtb_ext.BidderAdyoulike: adyoulike.Builder, openrtb_ext.BidderAJA: aja.Builder, openrtb_ext.BidderAMX: amx.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index f48cb23047a..e600eb05b82 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -90,6 +90,7 @@ const ( BidderAdtarget BidderName = "adtarget" BidderAdtelligent BidderName = "adtelligent" BidderAdvangelists BidderName = "advangelists" + BidderAdxcg BidderName = "adxcg" BidderAdyoulike BidderName = "adyoulike" BidderAJA BidderName = "aja" BidderAMX BidderName = "amx" @@ -201,6 +202,7 @@ func CoreBidderNames() []BidderName { BidderAdtarget, BidderAdtelligent, BidderAdvangelists, + BidderAdxcg, BidderAdyoulike, BidderAJA, BidderAMX, diff --git a/static/bidder-info/adxcg.yaml b/static/bidder-info/adxcg.yaml new file mode 100644 index 00000000000..e5535ae7258 --- /dev/null +++ b/static/bidder-info/adxcg.yaml @@ -0,0 +1,13 @@ +maintainer: + email: "info@adxcg.com" +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native diff --git a/static/bidder-params/adxcg.json b/static/bidder-params/adxcg.json new file mode 100644 index 00000000000..3f89234359d --- /dev/null +++ b/static/bidder-params/adxcg.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Adxcg Adapter Params", + "description": "A schema which validates params accepted by the Adxcg adapter", + "type": "object", + "properties": { + "adzoneid": { + "type": "string", + "minLength": 1, + "description": "An ID which identifies the placement selling the impression" + } + }, + "required": ["adzoneid"] +} diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 104312cc164..50362ad04ec 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -17,6 +17,7 @@ import ( "github.com/prebid/prebid-server/adapters/adtarget" "github.com/prebid/prebid-server/adapters/adtelligent" "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/adxcg" "github.com/prebid/prebid-server/adapters/adyoulike" "github.com/prebid/prebid-server/adapters/aja" "github.com/prebid/prebid-server/adapters/amx" @@ -112,6 +113,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtarget, adtarget.NewAdtargetSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtelligent, adtelligent.NewAdtelligentSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdvangelists, advangelists.NewAdvangelistsSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderAdxcg, adxcg.NewAdxcgSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdyoulike, adyoulike.NewAdyoulikeSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAJA, aja.NewAJASyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAMX, amx.NewAMXSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index e0dc3dd2896..7327630b464 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -26,6 +26,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderAdtarget): syncConfig, string(openrtb_ext.BidderAdtelligent): syncConfig, string(openrtb_ext.BidderAdvangelists): syncConfig, + string(openrtb_ext.BidderAdxcg): syncConfig, string(openrtb_ext.BidderAdyoulike): syncConfig, string(openrtb_ext.BidderAJA): syncConfig, string(openrtb_ext.BidderAMX): syncConfig, From b3b6099e68872560f9967efefd95b4ba1fba1f69 Mon Sep 17 00:00:00 2001 From: agilfix Date: Thu, 15 Apr 2021 09:33:29 -0400 Subject: [PATCH 67/91] Update kidoz properties to type string (#1808) Remove definitions object from schema and define types and other parameters directly in properties objects to ensure compatibility with more downstream systems that use this schema. --- static/bidder-params/kidoz.json | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/static/bidder-params/kidoz.json b/static/bidder-params/kidoz.json index 79e2edc2fd2..16511a15ca7 100644 --- a/static/bidder-params/kidoz.json +++ b/static/bidder-params/kidoz.json @@ -5,22 +5,18 @@ "type": "object", "properties": { "access_token": { - "$ref": "#/definitions/non-empty-string", + "type": "string", + "minLength": 1, "description": "Kidoz access_token" }, "publisher_id": { - "$ref": "#/definitions/non-empty-string", - "description": "Kidoz publisher_id" - } - }, - "definitions": { - "non-empty-string": { "type": "string", - "minLength": 1 + "minLength": 1, + "description": "Kidoz publisher_id" } }, "required": [ "access_token", "publisher_id" ] -} \ No newline at end of file +} From 51822e1daa9485f9d3c66449faec6474882da688 Mon Sep 17 00:00:00 2001 From: agilfix Date: Thu, 15 Apr 2021 11:04:38 -0400 Subject: [PATCH 68/91] Update bidmachine properties to type string (#1809) Remove definitions object from schema and define types and other parameters directly in properties objects to ensure compatibility with more downstream systems that use this schema. --- static/bidder-params/bidmachine.json | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/static/bidder-params/bidmachine.json b/static/bidder-params/bidmachine.json index f3971c00274..819dc9b7e2d 100644 --- a/static/bidder-params/bidmachine.json +++ b/static/bidder-params/bidmachine.json @@ -5,22 +5,19 @@ "type": "object", "properties": { "host": { - "$ref": "#/definitions/non-empty-string", + "type": "string", + "minLength": 1, "description": "Host" }, "path": { - "$ref": "#/definitions/non-empty-string", + "type": "string", + "minLength": 1, "description": "URL path" }, "seller_id": { - "$ref": "#/definitions/non-empty-string", - "description": "Seller Identifier" - } - }, - "definitions": { - "non-empty-string": { "type": "string", - "minLength": 1 + "minLength": 1, + "description": "Seller Identifier" } }, "required": [ @@ -28,4 +25,4 @@ "path", "seller_id" ] -} \ No newline at end of file +} From c7b64639110ad7d6699706b5f9c016f362f76d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20Su=C5=A1nik?= Date: Fri, 16 Apr 2021 21:50:56 +0200 Subject: [PATCH 69/91] transform native eventtrackers to imptrackers and jstracker (#1811) --- adapters/outbrain/outbrain.go | 33 +++++++++++++++++++ .../outbraintest/exemplary/native.json | 12 +++---- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/adapters/outbrain/outbrain.go b/adapters/outbrain/outbrain.go index 02a9784303c..282a6d53aa0 100644 --- a/adapters/outbrain/outbrain.go +++ b/adapters/outbrain/outbrain.go @@ -5,6 +5,8 @@ import ( "fmt" "net/http" + "github.com/mxmCherry/openrtb/v15/native1" + nativeResponse "github.com/mxmCherry/openrtb/v15/native1/response" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" @@ -118,6 +120,20 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R errs = append(errs, err) continue } + if bidType == openrtb_ext.BidTypeNative { + var nativePayload nativeResponse.Response + if err := json.Unmarshal(json.RawMessage(bid.AdM), &nativePayload); err != nil { + errs = append(errs, err) + continue + } + transformEventTrackers(&nativePayload) + nativePayloadJson, err := json.Marshal(nativePayload) + if err != nil { + errs = append(errs, err) + continue + } + bid.AdM = string(nativePayloadJson) + } b := &adapters.TypedBid{ Bid: &bid, @@ -145,3 +161,20 @@ func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, Message: fmt.Sprintf("Failed to find native/banner impression \"%s\" ", impID), } } + +func transformEventTrackers(nativePayload *nativeResponse.Response) { + // the native-trk.js library used to trigger the trackers currently doesn't support the native 1.2 eventtrackers, + // so transform them to the deprecated imptrackers and jstracker + for _, eventTracker := range nativePayload.EventTrackers { + if eventTracker.Event != native1.EventTypeImpression { + continue + } + switch eventTracker.Method { + case native1.EventTrackingMethodImage: + nativePayload.ImpTrackers = append(nativePayload.ImpTrackers, eventTracker.URL) + case native1.EventTrackingMethodJS: + nativePayload.JSTracker = fmt.Sprintf("", eventTracker.URL) + } + } + nativePayload.EventTrackers = nil +} diff --git a/adapters/outbrain/outbraintest/exemplary/native.json b/adapters/outbrain/outbraintest/exemplary/native.json index d32fd60382e..bf1eb7f53ff 100644 --- a/adapters/outbrain/outbraintest/exemplary/native.json +++ b/adapters/outbrain/outbraintest/exemplary/native.json @@ -73,7 +73,7 @@ "impid": "test-imp-id", "price": 1000, "nurl": "http://example.com/win/1000", - "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":3,\"required\":1,\"img\":{\"url\":\"http://example.com/img/url\",\"w\":120,\"h\":100}},{\"id\":0,\"required\":1,\"title\":{\"text\":\"Test title\"}},{\"id\":5,\"data\":{\"value\":\"Test sponsor\"}}],\"link\":{\"url\":\"http://example.com/click/url\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"http://example.com/impression\"}]}", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":3,\"required\":1,\"img\":{\"url\":\"http://example.com/img/url\",\"w\":120,\"h\":100}},{\"id\":0,\"required\":1,\"title\":{\"text\":\"Test title\"}},{\"id\":5,\"data\":{\"value\":\"Test sponsor\"}}],\"link\":{\"url\":\"http://example.com/click/url\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"http://example.com/impression\"},{\"event\":1,\"method\":2,\"url\":\"http://example.com/impression\"}]}", "adomain": [ "example.com" ], @@ -81,9 +81,7 @@ "crid": "test-crid", "cat": [ "IAB13-4" - ], - "w": 300, - "h": 250 + ] } ], "seat": "acc-1876" @@ -105,7 +103,7 @@ "impid": "test-imp-id", "price": 1000, "nurl": "http://example.com/win/1000", - "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":3,\"required\":1,\"img\":{\"url\":\"http://example.com/img/url\",\"w\":120,\"h\":100}},{\"id\":0,\"required\":1,\"title\":{\"text\":\"Test title\"}},{\"id\":5,\"data\":{\"value\":\"Test sponsor\"}}],\"link\":{\"url\":\"http://example.com/click/url\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"http://example.com/impression\"}]}", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":3,\"required\":1,\"img\":{\"url\":\"http://example.com/img/url\",\"w\":120,\"h\":100}},{\"id\":0,\"required\":1,\"title\":{\"text\":\"Test title\"}},{\"id\":5,\"data\":{\"value\":\"Test sponsor\"}}],\"link\":{\"url\":\"http://example.com/click/url\"},\"imptrackers\":[\"http://example.com/impression\"],\"jstracker\":\"\\u003cscript src=\\\"http://example.com/impression\\\"\\u003e\\u003c/script\\u003e\"}", "adomain": [ "example.com" ], @@ -113,9 +111,7 @@ "crid": "test-crid", "cat": [ "IAB13-4" - ], - "w": 300, - "h": 250 + ] }, "type": "native" } From d384e91bf99f886927a2bd412fd439502a1de088 Mon Sep 17 00:00:00 2001 From: TheMediaGrid <44166371+TheMediaGrid@users.noreply.github.com> Date: Tue, 20 Apr 2021 19:45:21 +0300 Subject: [PATCH 70/91] TheMediaGrid: Added processing of imp[].ext.data (#1807) --- adapters/grid/grid.go | 34 +++++- .../grid/gridtest/exemplary/with_gpid.json | 100 ++++++++++++++++++ 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 adapters/grid/gridtest/exemplary/with_gpid.json diff --git a/adapters/grid/grid.go b/adapters/grid/grid.go index 2c2b291bab8..bc819fc067e 100644 --- a/adapters/grid/grid.go +++ b/adapters/grid/grid.go @@ -16,6 +16,23 @@ type GridAdapter struct { endpoint string } +type ExtImpDataAdServer struct { + Name string `json:"name"` + AdSlot string `json:"adslot"` +} + +type ExtImpData struct { + PbAdslot string `json:"pbadslot,omitempty"` + AdServer *ExtImpDataAdServer `json:"adserver,omitempty"` +} + +type ExtImp struct { + Prebid *openrtb_ext.ExtImpPrebid `json:"prebid,omitempty"` + Bidder json.RawMessage `json:"bidder"` + Data *ExtImpData `json:"data,omitempty"` + Gpid string `json:"gpid,omitempty"` +} + func processImp(imp *openrtb2.Imp) error { // get the grid extension var ext adapters.ExtImpBidder @@ -37,6 +54,21 @@ func processImp(imp *openrtb2.Imp) error { return nil } +func setImpExtData(imp openrtb2.Imp) openrtb2.Imp { + var ext ExtImp + if err := json.Unmarshal(imp.Ext, &ext); err != nil { + return imp + } + if ext.Data != nil && ext.Data.AdServer != nil && ext.Data.AdServer.AdSlot != "" { + ext.Gpid = ext.Data.AdServer.AdSlot + extJSON, err := json.Marshal(ext) + if err == nil { + imp.Ext = extJSON + } + } + return imp +} + // MakeRequests makes the HTTP requests which should be made to fetch bids. func (a *GridAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) @@ -48,7 +80,7 @@ func (a *GridAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapte // pre-process the imps for _, imp := range requestCopy.Imp { if err := processImp(&imp); err == nil { - validImps = append(validImps, imp) + validImps = append(validImps, setImpExtData(imp)) } else { errors = append(errors, err) } diff --git a/adapters/grid/gridtest/exemplary/with_gpid.json b/adapters/grid/gridtest/exemplary/with_gpid.json new file mode 100644 index 00000000000..f54013581de --- /dev/null +++ b/adapters/grid/gridtest/exemplary/with_gpid.json @@ -0,0 +1,100 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [{ + "id": "test-imp-id", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": { + "uid": 1 + }, + "data": { + "adserver": { + "name": "some_name", + "adslot": "some_slot" + } + } + } + }] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "http://localhost/prebid", + "body": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [{ + "id": "test-imp-id", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": { + "uid": 1 + }, + "data": { + "adserver": { + "name": "some_name", + "adslot": "some_slot" + } + }, + "gpid": "some_slot" + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [{ + "seat": "grid", + "bid": [{ + "id": "randomid", + "impid": "test-imp-id", + "price": 0.500000, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300 + }] + }], + "cur": "USD" + } + } + }], + + "expectedBidResponses": [{ + "currency": "USD", + "bids": [{ + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "12345678", + "cid": "987", + "crid": "12345678", + "w": 300, + "h": 250 + }, + "type": "banner" + }] + }] +} From d8fa9d62d2daf0c501cbeff00bf01b54983fe988 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Sun, 25 Apr 2021 22:55:26 +0530 Subject: [PATCH 71/91] Renaming package github.com/PubMatic-OpenWrap/openrtb to github.com/mxmCherry/openrtb --- adapters/33across/33across.go | 20 +- adapters/acuityads/acuityads.go | 14 +- adapters/adapterstest/adapter_test_util.go | 10 +- adapters/adapterstest/test_json.go | 6 +- adapters/adform/adform.go | 28 +- adapters/adform/adform_test.go | 64 ++-- adapters/adgeneration/adgeneration.go | 24 +- adapters/adgeneration/adgeneration_test.go | 70 ++-- adapters/adhese/adhese.go | 30 +- adapters/adhese/utils.go | 4 +- adapters/adkernel/adkernel.go | 34 +- adapters/adkernelAdn/adkernelAdn.go | 34 +- adapters/adman/adman.go | 14 +- .../admantest/supplemental/bad_response.json | 2 +- adapters/admixer/admixer.go | 16 +- adapters/adocean/adocean.go | 28 +- adapters/adoppler/adoppler.go | 12 +- .../supplemental/invalid-response.json | 2 +- adapters/adot/adot.go | 10 +- adapters/adot/adot_test.go | 10 +- .../supplemental/unmarshal_error.json | 2 +- adapters/adpone/adpone.go | 8 +- .../adponetest/supplemental/bad_response.json | 2 +- adapters/adprime/adprime.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/adtarget/adtarget.go | 12 +- adapters/adtelligent/adtelligent.go | 12 +- adapters/advangelists/advangelists.go | 32 +- adapters/aja/aja.go | 12 +- adapters/amx/amx.go | 14 +- adapters/amx/amx_test.go | 48 +-- adapters/applogy/applogy.go | 8 +- adapters/appnexus/appnexus.go | 28 +- adapters/appnexus/appnexus_test.go | 132 ++++---- adapters/audienceNetwork/facebook.go | 36 +-- adapters/avocet/avocet.go | 12 +- adapters/avocet/avocet_test.go | 22 +- adapters/beachfront/beachfront.go | 62 ++-- adapters/beintoo/beintoo.go | 18 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/between/between.go | 18 +- .../supplemental/bad-response-body.json | 2 +- adapters/bidder.go | 10 +- adapters/brightroll/brightroll.go | 16 +- adapters/colossus/colossus.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/connectad/connectad.go | 18 +- .../supplemental/badresponse.json | 2 +- adapters/consumable/adtypes.go | 6 +- adapters/consumable/consumable.go | 14 +- adapters/conversant/cnvr_legacy.go | 20 +- adapters/conversant/cnvr_legacy_test.go | 40 +-- adapters/conversant/conversant.go | 24 +- adapters/cpmstar/cpmstar.go | 14 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/datablocks/datablocks.go | 18 +- .../supplemental/bad-response-body.json | 2 +- adapters/decenterads/decenterads.go | 12 +- .../supplemental/bad_response.json | 2 +- adapters/deepintent/deepintent.go | 18 +- .../supplemental/bad_response.json | 2 +- adapters/dmx/dmx.go | 30 +- adapters/dmx/dmx_test.go | 252 +++++++-------- adapters/emx_digital/emx_digital.go | 26 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/engagebdr/engagebdr.go | 12 +- adapters/eplanning/eplanning.go | 22 +- adapters/gamma/gamma.go | 18 +- adapters/gamoshi/gamoshi.go | 10 +- adapters/grid/grid.go | 14 +- .../gridtest/supplemental/bad_response.json | 2 +- adapters/gumgum/gumgum.go | 16 +- adapters/improvedigital/improvedigital.go | 10 +- .../supplemental/bad_response.json | 2 +- adapters/info.go | 12 +- adapters/info_test.go | 72 ++--- adapters/inmobi/inmobi.go | 12 +- adapters/invibes/invibes.go | 28 +- adapters/ix/ix.go | 34 +- adapters/ix/ix_test.go | 54 ++-- adapters/kidoz/kidoz.go | 10 +- adapters/kidoz/kidoz_test.go | 22 +- adapters/krushmedia/krushmedia.go | 14 +- adapters/kubient/kubient.go | 12 +- .../supplemental/bad_response.json | 2 +- adapters/lifestreet/lifestreet.go | 8 +- adapters/lifestreet/lifestreet_test.go | 36 +-- adapters/lockerdome/lockerdome.go | 10 +- .../supplemental/bad_response.json | 2 +- adapters/logicad/logicad.go | 22 +- adapters/lunamedia/lunamedia.go | 28 +- adapters/marsmedia/marsmedia.go | 10 +- adapters/mgid/mgid.go | 12 +- adapters/mobfoxpb/mobfoxpb.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/mobilefuse/mobilefuse.go | 18 +- adapters/nanointeractive/nanointeractive.go | 14 +- adapters/ninthdecimal/ninthdecimal.go | 28 +- adapters/nobid/nobid.go | 12 +- adapters/openrtb_util.go | 50 +-- adapters/openrtb_util_test.go | 66 ++-- adapters/openx/openx.go | 22 +- adapters/openx/openx_test.go | 8 +- adapters/orbidder/orbidder.go | 12 +- adapters/pubmatic/pubmatic.go | 50 +-- adapters/pubmatic/pubmatic_test.go | 46 +-- adapters/pubnative/pubnative.go | 18 +- adapters/pulsepoint/pulsepoint.go | 26 +- adapters/pulsepoint/pulsepoint_test.go | 18 +- .../supplemental/bad-bid-data.json | 2 +- adapters/revcontent/revcontent.go | 10 +- .../supplemental/bad_response.json | 2 +- adapters/rhythmone/rhythmone.go | 12 +- adapters/rtbhouse/rtbhouse.go | 8 +- .../supplemental/bad_response.json | 2 +- adapters/rubicon/rubicon.go | 42 +-- adapters/rubicon/rubicon_test.go | 220 ++++++------- adapters/sharethrough/butler.go | 18 +- adapters/sharethrough/butler_test.go | 80 ++--- adapters/sharethrough/sharethrough.go | 6 +- adapters/sharethrough/sharethrough_test.go | 36 +-- adapters/sharethrough/utils.go | 20 +- adapters/sharethrough/utils_test.go | 62 ++-- adapters/silvermob/silvermob.go | 16 +- .../supplemental/invalid-response.json | 2 +- adapters/smaato/smaato.go | 22 +- adapters/smartadserver/smartadserver.go | 16 +- adapters/smartrtb/smartrtb.go | 12 +- .../supplemental/invalid-bid-json.json | 2 +- adapters/smartyads/smartyads.go | 14 +- adapters/somoaudience/somoaudience.go | 26 +- adapters/sonobi/sonobi.go | 14 +- adapters/sovrn/sovrn.go | 14 +- adapters/sovrn/sovrn_test.go | 22 +- adapters/spotx/spotx.go | 14 +- adapters/spotx/spotx_test.go | 8 +- adapters/synacormedia/synacormedia.go | 16 +- .../supplemental/bad_response.json | 2 +- adapters/tappx/tappx.go | 10 +- adapters/telaria/telaria.go | 24 +- adapters/triplelift/triplelift.go | 14 +- .../triplelift_native/triplelift_native.go | 18 +- adapters/ucfunnel/ucfunnel.go | 14 +- adapters/ucfunnel/ucfunnel_test.go | 60 ++-- adapters/unruly/unruly.go | 20 +- adapters/unruly/unruly_test.go | 64 ++-- adapters/valueimpression/valueimpression.go | 12 +- .../invalid-response-unmarshall-error.json | 2 +- adapters/verizonmedia/verizonmedia.go | 20 +- adapters/visx/visx.go | 12 +- adapters/vrtcal/vrtcal.go | 8 +- adapters/yeahmobi/yeahmobi.go | 16 +- .../supplemental/bad_response.json | 2 +- adapters/yieldlab/yieldlab.go | 22 +- adapters/yieldmo/yieldmo.go | 14 +- adapters/yieldone/yieldone.go | 14 +- .../supplemental/bad_response.json | 2 +- adapters/zeroclickfraud/zeroclickfraud.go | 16 +- .../supplemental/bad-response-body.json | 2 +- amp/parse.go | 22 +- amp/parse_test.go | 12 +- analytics/config/config_test.go | 6 +- analytics/core.go | 14 +- analytics/filesystem/file_module_test.go | 4 +- analytics/pubstack/README.md | 4 +- analytics/pubstack/helpers/json_test.go | 4 +- analytics/pubstack/pubstack_module_test.go | 6 +- endpoints/auction.go | 4 +- endpoints/auction_test.go | 14 +- endpoints/openrtb2/amp_auction.go | 40 +-- endpoints/openrtb2/amp_auction_test.go | 108 +++---- endpoints/openrtb2/auction.go | 158 +++++---- endpoints/openrtb2/auction_test.go | 300 ++++++++--------- .../openrtb2/ctv/response/adpod_generator.go | 6 +- .../ctv/response/adpod_generator_test.go | 18 +- endpoints/openrtb2/ctv/types/adpod_types.go | 6 +- endpoints/openrtb2/ctv/util/util.go | 4 +- endpoints/openrtb2/ctv/util/util_test.go | 6 +- endpoints/openrtb2/ctv_auction.go | 56 ++-- endpoints/openrtb2/ctv_auction_test.go | 6 +- endpoints/openrtb2/interstitial.go | 20 +- endpoints/openrtb2/interstitial_test.go | 14 +- .../invalid-native/empty-object.json | 2 +- endpoints/openrtb2/video_auction.go | 20 +- endpoints/openrtb2/video_auction_test.go | 136 ++++---- exchange/adapter_util_test.go | 8 +- exchange/auction.go | 20 +- exchange/auction_test.go | 24 +- exchange/bidder.go | 26 +- exchange/bidder_test.go | 92 +++--- exchange/bidder_validate_bids.go | 6 +- exchange/bidder_validate_bids_test.go | 38 +-- exchange/events_test.go | 6 +- exchange/exchange.go | 42 +-- exchange/exchange_test.go | 302 +++++++++--------- exchange/gdpr.go | 6 +- exchange/gdpr_test.go | 28 +- exchange/legacy.go | 32 +- exchange/legacy_test.go | 88 ++--- exchange/targeting.go | 6 +- exchange/targeting_test.go | 46 +-- exchange/utils.go | 42 +-- exchange/utils_test.go | 102 +++--- go.mod | 14 +- go.sum | 67 ++++ openrtb_ext/bid_request_video.go | 16 +- openrtb_ext/deal_tier.go | 4 +- openrtb_ext/deal_tier_test.go | 4 +- openrtb_ext/response.go | 4 +- pbs/pbsrequest.go | 18 +- pbs/pbsresponse.go | 4 +- prebid_cache_client/client.go | 2 +- prebid_cache_client/prebid_cache.go | 4 +- privacy/ccpa/consentwriter.go | 4 +- privacy/ccpa/consentwriter_test.go | 20 +- privacy/ccpa/parsedpolicy_test.go | 4 +- privacy/ccpa/policy.go | 18 +- privacy/ccpa/policy_test.go | 144 ++++----- privacy/enforcement.go | 6 +- privacy/enforcement_test.go | 22 +- privacy/gdpr/consentwriter.go | 6 +- privacy/gdpr/consentwriter_test.go | 40 +-- privacy/lmt/policy.go | 4 +- privacy/lmt/policy_test.go | 14 +- privacy/scrubber.go | 16 +- privacy/scrubber_test.go | 78 ++--- privacy/writer.go | 6 +- privacy/writer_test.go | 6 +- 228 files changed, 2990 insertions(+), 2911 deletions(-) diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index 7abd7ba72bd..9d2a5310943 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" @@ -51,7 +51,7 @@ type bidTtxExt struct { } // MakeRequests create the object for TTX Reqeust. -func (a *TtxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TtxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -77,14 +77,14 @@ func (a *TtxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters return adapterRequests, errs } -func (a *TtxAdapter) makeRequest(request openrtb.BidRequest, imp openrtb.Imp) (*adapters.RequestData, error) { +func (a *TtxAdapter) makeRequest(request openrtb2.BidRequest, imp openrtb2.Imp) (*adapters.RequestData, error) { impCopy, err := makeImps(imp) if err != nil { return nil, err } - request.Imp = []openrtb.Imp{*impCopy} + request.Imp = []openrtb2.Imp{*impCopy} // Last Step reqJSON, err := json.Marshal(request) @@ -103,7 +103,7 @@ func (a *TtxAdapter) makeRequest(request openrtb.BidRequest, imp openrtb.Imp) (* }, nil } -func makeImps(imp openrtb.Imp) (*openrtb.Imp, error) { +func makeImps(imp openrtb2.Imp) (*openrtb2.Imp, error) { if imp.Banner == nil && imp.Video == nil { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Imp ID %s must have at least one of [Banner, Video] defined", imp.ID), @@ -158,7 +158,7 @@ func makeImps(imp openrtb.Imp) (*openrtb.Imp, error) { return &imp, nil } -func makeReqExt(request *openrtb.BidRequest) ([]byte, error) { +func makeReqExt(request *openrtb2.BidRequest) ([]byte, error) { var reqExt reqExt if len(request.Ext) > 0 { @@ -181,7 +181,7 @@ func makeReqExt(request *openrtb.BidRequest) ([]byte, error) { } // MakeBids make the bids for the bid response. -func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TtxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -198,7 +198,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -227,7 +227,7 @@ func (a *TtxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReque } -func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, error) { +func validateVideoParams(video *openrtb2.Video, prod string) (*openrtb2.Video, error) { videoCopy := video if videoCopy.W == 0 || videoCopy.H == 0 || @@ -248,7 +248,7 @@ func validateVideoParams(video *openrtb.Video, prod string) (*openrtb.Video, err videoCopy.Placement = 1 if videoCopy.StartDelay == nil { - videoCopy.StartDelay = openrtb.StartDelay.Ptr(0) + videoCopy.StartDelay = openrtb2.StartDelay.Ptr(0) } } diff --git a/adapters/acuityads/acuityads.go b/adapters/acuityads/acuityads.go index ac2c6ac7c4d..7f92231e89c 100644 --- a/adapters/acuityads/acuityads.go +++ b/adapters/acuityads/acuityads.go @@ -6,7 +6,7 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" @@ -31,7 +31,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getHeaders(request *openrtb.BidRequest) http.Header { +func getHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -55,7 +55,7 @@ func getHeaders(request *openrtb.BidRequest) http.Header { } func (a *AcuityAdsAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -87,7 +87,7 @@ func (a *AcuityAdsAdapter) MakeRequests( }}, nil } -func (a *AcuityAdsAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtAcuityAds, error) { +func (a *AcuityAdsAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtAcuityAds, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -136,7 +136,7 @@ func (a *AcuityAdsAdapter) checkResponseStatusCodes(response *adapters.ResponseD } func (a *AcuityAdsAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -153,7 +153,7 @@ func (a *AcuityAdsAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Bad Server Response", @@ -178,7 +178,7 @@ func (a *AcuityAdsAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/adapterstest/adapter_test_util.go b/adapters/adapterstest/adapter_test_util.go index 269eed087ed..25d43a138fb 100644 --- a/adapters/adapterstest/adapter_test_util.go +++ b/adapters/adapterstest/adapter_test_util.go @@ -8,13 +8,13 @@ import ( "net/http" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // OrtbMockService Represents a scaffolded OpenRTB service. type OrtbMockService struct { Server *httptest.Server - LastBidRequest *openrtb.BidRequest + LastBidRequest *openrtb2.BidRequest LastHttpRequest *http.Request } @@ -30,8 +30,8 @@ func BidOnTags(tags string) map[string]bool { } // SampleBid Produces a sample bid based on params given. -func SampleBid(width *uint64, height *uint64, impId string, index int) openrtb.Bid { - return openrtb.Bid{ +func SampleBid(width *int64, height *int64, impId string, index int) openrtb2.Bid { + return openrtb2.Bid{ ID: "Bid-123", ImpID: fmt.Sprintf("div-adunit-%d", index), Price: 2.1, @@ -64,7 +64,7 @@ func VerifyBoolValue(value bool, expected bool, t *testing.T) { } // VerifyBannerSize helper function to assert banner size -func VerifyBannerSize(banner *openrtb.Banner, expectedWidth int, expectedHeight int, t *testing.T) { +func VerifyBannerSize(banner *openrtb2.Banner, expectedWidth int, expectedHeight int, t *testing.T) { VerifyIntValue(int(*(banner.W)), expectedWidth, t) VerifyIntValue(int(*(banner.H)), expectedHeight, t) } diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index b8c33064fc4..e6edf495d7d 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -7,8 +7,8 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" @@ -128,7 +128,7 @@ func runSpec(t *testing.T, filename string, spec *testSpec, bidder adapters.Bidd } type testSpec struct { - BidRequest openrtb.BidRequest `json:"mockBidRequest"` + BidRequest openrtb2.BidRequest `json:"mockBidRequest"` HttpCalls []httpCall `json:"httpCalls"` BidResponses []expectedBidResponse `json:"expectedBidResponses"` MakeRequestErrors []testSpecExpectedError `json:"expectedMakeRequestsErrors"` @@ -266,7 +266,7 @@ func diffBids(t *testing.T, description string, actual *adapters.TypedBid, expec } // diffOrtbBids compares the actual Bid made by the adapter to the expectation from the JSON file. -func diffOrtbBids(t *testing.T, description string, actual *openrtb.Bid, expected json.RawMessage) { +func diffOrtbBids(t *testing.T, description string, actual *openrtb2.Bid, expected json.RawMessage) { if actual == nil { t.Errorf("Bidders cannot return nil Bids. %s was nil.", description) return diff --git a/adapters/adform/adform.go b/adapters/adform/adform.go index bb3f9f4d8a3..ea93bb4da84 100644 --- a/adapters/adform/adform.go +++ b/adapters/adform/adform.go @@ -19,8 +19,8 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -235,8 +235,8 @@ func toPBSBidSlice(adformBids []*adformBid, r *adformRequest) pbs.PBSBidSlice { BidderCode: r.bidderCode, Price: bid.Price, Adm: adm, - Width: bid.Width, - Height: bid.Height, + Width: int64(bid.Width), + Height: int64(bid.Height), DealId: bid.DealId, Creative_id: bid.CreativeId, CreativeMediaType: string(bidType), @@ -374,7 +374,7 @@ func NewAdformLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, endpointURL } } -func (a *AdformAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdformAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { adformRequest, errors := openRtbToAdformRequest(request) if len(adformRequest.adUnits) == 0 { return nil, errors @@ -392,7 +392,7 @@ func (a *AdformAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt return requests, errors } -func openRtbToAdformRequest(request *openrtb.BidRequest) (*adformRequest, []error) { +func openRtbToAdformRequest(request *openrtb2.BidRequest) (*adformRequest, []error) { adUnits := make([]*adformAdUnit, 0, len(request.Imp)) errors := make([]error, 0, len(request.Imp)) secure := false @@ -529,35 +529,35 @@ func encodeEids(eids []openrtb_ext.ExtUserEid) string { return encodedEids } -func getIPSafely(device *openrtb.Device) string { +func getIPSafely(device *openrtb2.Device) string { if device == nil { return "" } return device.IP } -func getIFASafely(device *openrtb.Device) string { +func getIFASafely(device *openrtb2.Device) string { if device == nil { return "" } return device.IFA } -func getUASafely(device *openrtb.Device) string { +func getUASafely(device *openrtb2.Device) string { if device == nil { return "" } return device.UA } -func getBuyerUIDSafely(user *openrtb.User) string { +func getBuyerUIDSafely(user *openrtb2.User) string { if user == nil { return "" } return user.BuyerUID } -func (a *AdformAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdformAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -584,7 +584,7 @@ func (a *AdformAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, nil } -func toOpenRtbBidResponse(adformBids []*adformBid, r *openrtb.BidRequest) *adapters.BidderResponse { +func toOpenRtbBidResponse(adformBids []*adformBid, r *openrtb2.BidRequest) *adapters.BidderResponse { bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(adformBids)) currency := bidResponse.Currency @@ -598,13 +598,13 @@ func toOpenRtbBidResponse(adformBids []*adformBid, r *openrtb.BidRequest) *adapt continue } - openRtbBid := openrtb.Bid{ + openRtbBid := openrtb2.Bid{ ID: r.Imp[i].ID, ImpID: r.Imp[i].ID, Price: bid.Price, AdM: adm, - W: bid.Width, - H: bid.Height, + W: int64(bid.Width), + H: int64(bid.Height), DealID: bid.DealId, CrID: bid.CreativeId, } diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index 14663c32112..c903eb24c10 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -17,10 +17,10 @@ import ( "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -172,7 +172,7 @@ func TestAdformBasicResponse(t *testing.T) { if bid.Price != tag.price { t.Errorf("Incorrect bid price '%.2f' expected '%.2f'", bid.Price, tag.price) } - if bid.Width != adformTestData.width || bid.Height != adformTestData.height { + if bid.Width != int64(adformTestData.width) || bid.Height != int64(adformTestData.height) { t.Errorf("Incorrect bid size %dx%d, expected %dx%d", bid.Width, bid.Height, adformTestData.width, adformTestData.height) } if bid.Adm != tag.content { @@ -249,7 +249,7 @@ func preparePrebidRequest(serverUrl string, t *testing.T) *pbs.PBSRequest { // so User and Regs are copied from OpenRTB request, see legacy.go -> toLegacyRequest regs := getRegs() r.Regs = ®s - user := openrtb.User{ + user := openrtb2.User{ Ext: getUserExt(), } r.User = &user @@ -260,7 +260,7 @@ func preparePrebidRequest(serverUrl string, t *testing.T) *pbs.PBSRequest { func preparePrebidRequestBody(requestData aBidInfo, t *testing.T) *bytes.Buffer { prebidRequest := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 4), - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: requestData.deviceUA, IP: requestData.deviceIP, IFA: requestData.deviceIFA, @@ -271,10 +271,10 @@ func preparePrebidRequestBody(requestData aBidInfo, t *testing.T) *bytes.Buffer for i, tag := range requestData.tags { prebidRequest.AdUnits[i] = pbs.AdUnit{ Code: tag.code, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { - W: requestData.width, - H: requestData.height, + W: int64(requestData.width), + H: int64(requestData.height), }, }, Bids: []pbs.Bids{ @@ -332,16 +332,16 @@ func TestOpenRTBRequest(t *testing.T) { func TestOpenRTBIncorrectRequest(t *testing.T) { bidder := new(AdformAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ {ID: "incorrect-bidder-field", Ext: json.RawMessage(`{"bidder1": { "mid": "32344" }}`)}, {ID: "incorrect-adform-params", Ext: json.RawMessage(`{"bidder": { : "33" }}`)}, {ID: "mid-integer", Ext: json.RawMessage(`{"bidder": { "mid": 1.234 }}`)}, {ID: "mid-greater-then-zero", Ext: json.RawMessage(`{"bidder": { "mid": -1 }}`)}, }, - Device: &openrtb.Device{UA: "ua", IP: "ip"}, - User: &openrtb.User{BuyerUID: "buyerUID"}, + Device: &openrtb2.Device{UA: "ua", IP: "ip"}, + User: &openrtb2.User{BuyerUID: "buyerUID"}, } httpRequests, errs := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) @@ -374,36 +374,36 @@ func createTestData(secure bool) aBidInfo { return testData } -func createOpenRtbRequest(testData *aBidInfo) *openrtb.BidRequest { +func createOpenRtbRequest(testData *aBidInfo) *openrtb2.BidRequest { secure := int8(0) if testData.secure { secure = int8(1) } - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: make([]openrtb.Imp, len(testData.tags)), - Site: &openrtb.Site{ + Imp: make([]openrtb2.Imp, len(testData.tags)), + Site: &openrtb2.Site{ Page: testData.referrer, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: testData.deviceUA, IP: testData.deviceIP, IFA: testData.deviceIFA, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: testData.tid, }, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: testData.buyerUID, }, } for i, tag := range testData.tags { - bidRequest.Imp[i] = openrtb.Imp{ + bidRequest.Imp[i] = openrtb2.Imp{ ID: tag.code, Secure: &secure, Ext: json.RawMessage(fmt.Sprintf("{\"bidder\": %s}", formatAdUnitJson(tag))), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, } } @@ -457,7 +457,7 @@ func TestOpenRTBStandardResponse(t *testing.T) { if bid.Price != tag.price { t.Errorf("Incorrect bid price '%.2f' expected '%.2f'", bid.Price, tag.price) } - if bid.W != testData.width || bid.H != testData.height { + if bid.W != int64(testData.width) || bid.H != int64(testData.height) { t.Errorf("Incorrect bid size %dx%d, expected %dx%d", bid.W, bid.H, testData.width, testData.height) } if bid.AdM != tag.content { @@ -511,12 +511,12 @@ func TestAdformProperties(t *testing.T) { // helpers -func getRegs() openrtb.Regs { +func getRegs() openrtb2.Regs { var gdpr int8 = 1 regsExt := openrtb_ext.ExtRegs{ GDPR: &gdpr, } - regs := openrtb.Regs{} + regs := openrtb2.Regs{} regsExtData, err := json.Marshal(regsExt) if err == nil { regs.Ext = regsExtData @@ -689,37 +689,37 @@ func TestToOpenRtbBidResponse(t *testing.T) { expectedBids := 4 lastCurrency, anotherCurrency, emptyCurrency := "EUR", "USD", "" - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "banner-imp-no1", Ext: json.RawMessage(`{"bidder1": { "mid": "32341" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "banner-imp-no2", Ext: json.RawMessage(`{"bidder1": { "mid": "32342" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "banner-imp-no3", Ext: json.RawMessage(`{"bidder1": { "mid": "32343" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "banner-imp-no4", Ext: json.RawMessage(`{"bidder1": { "mid": "32344" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "video-imp-no4", Ext: json.RawMessage(`{"bidder1": { "mid": "32345" }}`), - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, }, - Device: &openrtb.Device{UA: "ua", IP: "ip"}, - User: &openrtb.User{BuyerUID: "buyerUID"}, + Device: &openrtb2.Device{UA: "ua", IP: "ip"}, + User: &openrtb2.User{BuyerUID: "buyerUID"}, } testAdformBids := []*adformBid{ diff --git a/adapters/adgeneration/adgeneration.go b/adapters/adgeneration/adgeneration.go index 59a3ba5b6a2..c6a960ac1be 100644 --- a/adapters/adgeneration/adgeneration.go +++ b/adapters/adgeneration/adgeneration.go @@ -10,11 +10,11 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AdgenerationAdapter struct { @@ -41,7 +41,7 @@ type adgServerResponse struct { Results []interface{} `json:"results"` } -func (adg *AdgenerationAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adg *AdgenerationAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { numRequests := len(request.Imp) var errs []error @@ -79,7 +79,7 @@ func (adg *AdgenerationAdapter) MakeRequests(request *openrtb.BidRequest, reqInf return bidRequestArray, errs } -func (adg *AdgenerationAdapter) getRequestUri(request *openrtb.BidRequest, index int) (string, error) { +func (adg *AdgenerationAdapter) getRequestUri(request *openrtb2.BidRequest, index int) (string, error) { imp := request.Imp[index] adgExt, err := unmarshalExtImpAdgeneration(&imp) if err != nil { @@ -98,7 +98,7 @@ func (adg *AdgenerationAdapter) getRequestUri(request *openrtb.BidRequest, index return uriObj.String(), err } -func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb.BidRequest, imp *openrtb.Imp) *url.Values { +func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb2.BidRequest, imp *openrtb2.Imp) *url.Values { v := url.Values{} v.Set("posall", "SSPLOC") v.Set("id", id) @@ -121,7 +121,7 @@ func (adg *AdgenerationAdapter) getRawQuery(id string, request *openrtb.BidReque return &v } -func unmarshalExtImpAdgeneration(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdgeneration, error) { +func unmarshalExtImpAdgeneration(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdgeneration, error) { var bidderExt adapters.ExtImpBidder var adgExt openrtb_ext.ExtImpAdgeneration if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { @@ -136,13 +136,13 @@ func unmarshalExtImpAdgeneration(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdgenerat return &adgExt, nil } -func getSizes(imp *openrtb.Imp) string { +func getSizes(imp *openrtb2.Imp) string { if imp.Banner == nil || len(imp.Banner.Format) == 0 { return "" } var sizeStr string for _, v := range imp.Banner.Format { - sizeStr += strconv.FormatUint(v.W, 10) + "x" + strconv.FormatUint(v.H, 10) + "," + sizeStr += strconv.FormatInt(v.W, 10) + "x" + strconv.FormatInt(v.H, 10) + "," } if len(sizeStr) > 0 && strings.LastIndex(sizeStr, ",") == len(sizeStr)-1 { sizeStr = sizeStr[:len(sizeStr)-1] @@ -150,7 +150,7 @@ func getSizes(imp *openrtb.Imp) string { return sizeStr } -func (adg *AdgenerationAdapter) getCurrency(request *openrtb.BidRequest) string { +func (adg *AdgenerationAdapter) getCurrency(request *openrtb2.BidRequest) string { if len(request.Cur) <= 0 { return adg.defaultCurrency } else { @@ -163,7 +163,7 @@ func (adg *AdgenerationAdapter) getCurrency(request *openrtb.BidRequest) string } } -func (adg *AdgenerationAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adg *AdgenerationAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -202,13 +202,13 @@ func (adg *AdgenerationAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex impId = v.ID bitType = openrtb_ext.BidTypeBanner adm = createAd(&bidResp, impId) - bid := openrtb.Bid{ + bid := openrtb2.Bid{ ID: bidResp.Locationid, ImpID: impId, AdM: adm, Price: bidResp.Cpm, - W: bidResp.W, - H: bidResp.H, + W: int64(bidResp.W), + H: int64(bidResp.H), CrID: bidResp.Creativeid, DealID: bidResp.Dealid, } diff --git a/adapters/adgeneration/adgeneration_test.go b/adapters/adgeneration/adgeneration_test.go index a4041a5a1d7..60fd4041d3b 100644 --- a/adapters/adgeneration/adgeneration_test.go +++ b/adapters/adgeneration/adgeneration_test.go @@ -4,11 +4,11 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -34,27 +34,27 @@ func TestgetRequestUri(t *testing.T) { bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) // Test items - failedRequest := &openrtb.BidRequest{ + failedRequest := &openrtb2.BidRequest{ ID: "test-failed-bid-request", - Imp: []openrtb.Imp{ - {ID: "extImpBidder-failed-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{{ "id": "58278" }}`)}, - {ID: "extImpBidder-failed-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"_bidder": { "id": "58278" }}`)}, - {ID: "extImpAdgeneration-failed-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "_id": "58278" }}`)}, + Imp: []openrtb2.Imp{ + {ID: "extImpBidder-failed-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{{ "id": "58278" }}`)}, + {ID: "extImpBidder-failed-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"_bidder": { "id": "58278" }}`)}, + {ID: "extImpAdgeneration-failed-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "_id": "58278" }}`)}, }, - Source: &openrtb.Source{TID: "SourceTID"}, - Device: &openrtb.Device{UA: "testUA", IP: "testIP"}, - Site: &openrtb.Site{Page: "https://supership.com"}, - User: &openrtb.User{BuyerUID: "buyerID"}, + Source: &openrtb2.Source{TID: "SourceTID"}, + Device: &openrtb2.Device{UA: "testUA", IP: "testIP"}, + Site: &openrtb2.Site{Page: "https://supership.com"}, + User: &openrtb2.User{BuyerUID: "buyerID"}, } - successRequest := &openrtb.BidRequest{ + successRequest := &openrtb2.BidRequest{ ID: "test-success-bid-request", - Imp: []openrtb.Imp{ - {ID: "bidRequest-success-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, + Imp: []openrtb2.Imp{ + {ID: "bidRequest-success-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, }, - Source: &openrtb.Source{TID: "SourceTID"}, - Device: &openrtb.Device{UA: "testUA", IP: "testIP"}, - Site: &openrtb.Site{Page: "https://supership.com"}, - User: &openrtb.User{BuyerUID: "buyerID"}, + Source: &openrtb2.Source{TID: "SourceTID"}, + Device: &openrtb2.Device{UA: "testUA", IP: "testIP"}, + Site: &openrtb2.Site{Page: "https://supership.com"}, + User: &openrtb2.User{BuyerUID: "buyerID"}, } numRequests := len(failedRequest.Imp) @@ -108,23 +108,23 @@ func TestgetRequestUri(t *testing.T) { func TestGetSizes(t *testing.T) { // Test items - var request *openrtb.Imp + var request *openrtb2.Imp var size string - multiFormatBanner := &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 320, H: 50}}} - noFormatBanner := &openrtb.Banner{Format: []openrtb.Format{}} - nativeFormat := &openrtb.Native{} + multiFormatBanner := &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 320, H: 50}}} + noFormatBanner := &openrtb2.Banner{Format: []openrtb2.Format{}} + nativeFormat := &openrtb2.Native{} - request = &openrtb.Imp{Banner: multiFormatBanner} + request = &openrtb2.Imp{Banner: multiFormatBanner} size = getSizes(request) if size != "300x250,320x50" { t.Errorf("%v does not match size.", multiFormatBanner) } - request = &openrtb.Imp{Banner: noFormatBanner} + request = &openrtb2.Imp{Banner: noFormatBanner} size = getSizes(request) if size != "" { t.Errorf("%v does not match size.", noFormatBanner) } - request = &openrtb.Imp{Native: nativeFormat} + request = &openrtb2.Imp{Native: nativeFormat} size = getSizes(request) if size != "" { t.Errorf("%v does not match size.", nativeFormat) @@ -142,17 +142,17 @@ func TestGetCurrency(t *testing.T) { bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) // Test items - var request *openrtb.BidRequest + var request *openrtb2.BidRequest var currency string innerDefaultCur := []string{"USD", "JPY"} usdCur := []string{"USD", "EUR"} - request = &openrtb.BidRequest{Cur: innerDefaultCur} + request = &openrtb2.BidRequest{Cur: innerDefaultCur} currency = bidderAdgeneration.getCurrency(request) if currency != "JPY" { t.Errorf("%v does not match currency.", innerDefaultCur) } - request = &openrtb.BidRequest{Cur: usdCur} + request = &openrtb2.BidRequest{Cur: usdCur} currency = bidderAdgeneration.getCurrency(request) if currency != "USD" { t.Errorf("%v does not match currency.", usdCur) @@ -212,14 +212,14 @@ func TestMakeBids(t *testing.T) { bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) - internalRequest := &openrtb.BidRequest{ + internalRequest := &openrtb2.BidRequest{ ID: "test-success-bid-request", - Imp: []openrtb.Imp{ - {ID: "bidRequest-success-test", Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, + Imp: []openrtb2.Imp{ + {ID: "bidRequest-success-test", Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(`{"bidder": { "id": "58278" }}`)}, }, - Device: &openrtb.Device{UA: "testUA", IP: "testIP"}, - Site: &openrtb.Site{Page: "https://supership.com"}, - User: &openrtb.User{BuyerUID: "buyerID"}, + Device: &openrtb2.Device{UA: "testUA", IP: "testIP"}, + Site: &openrtb2.Site{Page: "https://supership.com"}, + User: &openrtb2.User{BuyerUID: "buyerID"}, } externalRequest := adapters.RequestData{} response := adapters.ResponseData{ @@ -254,8 +254,8 @@ func checkBidResponse(t *testing.T, bidderResponse *adapters.BidderResponse, exp var expectedID string = "58278" var expectedImpID = "bidRequest-success-test" var expectedPrice float64 = 30.0 - var expectedW uint64 = 300 - var expectedH uint64 = 250 + var expectedW int64 = 300 + var expectedH int64 = 250 var expectedCrID string = "Dummy_supership.jp" var extectedDealID string = "test-deal-id" diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index 96a936c2276..292c5b04af8 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -10,13 +10,13 @@ import ( "strings" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AdheseAdapter struct { @@ -57,7 +57,7 @@ func extractTargetParameters(parameters openrtb_ext.ExtImpAdhese) string { return parametersAsString } -func extractGdprParameter(request *openrtb.BidRequest) string { +func extractGdprParameter(request *openrtb2.BidRequest) string { if request.User != nil { var extUser openrtb_ext.ExtUser if err := json.Unmarshal(request.User.Ext, &extUser); err == nil { @@ -67,21 +67,21 @@ func extractGdprParameter(request *openrtb.BidRequest) string { return "" } -func extractRefererParameter(request *openrtb.BidRequest) string { +func extractRefererParameter(request *openrtb2.BidRequest) string { if request.Site != nil && request.Site.Page != "" { return "/xf" + url.QueryEscape(request.Site.Page) } return "" } -func extractIfaParameter(request *openrtb.BidRequest) string { +func extractIfaParameter(request *openrtb2.BidRequest) string { if request.Device != nil && request.Device.IFA != "" { return "/xz" + url.QueryEscape(request.Device.IFA) } return "" } -func (a *AdheseAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdheseAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var err error @@ -128,14 +128,14 @@ func (a *AdheseAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt }}, errs } -func (a *AdheseAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdheseAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } else if response.StatusCode != http.StatusOK { return nil, []error{WrapServerError(fmt.Sprintf("Unexpected status code: %d.", response.StatusCode))} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse var adheseBidResponseArray []AdheseBid if err := json.Unmarshal(response.Body, &adheseBidResponseArray); err != nil { @@ -163,11 +163,11 @@ func (a *AdheseAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe if err != nil { return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Price %v as float ", string(adheseBid.Extension.Prebid.Cpm.Amount)))} } - width, err := strconv.ParseUint(adheseBid.Width, 10, 64) + width, err := strconv.ParseInt(adheseBid.Width, 10, 64) if err != nil { return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Width %v as int ", string(adheseBid.Width)))} } - height, err := strconv.ParseUint(adheseBid.Height, 10, 64) + height, err := strconv.ParseInt(adheseBid.Height, 10, 64) if err != nil { return nil, []error{err, WrapServerError(fmt.Sprintf("Could not parse Height %v as int ", string(adheseBid.Height)))} } @@ -198,16 +198,16 @@ func (a *AdheseAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidderResponse, errs } -func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData AdheseOriginData) openrtb.BidResponse { +func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData AdheseOriginData) openrtb2.BidResponse { adheseExtJson, err := json.Marshal(adheseOriginData) if err != nil { glog.Error(fmt.Sprintf("Unable to parse adhese Origin Data as JSON due to %v", err)) adheseExtJson = make([]byte, 0) } - return openrtb.BidResponse{ + return openrtb2.BidResponse{ ID: adheseExt.Id, - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ DealID: adheseExt.OrderId, CrID: adheseExt.Id, AdM: getAdMarkup(adheseBid, adheseExt), @@ -218,8 +218,8 @@ func convertAdheseBid(adheseBid AdheseBid, adheseExt AdheseExt, adheseOriginData } } -func convertAdheseOpenRtbBid(adheseBid AdheseBid) openrtb.BidResponse { - var response openrtb.BidResponse = adheseBid.OriginData +func convertAdheseOpenRtbBid(adheseBid AdheseBid) openrtb2.BidResponse { + var response openrtb2.BidResponse = adheseBid.OriginData if len(response.SeatBid) > 0 && len(response.SeatBid[0].Bid) > 0 { response.SeatBid[0].Bid[0].AdM = adheseBid.Body } diff --git a/adapters/adhese/utils.go b/adapters/adhese/utils.go index 7b09ad02924..bf1c45d2432 100644 --- a/adapters/adhese/utils.go +++ b/adapters/adhese/utils.go @@ -1,6 +1,6 @@ package adhese -import "github.com/PubMatic-OpenWrap/openrtb" +import "github.com/mxmCherry/openrtb/v15/openrtb2" type AdheseOriginData struct { Priority string `json:"priority"` @@ -23,7 +23,7 @@ type AdheseExt struct { type AdheseBid struct { Origin string `json:"origin"` - OriginData openrtb.BidResponse `json:"originData"` + OriginData openrtb2.BidResponse `json:"originData"` OriginInstance string `json:"originInstance,omitempty"` Body string `json:"body,omitempty"` Height string `json:"height"` diff --git a/adapters/adkernel/adkernel.go b/adapters/adkernel/adkernel.go index f483ba7ce49..622fa8d95ae 100644 --- a/adapters/adkernel/adkernel.go +++ b/adapters/adkernel/adkernel.go @@ -7,12 +7,12 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type adkernelAdapter struct { @@ -20,7 +20,7 @@ type adkernelAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *adkernelAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *adkernelAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, newBadInputError("No impression in the bid request")) @@ -52,10 +52,10 @@ func (adapter *adkernelAdapter) MakeRequests(request *openrtb.BidRequest, reqInf } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImpAdkernel, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) ([]openrtb2.Imp, []openrtb_ext.ExtImpAdkernel, []error) { impsCount := len(imps) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) resImpExts := make([]openrtb_ext.ExtImpAdkernel, 0, impsCount) for _, imp := range imps { @@ -74,7 +74,7 @@ func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImp return resImps, resImpExts, errors } -func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernel) error { +func validateImpression(imp *openrtb2.Imp, impExt *openrtb_ext.ExtImpAdkernel) error { if impExt.ZoneId < 1 { return newBadInputError(fmt.Sprintf("Invalid zoneId value: %d. Ignoring imp id=%s", impExt.ZoneId, imp.ID)) } @@ -88,8 +88,8 @@ func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernel) er } //Group impressions by AdKernel-specific parameters `zoneId` & `host` -func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkernel) (map[openrtb_ext.ExtImpAdkernel][]openrtb.Imp, []error) { - res := make(map[openrtb_ext.ExtImpAdkernel][]openrtb.Imp) +func dispatchImpressions(imps []openrtb2.Imp, impsExt []openrtb_ext.ExtImpAdkernel) (map[openrtb_ext.ExtImpAdkernel][]openrtb2.Imp, []error) { + res := make(map[openrtb_ext.ExtImpAdkernel][]openrtb2.Imp) errors := make([]error, 0) for idx := range imps { imp := imps[idx] @@ -100,7 +100,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } impExt := impsExt[idx] if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) } @@ -108,7 +108,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } //Alter impression info to comply with adkernel platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to adkernel platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -119,21 +119,21 @@ func compatImpression(imp *openrtb.Imp) error { return newBadInputError("Invalid impression") } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { imp.Audio = nil imp.Video = nil imp.Native = nil return nil } -func compatVideoImpression(imp *openrtb.Imp) error { +func compatVideoImpression(imp *openrtb2.Imp) error { imp.Banner = nil imp.Audio = nil imp.Native = nil return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernel, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdkernel, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -149,7 +149,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernel, error) { return &adkernelExt, nil } -func (adapter *adkernelAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *adkernelAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -173,7 +173,7 @@ func (adapter *adkernelAdapter) buildAdapterRequest(prebidBidRequest *openrtb.Bi Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernel, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps if bidRequest.Site != nil { @@ -198,7 +198,7 @@ func (adapter *adkernelAdapter) buildEndpointURL(params *openrtb_ext.ExtImpAdker } //MakeBids translates adkernel bid response to prebid-server specific format -func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -207,7 +207,7 @@ func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex newBadServerResponseError(fmt.Sprintf("Unexpected http status code: %d", response.StatusCode)), } } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{ newBadServerResponseError(fmt.Sprintf("Bad server response: %d", err)), @@ -233,7 +233,7 @@ func (adapter *adkernelAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Banner != nil { return openrtb_ext.BidTypeBanner diff --git a/adapters/adkernelAdn/adkernelAdn.go b/adapters/adkernelAdn/adkernelAdn.go index 491bead4e8b..3e62c17df31 100644 --- a/adapters/adkernelAdn/adkernelAdn.go +++ b/adapters/adkernelAdn/adkernelAdn.go @@ -7,12 +7,12 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const defaultDomain string = "tag.adkernel.com" @@ -22,7 +22,7 @@ type adkernelAdnAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *adkernelAdnAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *adkernelAdnAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, newBadInputError("No impression in the bid request")) @@ -54,10 +54,10 @@ func (adapter *adkernelAdnAdapter) MakeRequests(request *openrtb.BidRequest, req } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImpAdkernelAdn, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) ([]openrtb2.Imp, []openrtb_ext.ExtImpAdkernelAdn, []error) { impsCount := len(imps) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) resImpExts := make([]openrtb_ext.ExtImpAdkernelAdn, 0, impsCount) for _, imp := range imps { @@ -77,7 +77,7 @@ func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImp return resImps, resImpExts, errors } -func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernelAdn) error { +func validateImpression(imp *openrtb2.Imp, impExt *openrtb_ext.ExtImpAdkernelAdn) error { if impExt.PublisherID < 1 { return newBadInputError(fmt.Sprintf("Invalid pubId value. Ignoring imp id=%s", imp.ID)) } @@ -88,8 +88,8 @@ func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdkernelAdn) } //Group impressions by AdKernel-specific parameters `pubId` & `host` -func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkernelAdn) (map[openrtb_ext.ExtImpAdkernelAdn][]openrtb.Imp, []error) { - res := make(map[openrtb_ext.ExtImpAdkernelAdn][]openrtb.Imp) +func dispatchImpressions(imps []openrtb2.Imp, impsExt []openrtb_ext.ExtImpAdkernelAdn) (map[openrtb_ext.ExtImpAdkernelAdn][]openrtb2.Imp, []error) { + res := make(map[openrtb_ext.ExtImpAdkernelAdn][]openrtb2.Imp) errors := make([]error, 0) for idx := range imps { imp := imps[idx] @@ -100,7 +100,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } impExt := impsExt[idx] if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) @@ -109,7 +109,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdkerne } //Alter impression info to comply with adkernel platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to adkernel platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -120,7 +120,7 @@ func compatImpression(imp *openrtb.Imp) error { return newBadInputError("Unsupported impression has been received") } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner banner := &bannerCopy @@ -143,14 +143,14 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func compatVideoImpression(imp *openrtb.Imp) error { +func compatVideoImpression(imp *openrtb2.Imp) error { imp.Banner = nil imp.Audio = nil imp.Native = nil return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernelAdn, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdkernelAdn, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -166,7 +166,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdkernelAdn, error) return &adkernelAdnExt, nil } -func (adapter *adkernelAdnAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *adkernelAdnAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -190,7 +190,7 @@ func (adapter *adkernelAdnAdapter) buildAdapterRequest(prebidBidRequest *openrtb Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdkernelAdn, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps @@ -222,7 +222,7 @@ func (adapter *adkernelAdnAdapter) buildEndpointURL(params *openrtb_ext.ExtImpAd } //MakeBids translates adkernel bid response to prebid-server specific format -func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -231,7 +231,7 @@ func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb.BidRequest, newBadServerResponseError(fmt.Sprintf("Unexpected http status code: %d", response.StatusCode)), } } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{ newBadServerResponseError(fmt.Sprintf("Bad server response: %d", err)), @@ -257,7 +257,7 @@ func (adapter *adkernelAdnAdapter) MakeBids(internalRequest *openrtb.BidRequest, } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Banner != nil { return openrtb_ext.BidTypeBanner diff --git a/adapters/adman/adman.go b/adapters/adman/adman.go index 3c0342fe24f..6b0ab3040c6 100644 --- a/adapters/adman/adman.go +++ b/adapters/adman/adman.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // AdmanAdapter struct @@ -30,7 +30,7 @@ type admanParams struct { } // MakeRequests create bid request for adman demand -func (a *AdmanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdmanAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var admanExt openrtb_ext.ExtImpAdman var err error @@ -39,7 +39,7 @@ func (a *AdmanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} var bidderExt adapters.ExtImpBidder if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { @@ -63,7 +63,7 @@ func (a *AdmanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte return adapterRequests, errs } -func (a *AdmanAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *AdmanAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -86,7 +86,7 @@ func (a *AdmanAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Reque } // MakeBids makes the bids -func (a *AdmanAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdmanAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -99,7 +99,7 @@ func (a *AdmanAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -124,7 +124,7 @@ func (a *AdmanAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/adman/admantest/supplemental/bad_response.json b/adapters/adman/admantest/supplemental/bad_response.json index d5a28c74256..4431a328154 100644 --- a/adapters/adman/admantest/supplemental/bad_response.json +++ b/adapters/adman/admantest/supplemental/bad_response.json @@ -78,7 +78,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index b16dc0073d4..219f32b1a51 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AdmixerAdapter struct { @@ -28,7 +28,7 @@ type admixerImpExt struct { CustomParams map[string]interface{} `json:"customParams"` } -func (a *AdmixerAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) { +func (a *AdmixerAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) { rq, errs := a.makeRequest(request) if len(errs) > 0 { @@ -43,9 +43,9 @@ func (a *AdmixerAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return } -func (a *AdmixerAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *AdmixerAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ @@ -84,7 +84,7 @@ func (a *AdmixerAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Req }, errs } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -126,7 +126,7 @@ func preprocess(imp *openrtb.Imp) error { return nil } -func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -149,7 +149,7 @@ func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -172,7 +172,7 @@ func (a *AdmixerAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR return bidResponse, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/adocean/adocean.go b/adapters/adocean/adocean.go index 8310626fcec..34f815c20a7 100644 --- a/adapters/adocean/adocean.go +++ b/adapters/adocean/adocean.go @@ -13,12 +13,12 @@ import ( "strings" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const adapterVersion = "1.1.0" @@ -80,7 +80,7 @@ type AdOceanAdapter struct { measurementCode string } -func (a *AdOceanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdOceanAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impression in the bid request", @@ -119,8 +119,8 @@ func (a *AdOceanAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap func (a *AdOceanAdapter) addNewBid( requestsData []*requestData, - imp *openrtb.Imp, - request *openrtb.BidRequest, + imp *openrtb2.Imp, + request *openrtb2.BidRequest, consentString string, ) ([]*requestData, error) { var bidderExt adapters.ExtImpBidder @@ -177,7 +177,7 @@ func (a *AdOceanAdapter) addNewBid( return requestsData, nil } -func addToExistingRequest(requestsData []*requestData, newParams *openrtb_ext.ExtImpAdOcean, imp *openrtb.Imp, testImp bool) bool { +func addToExistingRequest(requestsData []*requestData, newParams *openrtb_ext.ExtImpAdOcean, imp *openrtb2.Imp, testImp bool) bool { auctionID := imp.ID for _, requestData := range requestsData { @@ -209,8 +209,8 @@ func addToExistingRequest(requestsData []*requestData, newParams *openrtb_ext.Ex func (a *AdOceanAdapter) makeURL( params *openrtb_ext.ExtImpAdOcean, - imp *openrtb.Imp, - request *openrtb.BidRequest, + imp *openrtb2.Imp, + request *openrtb2.BidRequest, slaveSizes map[string]string, consentString string, ) (*url.URL, error) { @@ -256,7 +256,7 @@ func (a *AdOceanAdapter) makeURL( return endpointURL, nil } -func getImpSizes(imp *openrtb.Imp) string { +func getImpSizes(imp *openrtb2.Imp) string { if imp.Banner == nil { return "" } @@ -264,14 +264,14 @@ func getImpSizes(imp *openrtb.Imp) string { if len(imp.Banner.Format) > 0 { sizes := make([]string, len(imp.Banner.Format)) for i, format := range imp.Banner.Format { - sizes[i] = strconv.FormatUint(format.W, 10) + "x" + strconv.FormatUint(format.H, 10) + sizes[i] = strconv.FormatInt(format.W, 10) + "x" + strconv.FormatInt(format.H, 10) } return strings.Join(sizes, "_") } if imp.Banner.W != nil && imp.Banner.H != nil { - return strconv.FormatUint(*imp.Banner.W, 10) + "x" + strconv.FormatUint(*imp.Banner.H, 10) + return strconv.FormatInt(*imp.Banner.W, 10) + "x" + strconv.FormatInt(*imp.Banner.H, 10) } return "" @@ -304,7 +304,7 @@ func setSlaveSizesParam(queryParams *url.Values, slaveSizes map[string]string, o } func (a *AdOceanAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -337,8 +337,8 @@ func (a *AdOceanAdapter) MakeBids( } price, _ := strconv.ParseFloat(bid.Price, 64) - width, _ := strconv.ParseUint(bid.Width, 10, 64) - height, _ := strconv.ParseUint(bid.Height, 10, 64) + width, _ := strconv.ParseInt(bid.Width, 10, 64) + height, _ := strconv.ParseInt(bid.Height, 10, 64) adCode, err := a.prepareAdCodeForBid(bid) if err != nil { errors = append(errors, err) @@ -346,7 +346,7 @@ func (a *AdOceanAdapter) MakeBids( } parsedResponses.Bids = append(parsedResponses.Bids, &adapters.TypedBid{ - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ID: bid.ID, ImpID: auctionID, Price: price, diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index 498bb4c7cc0..a1fc0581c66 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -8,12 +8,12 @@ import ( "net/url" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const DefaultClient = "app" @@ -50,7 +50,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } func (ads *AdopplerAdapter) MakeRequests( - req *openrtb.BidRequest, + req *openrtb2.BidRequest, info *adapters.ExtraRequestInfo, ) ( []*adapters.RequestData, @@ -69,9 +69,9 @@ func (ads *AdopplerAdapter) MakeRequests( continue } - var r openrtb.BidRequest = *req + var r openrtb2.BidRequest = *req r.ID = req.ID + "-" + ext.AdUnit - r.Imp = []openrtb.Imp{imp} + r.Imp = []openrtb2.Imp{imp} body, err := json.Marshal(r) if err != nil { @@ -99,7 +99,7 @@ func (ads *AdopplerAdapter) MakeRequests( } func (ads *AdopplerAdapter) MakeBids( - intReq *openrtb.BidRequest, + intReq *openrtb2.BidRequest, extReq *adapters.RequestData, resp *adapters.ResponseData, ) ( @@ -119,7 +119,7 @@ func (ads *AdopplerAdapter) MakeBids( return nil, []error{err} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err := json.Unmarshal(resp.Body, &bidResp) if err != nil { err := &errortypes.BadServerResponse{ diff --git a/adapters/adoppler/adopplertest/supplemental/invalid-response.json b/adapters/adoppler/adopplertest/supplemental/invalid-response.json index d0a7d2ef84b..83aa35f0ec1 100644 --- a/adapters/adoppler/adopplertest/supplemental/invalid-response.json +++ b/adapters/adoppler/adopplertest/supplemental/invalid-response.json @@ -49,7 +49,7 @@ ], "expectedMakeBidsErrors":[ { - "value":"invalid body: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value":"invalid body: json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison":"literal" } ] diff --git a/adapters/adot/adot.go b/adapters/adot/adot.go index fcbb5a2906d..83517429d52 100644 --- a/adapters/adot/adot.go +++ b/adapters/adot/adot.go @@ -3,11 +3,11 @@ package adot import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "net/http" ) @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var reqJSON []byte var err error @@ -53,7 +53,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex // MakeBids unpacks the server's response into Bids. // The bidder return a status code 204 when it cannot delivery an ad. -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -70,7 +70,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -96,7 +96,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest } // getMediaTypeForBid determines which type of bid. -func getMediaTypeForBid(bid *openrtb.Bid) (openrtb_ext.BidType, error) { +func getMediaTypeForBid(bid *openrtb2.Bid) (openrtb_ext.BidType, error) { if bid == nil { return "", fmt.Errorf("the bid request object is nil") } diff --git a/adapters/adot/adot_test.go b/adapters/adot/adot_test.go index 2e6e74861d4..57aacc5a595 100644 --- a/adapters/adot/adot_test.go +++ b/adapters/adot/adot_test.go @@ -2,11 +2,11 @@ package adot import ( "encoding/json" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "testing" ) @@ -31,7 +31,7 @@ func TestMediaTypeError(t *testing.T) { assert.Error(t, err) byteInvalid, _ := json.Marshal(&adotBidExt{Adot: bidExt{"invalid"}}) - _, err = getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteInvalid)}) + _, err = getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteInvalid)}) assert.Error(t, err) } @@ -59,17 +59,17 @@ func TestMediaTypeForBid(t *testing.T) { byteVideo, _ := json.Marshal(&adotBidExt{Adot: bidExt{"video"}}) byteNative, _ := json.Marshal(&adotBidExt{Adot: bidExt{"native"}}) - bidTypeBanner, _ := getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteBanner)}) + bidTypeBanner, _ := getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteBanner)}) if bidTypeBanner != openrtb_ext.BidTypeBanner { t.Errorf("the type is not the valid one. actual: %v, expected: %v", bidTypeBanner, openrtb_ext.BidTypeBanner) } - bidTypeVideo, _ := getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteVideo)}) + bidTypeVideo, _ := getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteVideo)}) if bidTypeVideo != openrtb_ext.BidTypeVideo { t.Errorf("the type is not the valid one. actual: %v, expected: %v", bidTypeVideo, openrtb_ext.BidTypeVideo) } - bidTypeNative, _ := getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteNative)}) + bidTypeNative, _ := getMediaTypeForBid(&openrtb2.Bid{Ext: json.RawMessage(byteNative)}) if bidTypeNative != openrtb_ext.BidTypeNative { t.Errorf("the type is not the valid one. actual: %v, expected: %v", bidTypeNative, openrtb_ext.BidTypeVideo) } diff --git a/adapters/adot/adottest/supplemental/unmarshal_error.json b/adapters/adot/adottest/supplemental/unmarshal_error.json index a87e1189a62..3094fa865e4 100644 --- a/adapters/adot/adottest/supplemental/unmarshal_error.json +++ b/adapters/adot/adottest/supplemental/unmarshal_error.json @@ -54,7 +54,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/adpone/adpone.go b/adapters/adpone/adpone.go index ec4cba75f87..cdbc632efef 100644 --- a/adapters/adpone/adpone.go +++ b/adapters/adpone/adpone.go @@ -8,9 +8,9 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Builder builds a new instance of the Adpone adapter for the given bidder with the given config. @@ -26,7 +26,7 @@ type adponeAdapter struct { } func (adapter *adponeAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -75,7 +75,7 @@ const unexpectedStatusCodeFormat = "" + "Unexpected status code: %d. Run with request.debug = 1 for more info" func (adapter *adponeAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -99,7 +99,7 @@ func (adapter *adponeAdapter) MakeBids( return nil, []error{err} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{err} } diff --git a/adapters/adpone/adponetest/supplemental/bad_response.json b/adapters/adpone/adponetest/supplemental/bad_response.json index 9cbc8b5d9c2..68da7064b97 100644 --- a/adapters/adpone/adponetest/supplemental/bad_response.json +++ b/adapters/adpone/adponetest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/adprime/adprime.go b/adapters/adprime/adprime.go index 053999fd5d1..3b8f7a69b0f 100644 --- a/adapters/adprime/adprime.go +++ b/adapters/adprime/adprime.go @@ -5,12 +5,12 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // AdprimeAdapter struct @@ -27,7 +27,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests create bid request for adprime demand -func (a *AdprimeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdprimeAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var err error var tagID string @@ -36,7 +36,7 @@ func (a *AdprimeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} tagID, err = jsonparser.GetString(reqCopy.Imp[0].Ext, "bidder", "TagID") if err != nil { @@ -55,7 +55,7 @@ func (a *AdprimeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return adapterRequests, errs } -func (a *AdprimeAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *AdprimeAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -78,7 +78,7 @@ func (a *AdprimeAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Req } // MakeBids makes the bids -func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -97,7 +97,7 @@ func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -122,7 +122,7 @@ func (a *AdprimeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/adprime/adprimetest/supplemental/bad_response.json b/adapters/adprime/adprimetest/supplemental/bad_response.json index 329e9c7269f..435529a485c 100644 --- a/adapters/adprime/adprimetest/supplemental/bad_response.json +++ b/adapters/adprime/adprimetest/supplemental/bad_response.json @@ -78,7 +78,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index 070ede40feb..04aea18e515 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AdtargetAdapter struct { @@ -20,7 +20,7 @@ type adtargetImpExt struct { Adtarget openrtb_ext.ExtImpAdtarget `json:"adtarget"` } -func (a *AdtargetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdtargetAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { totalImps := len(request.Imp) errors := make([]error, 0, totalImps) @@ -55,7 +55,7 @@ func (a *AdtargetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada reqs := make([]*adapters.RequestData, 0, totalReqs) imps := request.Imp - request.Imp = make([]openrtb.Imp, 0, len(imps)) + request.Imp = make([]openrtb2.Imp, 0, len(imps)) for sourceId, impIndexes := range imp2source { request.Imp = request.Imp[:0] @@ -80,7 +80,7 @@ func (a *AdtargetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada return reqs, errors } -func (a *AdtargetAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdtargetAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { if httpRes.StatusCode == http.StatusNoContent { return nil, nil @@ -90,7 +90,7 @@ func (a *AdtargetAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters. Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", httpRes.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("error while decoding response, err: %s", err), @@ -137,7 +137,7 @@ func (a *AdtargetAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters. return bidResponse, errors } -func validateImpressionAndSetExt(imp *openrtb.Imp) (int, error) { +func validateImpressionAndSetExt(imp *openrtb2.Imp) (int, error) { if imp.Banner == nil && imp.Video == nil { return 0, &errortypes.BadInput{ diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index 7d8f6099fbf..852280565d1 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AdtelligentAdapter struct { @@ -20,7 +20,7 @@ type adtelligentImpExt struct { Adtelligent openrtb_ext.ExtImpAdtelligent `json:"adtelligent"` } -func (a *AdtelligentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AdtelligentAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { totalImps := len(request.Imp) errors := make([]error, 0, totalImps) @@ -55,7 +55,7 @@ func (a *AdtelligentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * reqs := make([]*adapters.RequestData, 0, totalReqs) imps := request.Imp - request.Imp = make([]openrtb.Imp, 0, len(imps)) + request.Imp = make([]openrtb2.Imp, 0, len(imps)) for sourceId, impIds := range imp2source { request.Imp = request.Imp[:0] @@ -85,13 +85,13 @@ func (a *AdtelligentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * } -func (a *AdtelligentAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AdtelligentAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { if httpRes.StatusCode == http.StatusNoContent { return nil, nil } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("error while decoding response, err: %s", err), @@ -138,7 +138,7 @@ func (a *AdtelligentAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapte return bidResponse, errors } -func validateImpression(imp *openrtb.Imp) (int, error) { +func validateImpression(imp *openrtb2.Imp) (int, error) { if imp.Banner == nil && imp.Video == nil { return 0, &errortypes.BadInput{ diff --git a/adapters/advangelists/advangelists.go b/adapters/advangelists/advangelists.go index 249e3282481..d6b4b53a2e5 100644 --- a/adapters/advangelists/advangelists.go +++ b/adapters/advangelists/advangelists.go @@ -6,12 +6,12 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AdvangelistsAdapter struct { @@ -19,7 +19,7 @@ type AdvangelistsAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *AdvangelistsAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *AdvangelistsAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "No impression in the bid request"}) @@ -51,9 +51,9 @@ func (adapter *AdvangelistsAdapter) MakeRequests(request *openrtb.BidRequest, re } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImpAdvangelists, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) ([]openrtb2.Imp, []openrtb_ext.ExtImpAdvangelists, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) + resImps := make([]openrtb2.Imp, 0, len(imps)) resImpExts := make([]openrtb_ext.ExtImpAdvangelists, 0, len(imps)) for _, imp := range imps { @@ -73,7 +73,7 @@ func getImpressionsInfo(imps []openrtb.Imp) ([]openrtb.Imp, []openrtb_ext.ExtImp return resImps, resImpExts, errors } -func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdvangelists) error { +func validateImpression(imp *openrtb2.Imp, impExt *openrtb_ext.ExtImpAdvangelists) error { if impExt.PublisherID == "" { return &errortypes.BadInput{Message: "No pubid value provided"} } @@ -81,8 +81,8 @@ func validateImpression(imp *openrtb.Imp, impExt *openrtb_ext.ExtImpAdvangelists } //Group impressions by advangelists-specific parameters `pubid -func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdvangelists) (map[openrtb_ext.ExtImpAdvangelists][]openrtb.Imp, []error) { - res := make(map[openrtb_ext.ExtImpAdvangelists][]openrtb.Imp) +func dispatchImpressions(imps []openrtb2.Imp, impsExt []openrtb_ext.ExtImpAdvangelists) (map[openrtb_ext.ExtImpAdvangelists][]openrtb2.Imp, []error) { + res := make(map[openrtb_ext.ExtImpAdvangelists][]openrtb2.Imp) errors := make([]error, 0) for idx, imp := range imps { err := compatImpression(&imp) @@ -92,7 +92,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdvange } impExt := impsExt[idx] if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) @@ -101,7 +101,7 @@ func dispatchImpressions(imps []openrtb.Imp, impsExt []openrtb_ext.ExtImpAdvange } //Alter impression info to comply with advangelists platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to advangelists platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -109,7 +109,7 @@ func compatImpression(imp *openrtb.Imp) error { return nil } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner banner := &bannerCopy @@ -127,7 +127,7 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdvangelists, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpAdvangelists, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -143,7 +143,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpAdvangelists, error) return &advangelistsExt, nil } -func (adapter *AdvangelistsAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *AdvangelistsAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -167,7 +167,7 @@ func (adapter *AdvangelistsAdapter) buildAdapterRequest(prebidBidRequest *openrt Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpAdvangelists, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -197,7 +197,7 @@ func (adapter *AdvangelistsAdapter) buildEndpointURL(params *openrtb_ext.ExtImpA } //MakeBids translates advangelists bid response to prebid-server specific format -func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var msg = "" if response.StatusCode == http.StatusNoContent { return nil, nil @@ -206,7 +206,7 @@ func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb.BidRequest msg = fmt.Sprintf("Unexpected http status code: %d", response.StatusCode) return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg = fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} @@ -230,7 +230,7 @@ func (adapter *AdvangelistsAdapter) MakeBids(internalRequest *openrtb.BidRequest } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo diff --git a/adapters/aja/aja.go b/adapters/aja/aja.go index afd9c6d7131..fb9d37e0359 100644 --- a/adapters/aja/aja.go +++ b/adapters/aja/aja.go @@ -5,21 +5,21 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type AJAAdapter struct { endpoint string } -func (a *AJAAdapter) MakeRequests(bidReq *openrtb.BidRequest, extraInfo *adapters.ExtraRequestInfo) (adapterReqs []*adapters.RequestData, errs []error) { +func (a *AJAAdapter) MakeRequests(bidReq *openrtb2.BidRequest, extraInfo *adapters.ExtraRequestInfo) (adapterReqs []*adapters.RequestData, errs []error) { // split imps by tagid tagIDs := []string{} - impsByTagID := map[string][]openrtb.Imp{} + impsByTagID := map[string][]openrtb2.Imp{} for _, imp := range bidReq.Imp { extAJA, err := parseExtAJA(imp) if err != nil { @@ -54,7 +54,7 @@ func (a *AJAAdapter) MakeRequests(bidReq *openrtb.BidRequest, extraInfo *adapter return } -func parseExtAJA(imp openrtb.Imp) (openrtb_ext.ExtImpAJA, error) { +func parseExtAJA(imp openrtb2.Imp) (openrtb_ext.ExtImpAJA, error) { var ( extImp adapters.ExtImpBidder extAJA openrtb_ext.ExtImpAJA @@ -75,7 +75,7 @@ func parseExtAJA(imp openrtb.Imp) (openrtb_ext.ExtImpAJA, error) { return extAJA, nil } -func (a *AJAAdapter) MakeBids(bidReq *openrtb.BidRequest, adapterReq *adapters.RequestData, adapterResp *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AJAAdapter) MakeBids(bidReq *openrtb2.BidRequest, adapterReq *adapters.RequestData, adapterResp *adapters.ResponseData) (*adapters.BidderResponse, []error) { if adapterResp.StatusCode != http.StatusOK { if adapterResp.StatusCode == http.StatusNoContent { return nil, nil @@ -90,7 +90,7 @@ func (a *AJAAdapter) MakeBids(bidReq *openrtb.BidRequest, adapterReq *adapters.R }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(adapterResp.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Failed to unmarshal bid response: %s", err.Error()), diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index ddd0c0373da..15a9e4d806e 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -7,11 +7,11 @@ import ( "net/url" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const vastImpressionFormat = "" @@ -49,9 +49,9 @@ type amxExt struct { Bidder openrtb_ext.ExtImpAMX `json:"bidder"` } -func ensurePublisherWithID(pub *openrtb.Publisher, publisherID string) openrtb.Publisher { +func ensurePublisherWithID(pub *openrtb2.Publisher, publisherID string) openrtb2.Publisher { if pub == nil { - return openrtb.Publisher{ID: publisherID} + return openrtb2.Publisher{ID: publisherID} } pubCopy := *pub @@ -60,7 +60,7 @@ func ensurePublisherWithID(pub *openrtb.Publisher, publisherID string) openrtb.P } // MakeRequests creates AMX adapter requests -func (adapter *AMXAdapter) MakeRequests(request *openrtb.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { +func (adapter *AMXAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { reqCopy := *request var publisherID string @@ -119,7 +119,7 @@ type amxBidExt struct { } // MakeBids will parse the bids from the AMX server -func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *AMXAdapter) MakeBids(request *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if http.StatusNoContent == response.StatusCode { @@ -140,7 +140,7 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -196,7 +196,7 @@ func pixelToImpression(pixel string) string { return fmt.Sprintf(vastImpressionFormat, pixel) } -func interpolateImpressions(bid openrtb.Bid, ext amxBidExt) string { +func interpolateImpressions(bid openrtb2.Bid, ext amxBidExt) string { var buffer strings.Builder if bid.NURL != "" { buffer.WriteString(pixelToImpression(bid.NURL)) diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index 6fc850cb2cc..8404520fefc 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" @@ -48,7 +48,7 @@ func TestEndpointQueryStringMalformed(t *testing.T) { func TestMakeRequestsTagID(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ Endpoint: amxTestEndpoint}) @@ -75,12 +75,12 @@ func TestMakeRequestsTagID(t *testing.T) { } for _, tc := range tests { - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "sample_imp_1", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} @@ -94,16 +94,16 @@ func TestMakeRequestsTagID(t *testing.T) { imp1.TagID = tc.tagID } - inputRequest := openrtb.BidRequest{ - User: &openrtb.User{}, - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{}, + inputRequest := openrtb2.BidRequest{ + User: &openrtb2.User{}, + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{}, } actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) - var body openrtb.BidRequest + var body openrtb2.BidRequest assert.Nil(t, json.Unmarshal(actualAdapterRequests[0].Body, &body)) assert.Equal(t, tc.expectedTagID, body.Imp[0].TagID) } @@ -111,7 +111,7 @@ func TestMakeRequestsTagID(t *testing.T) { func TestMakeRequestsPublisherId(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ Endpoint: amxTestEndpoint}) @@ -137,12 +137,12 @@ func TestMakeRequestsPublisherId(t *testing.T) { } for _, tc := range tests { - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "sample_imp_1", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} @@ -152,15 +152,15 @@ func TestMakeRequestsPublisherId(t *testing.T) { fmt.Sprintf(`{"bidder":{"tagId":"%s"}}`, tc.extTagID)) } - inputRequest := openrtb.BidRequest{ - User: &openrtb.User{ID: "example_user_id"}, - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{}, + inputRequest := openrtb2.BidRequest{ + User: &openrtb2.User{ID: "example_user_id"}, + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{}, ID: "1234", } if tc.publisherID != "" || !tc.blankNil { - inputRequest.Site.Publisher = &openrtb.Publisher{ + inputRequest.Site.Publisher = &openrtb2.Publisher{ ID: tc.publisherID, } } @@ -168,7 +168,7 @@ func TestMakeRequestsPublisherId(t *testing.T) { actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) - var body openrtb.BidRequest + var body openrtb2.BidRequest assert.Nil(t, json.Unmarshal(actualAdapterRequests[0].Body, &body)) assert.Equal(t, tc.expectedPublisherID, body.Site.Publisher.ID) } @@ -182,7 +182,7 @@ func countImpressionPixels(vast string) int { } func TestVideoImpInsertion(t *testing.T) { - markup := interpolateImpressions(openrtb.Bid{ + markup := interpolateImpressions(openrtb2.Bid{ AdM: sampleVastADM, NURL: "https://example2.com/nurl", }, amxBidExt{Himp: []string{"https://example.com/pixel.png"}}) @@ -191,14 +191,14 @@ func TestVideoImpInsertion(t *testing.T) { assert.Equal(t, 3, countImpressionPixels(markup), "should have 3 Impression pixels") // make sure that a blank NURL won't result in a blank impression tag - markup = interpolateImpressions(openrtb.Bid{ + markup = interpolateImpressions(openrtb2.Bid{ AdM: sampleVastADM, NURL: "", }, amxBidExt{}) assert.Equal(t, 1, countImpressionPixels(markup), "should have 1 impression pixels") // we should also ignore blank ext.Himp pixels - markup = interpolateImpressions(openrtb.Bid{ + markup = interpolateImpressions(openrtb2.Bid{ AdM: sampleVastADM, NURL: "https://example-nurl.com/nurl", }, amxBidExt{Himp: []string{"", "", ""}}) @@ -206,7 +206,7 @@ func TestVideoImpInsertion(t *testing.T) { } func TestNoDisplayImpInsertion(t *testing.T) { - data := interpolateImpressions(openrtb.Bid{ + data := interpolateImpressions(openrtb2.Bid{ AdM: sampleDisplayADM, NURL: "https://example2.com/nurl", }, amxBidExt{Himp: []string{"https://example.com/pixel.png"}}) diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go index cdeafa0f426..0d07f4b583a 100644 --- a/adapters/applogy/applogy.go +++ b/adapters/applogy/applogy.go @@ -6,18 +6,18 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ApplogyAdapter struct { endpoint string } -func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ApplogyAdapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -92,7 +92,7 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E return result, errs } -func (a *ApplogyAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ApplogyAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error switch responseData.StatusCode { @@ -110,7 +110,7 @@ func (a *ApplogyAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.Reque }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse err := json.Unmarshal(responseData.Body, &bidResponse) if err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index 847c11a25ce..a56f124d6d4 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -17,11 +17,11 @@ import ( "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const defaultPlatformID int = 5 @@ -163,9 +163,9 @@ func (a *AppNexusAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder } if anReq.Imp[i].Banner != nil && params.Position != "" { if params.Position == "above" { - anReq.Imp[i].Banner.Pos = openrtb.AdPositionAboveTheFold.Ptr() + anReq.Imp[i].Banner.Pos = openrtb2.AdPositionAboveTheFold.Ptr() } else if params.Position == "below" { - anReq.Imp[i].Banner.Pos = openrtb.AdPositionBelowTheFold.Ptr() + anReq.Imp[i].Banner.Pos = openrtb2.AdPositionBelowTheFold.Ptr() } } @@ -245,7 +245,7 @@ func (a *AppNexusAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder debug.ResponseBody = responseBody } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, err @@ -288,7 +288,7 @@ func (a *AppNexusAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder return bids, nil } -func (a *AppNexusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AppNexusAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { memberIds := make(map[string]bool) errs := make([]error, 0, len(request.Imp)) @@ -391,9 +391,9 @@ func generatePodId() string { return fmt.Sprint(val) } -func groupByPods(imps []openrtb.Imp) map[string]([]openrtb.Imp) { +func groupByPods(imps []openrtb2.Imp) map[string]([]openrtb2.Imp) { // find number of pods in response - podImps := make(map[string][]openrtb.Imp) + podImps := make(map[string][]openrtb2.Imp) for _, imp := range imps { pod := strings.Split(imp.ID, "_")[0] podImps[pod] = append(podImps[pod], imp) @@ -401,7 +401,7 @@ func groupByPods(imps []openrtb.Imp) map[string]([]openrtb.Imp) { return podImps } -func marshalAndSetRequestExt(request *openrtb.BidRequest, requestExtension appnexusReqExt, errs []error) { +func marshalAndSetRequestExt(request *openrtb2.BidRequest, requestExtension appnexusReqExt, errs []error) { var err error request.Ext, err = json.Marshal(requestExtension) if err != nil { @@ -409,7 +409,7 @@ func marshalAndSetRequestExt(request *openrtb.BidRequest, requestExtension appne } } -func splitRequests(imps []openrtb.Imp, request *openrtb.BidRequest, requestExtension appnexusReqExt, uri string, errs []error) ([]*adapters.RequestData, []error) { +func splitRequests(imps []openrtb2.Imp, request *openrtb2.BidRequest, requestExtension appnexusReqExt, uri string, errs []error) ([]*adapters.RequestData, []error) { // Initial capacity for future array of requests, memory optimization. // Let's say there are 35 impressions and limit impressions per request equals to 10. @@ -465,7 +465,7 @@ func keys(m map[string]bool) []string { // preprocess mutates the imp to get it ready to send to appnexus. // // It returns the member param, if it exists, and an error if anything went wrong during the preprocessing. -func preprocess(imp *openrtb.Imp, defaultDisplayManagerVer string) (string, error) { +func preprocess(imp *openrtb2.Imp, defaultDisplayManagerVer string) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return "", err @@ -503,9 +503,9 @@ func preprocess(imp *openrtb.Imp, defaultDisplayManagerVer string) (string, erro if imp.Banner != nil { bannerCopy := *imp.Banner if appnexusExt.Position == "above" { - bannerCopy.Pos = openrtb.AdPositionAboveTheFold.Ptr() + bannerCopy.Pos = openrtb2.AdPositionAboveTheFold.Ptr() } else if appnexusExt.Position == "below" { - bannerCopy.Pos = openrtb.AdPositionBelowTheFold.Ptr() + bannerCopy.Pos = openrtb2.AdPositionBelowTheFold.Ptr() } // Fixes #307 @@ -552,7 +552,7 @@ func makeKeywordStr(keywords []*openrtb_ext.ExtImpAppnexusKeyVal) string { return strings.Join(kvs, ",") } -func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -567,7 +567,7 @@ func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/appnexus/appnexus_test.go b/adapters/appnexus/appnexus_test.go index 635563a14d3..19aca43897a 100644 --- a/adapters/appnexus/appnexus_test.go +++ b/adapters/appnexus/appnexus_test.go @@ -17,10 +17,10 @@ import ( "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func TestJsonSamples(t *testing.T) { @@ -63,16 +63,16 @@ func TestMemberQueryParam(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) result, err := a.MakeRequests(&req, &reqInfo) @@ -80,7 +80,7 @@ func TestMemberQueryParam(t *testing.T) { assert.Len(t, result, 1, "Only one request should be returned") var error error - var reqData *openrtb.BidRequest + var reqData *openrtb2.BidRequest error = json.Unmarshal(result[0].Body, &reqData) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -101,28 +101,28 @@ func TestVideoSinglePodManyImps(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_3", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_4", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_5", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_6", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_7", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_8", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_9", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_10", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_11", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_12", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_13", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_14", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_3", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_4", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_5", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_6", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_7", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_8", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_9", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_10", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_11", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_12", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_13", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_14", Ext: []byte(impExt)}) res, err := a.MakeRequests(&req, &reqInfo) @@ -130,7 +130,7 @@ func TestVideoSinglePodManyImps(t *testing.T) { assert.Len(t, res, 2, "Two requests should be returned") var error error - var reqData1 *openrtb.BidRequest + var reqData1 *openrtb2.BidRequest error = json.Unmarshal(res[0].Body, &reqData1) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -140,7 +140,7 @@ func TestVideoSinglePodManyImps(t *testing.T) { adPodId1 := reqDataExt1.Appnexus.AdPodId - var reqData2 *openrtb.BidRequest + var reqData2 *openrtb2.BidRequest error = json.Unmarshal(res[1].Body, &reqData2) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -161,20 +161,20 @@ func TestVideoTwoPods(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_2", Ext: []byte(impExt)}) res, err := a.MakeRequests(&req, &reqInfo) @@ -182,7 +182,7 @@ func TestVideoTwoPods(t *testing.T) { assert.Len(t, res, 2, "Two request should be returned") var error error - var reqData1 *openrtb.BidRequest + var reqData1 *openrtb2.BidRequest error = json.Unmarshal(res[0].Body, &reqData1) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -192,7 +192,7 @@ func TestVideoTwoPods(t *testing.T) { adPodId1 := reqDataExt1.Appnexus.AdPodId - var reqData2 *openrtb.BidRequest + var reqData2 *openrtb2.BidRequest error = json.Unmarshal(res[1].Body, &reqData2) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -213,32 +213,32 @@ func TestVideoTwoPodsManyImps(t *testing.T) { var reqInfo adapters.ExtraRequestInfo reqInfo.PbsEntryPoint = "video" - var req openrtb.BidRequest + var req openrtb2.BidRequest req.ID = "test_id" reqExt := `{"prebid":{}}` impExt := `{"bidder":{"placementId":123}}` req.Ext = []byte(reqExt) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "1_2", Ext: []byte(impExt)}) - - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_0", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_1", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_2", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_3", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_4", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_5", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_6", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_7", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_8", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_9", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_10", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_11", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_12", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_13", Ext: []byte(impExt)}) - req.Imp = append(req.Imp, openrtb.Imp{ID: "2_14", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "1_2", Ext: []byte(impExt)}) + + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_0", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_1", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_2", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_3", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_4", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_5", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_6", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_7", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_8", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_9", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_10", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_11", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_12", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_13", Ext: []byte(impExt)}) + req.Imp = append(req.Imp, openrtb2.Imp{ID: "2_14", Ext: []byte(impExt)}) res, err := a.MakeRequests(&req, &reqInfo) @@ -246,7 +246,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { assert.Len(t, res, 3, "Three requests should be returned") var error error - var reqData1 *openrtb.BidRequest + var reqData1 *openrtb2.BidRequest error = json.Unmarshal(res[0].Body, &reqData1) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -254,7 +254,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { error = json.Unmarshal(reqData1.Ext, &reqDataExt1) assert.NoError(t, error, "Response ext unmarshalling error should be nil") - var reqData2 *openrtb.BidRequest + var reqData2 *openrtb2.BidRequest error = json.Unmarshal(res[1].Body, &reqData2) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -262,7 +262,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { error = json.Unmarshal(reqData2.Ext, &reqDataExt2) assert.NoError(t, error, "Response ext unmarshalling error should be nil") - var reqData3 *openrtb.BidRequest + var reqData3 *openrtb2.BidRequest error = json.Unmarshal(res[2].Body, &reqData3) assert.NoError(t, error, "Response body unmarshalling error should be nil") @@ -284,7 +284,7 @@ func TestVideoTwoPodsManyImps(t *testing.T) { // ---------------------------------------------------------------------------- // Code below this line tests the legacy, non-openrtb code flow. It can be deleted after we -// clean up the existing code and make everything openrtb. +// clean up the existing code and make everything openrtb2. type anTagInfo struct { code string @@ -323,7 +323,7 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -336,14 +336,14 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: breq.ID, BidID: "a-random-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "Buyer Member ID", - Bid: make([]openrtb.Bid, 0, 2), + Bid: make([]openrtb2.Bid, 0, 2), }, }, } @@ -413,11 +413,11 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Empty imp.banner.format array"), http.StatusInternalServerError) return } - if andata.tags[i].position == "above" && *imp.Banner.Pos != openrtb.AdPosition(1) { + if andata.tags[i].position == "above" && *imp.Banner.Pos != openrtb2.AdPosition(1) { http.Error(w, fmt.Sprintf("Mismatch in position - expected 1 for atf"), http.StatusInternalServerError) return } - if andata.tags[i].position == "below" && *imp.Banner.Pos != openrtb.AdPosition(3) { + if andata.tags[i].position == "below" && *imp.Banner.Pos != openrtb2.AdPosition(3) { http.Error(w, fmt.Sprintf("Mismatch in position - expected 3 for btf"), http.StatusInternalServerError) return } @@ -440,7 +440,7 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { } } - resBid := openrtb.Bid{ + resBid := openrtb2.Bid{ ID: "random-id", ImpID: imp.ID, Price: andata.tags[i].bid, @@ -449,7 +449,7 @@ func DummyAppNexusServer(w http.ResponseWriter, r *http.Request) { } if imp.Video != nil { - resBid.Attr = []openrtb.CreativeAttribute{openrtb.CreativeAttribute(6)} + resBid.Attr = []openrtb2.CreativeAttribute{openrtb2.CreativeAttribute(6)} } resp.SeatBid[0].Bid = append(resp.SeatBid[0].Bid, resBid) } @@ -566,7 +566,7 @@ func TestAppNexusLegacyBasicResponse(t *testing.T) { pbin.AdUnits[i] = pbs.AdUnit{ Code: tag.code, MediaTypes: []string{tag.mediaType}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 600, diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index a74c51d9ecb..2966bbc8d3a 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -16,11 +16,11 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/util/maputil" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) -var supportedBannerHeights = map[uint64]bool{ +var supportedBannerHeights = map[int64]bool{ 50: true, 250: true, } @@ -40,7 +40,7 @@ type facebookReqExt struct { AuthID string `json:"authentication_id"` } -func (this *FacebookAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (this *FacebookAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impressions provided", @@ -62,7 +62,7 @@ func (this *FacebookAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * return this.buildRequests(request) } -func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { +func (this *FacebookAdapter) buildRequests(request *openrtb2.BidRequest) ([]*adapters.RequestData, []error) { // Documentation suggests bid request splitting by impression so that each // request only represents a single impression reqs := make([]*adapters.RequestData, 0, len(request.Imp)) @@ -77,7 +77,7 @@ func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adap // Make a copy of the request so that we don't change the original request which // is shared across multiple threads fbreq := *request - fbreq.Imp = []openrtb.Imp{imp} + fbreq.Imp = []openrtb2.Imp{imp} if err := this.modifyRequest(&fbreq); err != nil { errs = append(errs, err) @@ -109,14 +109,14 @@ func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adap // The authentication ID is a sha256 hmac hash encoded as a hex string, based on // the app secret and the ID of the bid request -func (this *FacebookAdapter) makeAuthID(req *openrtb.BidRequest) string { +func (this *FacebookAdapter) makeAuthID(req *openrtb2.BidRequest) string { h := hmac.New(sha256.New, []byte(this.appSecret)) h.Write([]byte(req.ID)) return hex.EncodeToString(h.Sum(nil)) } -func (this *FacebookAdapter) modifyRequest(out *openrtb.BidRequest) error { +func (this *FacebookAdapter) modifyRequest(out *openrtb2.BidRequest) error { if len(out.Imp) != 1 { panic("each bid request to facebook should only have a single impression") } @@ -146,7 +146,7 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb.BidRequest) error { if out.App != nil { app := *out.App - app.Publisher = &openrtb.Publisher{ID: pubId} + app.Publisher = &openrtb2.Publisher{ID: pubId} out.App = &app } @@ -157,7 +157,7 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb.BidRequest) error { return nil } -func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { +func (this *FacebookAdapter) modifyImp(out *openrtb2.Imp) error { impType, ok := resolveImpType(out) if !ok { return &errortypes.BadInput{ @@ -176,8 +176,8 @@ func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { out.Banner = &bannerCopy if out.Instl == 1 { - out.Banner.W = openrtb.Uint64Ptr(0) - out.Banner.H = openrtb.Uint64Ptr(0) + out.Banner.W = openrtb2.Int64Ptr(0) + out.Banner.H = openrtb2.Int64Ptr(0) out.Banner.Format = nil return nil @@ -205,14 +205,14 @@ func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error { } /* This will get overwritten post-serialization */ - out.Banner.W = openrtb.Uint64Ptr(0) + out.Banner.W = openrtb2.Int64Ptr(0) out.Banner.Format = nil } return nil } -func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb.Imp) (string, string, error) { +func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb2.Imp) (string, string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(out.Ext, &bidderExt); err != nil { return "", "", &errortypes.BadInput{ @@ -264,7 +264,7 @@ func (this *FacebookAdapter) extractPlacementAndPublisher(out *openrtb.Imp) (str // XXX: This entire function is just a hack to get around mxmCherry 11.0.0 limitations, without // having to fork the library and maintain our own branch -func modifyImpCustom(jsonData []byte, imp *openrtb.Imp) ([]byte, error) { +func modifyImpCustom(jsonData []byte, imp *openrtb2.Imp) ([]byte, error) { impType, ok := resolveImpType(imp) if ok == false { panic("processing an invalid impression") @@ -335,7 +335,7 @@ func modifyImpCustom(jsonData []byte, imp *openrtb.Imp) ([]byte, error) { } } -func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (this *FacebookAdapter) MakeBids(request *openrtb2.BidRequest, adapterRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { /* No bid response */ if response.StatusCode == http.StatusNoContent { return nil, nil @@ -349,7 +349,7 @@ func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterReques }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -394,7 +394,7 @@ func (this *FacebookAdapter) MakeBids(request *openrtb.BidRequest, adapterReques return out, errs } -func resolveBidType(bid *openrtb.Bid, req *openrtb.BidRequest) openrtb_ext.BidType { +func resolveBidType(bid *openrtb2.Bid, req *openrtb2.BidRequest) openrtb_ext.BidType { for _, imp := range req.Imp { if bid.ImpID == imp.ID { if typ, ok := resolveImpType(&imp); ok { @@ -408,7 +408,7 @@ func resolveBidType(bid *openrtb.Bid, req *openrtb.BidRequest) openrtb_ext.BidTy panic(fmt.Sprintf("Invalid bid imp ID %s does not match any imp IDs from the original bid request", bid.ImpID)) } -func resolveImpType(imp *openrtb.Imp) (openrtb_ext.BidType, bool) { +func resolveImpType(imp *openrtb2.Imp) (openrtb_ext.BidType, bool) { if imp.Banner != nil { return openrtb_ext.BidTypeBanner, true } diff --git a/adapters/avocet/avocet.go b/adapters/avocet/avocet.go index ef2314e7ebb..d4daa076162 100644 --- a/adapters/avocet/avocet.go +++ b/adapters/avocet/avocet.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // AvocetAdapter implements a adapters.Bidder compatible with the Avocet advertising platform. @@ -18,7 +18,7 @@ type AvocetAdapter struct { Endpoint string } -func (a *AvocetAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *AvocetAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, nil } @@ -50,7 +50,7 @@ type avocetBidExtension struct { DealPriority int `json:"deal_priority"` } -func (a *AvocetAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *AvocetAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -68,7 +68,7 @@ func (a *AvocetAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var br openrtb.BidResponse + var br openrtb2.BidResponse err := json.Unmarshal(response.Body, &br) if err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -105,12 +105,12 @@ func (a *AvocetAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe } // getBidType returns the openrtb_ext.BidType for the provided bid. -func getBidType(bid openrtb.Bid, ext avocetBidExt) openrtb_ext.BidType { +func getBidType(bid openrtb2.Bid, ext avocetBidExt) openrtb_ext.BidType { if ext.Avocet.Duration != 0 { return openrtb_ext.BidTypeVideo } switch bid.API { - case openrtb.APIFrameworkVPAID10, openrtb.APIFrameworkVPAID20: + case openrtb2.APIFrameworkVPAID10, openrtb2.APIFrameworkVPAID20: return openrtb_ext.BidTypeVideo default: return openrtb_ext.BidTypeBanner diff --git a/adapters/avocet/avocet_test.go b/adapters/avocet/avocet_test.go index f669e34492f..82d2e16eac5 100644 --- a/adapters/avocet/avocet_test.go +++ b/adapters/avocet/avocet_test.go @@ -6,12 +6,12 @@ import ( "reflect" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func TestJsonSamples(t *testing.T) { @@ -30,7 +30,7 @@ func TestAvocetAdapter_MakeRequests(t *testing.T) { Endpoint string } type args struct { - request *openrtb.BidRequest + request *openrtb2.BidRequest reqInfo *adapters.ExtraRequestInfo } type reqData []*adapters.RequestData @@ -45,7 +45,7 @@ func TestAvocetAdapter_MakeRequests(t *testing.T) { name: "return nil if zero imps", fields: fields{Endpoint: "https://bid.avct.cloud"}, args: args{ - &openrtb.BidRequest{}, + &openrtb2.BidRequest{}, nil, }, want: nil, @@ -55,7 +55,7 @@ func TestAvocetAdapter_MakeRequests(t *testing.T) { name: "makes POST request with JSON content", fields: fields{Endpoint: "https://bid.avct.cloud"}, args: args{ - &openrtb.BidRequest{Imp: []openrtb.Imp{{}}}, + &openrtb2.BidRequest{Imp: []openrtb2.Imp{{}}}, nil, }, want: reqData{ @@ -100,7 +100,7 @@ func TestAvocetAdapter_MakeBids(t *testing.T) { Endpoint string } type args struct { - internalRequest *openrtb.BidRequest + internalRequest *openrtb2.BidRequest externalRequest *adapters.RequestData response *adapters.ResponseData } @@ -195,7 +195,7 @@ func TestAvocetAdapter_MakeBids(t *testing.T) { func Test_getBidType(t *testing.T) { type args struct { - bid openrtb.Bid + bid openrtb2.Bid ext avocetBidExt } tests := []struct { @@ -205,17 +205,17 @@ func Test_getBidType(t *testing.T) { }{ { name: "VPAID 1.0", - args: args{openrtb.Bid{API: openrtb.APIFrameworkVPAID10}, avocetBidExt{}}, + args: args{openrtb2.Bid{API: openrtb2.APIFrameworkVPAID10}, avocetBidExt{}}, want: openrtb_ext.BidTypeVideo, }, { name: "VPAID 2.0", - args: args{openrtb.Bid{API: openrtb.APIFrameworkVPAID20}, avocetBidExt{}}, + args: args{openrtb2.Bid{API: openrtb2.APIFrameworkVPAID20}, avocetBidExt{}}, want: openrtb_ext.BidTypeVideo, }, { name: "other", - args: args{openrtb.Bid{}, avocetBidExt{}}, + args: args{openrtb2.Bid{}, avocetBidExt{}}, want: openrtb_ext.BidTypeBanner, }, } @@ -228,7 +228,7 @@ func Test_getBidType(t *testing.T) { } } -var validBannerBid = openrtb.Bid{ +var validBannerBid = openrtb2.Bid{ AdM: "", ADomain: []string{"avocet.io"}, CID: "5b51e2d689654741306813a4", @@ -267,7 +267,7 @@ var validBannerBidResponseBody = []byte(`{ ] }`) -var validVideoBid = openrtb.Bid{ +var validVideoBid = openrtb2.Bid{ AdM: "Avocet", ADomain: []string{"avocet.io"}, CID: "5b51e2d689654741306813a4", diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 8aca4ca0427..8f069eba9b3 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -9,11 +9,11 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const Seat = "beachfront" @@ -51,9 +51,9 @@ type beachfrontRequests struct { // --------------------------------------------------- type beachfrontVideoRequest struct { - AppId string `json:"appId"` - VideoResponseType string `json:"videoResponseType"` - Request openrtb.BidRequest `json:"request"` + AppId string `json:"appId"` + VideoResponseType string `json:"videoResponseType"` + Request openrtb2.BidRequest `json:"request"` } // --------------------------------------------------- @@ -71,7 +71,7 @@ type beachfrontBannerRequest struct { IsMobile int8 `json:"isMobile"` UA string `json:"ua"` Dnt int8 `json:"dnt"` - User openrtb.User `json:"user"` + User openrtb2.User `json:"user"` AdapterName string `json:"adapterName"` AdapterVersion string `json:"adapterVersion"` IP string `json:"ip"` @@ -107,7 +107,7 @@ type beachfrontVideoBidExtension struct { Duration int `json:"duration"` } -func (a *BeachfrontAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BeachfrontAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { beachfrontRequests, errs := preprocess(request) headers := http.Header{} @@ -197,9 +197,9 @@ func (a *BeachfrontAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a return reqs, errs } -func preprocess(request *openrtb.BidRequest) (beachfrontReqs beachfrontRequests, errs []error) { - var videoImps = make([]openrtb.Imp, 0) - var bannerImps = make([]openrtb.Imp, 0) +func preprocess(request *openrtb2.BidRequest) (beachfrontReqs beachfrontRequests, errs []error) { + var videoImps = make([]openrtb2.Imp, 0) + var bannerImps = make([]openrtb2.Imp, 0) for i := 0; i < len(request.Imp); i++ { if request.Imp[i].Banner != nil && request.Imp[i].Banner.Format != nil && @@ -270,7 +270,7 @@ func getAppId(ext openrtb_ext.ExtImpBeachfront, media openrtb_ext.BidType) (stri getBannerRequest, singular. A "Slot" is an "imp," and each Slot can have an AppId, so just one request to the beachfront banner endpoint gets all banner Imps. */ -func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []error) { +func getBannerRequest(request *openrtb2.BidRequest) (beachfrontBannerRequest, []error) { var bfr beachfrontBannerRequest var errs = make([]error, 0, len(request.Imp)) @@ -304,8 +304,8 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e for j := 0; j < len(request.Imp[i].Banner.Format); j++ { slot.Sizes = append(slot.Sizes, beachfrontSize{ - H: request.Imp[i].Banner.Format[j].H, - W: request.Imp[i].Banner.Format[j].W, + H: uint64(request.Imp[i].Banner.Format[j].H), + W: uint64(request.Imp[i].Banner.Format[j].W), }) } @@ -330,7 +330,7 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e var t = fallBackDeviceType(request) - if t == openrtb.DeviceTypeMobileTablet { + if t == openrtb2.DeviceTypeMobileTablet { bfr.Page = request.App.Bundle if request.App.Domain == "" { bfr.Domain = getDomain(request.App.Domain) @@ -339,7 +339,7 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e } bfr.IsMobile = 1 - } else if t == openrtb.DeviceTypePersonalComputer { + } else if t == openrtb2.DeviceTypePersonalComputer { bfr.Page = request.Site.Page if request.Site.Domain == "" { bfr.Domain = getDomain(request.Site.Page) @@ -375,15 +375,15 @@ func getBannerRequest(request *openrtb.BidRequest) (beachfrontBannerRequest, []e return bfr, errs } -func fallBackDeviceType(request *openrtb.BidRequest) openrtb.DeviceType { +func fallBackDeviceType(request *openrtb2.BidRequest) openrtb2.DeviceType { if request.Site != nil { - return openrtb.DeviceTypePersonalComputer + return openrtb2.DeviceTypePersonalComputer } - return openrtb.DeviceTypeMobileTablet + return openrtb2.DeviceTypeMobileTablet } -func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, []error) { +func getVideoRequests(request *openrtb2.BidRequest) ([]beachfrontVideoRequest, []error) { var bfReqs = make([]beachfrontVideoRequest, len(request.Imp)) var errs = make([]error, 0, len(request.Imp)) var failedRequestIndicies = make([]int, 0) @@ -464,7 +464,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } bfReqs[i].Request.Imp = nil - bfReqs[i].Request.Imp = make([]openrtb.Imp, 1, 1) + bfReqs[i].Request.Imp = make([]openrtb2.Imp, 1, 1) bfReqs[i].Request.Imp[0] = imp if bfReqs[i].Request.Device != nil && bfReqs[i].Request.Device.IP != "" { @@ -482,8 +482,8 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] return bfReqs, errs } -func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { - var bids []openrtb.Bid +func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + var bids []openrtb2.Bid var errs []error if response.StatusCode == http.StatusNoContent || (response.StatusCode == http.StatusOK && len(response.Body) <= 2) { @@ -500,7 +500,7 @@ func (a *BeachfrontAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return nil, []error{fmt.Errorf("unexpected status code %d from %s. Run with request.debug = 1 for more info", response.StatusCode, externalRequest.Uri)} } - var xtrnal openrtb.BidRequest + var xtrnal openrtb2.BidRequest // For video, which uses RTB for the external request, this will unmarshal as expected. For banner, it will // only get the User struct and everything else will be nil @@ -548,11 +548,11 @@ func (a *BeachfrontAdapter) getBidType(externalRequest *adapters.RequestData) op return openrtb_ext.BidTypeBanner } -func postprocess(response *adapters.ResponseData, xtrnal openrtb.BidRequest, uri string, id string) ([]openrtb.Bid, []error) { +func postprocess(response *adapters.ResponseData, xtrnal openrtb2.BidRequest, uri string, id string) ([]openrtb2.Bid, []error) { var beachfrontResp []beachfrontResponseSlot var errs = make([]error, 0) - var openrtbResp openrtb.BidResponse + var openrtbResp openrtb2.BidResponse // try it as a video if err := json.Unmarshal(response.Body, &openrtbResp); err != nil { @@ -570,27 +570,27 @@ func postprocess(response *adapters.ResponseData, xtrnal openrtb.BidRequest, uri return postprocessVideo(openrtbResp.SeatBid[0].Bid, xtrnal, uri, id) } -func postprocessBanner(beachfrontResp []beachfrontResponseSlot, id string) ([]openrtb.Bid, []error) { +func postprocessBanner(beachfrontResp []beachfrontResponseSlot, id string) ([]openrtb2.Bid, []error) { - var bids = make([]openrtb.Bid, len(beachfrontResp)) + var bids = make([]openrtb2.Bid, len(beachfrontResp)) var errs = make([]error, 0) for i := 0; i < len(beachfrontResp); i++ { - bids[i] = openrtb.Bid{ + bids[i] = openrtb2.Bid{ CrID: beachfrontResp[i].CrID, ImpID: beachfrontResp[i].Slot, Price: beachfrontResp[i].Price, ID: fmt.Sprintf("%sBanner", beachfrontResp[i].Slot), AdM: beachfrontResp[i].Adm, - H: beachfrontResp[i].H, - W: beachfrontResp[i].W, + H: int64(beachfrontResp[i].H), + W: int64(beachfrontResp[i].W), } } return bids, errs } -func postprocessVideo(bids []openrtb.Bid, xtrnal openrtb.BidRequest, uri string, id string) ([]openrtb.Bid, []error) { +func postprocessVideo(bids []openrtb2.Bid, xtrnal openrtb2.BidRequest, uri string, id string) ([]openrtb2.Bid, []error) { var errs = make([]error, 0) @@ -624,7 +624,7 @@ func extractNurlVideoCrid(nurl string) string { return "" } -func getBeachfrontExtension(imp openrtb.Imp) (openrtb_ext.ExtImpBeachfront, error) { +func getBeachfrontExtension(imp openrtb2.Imp) (openrtb_ext.ExtImpBeachfront, error) { var err error var bidderExt adapters.ExtImpBidder var beachfrontExt openrtb_ext.ExtImpBeachfront diff --git a/adapters/beintoo/beintoo.go b/adapters/beintoo/beintoo.go index 9d704c2265e..4dfc05731d6 100644 --- a/adapters/beintoo/beintoo.go +++ b/adapters/beintoo/beintoo.go @@ -7,18 +7,18 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type BeintooAdapter struct { endpoint string } -func (a *BeintooAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BeintooAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors []error if len(request.Imp) == 0 { @@ -64,7 +64,7 @@ func (a *BeintooAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap }}, errors } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpBeintoo, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpBeintoo, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -89,7 +89,7 @@ func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpBeintoo, error) { return &beintooExt, nil } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { imp.Ext = nil if imp.Banner == nil { @@ -118,7 +118,7 @@ func buildImpBanner(imp *openrtb.Imp) error { } // Add Beintoo required properties to Imp object -func addImpProps(imp *openrtb.Imp, secure *int8, BeintooExt *openrtb_ext.ExtImpBeintoo) { +func addImpProps(imp *openrtb2.Imp, secure *int8, BeintooExt *openrtb_ext.ExtImpBeintoo) { imp.TagID = BeintooExt.TagID imp.Secure = secure @@ -144,9 +144,9 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // Handle request errors and formatting to be sent to Beintoo -func preprocess(request *openrtb.BidRequest) []error { +func preprocess(request *openrtb2.BidRequest) []error { errors := make([]error, 0, len(request.Imp)) - resImps := make([]openrtb.Imp, 0, len(request.Imp)) + resImps := make([]openrtb2.Imp, 0, len(request.Imp)) secure := int8(0) if request.Site != nil && request.Site.Page != "" { @@ -178,7 +178,7 @@ func preprocess(request *openrtb.BidRequest) []error { } // MakeBids make the bids for the bid response. -func (a *BeintooAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BeintooAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -191,7 +191,7 @@ func (a *BeintooAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json b/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json index 5c5462c2990..6d587c2252b 100644 --- a/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/beintoo/beintootest/supplemental/invalid-response-unmarshall-error.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type uint64", + "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type int64", "comparison": "regex" } ] diff --git a/adapters/between/between.go b/adapters/between/between.go index 038aa4b8b10..95c8a684edd 100644 --- a/adapters/between/between.go +++ b/adapters/between/between.go @@ -8,12 +8,12 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type BetweenAdapter struct { @@ -24,7 +24,7 @@ type BetweenAdapter struct { // If BidFloor of openrtb_ext.ExtImpBetween is zero, set it to defaultBidFloor value, see addImpProps const defaultBidfloor = 0.00001 -func (a *BetweenAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BetweenAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors []error if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ @@ -70,7 +70,7 @@ func (a *BetweenAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap }}, errors } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpBetween, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpBetween, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -103,7 +103,7 @@ func (a *BetweenAdapter) buildEndpointURL(e *openrtb_ext.ExtImpBetween) (string, return macros.ResolveMacros(a.EndpointTemplate, macros.EndpointTemplateParams{Host: e.Host, PublisherID: e.PublisherID}) } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { if imp.Banner == nil { return &errortypes.BadInput{ Message: fmt.Sprintf("Request needs to include a Banner object"), @@ -127,7 +127,7 @@ func buildImpBanner(imp *openrtb.Imp) error { } // Add Between required properties to Imp object -func addImpProps(imp *openrtb.Imp, secure *int8, betweenExt *openrtb_ext.ExtImpBetween) { +func addImpProps(imp *openrtb2.Imp, secure *int8, betweenExt *openrtb_ext.ExtImpBetween) { imp.Secure = secure if betweenExt.BidFloor <= 0 { imp.BidFloor = defaultBidfloor @@ -147,9 +147,9 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // Handle request errors and formatting to be sent to Between -func preprocess(request *openrtb.BidRequest) (*openrtb_ext.ExtImpBetween, []error) { +func preprocess(request *openrtb2.BidRequest) (*openrtb_ext.ExtImpBetween, []error) { errors := make([]error, 0, len(request.Imp)) - resImps := make([]openrtb.Imp, 0, len(request.Imp)) + resImps := make([]openrtb2.Imp, 0, len(request.Imp)) secure := int8(0) if request.Site != nil && request.Site.Page != "" { @@ -181,7 +181,7 @@ func preprocess(request *openrtb.BidRequest) (*openrtb_ext.ExtImpBetween, []erro return betweenExt, errors } -func (a *BetweenAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BetweenAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -193,7 +193,7 @@ func (a *BetweenAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR Message: fmt.Sprintf("Invalid Status Returned: %d. Run with request.debug = 1 for more info", response.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Unable to unpackage bid response. Error %s", err.Error()), diff --git a/adapters/between/betweentest/supplemental/bad-response-body.json b/adapters/between/betweentest/supplemental/bad-response-body.json index e88c2f8e235..05ecbea5c19 100644 --- a/adapters/between/betweentest/supplemental/bad-response-body.json +++ b/adapters/between/betweentest/supplemental/bad-response-body.json @@ -70,7 +70,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response. Error json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Unable to unpackage bid response. Error json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/bidder.go b/adapters/bidder.go index e91947e2b4e..451839d9ced 100644 --- a/adapters/bidder.go +++ b/adapters/bidder.go @@ -5,10 +5,10 @@ import ( "encoding/json" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Bidder describes how to connect to external demand. @@ -26,7 +26,7 @@ type Bidder interface { // "subpar" in some way. For example: the request contained ad types which this bidder doesn't support. // // If the error is caused by bad user input, return an errortypes.BadInput. - MakeRequests(request *openrtb.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) + MakeRequests(request *openrtb2.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) // MakeBids unpacks the server's response into Bids. // @@ -37,7 +37,7 @@ type Bidder interface { // // If the error was caused by bad user input, return a errortypes.BadInput. // If the error was caused by a bad server response, return a errortypes.BadServerResponse - MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) + MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) } // TimeoutBidder is used to identify bidders that support timeout notifications. @@ -90,7 +90,7 @@ func NewBidderResponse() *BidderResponse { return NewBidderResponseWithBidsCapacity(0) } -// TypedBid packages the openrtb.Bid with any bidder-specific information that PBS needs to populate an +// TypedBid packages the openrtb2.Bid with any bidder-specific information that PBS needs to populate an // openrtb_ext.ExtBidPrebid. // // TypedBid.Bid.Ext will become "response.seatbid[i].bid.ext.bidder" in the final OpenRTB response. @@ -98,7 +98,7 @@ func NewBidderResponse() *BidderResponse { // TypedBid.BidVideo will become "response.seatbid[i].bid.ext.prebid.video" in the final OpenRTB response. // TypedBid.DealPriority is optionally provided by adapters and used internally by the exchange to support deal targeted campaigns. type TypedBid struct { - Bid *openrtb.Bid + Bid *openrtb2.Bid BidType openrtb_ext.BidType BidVideo *openrtb_ext.ExtBidPrebidVideo BidTargets map[string]string diff --git a/adapters/brightroll/brightroll.go b/adapters/brightroll/brightroll.go index d1f5868275e..bd1c87bc6f0 100644 --- a/adapters/brightroll/brightroll.go +++ b/adapters/brightroll/brightroll.go @@ -6,11 +6,11 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type BrightrollAdapter struct { @@ -30,7 +30,7 @@ type Account struct { BidFloor float64 `json:"bidfloor"` } -func (a *BrightrollAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *BrightrollAdapter) MakeRequests(requestIn *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { request := *requestIn errs := make([]error, 0, len(request.Imp)) @@ -162,7 +162,7 @@ func (a *BrightrollAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo }}, errors } -func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -180,7 +180,7 @@ func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %d. ", err), @@ -199,10 +199,10 @@ func (a *BrightrollAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return bidResponse, nil } -func getBlockedCreativetypes(attr []int8) []openrtb.CreativeAttribute { - var creativeAttr []openrtb.CreativeAttribute +func getBlockedCreativetypes(attr []int8) []openrtb2.CreativeAttribute { + var creativeAttr []openrtb2.CreativeAttribute for i := 0; i < len(attr); i++ { - creativeAttr = append(creativeAttr, openrtb.CreativeAttribute(attr[i])) + creativeAttr = append(creativeAttr, openrtb2.CreativeAttribute(attr[i])) } return creativeAttr } @@ -215,7 +215,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // getMediaTypeForImp figures out which media type this bid is for. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner //default type for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/colossus/colossus.go b/adapters/colossus/colossus.go index 941ca4ce3b3..d70b4f755dc 100644 --- a/adapters/colossus/colossus.go +++ b/adapters/colossus/colossus.go @@ -5,12 +5,12 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ColossusAdapter struct { @@ -26,7 +26,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests create bid request for colossus demand -func (a *ColossusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ColossusAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var err error var tagID string @@ -35,7 +35,7 @@ func (a *ColossusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} tagID, err = jsonparser.GetString(reqCopy.Imp[0].Ext, "bidder", "TagID") if err != nil { @@ -54,7 +54,7 @@ func (a *ColossusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada return adapterRequests, errs } -func (a *ColossusAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *ColossusAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -77,7 +77,7 @@ func (a *ColossusAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Re } // MakeBids makes the bids -func (a *ColossusAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ColossusAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -96,7 +96,7 @@ func (a *ColossusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -121,7 +121,7 @@ func (a *ColossusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/colossus/colossustest/supplemental/bad_response.json b/adapters/colossus/colossustest/supplemental/bad_response.json index c69b00c8e6e..62b862b181e 100644 --- a/adapters/colossus/colossustest/supplemental/bad_response.json +++ b/adapters/colossus/colossustest/supplemental/bad_response.json @@ -78,7 +78,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/connectad/connectad.go b/adapters/connectad/connectad.go index 7731e0fd51b..aaf68ced127 100644 --- a/adapters/connectad/connectad.go +++ b/adapters/connectad/connectad.go @@ -7,11 +7,11 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ConnectAdAdapter struct { @@ -30,7 +30,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *ConnectAdAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ConnectAdAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error @@ -73,7 +73,7 @@ func (a *ConnectAdAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad }}, errs } -func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { if httpRes.StatusCode == http.StatusNoContent { return nil, nil @@ -85,7 +85,7 @@ func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -107,10 +107,10 @@ func (a *ConnectAdAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters return bidResponse, nil } -func preprocess(request *openrtb.BidRequest) []error { +func preprocess(request *openrtb2.BidRequest) []error { impsCount := len(request.Imp) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) secure := int8(0) if request.Site != nil && request.Site.Page != "" { @@ -141,7 +141,7 @@ func preprocess(request *openrtb.BidRequest) []error { return errors } -func addImpInfo(imp *openrtb.Imp, secure *int8, cadExt *openrtb_ext.ExtImpConnectAd) { +func addImpInfo(imp *openrtb2.Imp, secure *int8, cadExt *openrtb_ext.ExtImpConnectAd) { imp.TagID = strconv.Itoa(cadExt.SiteID) imp.Secure = secure @@ -159,7 +159,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpConnectAd, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpConnectAd, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -183,7 +183,7 @@ func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpConnectAd, error) { return &cadExt, nil } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { imp.Ext = nil if imp.Banner == nil { diff --git a/adapters/connectad/connectadtest/supplemental/badresponse.json b/adapters/connectad/connectadtest/supplemental/badresponse.json index de56d8b4c91..6c3bdaa4985 100644 --- a/adapters/connectad/connectadtest/supplemental/badresponse.json +++ b/adapters/connectad/connectadtest/supplemental/badresponse.json @@ -83,7 +83,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response. Error: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Unable to unpackage bid response. Error: json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/consumable/adtypes.go b/adapters/consumable/adtypes.go index f04f8822f7a..e7666c737ed 100644 --- a/adapters/consumable/adtypes.go +++ b/adapters/consumable/adtypes.go @@ -1,16 +1,16 @@ package consumable import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "strconv" ) /* Turn array of openrtb formats into consumable's code*/ -func getSizeCodes(Formats []openrtb.Format) []int { +func getSizeCodes(Formats []openrtb2.Format) []int { codes := make([]int, 0) for _, format := range Formats { - str := strconv.FormatUint(format.W, 10) + "x" + strconv.FormatUint(format.H, 10) + str := strconv.FormatInt(format.W, 10) + "x" + strconv.FormatInt(format.H, 10) if code, ok := sizeMap[str]; ok { codes = append(codes, code) } diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index e6aea9c55f0..a0878b22531 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -8,12 +8,12 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ConsumableAdapter struct { @@ -83,7 +83,7 @@ type pricing struct { ClearPrice *float64 `json:"clearPrice"` } -func (a *ConsumableAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ConsumableAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{ "Content-Type": {"application/json"}, "Accept": {"application/json"}, @@ -211,7 +211,7 @@ func (a *ConsumableAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) */ func (a *ConsumableAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -245,13 +245,13 @@ func (a *ConsumableAdapter) MakeBids( for impID, decision := range serverResponse.Decisions { if decision.Pricing != nil && decision.Pricing.ClearPrice != nil { - bid := openrtb.Bid{} + bid := openrtb2.Bid{} bid.ID = internalRequest.ID bid.ImpID = impID bid.Price = *decision.Pricing.ClearPrice bid.AdM = retrieveAd(decision) - bid.W = decision.Width - bid.H = decision.Height + bid.W = int64(decision.Width) + bid.H = int64(decision.Height) bid.CrID = strconv.FormatInt(decision.AdID, 10) bid.Exp = 30 // TODO: Check this is intention of TTL @@ -273,7 +273,7 @@ func (a *ConsumableAdapter) MakeBids( return bidderResponse, errors } -func extractExtensions(impression openrtb.Imp) (*adapters.ExtImpBidder, *openrtb_ext.ExtImpConsumable, []error) { +func extractExtensions(impression openrtb2.Imp) (*adapters.ExtImpBidder, *openrtb_ext.ExtImpConsumable, []error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(impression.Ext, &bidderExt); err != nil { return nil, nil, []error{&errortypes.BadInput{ diff --git a/adapters/conversant/cnvr_legacy.go b/adapters/conversant/cnvr_legacy.go index b9e752e6c76..4f50d2d68f5 100644 --- a/adapters/conversant/cnvr_legacy.go +++ b/adapters/conversant/cnvr_legacy.go @@ -8,10 +8,10 @@ import ( "io/ioutil" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -54,7 +54,7 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, // Create a map of impression objects for both request creation // and response parsing. - impMap := make(map[string]*openrtb.Imp, len(cnvrReq.Imp)) + impMap := make(map[string]*openrtb2.Imp, len(cnvrReq.Imp)) for idx := range cnvrReq.Imp { impMap[cnvrReq.Imp[idx].ID] = &cnvrReq.Imp[idx] } @@ -98,9 +98,9 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, imp.BidFloor = params.BidFloor imp.TagID = params.TagID - var position *openrtb.AdPosition + var position *openrtb2.AdPosition if params.Position != nil { - position = openrtb.AdPosition(*params.Position).Ptr() + position = openrtb2.AdPosition(*params.Position).Ptr() } if imp.Banner != nil { @@ -109,9 +109,9 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, imp.Video.Pos = position if len(params.API) > 0 { - imp.Video.API = make([]openrtb.APIFramework, 0, len(params.API)) + imp.Video.API = make([]openrtb2.APIFramework, 0, len(params.API)) for _, api := range params.API { - imp.Video.API = append(imp.Video.API, openrtb.APIFramework(api)) + imp.Video.API = append(imp.Video.API, openrtb2.APIFramework(api)) } } @@ -120,9 +120,9 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, // but are overridden if the custom params object also contains them. if len(params.Protocols) > 0 { - imp.Video.Protocols = make([]openrtb.Protocol, 0, len(params.Protocols)) + imp.Video.Protocols = make([]openrtb2.Protocol, 0, len(params.Protocols)) for _, protocol := range params.Protocols { - imp.Video.Protocols = append(imp.Video.Protocols, openrtb.Protocol(protocol)) + imp.Video.Protocols = append(imp.Video.Protocols, openrtb2.Protocol(protocol)) } } @@ -164,7 +164,7 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, } if cnvrReq.Device == nil { - cnvrReq.Device = &openrtb.Device{} + cnvrReq.Device = &openrtb2.Device{} } // Convert request to json to be sent over http @@ -217,7 +217,7 @@ func (a *ConversantLegacyAdapter) Call(ctx context.Context, req *pbs.PBSRequest, debug.ResponseBody = string(body) } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { diff --git a/adapters/conversant/cnvr_legacy_test.go b/adapters/conversant/cnvr_legacy_test.go index a907e74b746..b7dc72edd75 100644 --- a/adapters/conversant/cnvr_legacy_test.go +++ b/adapters/conversant/cnvr_legacy_test.go @@ -11,12 +11,12 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Constants @@ -497,12 +497,12 @@ func TestConversantVideoRequestWithParams(t *testing.T) { assertEqual(t, len(imp.Video.MIMEs), 1, "Request video MIMEs entries") assertEqual(t, imp.Video.MIMEs[0], "video/x-ms-wmv", "Requst video MIMEs type") assertEqual(t, len(imp.Video.Protocols), 2, "Request video protocols") - assertEqual(t, imp.Video.Protocols[0], openrtb.Protocol(1), "Request video protocols 1") - assertEqual(t, imp.Video.Protocols[1], openrtb.Protocol(2), "Request video protocols 2") + assertEqual(t, imp.Video.Protocols[0], openrtb2.Protocol(1), "Request video protocols 1") + assertEqual(t, imp.Video.Protocols[1], openrtb2.Protocol(2), "Request video protocols 2") assertEqual(t, imp.Video.MaxDuration, int64(90), "Request video 0 max duration") assertEqual(t, len(imp.Video.API), 2, "Request video api should be nil") - assertEqual(t, imp.Video.API[0], openrtb.APIFramework(1), "Request video api 1") - assertEqual(t, imp.Video.API[1], openrtb.APIFramework(2), "Request video api 2") + assertEqual(t, imp.Video.API[0], openrtb2.APIFramework(1), "Request video api 1") + assertEqual(t, imp.Video.API[1], openrtb2.APIFramework(2), "Request video api 2") } // Test video request with parameters in the video object @@ -557,8 +557,8 @@ func TestConversantVideoRequestWithParams2(t *testing.T) { assertEqual(t, len(imp.Video.MIMEs), 1, "Request video MIMEs entries") assertEqual(t, imp.Video.MIMEs[0], "video/x-ms-wmv", "Requst video MIMEs type") assertEqual(t, len(imp.Video.Protocols), 2, "Request video protocols") - assertEqual(t, imp.Video.Protocols[0], openrtb.Protocol(1), "Request video protocols 1") - assertEqual(t, imp.Video.Protocols[1], openrtb.Protocol(2), "Request video protocols 2") + assertEqual(t, imp.Video.Protocols[0], openrtb2.Protocol(1), "Request video protocols 1") + assertEqual(t, imp.Video.Protocols[1], openrtb2.Protocol(2), "Request video protocols 2") assertEqual(t, imp.Video.MaxDuration, int64(90), "Request video 0 max duration") } @@ -628,7 +628,7 @@ func CreateRequest(params ...string) *pbs.PBSRequest { for i := 0; i < num; i++ { req.AdUnits[i] = pbs.AdUnit{ Code: fmt.Sprintf("au-%03d", i), - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, @@ -672,7 +672,7 @@ func ConvertToVideoRequest(req *pbs.PBSRequest, videoParams ...string) (*pbs.PBS // Convert a request to an app request by adding required properties func ConvertToAppRequest(req *pbs.PBSRequest, appParams string) (*pbs.PBSRequest, error) { - app := new(openrtb.App) + app := new(openrtb2.App) err := json.Unmarshal([]byte(appParams), &app) if err == nil { req.App = app @@ -728,8 +728,8 @@ func CreateVideoRequest(params ...string) (*pbs.PBSRequest, error) { // Helper to create a test http server that receives and generate openrtb requests and responses -func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { - var lastBidRequest openrtb.BidRequest +func CreateServer(prices ...float64) (*httptest.Server, *openrtb2.BidRequest) { + var lastBidRequest openrtb2.BidRequest server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) @@ -738,10 +738,10 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { return } - var bidReq openrtb.BidRequest + var bidReq openrtb2.BidRequest var price float64 - var bids []openrtb.Bid - var bid openrtb.Bid + var bids []openrtb2.Bid + var bid openrtb2.Bid err = json.Unmarshal(body, &bidReq) if err != nil { @@ -758,7 +758,7 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { } if price > 0 { - bid = openrtb.Bid{ + bid = openrtb2.Bid{ ID: imp.ID, ImpID: imp.ID, Price: price, @@ -775,7 +775,7 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { bid.H = imp.Video.H } } else { - bid = openrtb.Bid{ + bid = openrtb2.Bid{ ID: imp.ID, ImpID: imp.ID, Price: 0, @@ -788,9 +788,9 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { if len(bids) == 0 { w.WriteHeader(http.StatusNoContent) } else { - js, _ := json.Marshal(openrtb.BidResponse{ + js, _ := json.Marshal(openrtb2.BidResponse{ ID: bidReq.ID, - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Bid: bids, }, @@ -808,9 +808,9 @@ func CreateServer(prices ...float64) (*httptest.Server, *openrtb.BidRequest) { // Helper to remove impressions with $0 bids -func FilterZeroPrices(prices []float64, imps []openrtb.Imp) ([]float64, []openrtb.Imp) { +func FilterZeroPrices(prices []float64, imps []openrtb2.Imp) ([]float64, []openrtb2.Imp) { prices2 := make([]float64, 0) - imps2 := make([]openrtb.Imp, 0) + imps2 := make([]openrtb2.Imp, 0) for i := range prices { if prices[i] > 0 { diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index 568759d57d0..bee365128b7 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -5,18 +5,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ConversantAdapter struct { URI string } -func (c ConversantAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (c ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { for i := 0; i < len(request.Imp); i++ { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(request.Imp[i].Ext, &bidderExt); err != nil { @@ -71,7 +71,7 @@ func (c ConversantAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad }}, nil } -func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { +func parseCnvrParams(imp *openrtb2.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.DisplayManager = "pubmatic-openwrap" imp.DisplayManagerVer = "2.0.0" imp.BidFloor = cnvrExt.BidFloor @@ -82,9 +82,9 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.Secure = cnvrExt.Secure } - var position *openrtb.AdPosition + var position *openrtb2.AdPosition if cnvrExt.Position != nil { - position = openrtb.AdPosition(*cnvrExt.Position).Ptr() + position = openrtb2.AdPosition(*cnvrExt.Position).Ptr() } if imp.Banner != nil { tmpBanner := *imp.Banner @@ -97,9 +97,9 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { imp.Video.Pos = position if len(cnvrExt.API) > 0 { - imp.Video.API = make([]openrtb.APIFramework, 0, len(cnvrExt.API)) + imp.Video.API = make([]openrtb2.APIFramework, 0, len(cnvrExt.API)) for _, api := range cnvrExt.API { - imp.Video.API = append(imp.Video.API, openrtb.APIFramework(api)) + imp.Video.API = append(imp.Video.API, openrtb2.APIFramework(api)) } } @@ -108,9 +108,9 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { // but are overridden if the custom params object also contains them. if len(cnvrExt.Protocols) > 0 { - imp.Video.Protocols = make([]openrtb.Protocol, 0, len(cnvrExt.Protocols)) + imp.Video.Protocols = make([]openrtb2.Protocol, 0, len(cnvrExt.Protocols)) for _, protocol := range cnvrExt.Protocols { - imp.Video.Protocols = append(imp.Video.Protocols, openrtb.Protocol(protocol)) + imp.Video.Protocols = append(imp.Video.Protocols, openrtb2.Protocol(protocol)) } } @@ -125,7 +125,7 @@ func parseCnvrParams(imp *openrtb.Imp, cnvrExt openrtb_ext.ExtImpConversant) { } } -func (c ConversantAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (c ConversantAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil // no bid response } @@ -136,7 +136,7 @@ func (c ConversantAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var resp openrtb.BidResponse + var resp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &resp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %d. ", err), @@ -160,7 +160,7 @@ func (c ConversantAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa return bidResponse, nil } -func getBidType(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getBidType(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/cpmstar/cpmstar.go b/adapters/cpmstar/cpmstar.go index d7bbb57635f..68d5dd6958f 100644 --- a/adapters/cpmstar/cpmstar.go +++ b/adapters/cpmstar/cpmstar.go @@ -5,18 +5,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type Adapter struct { endpoint string } -func (a *Adapter) MakeRequests(request *openrtb.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *Adapter) MakeRequests(request *openrtb2.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -36,7 +36,7 @@ func (a *Adapter) MakeRequests(request *openrtb.BidRequest, unused *adapters.Ext return adapterRequests, errs } -func (a *Adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *Adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { var err error jsonBody, err := json.Marshal(request) @@ -55,7 +55,7 @@ func (a *Adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestDat }, nil } -func preprocess(request *openrtb.BidRequest) error { +func preprocess(request *openrtb2.BidRequest) error { if len(request.Imp) == 0 { return &errortypes.BadInput{ Message: "No Imps in Bid Request", @@ -88,7 +88,7 @@ func preprocess(request *openrtb.BidRequest) error { return nil } -func validateImp(imp *openrtb.Imp) error { +func validateImp(imp *openrtb2.Imp) error { if imp.Banner == nil && imp.Video == nil { return &errortypes.BadInput{ Message: "Only Banner and Video bid-types are supported at this time", @@ -98,7 +98,7 @@ func validateImp(imp *openrtb.Imp) error { } // MakeBids based on cpmstar server response -func (a *Adapter) MakeBids(bidRequest *openrtb.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *Adapter) MakeBids(bidRequest *openrtb2.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil } @@ -109,7 +109,7 @@ func (a *Adapter) MakeBids(bidRequest *openrtb.BidRequest, unused *adapters.Requ }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json b/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json index e20acefe2c3..4350b2dc714 100644 --- a/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/cpmstar/cpmstartest/supplemental/invalid-response-unmarshall-error.json @@ -59,7 +59,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type uint64", + "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type int64", "comparison": "regex" } ] diff --git a/adapters/datablocks/datablocks.go b/adapters/datablocks/datablocks.go index 84380184c78..c2fcf71d7b8 100644 --- a/adapters/datablocks/datablocks.go +++ b/adapters/datablocks/datablocks.go @@ -7,19 +7,19 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type DatablocksAdapter struct { EndpointTemplate template.Template } -func (a *DatablocksAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *DatablocksAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) headers := http.Header{ @@ -69,7 +69,7 @@ func (a *DatablocksAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) */ func (a *DatablocksAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -84,7 +84,7 @@ func (a *DatablocksAdapter) MakeBids( }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -106,9 +106,9 @@ func (a *DatablocksAdapter) MakeBids( return bidResponse, nil } -func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpDatablocks][]openrtb.Imp, error) { +func splitImpressions(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpDatablocks][]openrtb2.Imp, error) { - var m = make(map[openrtb_ext.ExtImpDatablocks][]openrtb.Imp) + var m = make(map[openrtb_ext.ExtImpDatablocks][]openrtb2.Imp) for _, imp := range imps { bidderParams, err := getBidderParams(&imp) @@ -120,14 +120,14 @@ func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpDatablocks][]op if ok { m[*bidderParams] = append(v, imp) } else { - m[*bidderParams] = []openrtb.Imp{imp} + m[*bidderParams] = []openrtb2.Imp{imp} } } return m, nil } -func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpDatablocks, error) { +func getBidderParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpDatablocks, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -156,7 +156,7 @@ func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpDatablocks, error) { return &datablocksExt, nil } -func getMediaType(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaType(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner diff --git a/adapters/datablocks/datablockstest/supplemental/bad-response-body.json b/adapters/datablocks/datablockstest/supplemental/bad-response-body.json index c7ecf3c0eaa..7c4801e1685 100644 --- a/adapters/datablocks/datablockstest/supplemental/bad-response-body.json +++ b/adapters/datablocks/datablockstest/supplemental/bad-response-body.json @@ -81,7 +81,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/decenterads/decenterads.go b/adapters/decenterads/decenterads.go index c0ba2eb90cc..715e44ce147 100644 --- a/adapters/decenterads/decenterads.go +++ b/adapters/decenterads/decenterads.go @@ -7,18 +7,18 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type adapter struct { endpoint string } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -40,7 +40,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraReq } impression.Ext = bidderExt - request.Imp = []openrtb.Imp{impression} + request.Imp = []openrtb2.Imp{impression} body, err := json.Marshal(request) if err != nil { errs = append(errs, err) @@ -58,7 +58,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraReq return result, errs } -func (a *adapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error switch responseData.StatusCode { @@ -76,7 +76,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse err := json.Unmarshal(responseData.Body, &bidResponse) if err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -98,7 +98,7 @@ func (a *adapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, return response, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/decenterads/decenteradstest/supplemental/bad_response.json b/adapters/decenterads/decenteradstest/supplemental/bad_response.json index 9d9d977b14a..487d6adf413 100644 --- a/adapters/decenterads/decenteradstest/supplemental/bad_response.json +++ b/adapters/decenterads/decenteradstest/supplemental/bad_response.json @@ -76,7 +76,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/deepintent/deepintent.go b/adapters/deepintent/deepintent.go index 5a9b30c9cda..4ee6aec2098 100644 --- a/adapters/deepintent/deepintent.go +++ b/adapters/deepintent/deepintent.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const displayManager string = "di_prebid" @@ -33,7 +33,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } //MakeRequests which creates request object for Deepintent DSP -func (d *DeepintentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (d *DeepintentAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var deepintentExt openrtb_ext.ExtImpDeepintent var err error @@ -42,7 +42,7 @@ func (d *DeepintentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a reqCopy := *request for _, imp := range request.Imp { - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} var bidderExt adapters.ExtImpBidder if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { @@ -76,7 +76,7 @@ func (d *DeepintentAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a } // MakeBids makes the bids -func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -89,7 +89,7 @@ func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -114,11 +114,11 @@ func (d *DeepintentAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return bidResponse, errs } -func (d *DeepintentAdapter) preprocess(request openrtb.BidRequest) (*adapters.RequestData, []error) { +func (d *DeepintentAdapter) preprocess(request openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error impsCount := len(request.Imp) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) for _, imp := range request.Imp { @@ -150,7 +150,7 @@ func (d *DeepintentAdapter) preprocess(request openrtb.BidRequest) (*adapters.Re }, errs } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { if imp.Banner == nil { return &errortypes.BadInput{ @@ -176,7 +176,7 @@ func buildImpBanner(imp *openrtb.Imp) error { return nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/deepintent/deepintenttest/supplemental/bad_response.json b/adapters/deepintent/deepintenttest/supplemental/bad_response.json index c03531b6232..b2c4c210df6 100644 --- a/adapters/deepintent/deepintenttest/supplemental/bad_response.json +++ b/adapters/deepintent/deepintenttest/supplemental/bad_response.json @@ -84,7 +84,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/dmx/dmx.go b/adapters/dmx/dmx.go index aa6163ad0f4..92b69c5e996 100644 --- a/adapters/dmx/dmx.go +++ b/adapters/dmx/dmx.go @@ -8,11 +8,11 @@ import ( "net/url" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type DmxAdapter struct { @@ -55,15 +55,15 @@ func UserSellerOrPubId(str1, str2 string) string { return str2 } -func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { - var imps []openrtb.Imp +func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapters.ExtraRequestInfo) (reqsBidder []*adapters.RequestData, errs []error) { + var imps []openrtb2.Imp var rootExtInfo dmxExt var publisherId string var sellerId string var userExt openrtb_ext.ExtUser var anyHasId = false - var reqCopy openrtb.BidRequest = *request - var dmxReq *openrtb.BidRequest = &reqCopy + var reqCopy openrtb2.BidRequest = *request + var dmxReq *openrtb2.BidRequest = &reqCopy var dmxRawPubId dmxPubExt if request.User == nil { @@ -121,7 +121,7 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapte } dmxReq.Site.Publisher.Ext = ext } else { - dmxReq.Site.Publisher = &openrtb.Publisher{ID: publisherId} + dmxReq.Site.Publisher = &openrtb2.Publisher{ID: publisherId} } } else { dmxReq.Site = nil @@ -152,9 +152,9 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapte } for _, inst := range dmxReq.Imp { - var banner *openrtb.Banner - var video *openrtb.Video - var ins openrtb.Imp + var banner *openrtb2.Banner + var video *openrtb2.Video + var ins openrtb2.Imp var params dmxExt const intVal int8 = 1 source := (*json.RawMessage)(&inst.Ext) @@ -207,7 +207,7 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb.BidRequest, req *adapte return } -func (adapter *DmxAdapter) MakeBids(request *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *DmxAdapter) MakeBids(request *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if http.StatusNoContent == response.StatusCode { @@ -226,7 +226,7 @@ func (adapter *DmxAdapter) MakeBids(request *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -255,8 +255,8 @@ func (adapter *DmxAdapter) MakeBids(request *openrtb.BidRequest, externalRequest } -func fetchParams(params dmxExt, inst openrtb.Imp, ins openrtb.Imp, imps []openrtb.Imp, banner *openrtb.Banner, video *openrtb.Video, intVal int8) []openrtb.Imp { - var tempimp openrtb.Imp +func fetchParams(params dmxExt, inst openrtb2.Imp, ins openrtb2.Imp, imps []openrtb2.Imp, banner *openrtb2.Banner, video *openrtb2.Video, intVal int8) []openrtb2.Imp { + var tempimp openrtb2.Imp tempimp = inst if params.Bidder.Bidfloor != 0 { tempimp.BidFloor = params.Bidder.Bidfloor @@ -292,7 +292,7 @@ func addParams(str string) string { return "" } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { @@ -309,7 +309,7 @@ func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, } } -func videoImpInsertion(bid *openrtb.Bid) string { +func videoImpInsertion(bid *openrtb2.Bid) string { adm := bid.AdM nurl := bid.NURL search := "" diff --git a/adapters/dmx/dmx_test.go b/adapters/dmx/dmx_test.go index 0649cb8a714..0d0c4f7c5cb 100644 --- a/adapters/dmx/dmx_test.go +++ b/adapters/dmx/dmx_test.go @@ -5,10 +5,10 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" ) @@ -20,17 +20,17 @@ var ( func TestFetchParams(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) - var arrImp []openrtb.Imp + var width, height int64 = int64(w), int64(h) + var arrImp []openrtb2.Imp var imps = fetchParams( dmxExt{Bidder: dmxParams{ TagId: "222", PublisherId: "5555", }}, - openrtb.Imp{ID: "32"}, - openrtb.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, arrImp, - &openrtb.Banner{W: &width, H: &height, Format: []openrtb.Format{ + &openrtb2.Banner{W: &width, H: &height, Format: []openrtb2.Format{ {W: 300, H: 250}, }}, nil, @@ -40,10 +40,10 @@ func TestFetchParams(t *testing.T) { DmxId: "222", MemberId: "5555", }}, - openrtb.Imp{ID: "32"}, - openrtb.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, + openrtb2.Imp{ID: "32"}, arrImp, - &openrtb.Banner{W: &width, H: &height, Format: []openrtb.Format{ + &openrtb2.Banner{W: &width, H: &height, Format: []openrtb2.Format{ {W: 300, H: 250}, }}, nil, @@ -70,7 +70,7 @@ func TestJsonSamples(t *testing.T) { func TestMakeRequestsOtherPlacement(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -79,22 +79,22 @@ func TestMakeRequestsOtherPlacement(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - User: &openrtb.User{ID: "bscakucbkasucbkasunscancasuin"}, - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + User: &openrtb2.User{ID: "bscakucbkasucbkasunscancasuin"}, + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, @@ -115,7 +115,7 @@ func TestMakeRequestsOtherPlacement(t *testing.T) { func TestMakeRequestsInvalid(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -124,21 +124,21 @@ func TestMakeRequestsInvalid(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, @@ -159,7 +159,7 @@ func TestMakeRequestsInvalid(t *testing.T) { func TestMakeRequestNoSite(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -168,20 +168,20 @@ func TestMakeRequestNoSite(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - App: &openrtb.App{ID: "cansanuabnua", Publisher: &openrtb.Publisher{ID: "whatever"}}, + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + App: &openrtb2.App{ID: "cansanuabnua", Publisher: &openrtb2.Publisher{ID: "whatever"}}, ID: "1234", } @@ -190,7 +190,7 @@ func TestMakeRequestNoSite(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("openrtb type should be an Array when it's an App") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -207,7 +207,7 @@ func TestMakeRequestNoSite(t *testing.T) { func TestMakeRequestsApp(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -216,25 +216,25 @@ func TestMakeRequestsApp(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - App: &openrtb.App{ID: "cansanuabnua", Publisher: &openrtb.Publisher{ID: "whatever"}}, + App: &openrtb2.App{ID: "cansanuabnua", Publisher: &openrtb2.Publisher{ID: "whatever"}}, ID: "1234", } @@ -243,7 +243,7 @@ func TestMakeRequestsApp(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("openrtb type should be an Array when it's an App") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -257,7 +257,7 @@ func TestMakeRequestsApp(t *testing.T) { func TestMakeRequestsNoUser(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -266,21 +266,21 @@ func TestMakeRequestsNoUser(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, @@ -299,7 +299,7 @@ func TestMakeRequests(t *testing.T) { //server := httptest.NewServer(http.HandlerFunc(DummyDmxServer)) var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -308,45 +308,45 @@ func TestMakeRequests(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "imp2", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - imp3 := openrtb.Imp{ + imp3 := openrtb2.Imp{ ID: "imp3", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp2, imp3}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp2, imp3}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID"}, + User: &openrtb2.User{ID: "districtmID"}, ID: "1234", } @@ -355,7 +355,7 @@ func TestMakeRequests(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("should have 1 request") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -369,7 +369,7 @@ func TestMakeRequests(t *testing.T) { func TestMakeBidVideo(t *testing.T) { var w, h int = 640, 480 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -378,23 +378,23 @@ func TestMakeBidVideo(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: width, H: height, MIMEs: []string{"video/mp4"}, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID"}, + User: &openrtb2.User{ID: "districtmID"}, ID: "1234", } @@ -403,7 +403,7 @@ func TestMakeBidVideo(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("should have 1 request") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -416,7 +416,7 @@ func TestMakeBidVideo(t *testing.T) { func TestMakeBidsNoContent(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -425,25 +425,25 @@ func TestMakeBidsNoContent(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID"}, + User: &openrtb2.User{ID: "districtmID"}, ID: "1234", } @@ -554,7 +554,7 @@ func TestMakeBidsNoContent(t *testing.T) { func TestUserExtEmptyObject(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -563,25 +563,25 @@ func TestUserExtEmptyObject(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{Ext: json.RawMessage(`{}`)}, + User: &openrtb2.User{Ext: json.RawMessage(`{}`)}, ID: "1234", } @@ -593,7 +593,7 @@ func TestUserExtEmptyObject(t *testing.T) { func TestUserEidsOnly(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -602,25 +602,25 @@ func TestUserEidsOnly(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{Ext: json.RawMessage(`{"eids": [{ + User: &openrtb2.User{Ext: json.RawMessage(`{"eids": [{ "source": "adserver.org", "uids": [{ "id": "111111111111", @@ -647,7 +647,7 @@ func TestUserEidsOnly(t *testing.T) { func TestUserDigitrustOnly(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -656,25 +656,25 @@ func TestUserDigitrustOnly(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{Ext: json.RawMessage(`{ + User: &openrtb2.User{Ext: json.RawMessage(`{ "digitrust": { "id": "11111111111", "keyv": 4 @@ -691,7 +691,7 @@ func TestUserDigitrustOnly(t *testing.T) { func TestUsersEids(t *testing.T) { var w, h int = 300, 250 - var width, height uint64 = uint64(w), uint64(h) + var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{ Endpoint: "https://dmx.districtm.io/b/v2"}) @@ -700,25 +700,25 @@ func TestUsersEids(t *testing.T) { t.Fatalf("Builder returned unexpected error %v", buildErr) } - imp1 := openrtb.Imp{ + imp1 := openrtb2.Imp{ ID: "imp1", Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"), - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &width, H: &height, - Format: []openrtb.Format{ + Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} - inputRequest := openrtb.BidRequest{ - Imp: []openrtb.Imp{imp1, imp1, imp1}, - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + inputRequest := openrtb2.BidRequest{ + Imp: []openrtb2.Imp{imp1, imp1, imp1}, + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "10007", }, }, - User: &openrtb.User{ID: "districtmID", Ext: json.RawMessage(`{"eids": [{ + User: &openrtb2.User{ID: "districtmID", Ext: json.RawMessage(`{"eids": [{ "source": "adserver.org", "uids": [{ "id": "111111111111", @@ -780,7 +780,7 @@ func TestUsersEids(t *testing.T) { if len(actualAdapterRequests) != 1 { t.Errorf("should have 1 request") } - var the_body openrtb.BidRequest + var the_body openrtb2.BidRequest if err := json.Unmarshal(actualAdapterRequests[0].Body, &the_body); err != nil { t.Errorf("failed to read bid request") } @@ -790,8 +790,8 @@ func TestUsersEids(t *testing.T) { } } func TestVideoImpInsertion(t *testing.T) { - var bidResp openrtb.BidResponse - var bid openrtb.Bid + var bidResp openrtb2.BidResponse + var bid openrtb2.Bid payload := []byte(`{ "id": "some-request-id", "seatbid": [ @@ -853,7 +853,7 @@ func TestVideoImpInsertion(t *testing.T) { if err != nil { t.Errorf("Payload is invalid") } - bid = openrtb.Bid(bidResp.SeatBid[0].Bid[0]) + bid = openrtb2.Bid(bidResp.SeatBid[0].Bid[0]) data := videoImpInsertion(&bid) find := strings.Index(data, "demo.arripiblik.com") if find == -1 { diff --git a/adapters/emx_digital/emx_digital.go b/adapters/emx_digital/emx_digital.go index dcebfdcbead..76f0af9b4c1 100644 --- a/adapters/emx_digital/emx_digital.go +++ b/adapters/emx_digital/emx_digital.go @@ -9,11 +9,11 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type EmxDigitalAdapter struct { @@ -32,7 +32,7 @@ func buildEndpoint(endpoint string, testing bool, timeout int64) string { return endpoint + "?t=" + strconv.FormatInt(timeout, 10) + "&ts=" + strconv.FormatInt(time.Now().Unix(), 10) + "&src=pbserver" } -func (a *EmxDigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *EmxDigitalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error if len(request.Imp) == 0 { @@ -80,7 +80,7 @@ func (a *EmxDigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a }}, errs } -func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpEmxDigital, error) { +func unpackImpExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpEmxDigital, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -111,7 +111,7 @@ func unpackImpExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpEmxDigital, error) { return &emxExt, nil } -func buildImpBanner(imp *openrtb.Imp) error { +func buildImpBanner(imp *openrtb2.Imp) error { if imp.Banner == nil { return &errortypes.BadInput{ @@ -138,7 +138,7 @@ func buildImpBanner(imp *openrtb.Imp) error { return nil } -func buildImpVideo(imp *openrtb.Imp) error { +func buildImpVideo(imp *openrtb2.Imp) error { if len(imp.Video.MIMEs) == 0 { return &errortypes.BadInput{ @@ -162,11 +162,11 @@ func buildImpVideo(imp *openrtb.Imp) error { } // not supporting VAST protocol 7 (VAST 4.0); -func cleanProtocol(protocols []openrtb.Protocol) []openrtb.Protocol { - newitems := make([]openrtb.Protocol, 0, len(protocols)) +func cleanProtocol(protocols []openrtb2.Protocol) []openrtb2.Protocol { + newitems := make([]openrtb2.Protocol, 0, len(protocols)) for _, i := range protocols { - if i != openrtb.ProtocolVAST40 { + if i != openrtb2.ProtocolVAST40 { newitems = append(newitems, i) } } @@ -175,7 +175,7 @@ func cleanProtocol(protocols []openrtb.Protocol) []openrtb.Protocol { } // Add EMX required properties to Imp object -func addImpProps(imp *openrtb.Imp, secure *int8, emxExt *openrtb_ext.ExtImpEmxDigital) { +func addImpProps(imp *openrtb2.Imp, secure *int8, emxExt *openrtb_ext.ExtImpEmxDigital) { imp.TagID = emxExt.TagID imp.Secure = secure @@ -202,10 +202,10 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // Handle request errors and formatting to be sent to EMX -func preprocess(request *openrtb.BidRequest) []error { +func preprocess(request *openrtb2.BidRequest) []error { impsCount := len(request.Imp) errors := make([]error, 0, impsCount) - resImps := make([]openrtb.Imp, 0, impsCount) + resImps := make([]openrtb2.Imp, 0, impsCount) secure := int8(0) domain := "" if request.Site != nil && request.Site.Page != "" { @@ -252,7 +252,7 @@ func preprocess(request *openrtb.BidRequest) []error { } // MakeBids make the bids for the bid response. -func (a *EmxDigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *EmxDigitalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { // no bid response @@ -265,7 +265,7 @@ func (a *EmxDigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json b/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json index 1281db66fd8..4108c7a524a 100644 --- a/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/emx_digital/emx_digitaltest/supplemental/invalid-response-unmarshall-error.json @@ -61,7 +61,7 @@ "expectedMakeBidsErrors": [ { - "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type uint64", + "value": "Unable to unpackage bid response\\. Error: json: cannot unmarshal string into Go struct field (Bid\\.seatbid\\.bid\\.w|Bid\\.w) of type int64", "comparison": "regex" } ] diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index a2401cd79b5..cac85eda919 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -9,16 +9,16 @@ import ( "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type EngageBDRAdapter struct { URI string } -func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0, len(request.Imp)) @@ -30,7 +30,7 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn } // EngageBDR uses different sspid parameters for banner and video. - sspidImps := make(map[string][]openrtb.Imp) + sspidImps := make(map[string][]openrtb2.Imp) for _, imp := range request.Imp { if imp.Audio != nil { @@ -92,7 +92,7 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn return adapterRequests, errors } -func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -109,7 +109,7 @@ func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb.BidRequest, e }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -127,7 +127,7 @@ func (adapter *EngageBDRAdapter) MakeBids(internalRequest *openrtb.BidRequest, e return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/eplanning/eplanning.go b/adapters/eplanning/eplanning.go index 062dcff4d61..ca10381936b 100644 --- a/adapters/eplanning/eplanning.go +++ b/adapters/eplanning/eplanning.go @@ -11,11 +11,11 @@ import ( "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "strconv" ) @@ -64,7 +64,7 @@ type hbResponseAd struct { Height uint64 `json:"h,omitempty"` } -func (adapter *EPlanningAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *EPlanningAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0, len(request.Imp)) totalImps := len(request.Imp) spacesStrings := make([]string, 0, totalImps) @@ -191,8 +191,8 @@ func (adapter *EPlanningAdapter) MakeRequests(request *openrtb.BidRequest, reqIn return requests, errors } -func isMobileDevice(request *openrtb.BidRequest) bool { - return request.Device != nil && (request.Device.DeviceType == openrtb.DeviceTypeMobileTablet || request.Device.DeviceType == openrtb.DeviceTypePhone || request.Device.DeviceType == openrtb.DeviceTypeTablet) +func isMobileDevice(request *openrtb2.BidRequest) bool { + return request.Device != nil && (request.Device.DeviceType == openrtb2.DeviceTypeMobileTablet || request.Device.DeviceType == openrtb2.DeviceTypePhone || request.Device.DeviceType == openrtb2.DeviceTypeTablet) } func cleanName(name string) string { @@ -202,7 +202,7 @@ func cleanName(name string) string { return name } -func verifyImp(imp *openrtb.Imp, isMobile bool) (*openrtb_ext.ExtImpEPlanning, error) { +func verifyImp(imp *openrtb2.Imp, isMobile bool) (*openrtb_ext.ExtImpEPlanning, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { @@ -240,7 +240,7 @@ func verifyImp(imp *openrtb.Imp, isMobile bool) (*openrtb_ext.ExtImpEPlanning, e return &impExt, nil } -func searchSizePriority(hashedFormats map[string]int, format []openrtb.Format, priorityOrderForSizesAsc []string) (uint64, uint64) { +func searchSizePriority(hashedFormats map[string]int, format []openrtb2.Format, priorityOrderForSizesAsc []string) (int64, int64) { for i := len(priorityOrderForSizesAsc) - 1; i >= 0; i-- { if formatIndex, wasFound := hashedFormats[priorityOrderForSizesAsc[i]]; wasFound { return format[formatIndex].W, format[formatIndex].H @@ -249,7 +249,7 @@ func searchSizePriority(hashedFormats map[string]int, format []openrtb.Format, p return format[0].W, format[0].H } -func getSizeFromImp(imp *openrtb.Imp, isMobile bool) (uint64, uint64) { +func getSizeFromImp(imp *openrtb2.Imp, isMobile bool) (int64, int64) { if imp.Banner.W != nil && imp.Banner.H != nil { return *imp.Banner.W, *imp.Banner.H } @@ -279,7 +279,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func (adapter *EPlanningAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *EPlanningAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -322,15 +322,15 @@ func (adapter *EPlanningAdapter) MakeBids(internalRequest *openrtb.BidRequest, e for _, space := range parsedResponse.Spaces { for _, ad := range space.Ads { if price, err := strconv.ParseFloat(ad.Price, 64); err == nil { - bid := openrtb.Bid{ + bid := openrtb2.Bid{ ID: ad.ImpressionID, AdID: ad.AdID, ImpID: spaceNameToImpID[space.Name], Price: price, AdM: ad.AdM, CrID: ad.CrID, - W: ad.Width, - H: ad.Height, + W: int64(ad.Width), + H: int64(ad.Height), } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ diff --git a/adapters/gamma/gamma.go b/adapters/gamma/gamma.go index 47f5775ff8e..320265b7016 100644 --- a/adapters/gamma/gamma.go +++ b/adapters/gamma/gamma.go @@ -7,11 +7,11 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type GammaAdapter struct { @@ -19,7 +19,7 @@ type GammaAdapter struct { } type gammaBid struct { - openrtb.Bid //base + openrtb2.Bid //base VastXML string `json:"vastXml,omitempty"` VastURL string `json:"vastUrl,omitempty"` } @@ -35,7 +35,7 @@ type gammaBidResponse struct { BidID string `json:"bidid,omitempty"` Cur string `json:"cur,omitempty"` CustomData string `json:"customdata,omitempty"` - NBR *openrtb.NoBidReasonCode `json:"nbr,omitempty"` + NBR *openrtb2.NoBidReasonCode `json:"nbr,omitempty"` Ext json.RawMessage `json:"ext,omitempty"` } @@ -57,7 +57,7 @@ func checkParams(gammaExt openrtb_ext.ExtImpGamma) error { } return nil } -func (a *GammaAdapter) makeRequest(request *openrtb.BidRequest, imp openrtb.Imp) (*adapters.RequestData, []error) { +func (a *GammaAdapter) makeRequest(request *openrtb2.BidRequest, imp openrtb2.Imp) (*adapters.RequestData, []error) { var errors []error var bidderExt adapters.ExtImpBidder @@ -139,7 +139,7 @@ func (a *GammaAdapter) makeRequest(request *openrtb.BidRequest, imp openrtb.Imp) Headers: headers, }, errors } -func (a *GammaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *GammaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { err := &errortypes.BadInput{ @@ -202,8 +202,8 @@ func (a *GammaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte return adapterRequests, errs } -func convertBid(gBid gammaBid, mediaType openrtb_ext.BidType) *openrtb.Bid { - var bid openrtb.Bid +func convertBid(gBid gammaBid, mediaType openrtb_ext.BidType) *openrtb2.Bid { + var bid openrtb2.Bid bid = gBid.Bid if mediaType == openrtb_ext.BidTypeVideo { @@ -224,7 +224,7 @@ func convertBid(gBid gammaBid, mediaType openrtb_ext.BidType) *openrtb.Bid { return &bid } -func (a *GammaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *GammaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -283,7 +283,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // getMediaTypeForImp figures out which media type this bid is for. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner //default type for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/gamoshi/gamoshi.go b/adapters/gamoshi/gamoshi.go index a6ab5febd3d..987b8df3083 100644 --- a/adapters/gamoshi/gamoshi.go +++ b/adapters/gamoshi/gamoshi.go @@ -6,19 +6,19 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type GamoshiAdapter struct { URI string } -func (a *GamoshiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *GamoshiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { @@ -125,7 +125,7 @@ func (a *GamoshiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap }}, errors } -func (a *GamoshiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *GamoshiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -143,7 +143,7 @@ func (a *GamoshiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %v. ", err), @@ -169,7 +169,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func getMediaType(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaType(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impId { if imp.Video != nil { diff --git a/adapters/grid/grid.go b/adapters/grid/grid.go index 955ead6b6c8..7dff52daf6f 100644 --- a/adapters/grid/grid.go +++ b/adapters/grid/grid.go @@ -5,18 +5,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type GridAdapter struct { endpoint string } -func processImp(imp *openrtb.Imp) error { +func processImp(imp *openrtb2.Imp) error { // get the grid extension var ext adapters.ExtImpBidder var gridExt openrtb_ext.ExtImpGrid @@ -38,13 +38,13 @@ func processImp(imp *openrtb.Imp) error { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *GridAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *GridAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) // copy the request, because we are going to mutate it requestCopy := *request // this will contain all the valid impressions - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // pre-process the imps for _, imp := range requestCopy.Imp { if err := processImp(&imp); err == nil { @@ -80,7 +80,7 @@ func (a *GridAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapter } // MakeBids unpacks the server's response into Bids. -func (a *GridAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *GridAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -97,7 +97,7 @@ func (a *GridAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequ }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -129,7 +129,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/grid/gridtest/supplemental/bad_response.json b/adapters/grid/gridtest/supplemental/bad_response.json index 87436da7fc1..a9d38368ab2 100644 --- a/adapters/grid/gridtest/supplemental/bad_response.json +++ b/adapters/grid/gridtest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index acb08ea3c00..c85517c6d21 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -7,11 +7,11 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // GumGumAdapter implements Bidder interface. @@ -20,8 +20,8 @@ type GumGumAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (g *GumGumAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - var validImps []openrtb.Imp +func (g *GumGumAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var validImps []openrtb2.Imp var trackingId string numRequests := len(request.Imp) @@ -83,7 +83,7 @@ func (g *GumGumAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // MakeBids unpacks the server's response into Bids. -func (g *GumGumAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (g *GumGumAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -99,7 +99,7 @@ func (g *GumGumAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe Message: fmt.Sprintf("Bad server response: HTTP status %d", response.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d. ", err), @@ -127,7 +127,7 @@ func (g *GumGumAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, errs } -func preprocess(imp *openrtb.Imp) (string, error) { +func preprocess(imp *openrtb2.Imp) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { err = &errortypes.BadInput{ @@ -148,7 +148,7 @@ func preprocess(imp *openrtb.Imp) (string, error) { return zone, nil } -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Banner != nil { return openrtb_ext.BidTypeBanner @@ -157,7 +157,7 @@ func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType return openrtb_ext.BidTypeVideo } -func validateVideoParams(video *openrtb.Video) (err error) { +func validateVideoParams(video *openrtb2.Video) (err error) { if video.W == 0 || video.H == 0 || video.MinDuration == 0 || video.MaxDuration == 0 || video.Placement == 0 || video.Linearity == 0 { return &errortypes.BadInput{ Message: "Invalid or missing video field(s)", diff --git a/adapters/improvedigital/improvedigital.go b/adapters/improvedigital/improvedigital.go index acda1b06d5a..e54b1f36a91 100644 --- a/adapters/improvedigital/improvedigital.go +++ b/adapters/improvedigital/improvedigital.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ImprovedigitalAdapter struct { @@ -17,7 +17,7 @@ type ImprovedigitalAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *ImprovedigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ImprovedigitalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) reqJSON, err := json.Marshal(request) @@ -38,7 +38,7 @@ func (a *ImprovedigitalAdapter) MakeRequests(request *openrtb.BidRequest, reqInf } // MakeBids unpacks the server's response into Bids. -func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -55,7 +55,7 @@ func (a *ImprovedigitalAdapter) MakeBids(internalRequest *openrtb.BidRequest, ex }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -103,7 +103,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json b/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json index 7099526bd90..7b103f011a1 100644 --- a/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json +++ b/adapters/improvedigital/improvedigitaltest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/info.go b/adapters/info.go index 63c66fc9862..49d7ed96d2a 100644 --- a/adapters/info.go +++ b/adapters/info.go @@ -5,11 +5,11 @@ import ( "io/ioutil" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" yaml "gopkg.in/yaml.v2" ) @@ -35,7 +35,7 @@ type InfoAwareBidder struct { info parsedBidderInfo } -func (i *InfoAwareBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) { +func (i *InfoAwareBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error) { var allowedMediaTypes parsedSupports if request.Site != nil { @@ -75,7 +75,7 @@ func (i *InfoAwareBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *Ext // pruneImps trims invalid media types from each imp, and returns true if any of the // Imps have _no_ valid Media Types left. -func (i *InfoAwareBidder) pruneImps(imps []openrtb.Imp, allowedTypes parsedSupports) (int, []error) { +func (i *InfoAwareBidder) pruneImps(imps []openrtb2.Imp, allowedTypes parsedSupports) (int, []error) { numToFilter := 0 var errs []error for i := 0; i < len(imps); i++ { @@ -118,12 +118,12 @@ func parseAllowedTypes(allowedTypes []openrtb_ext.BidType) (allowBanner bool, al return } -func hasAnyTypes(imp *openrtb.Imp) bool { +func hasAnyTypes(imp *openrtb2.Imp) bool { return imp.Banner != nil || imp.Video != nil || imp.Audio != nil || imp.Native != nil } -func (i *InfoAwareBidder) filterImps(imps []openrtb.Imp, numToFilter int) ([]openrtb.Imp, []error) { - newImps := make([]openrtb.Imp, 0, len(imps)-numToFilter) +func (i *InfoAwareBidder) filterImps(imps []openrtb2.Imp, numToFilter int) ([]openrtb2.Imp, []error) { + newImps := make([]openrtb2.Imp, 0, len(imps)-numToFilter) errs := make([]error, 0, numToFilter) for i := 0; i < len(imps); i++ { if hasAnyTypes(&imps[i]) { diff --git a/adapters/info_test.go b/adapters/info_test.go index 2d1f84cb760..c21c92a0c4a 100644 --- a/adapters/info_test.go +++ b/adapters/info_test.go @@ -5,11 +5,11 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -23,9 +23,9 @@ func TestAppNotSupported(t *testing.T) { }, } constrained := adapters.EnforceBidderInfo(bidder, info) - bids, errs := constrained.MakeRequests(&openrtb.BidRequest{ - Imp: []openrtb.Imp{{ID: "imp-1", Banner: &openrtb.Banner{}}}, - App: &openrtb.App{}, + bids, errs := constrained.MakeRequests(&openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ID: "imp-1", Banner: &openrtb2.Banner{}}}, + App: &openrtb2.App{}, }, &adapters.ExtraRequestInfo{}) if !assert.Len(t, errs, 1) { return @@ -45,9 +45,9 @@ func TestSiteNotSupported(t *testing.T) { }, } constrained := adapters.EnforceBidderInfo(bidder, info) - bids, errs := constrained.MakeRequests(&openrtb.BidRequest{ - Imp: []openrtb.Imp{{ID: "imp-1", Banner: &openrtb.Banner{}}}, - Site: &openrtb.Site{}, + bids, errs := constrained.MakeRequests(&openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ID: "imp-1", Banner: &openrtb2.Banner{}}}, + Site: &openrtb2.Site{}, }, &adapters.ExtraRequestInfo{}) if !assert.Len(t, errs, 1) { return @@ -74,15 +74,15 @@ func TestImpFiltering(t *testing.T) { testCases := []struct { description string - inBidRequest *openrtb.BidRequest + inBidRequest *openrtb2.BidRequest expectedErrors []error expectedImpLen int }{ { description: "Empty Imp array. MakeRequest() call not expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{}, - Site: &openrtb.Site{}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{}, + Site: &openrtb2.Site{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "Bid request didn't contain media types supported by the bidder"}, @@ -91,9 +91,9 @@ func TestImpFiltering(t *testing.T) { }, { description: "Sole imp in bid request is of wrong media type. MakeRequest() call not expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ID: "imp-1", Video: &openrtb.Video{}}}, - App: &openrtb.App{}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ID: "imp-1", Video: &openrtb2.Video{}}}, + App: &openrtb2.App{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "request.imp[0] uses video, but this bidder doesn't support it"}, @@ -103,13 +103,13 @@ func TestImpFiltering(t *testing.T) { }, { description: "All imps in bid request of wrong media type, MakeRequest() call not expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ - {ID: "imp-1", Video: &openrtb.Video{}}, - {ID: "imp-2", Native: &openrtb.Native{}}, - {ID: "imp-3", Audio: &openrtb.Audio{}}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + {ID: "imp-1", Video: &openrtb2.Video{}}, + {ID: "imp-2", Native: &openrtb2.Native{}}, + {ID: "imp-3", Audio: &openrtb2.Audio{}}, }, - App: &openrtb.App{}, + App: &openrtb2.App{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "request.imp[0] uses video, but this bidder doesn't support it"}, @@ -121,25 +121,25 @@ func TestImpFiltering(t *testing.T) { }, { description: "Some imps with correct media type, MakeRequest() call expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ { ID: "imp-1", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, }, { - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, }, { ID: "imp-2", - Video: &openrtb.Video{}, - Native: &openrtb.Native{}, + Video: &openrtb2.Video{}, + Native: &openrtb2.Native{}, }, { - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, }, - Site: &openrtb.Site{}, + Site: &openrtb2.Site{}, }, expectedErrors: []error{ &errortypes.BadInput{Message: "request.imp[1] uses native, but this bidder doesn't support it"}, @@ -152,12 +152,12 @@ func TestImpFiltering(t *testing.T) { }, { description: "All imps with correct media type, MakeRequest() call expected", - inBidRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ - {ID: "imp-1", Video: &openrtb.Video{}}, - {ID: "imp-2", Video: &openrtb.Video{}}, + inBidRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ + {ID: "imp-1", Video: &openrtb2.Video{}}, + {ID: "imp-2", Video: &openrtb2.Video{}}, }, - Site: &openrtb.Site{}, + Site: &openrtb2.Site{}, }, expectedErrors: nil, expectedImpLen: 2, @@ -179,10 +179,10 @@ func TestImpFiltering(t *testing.T) { } type mockBidder struct { - gotRequest *openrtb.BidRequest + gotRequest *openrtb2.BidRequest } -func (m *mockBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (m *mockBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var adapterRequests []*adapters.RequestData for i := 0; i < len(request.Imp); i++ { @@ -192,7 +192,7 @@ func (m *mockBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters return adapterRequests, nil } -func (m *mockBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (m *mockBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { return nil, []error{errors.New("mock MakeBids error")} } diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go index 411988fc4fa..585257b89d7 100644 --- a/adapters/inmobi/inmobi.go +++ b/adapters/inmobi/inmobi.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type InMobiAdapter struct { @@ -24,7 +24,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *InMobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *InMobiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error if len(request.Imp) == 0 { @@ -56,7 +56,7 @@ func (a *InMobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt }}, errs } -func (a *InMobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *InMobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -67,7 +67,7 @@ func (a *InMobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var serverBidResponse openrtb.BidResponse + var serverBidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &serverBidResponse); err != nil { return nil, []error{err} } @@ -87,7 +87,7 @@ func (a *InMobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, nil } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -117,7 +117,7 @@ func preprocess(imp *openrtb.Imp) error { return nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/invibes/invibes.go b/adapters/invibes/invibes.go index 358b16266ec..33fc5cdb6f0 100644 --- a/adapters/invibes/invibes.go +++ b/adapters/invibes/invibes.go @@ -9,13 +9,13 @@ import ( "strings" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const adapterVersion = "prebid_1.0.0" @@ -42,7 +42,7 @@ type InvibesBidParams struct { Properties map[string]InvibesPlacementProperty `json:"Properties"` } type InvibesPlacementProperty struct { - Formats []openrtb.Format `json:"Formats"` + Formats []openrtb2.Format `json:"Formats"` ImpID string `json:"ImpId"` } type InvibesInternalParams struct { @@ -61,7 +61,7 @@ type BidServerBidderResponse struct { Error string `json:"error"` } type BidServerTypedBid struct { - Bid openrtb.Bid `json:"bid"` + Bid openrtb2.Bid `json:"bid"` DealPriority int `json:"dealPriority"` } @@ -86,7 +86,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return &bidder, nil } -func (a *InvibesAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *InvibesAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var httpRequests []*adapters.RequestData var tempErrors []error gdprApplies, consentString := readGDPR(request) @@ -155,7 +155,7 @@ func (a *InvibesAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return httpRequests, finalErrors } -func readGDPR(request *openrtb.BidRequest) (bool, string) { +func readGDPR(request *openrtb2.BidRequest) (bool, string) { consentString := "" if request.User != nil { var extUser openrtb_ext.ExtUser @@ -175,12 +175,12 @@ func readGDPR(request *openrtb.BidRequest) (bool, string) { return gdprApplies, consentString } -func readAdFormats(currentBanner openrtb.Banner) []openrtb.Format { - var adFormats []openrtb.Format +func readAdFormats(currentBanner openrtb2.Banner) []openrtb2.Format { + var adFormats []openrtb2.Format if currentBanner.Format != nil { adFormats = currentBanner.Format } else if currentBanner.W != nil && currentBanner.H != nil { - adFormats = []openrtb.Format{ + adFormats = []openrtb2.Format{ { W: *currentBanner.W, H: *currentBanner.H, @@ -190,7 +190,7 @@ func readAdFormats(currentBanner openrtb.Banner) []openrtb.Format { return adFormats } -func (a *InvibesAdapter) makeRequest(invibesParams InvibesInternalParams, reqInfo *adapters.ExtraRequestInfo, existingRequests []*adapters.RequestData, request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *InvibesAdapter) makeRequest(invibesParams InvibesInternalParams, reqInfo *adapters.ExtraRequestInfo, existingRequests []*adapters.RequestData, request *openrtb2.BidRequest) (*adapters.RequestData, error) { url, err := a.makeURL(request, invibesParams.DomainID) if err != nil { @@ -233,7 +233,7 @@ func (a *InvibesAdapter) makeRequest(invibesParams InvibesInternalParams, reqInf }, nil } -func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, request *openrtb.BidRequest) (*InvibesAdRequest, error) { +func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, request *openrtb2.BidRequest) (*InvibesAdRequest, error) { var lid string = "" if request.User != nil && request.User.BuyerUID != "" { lid = request.User.BuyerUID @@ -247,11 +247,11 @@ func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, requ var width, height string if request.Device != nil { if request.Device.W > 0 { - width = strconv.FormatUint(request.Device.W, 10) + width = strconv.FormatInt(request.Device.W, 10) } if request.Device.H > 0 { - height = strconv.FormatUint(request.Device.H, 10) + height = strconv.FormatInt(request.Device.H, 10) } } @@ -278,7 +278,7 @@ func (a *InvibesAdapter) makeParameter(invibesParams InvibesInternalParams, requ return &invRequest, err } -func (a *InvibesAdapter) makeURL(request *openrtb.BidRequest, domainID int) (string, error) { +func (a *InvibesAdapter) makeURL(request *openrtb2.BidRequest, domainID int) (string, error) { host := "bid.videostep.com" if domainID == 1 { host = "adweb.videostepstage.com" @@ -307,7 +307,7 @@ func (a *InvibesAdapter) makeURL(request *openrtb.BidRequest, domainID int) (str } func (a *InvibesAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index e0a571aa8cc..76a86c8c6a8 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -10,12 +10,12 @@ import ( "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type IxAdapter struct { @@ -46,8 +46,8 @@ type ixBidResult struct { type callOneObject struct { requestJSON bytes.Buffer - width uint64 - height uint64 + width int64 + height int64 bidType string } @@ -87,11 +87,11 @@ func (a *IxAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pbs.P thisImp.TagID = unit.Code if thisImp.Banner != nil { - thisImp.Banner.Format = []openrtb.Format{format} + thisImp.Banner.Format = []openrtb2.Format{format} thisImp.Banner.W = &format.W thisImp.Banner.H = &format.H } - indexReq.Imp = []openrtb.Imp{thisImp} + indexReq.Imp = []openrtb2.Imp{thisImp} // Index spec says "adunit path representing ad server inventory" but we don't have this // ext is DFP div ID and KV pairs if avail //indexReq.Imp[i].Ext = json.RawMessage("{}") @@ -99,7 +99,7 @@ func (a *IxAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pbs.P if indexReq.Site != nil { // Any objects pointed to by indexReq *must not be mutated*, or we will get race conditions. siteCopy := *indexReq.Site - siteCopy.Publisher = &openrtb.Publisher{ID: params.SiteID} + siteCopy.Publisher = &openrtb2.Publisher{ID: params.SiteID} indexReq.Site = &siteCopy } @@ -221,7 +221,7 @@ func (a *IxAdapter) callOne(ctx context.Context, reqJSON bytes.Buffer) (ixBidRes } result.ResponseBody = string(body) - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return result, &errortypes.BadServerResponse{ @@ -251,7 +251,7 @@ func (a *IxAdapter) callOne(ctx context.Context, reqJSON bytes.Buffer) (ixBidRes return result, nil } -func (a *IxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { nImp := len(request.Imp) if nImp > a.maxRequests { request.Imp = request.Imp[:a.maxRequests] @@ -286,8 +286,8 @@ func (a *IxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters. formats := getBannerFormats(&banner) for iFmt := range formats { banner.Format = formats[iFmt : iFmt+1] - banner.W = openrtb.Uint64Ptr(banner.Format[0].W) - banner.H = openrtb.Uint64Ptr(banner.Format[0].H) + banner.W = openrtb2.Int64Ptr(banner.Format[0].W) + banner.H = openrtb2.Int64Ptr(banner.Format[0].H) if requestData, err := createRequestData(a, request, &headers); err == nil { if iFmt == 0 { requests = append(requests, requestData) @@ -312,12 +312,12 @@ func (a *IxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters. return append(requests, multiSizeRequests...), errs } -func setSitePublisherId(request *openrtb.BidRequest, iImp int) error { +func setSitePublisherId(request *openrtb2.BidRequest, iImp int) error { if iImp == 0 { // first impression - create a site and pub copy site := *request.Site if site.Publisher == nil { - site.Publisher = &openrtb.Publisher{} + site.Publisher = &openrtb2.Publisher{} } else { publisher := *site.Publisher site.Publisher = &publisher @@ -339,14 +339,14 @@ func setSitePublisherId(request *openrtb.BidRequest, iImp int) error { return nil } -func getBannerFormats(banner *openrtb.Banner) []openrtb.Format { +func getBannerFormats(banner *openrtb2.Banner) []openrtb2.Format { if len(banner.Format) == 0 && banner.W != nil && banner.H != nil { - banner.Format = []openrtb.Format{{W: *banner.W, H: *banner.H}} + banner.Format = []openrtb2.Format{{W: *banner.W, H: *banner.H}} } return banner.Format } -func createRequestData(a *IxAdapter, request *openrtb.BidRequest, headers *http.Header) (*adapters.RequestData, error) { +func createRequestData(a *IxAdapter, request *openrtb2.BidRequest, headers *http.Header) (*adapters.RequestData, error) { body, err := json.Marshal(request) return &adapters.RequestData{ Method: "POST", @@ -356,7 +356,7 @@ func createRequestData(a *IxAdapter, request *openrtb.BidRequest, headers *http. }, err } -func (a *IxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { switch { case response.StatusCode == http.StatusNoContent: return nil, nil @@ -370,7 +370,7 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReques }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("JSON parsing error: %v", err), diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index aaee4ba7694..91d8c043afe 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -11,12 +11,12 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const endpoint string = "http://host/endpoint" @@ -39,7 +39,7 @@ func getAdUnit() pbs.PBSAdUnit { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -54,7 +54,7 @@ func getVideoAdUnit() pbs.PBSAdUnit { Code: "unitCodeVideo", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, BidID: "bididvideo", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 100, H: 75, @@ -73,8 +73,8 @@ func getVideoAdUnit() pbs.PBSAdUnit { } } -func getOpenRTBBid(i openrtb.Imp) openrtb.Bid { - return openrtb.Bid{ +func getOpenRTBBid(i openrtb2.Imp) openrtb2.Bid { + return openrtb2.Bid{ ID: fmt.Sprintf("%d", rand.Intn(1000)), ImpID: i.ID, Price: 1.0, @@ -94,7 +94,7 @@ func dummyIXServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -103,10 +103,10 @@ func dummyIXServer(w http.ResponseWriter, r *http.Request) { impression := breq.Imp[0] - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ getOpenRTBBid(impression), }, }, @@ -141,7 +141,7 @@ func TestIxInvalidCall(t *testing.T) { func TestIxInvalidCallReqAppNil(t *testing.T) { ctx := context.TODO() pbReq := pbs.PBSRequest{ - App: &openrtb.App{}, + App: &openrtb2.App{}, } pbBidder := pbs.PBSBidder{} @@ -203,7 +203,7 @@ func TestIxTimeoutMultipleSlots(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -212,10 +212,10 @@ func TestIxTimeoutMultipleSlots(t *testing.T) { impression := breq.Imp[0] - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ getOpenRTBBid(impression), }, }, @@ -247,7 +247,7 @@ func TestIxTimeoutMultipleSlots(t *testing.T) { adUnit1 := getAdUnit() adUnit2 := getAdUnit() adUnit2.Code = "unitCode2" - adUnit2.Sizes = []openrtb.Format{ + adUnit2.Sizes = []openrtb2.Format{ { W: 8, H: 10, @@ -382,7 +382,7 @@ func TestIxInvalidCallMissingSize(t *testing.T) { ctx := context.TODO() pbReq := pbs.PBSRequest{} adUnit := getAdUnit() - adUnit.Sizes = []openrtb.Format{} + adUnit.Sizes = []openrtb2.Format{} pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", AdUnits: []pbs.PBSAdUnit{ @@ -423,17 +423,17 @@ func TestIxMismatchUnitCode(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ { ID: fmt.Sprintf("%d", rand.Intn(1000)), ImpID: "unitCode_bogus", @@ -477,14 +477,14 @@ func TestNoSeatBid(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{} + resp := openrtb2.BidResponse{} js, err := json.Marshal(resp) if err != nil { @@ -516,15 +516,15 @@ func TestNoSeatBidBid(t *testing.T) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + resp := openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ {}, }, } @@ -650,7 +650,7 @@ func TestIxTwoSlotMultiSizeOnlyValidIXSizeResponse(t *testing.T) { ctx := context.TODO() pbReq := pbs.PBSRequest{} adUnit := getAdUnit() - adUnit.Sizes = append(adUnit.Sizes, openrtb.Format{W: 20, H: 22}) + adUnit.Sizes = append(adUnit.Sizes, openrtb2.Format{W: 20, H: 22}) pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", @@ -674,7 +674,7 @@ func TestIxTwoSlotMultiSizeOnlyValidIXSizeResponse(t *testing.T) { } } -func bidResponseForSizeExist(bids pbs.PBSBidSlice, h uint64, w uint64) bool { +func bidResponseForSizeExist(bids pbs.PBSBidSlice, h, w int64) bool { for _, v := range bids { if v.Height == h && v.Width == w { return true diff --git a/adapters/kidoz/kidoz.go b/adapters/kidoz/kidoz.go index 755ffd24d63..2f29b865b2e 100644 --- a/adapters/kidoz/kidoz.go +++ b/adapters/kidoz/kidoz.go @@ -6,18 +6,18 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type KidozAdapter struct { endpoint string } -func (a *KidozAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *KidozAdapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -102,7 +102,7 @@ func (a *KidozAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.Ext return result, errs } -func (a *KidozAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *KidozAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error switch responseData.StatusCode { @@ -129,7 +129,7 @@ func (a *KidozAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.Request }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse err := json.Unmarshal(responseData.Body, &bidResponse) if err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -169,7 +169,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters const UndefinedMediaType = openrtb_ext.BidType("") -func GetMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func GetMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { var bidType openrtb_ext.BidType = UndefinedMediaType for _, impression := range imps { if impression.ID != impID { diff --git a/adapters/kidoz/kidoz_test.go b/adapters/kidoz/kidoz_test.go index b3365ac70a9..6e2e5eee99d 100644 --- a/adapters/kidoz/kidoz_test.go +++ b/adapters/kidoz/kidoz_test.go @@ -5,11 +5,11 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -24,14 +24,14 @@ func TestJsonSamples(t *testing.T) { adapterstest.RunJSONBidderTest(t, "kidoztest", bidder) } -func makeBidRequest() *openrtb.BidRequest { - request := &openrtb.BidRequest{ +func makeBidRequest() *openrtb2.BidRequest { + request := &openrtb2.BidRequest{ ID: "test-req-id-0", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "test-imp-id-0", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: 320, H: 50, @@ -89,22 +89,22 @@ func TestMakeBids(t *testing.T) { } func TestGetMediaTypeForImp(t *testing.T) { - imps := []openrtb.Imp{ + imps := []openrtb2.Imp{ { ID: "1", - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, }, { ID: "2", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, }, { ID: "3", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, }, { ID: "4", - Audio: &openrtb.Audio{}, + Audio: &openrtb2.Audio{}, }, } diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index 1f2e6b636c6..b5aa209ce4b 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -7,12 +7,12 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type KrushmediaAdapter struct { @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getHeaders(request *openrtb.BidRequest) *http.Header { +func getHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -60,7 +60,7 @@ func getHeaders(request *openrtb.BidRequest) *http.Header { } func (a *KrushmediaAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -107,7 +107,7 @@ func (a *KrushmediaAdapter) MakeRequests( }}, nil } -func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtKrushmedia, error) { +func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtKrushmedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -129,7 +129,7 @@ func (a *KrushmediaAdapter) buildEndpointURL(params *openrtb_ext.ExtKrushmedia) } func (a *KrushmediaAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -157,7 +157,7 @@ func (a *KrushmediaAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Bad Server Response", @@ -176,7 +176,7 @@ func (a *KrushmediaAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/kubient/kubient.go b/adapters/kubient/kubient.go index fd6c4ef13e8..c8617dbe0b0 100644 --- a/adapters/kubient/kubient.go +++ b/adapters/kubient/kubient.go @@ -8,9 +8,9 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Builder builds a new instance of the Kubient adapter for the given bidder with the given config. @@ -28,7 +28,7 @@ type KubientAdapter struct { // MakeRequests prepares the HTTP requests which should be made to fetch bids. func (adapter *KubientAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ([]*adapters.RequestData, []error) { if len(openRTBRequest.Imp) == 0 { @@ -65,7 +65,7 @@ func (adapter *KubientAdapter) MakeRequests( return requestsToBidder, errs } -func checkImpExt(impObj openrtb.Imp) error { +func checkImpExt(impObj openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(impObj.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -87,7 +87,7 @@ func checkImpExt(impObj openrtb.Imp) error { } // MakeBids makes the bids -func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -106,7 +106,7 @@ func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -131,7 +131,7 @@ func (adapter *KubientAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/kubient/kubienttest/supplemental/bad_response.json b/adapters/kubient/kubienttest/supplemental/bad_response.json index 076acf29058..832dc975088 100644 --- a/adapters/kubient/kubienttest/supplemental/bad_response.json +++ b/adapters/kubient/kubienttest/supplemental/bad_response.json @@ -54,7 +54,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/lifestreet/lifestreet.go b/adapters/lifestreet/lifestreet.go index ca9b9688943..7cd525c2e43 100644 --- a/adapters/lifestreet/lifestreet.go +++ b/adapters/lifestreet/lifestreet.go @@ -11,10 +11,10 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -63,7 +63,7 @@ func (a *LifestreetAdapter) callOne(ctx context.Context, req *pbs.PBSRequest, re return } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return @@ -98,11 +98,11 @@ func (a *LifestreetAdapter) callOne(ctx context.Context, req *pbs.PBSRequest, re return } -func (a *LifestreetAdapter) MakeOpenRtbBidRequest(req *pbs.PBSRequest, bidder *pbs.PBSBidder, slotTag string, mtype pbs.MediaType, unitInd int) (openrtb.BidRequest, error) { +func (a *LifestreetAdapter) MakeOpenRtbBidRequest(req *pbs.PBSRequest, bidder *pbs.PBSBidder, slotTag string, mtype pbs.MediaType, unitInd int) (openrtb2.BidRequest, error) { lsReq, err := adapters.MakeOpenRTBGeneric(req, bidder, a.Name(), []pbs.MediaType{mtype}) if err != nil { - return openrtb.BidRequest{}, err + return openrtb2.BidRequest{}, err } if lsReq.Imp != nil && len(lsReq.Imp) > 0 { diff --git a/adapters/lifestreet/lifestreet_test.go b/adapters/lifestreet/lifestreet_test.go index 39712192da6..f2d2cee190d 100644 --- a/adapters/lifestreet/lifestreet_test.go +++ b/adapters/lifestreet/lifestreet_test.go @@ -16,9 +16,9 @@ import ( "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type lsTagInfo struct { @@ -53,7 +53,7 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -84,7 +84,7 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Model '%s' doesn't match '%s", breq.Device.Model, lsdata.deviceModel), http.StatusInternalServerError) return } - if *breq.Device.ConnectionType != openrtb.ConnectionType(lsdata.deviceConnectiontype) { + if *breq.Device.ConnectionType != openrtb2.ConnectionType(lsdata.deviceConnectiontype) { http.Error(w, fmt.Sprintf("Connectiontype '%d' doesn't match '%d", breq.Device.ConnectionType, lsdata.deviceConnectiontype), http.StatusInternalServerError) return } @@ -96,24 +96,24 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { http.Error(w, fmt.Sprintf("Wrong number of imp objects sent: %d", len(breq.Imp)), http.StatusInternalServerError) return } - var bid *openrtb.Bid + var bid *openrtb2.Bid for _, tag := range lsdata.tags { if breq.Imp[0].Banner == nil { http.Error(w, fmt.Sprintf("No banner object sent"), http.StatusInternalServerError) return } - if *breq.Imp[0].Banner.W != lsdata.width || *breq.Imp[0].Banner.H != lsdata.height { + if *breq.Imp[0].Banner.W != int64(lsdata.width) || *breq.Imp[0].Banner.H != int64(lsdata.height) { http.Error(w, fmt.Sprintf("Size '%dx%d' doesn't match '%dx%d", breq.Imp[0].Banner.W, breq.Imp[0].Banner.H, lsdata.width, lsdata.height), http.StatusInternalServerError) return } if breq.Imp[0].TagID == tag.slotTag { - bid = &openrtb.Bid{ + bid = &openrtb2.Bid{ ID: "random-id", ImpID: breq.Imp[0].ID, Price: tag.bid, AdM: tag.content, - W: lsdata.width, - H: lsdata.height, + W: int64(lsdata.width), + H: int64(lsdata.height), } } } @@ -122,14 +122,14 @@ func DummyLifestreetServer(w http.ResponseWriter, r *http.Request) { return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "2345676337", BidID: "975537589956", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "LSM", - Bid: []openrtb.Bid{*bid}, + Bid: []openrtb2.Bid{*bid}, }, }, } @@ -181,25 +181,25 @@ func TestLifestreetBasicResponse(t *testing.T) { pbin := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 2), - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: lsdata.appBundle, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: lsdata.deviceUA, IP: lsdata.deviceIP, Make: lsdata.deviceMake, Model: lsdata.deviceModel, - ConnectionType: openrtb.ConnectionType(lsdata.deviceConnectiontype).Ptr(), + ConnectionType: openrtb2.ConnectionType(lsdata.deviceConnectiontype).Ptr(), IFA: lsdata.deviceIfa, }, } for i, tag := range lsdata.tags { pbin.AdUnits[i] = pbs.AdUnit{ Code: tag.code, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { - W: lsdata.width, - H: lsdata.height, + W: int64(lsdata.width), + H: int64(lsdata.height), }, }, Bids: []pbs.Bids{ @@ -266,7 +266,7 @@ func TestLifestreetBasicResponse(t *testing.T) { if bid.Price != tag.bid { t.Errorf("Incorrect bid price '%.2f' expected '%.2f'", bid.Price, tag.bid) } - if bid.Width != lsdata.width || bid.Height != lsdata.height { + if bid.Width != int64(lsdata.width) || bid.Height != int64(lsdata.height) { t.Errorf("Incorrect bid size %dx%d, expected %dx%d", bid.Width, bid.Height, lsdata.width, lsdata.height) } if bid.Adm != tag.content { diff --git a/adapters/lockerdome/lockerdome.go b/adapters/lockerdome/lockerdome.go index ec9ebe8c281..7a2b3ce58fb 100644 --- a/adapters/lockerdome/lockerdome.go +++ b/adapters/lockerdome/lockerdome.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const unexpectedStatusCodeMessage = "Unexpected status code: %d. Run with request.debug = 1 for more info" @@ -20,7 +20,7 @@ type LockerDomeAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids [from the bidder, in this case, LockerDome] -func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb.BidRequest, extraReqInfo *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { +func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb2.BidRequest, extraReqInfo *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { numberOfImps := len(openRTBRequest.Imp) @@ -70,7 +70,7 @@ func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb.BidReques indexesOfValidImps = append(indexesOfValidImps, i) } if numberOfImps > len(indexesOfValidImps) { - var validImps []openrtb.Imp + var validImps []openrtb2.Imp for j := 0; j < len(indexesOfValidImps); j++ { validImps = append(validImps, openRTBRequest.Imp[j]) } @@ -109,7 +109,7 @@ func (adapter *LockerDomeAdapter) MakeRequests(openRTBRequest *openrtb.BidReques } // MakeBids unpacks the server's response into Bids. -func (adapter *LockerDomeAdapter) MakeBids(openRTBRequest *openrtb.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData) (bidderResponse *adapters.BidderResponse, errs []error) { +func (adapter *LockerDomeAdapter) MakeBids(openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData) (bidderResponse *adapters.BidderResponse, errs []error) { if bidderRawResponse.StatusCode == http.StatusNoContent { return nil, nil @@ -127,7 +127,7 @@ func (adapter *LockerDomeAdapter) MakeBids(openRTBRequest *openrtb.BidRequest, r }} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{ fmt.Errorf("Error unmarshaling LockerDome bid response - %s", err.Error()), diff --git a/adapters/lockerdome/lockerdometest/supplemental/bad_response.json b/adapters/lockerdome/lockerdometest/supplemental/bad_response.json index 8df8a0e1633..d119a47da80 100644 --- a/adapters/lockerdome/lockerdometest/supplemental/bad_response.json +++ b/adapters/lockerdome/lockerdometest/supplemental/bad_response.json @@ -56,7 +56,7 @@ "expectedMakeBidsErrors": [ { - "value": "Error unmarshaling LockerDome bid response - json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Error unmarshaling LockerDome bid response - json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/logicad/logicad.go b/adapters/logicad/logicad.go index dd316321381..a38c99bce20 100644 --- a/adapters/logicad/logicad.go +++ b/adapters/logicad/logicad.go @@ -5,18 +5,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type LogicadAdapter struct { endpoint string } -func (adapter *LogicadAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *LogicadAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{Message: "No impression in the bid request"}} } @@ -38,10 +38,10 @@ func (adapter *LogicadAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo return result, errs } -func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLogicad][]openrtb.Imp, []openrtb.Imp, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpLogicad][]openrtb2.Imp, []openrtb2.Imp, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) - res := make(map[openrtb_ext.ExtImpLogicad][]openrtb.Imp) + resImps := make([]openrtb2.Imp, 0, len(imps)) + res := make(map[openrtb_ext.ExtImpLogicad][]openrtb2.Imp) for _, imp := range imps { impExt, err := getImpressionExt(&imp) @@ -55,7 +55,7 @@ func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLogicad][]ope } if res[impExt] == nil { - res[impExt] = make([]openrtb.Imp, 0) + res[impExt] = make([]openrtb2.Imp, 0) } res[impExt] = append(res[impExt], imp) resImps = append(resImps, imp) @@ -70,7 +70,7 @@ func validateImpression(impExt *openrtb_ext.ExtImpLogicad) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (openrtb_ext.ExtImpLogicad, error) { +func getImpressionExt(imp *openrtb2.Imp) (openrtb_ext.ExtImpLogicad, error) { var bidderExt adapters.ExtImpBidder var logicadExt openrtb_ext.ExtImpLogicad @@ -87,7 +87,7 @@ func getImpressionExt(imp *openrtb.Imp) (openrtb_ext.ExtImpLogicad, error) { return logicadExt, nil } -func (adapter *LogicadAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *LogicadAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -105,7 +105,7 @@ func (adapter *LogicadAdapter) buildAdapterRequest(prebidBidRequest *openrtb.Bid Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLogicad, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -117,7 +117,7 @@ func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext. } //MakeBids translates Logicad bid response to prebid-server specific format -func (adapter *LogicadAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *LogicadAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -126,7 +126,7 @@ func (adapter *LogicadAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg := fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} diff --git a/adapters/lunamedia/lunamedia.go b/adapters/lunamedia/lunamedia.go index c5e0ef8a3ee..daf38ea207e 100644 --- a/adapters/lunamedia/lunamedia.go +++ b/adapters/lunamedia/lunamedia.go @@ -6,12 +6,12 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type LunaMediaAdapter struct { @@ -19,7 +19,7 @@ type LunaMediaAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *LunaMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *LunaMediaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "No impression in the bid request"}) @@ -49,10 +49,10 @@ func (adapter *LunaMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqIn } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLunaMedia][]openrtb.Imp, []openrtb.Imp, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpLunaMedia][]openrtb2.Imp, []openrtb2.Imp, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) - res := make(map[openrtb_ext.ExtImpLunaMedia][]openrtb.Imp) + resImps := make([]openrtb2.Imp, 0, len(imps)) + res := make(map[openrtb_ext.ExtImpLunaMedia][]openrtb2.Imp) for _, imp := range imps { impExt, err := getImpressionExt(&imp) @@ -71,7 +71,7 @@ func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpLunaMedia][]o continue } if res[*impExt] == nil { - res[*impExt] = make([]openrtb.Imp, 0) + res[*impExt] = make([]openrtb2.Imp, 0) } res[*impExt] = append(res[*impExt], imp) resImps = append(resImps, imp) @@ -87,7 +87,7 @@ func validateImpression(impExt *openrtb_ext.ExtImpLunaMedia) error { } //Alter impression info to comply with LunaMedia platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to LunaMedia platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -95,7 +95,7 @@ func compatImpression(imp *openrtb.Imp) error { return nil } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner @@ -114,7 +114,7 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpLunaMedia, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpLunaMedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -130,7 +130,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpLunaMedia, error) { return &LunaMediaExt, nil } -func (adapter *LunaMediaAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *LunaMediaAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -154,7 +154,7 @@ func (adapter *LunaMediaAdapter) buildAdapterRequest(prebidBidRequest *openrtb.B Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpLunaMedia, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -184,7 +184,7 @@ func (adapter *LunaMediaAdapter) buildEndpointURL(params *openrtb_ext.ExtImpLuna } //MakeBids translates LunaMedia bid response to prebid-server specific format -func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var msg = "" if response.StatusCode == http.StatusNoContent { return nil, nil @@ -194,7 +194,7 @@ func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, e return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg = fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} @@ -218,7 +218,7 @@ func (adapter *LunaMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, e } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo diff --git a/adapters/marsmedia/marsmedia.go b/adapters/marsmedia/marsmedia.go index f1cffac2274..df9e4302c06 100644 --- a/adapters/marsmedia/marsmedia.go +++ b/adapters/marsmedia/marsmedia.go @@ -6,18 +6,18 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type MarsmediaAdapter struct { URI string } -func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { request := *requestIn @@ -106,7 +106,7 @@ func (a *MarsmediaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo * }}, []error{} } -func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -124,7 +124,7 @@ func (a *MarsmediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d. ", err), @@ -150,7 +150,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } // getMediaTypeForImp figures out which media type this bid is for. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner //default type for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/mgid/mgid.go b/adapters/mgid/mgid.go index 9754ba8088e..922cfd6bb37 100644 --- a/adapters/mgid/mgid.go +++ b/adapters/mgid/mgid.go @@ -6,11 +6,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type MgidAdapter struct { @@ -26,7 +26,7 @@ type RespBidExt struct { CreativeType openrtb_ext.BidType `json:"crtype"` } -func (a *MgidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) (adapterRequests []*adapters.RequestData, errs []error) { +func (a *MgidAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (adapterRequests []*adapters.RequestData, errs []error) { adapterReq, errs := a.makeRequest(request) if adapterReq != nil && len(errs) == 0 { @@ -36,7 +36,7 @@ func (a *MgidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapter return } -func (a *MgidAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *MgidAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error path, err := preprocess(request) @@ -65,7 +65,7 @@ func (a *MgidAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Reques } // Mutate the request to get it ready to send to yieldmo. -func preprocess(request *openrtb.BidRequest) (path string, err error) { +func preprocess(request *openrtb2.BidRequest) (path string, err error) { if request.TMax == 0 { request.TMax = 200 } @@ -123,7 +123,7 @@ func preprocess(request *openrtb.BidRequest) (path string, err error) { return } -func (a *MgidAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *MgidAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -140,7 +140,7 @@ func (a *MgidAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.Requ }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} diff --git a/adapters/mobfoxpb/mobfoxpb.go b/adapters/mobfoxpb/mobfoxpb.go index 42ac3dc02d4..a40a5e2f55a 100644 --- a/adapters/mobfoxpb/mobfoxpb.go +++ b/adapters/mobfoxpb/mobfoxpb.go @@ -5,12 +5,12 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type adapter struct { @@ -26,7 +26,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests create bid request for mobfoxpb demand -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var err error var tagID string @@ -41,7 +41,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return nil, errs } imp.TagID = tagID - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} adapterReq, err := a.makeRequest(&reqCopy) if err != nil { errs = append(errs, err) @@ -52,7 +52,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return adapterRequests, errs } -func (a *adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { reqJSON, err := json.Marshal(request) if err != nil { @@ -71,7 +71,7 @@ func (a *adapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestDat } // MakeBids makes the bids -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -84,7 +84,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -109,7 +109,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json index 2f834c92be7..f1d268c35e7 100644 --- a/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json +++ b/adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json @@ -80,7 +80,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/mobilefuse/mobilefuse.go b/adapters/mobilefuse/mobilefuse.go index 4e545ec1adc..ec271d2a0eb 100644 --- a/adapters/mobilefuse/mobilefuse.go +++ b/adapters/mobilefuse/mobilefuse.go @@ -7,12 +7,12 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type MobileFuseAdapter struct { @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (adapter *MobileFuseAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *MobileFuseAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var adapterRequests []*adapters.RequestData adapterRequest, errs := adapter.makeRequest(request) @@ -44,7 +44,7 @@ func (adapter *MobileFuseAdapter) MakeRequests(request *openrtb.BidRequest, reqI return adapterRequests, errs } -func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb.BidRequest, outgoingRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb2.BidRequest, outgoingRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -61,7 +61,7 @@ func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb.BidRequest, }} } - var incomingBidResponse openrtb.BidResponse + var incomingBidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &incomingBidResponse); err != nil { return nil, []error{err} @@ -81,7 +81,7 @@ func (adapter *MobileFuseAdapter) MakeBids(incomingRequest *openrtb.BidRequest, return outgoingBidResponse, nil } -func (adapter *MobileFuseAdapter) makeRequest(bidRequest *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (adapter *MobileFuseAdapter) makeRequest(bidRequest *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error mobileFuseExtension, errs := adapter.getFirstMobileFuseExtension(bidRequest) @@ -124,7 +124,7 @@ func (adapter *MobileFuseAdapter) makeRequest(bidRequest *openrtb.BidRequest) (* }, errs } -func (adapter *MobileFuseAdapter) getFirstMobileFuseExtension(request *openrtb.BidRequest) (*openrtb_ext.ExtImpMobileFuse, []error) { +func (adapter *MobileFuseAdapter) getFirstMobileFuseExtension(request *openrtb2.BidRequest) (*openrtb_ext.ExtImpMobileFuse, []error) { var mobileFuseImpExtension openrtb_ext.ExtImpMobileFuse var errs []error @@ -167,8 +167,8 @@ func (adapter *MobileFuseAdapter) getEndpoint(ext *openrtb_ext.ExtImpMobileFuse) return url, nil } -func (adapter *MobileFuseAdapter) getValidImps(bidRequest *openrtb.BidRequest, ext *openrtb_ext.ExtImpMobileFuse) []openrtb.Imp { - var validImps []openrtb.Imp +func (adapter *MobileFuseAdapter) getValidImps(bidRequest *openrtb2.BidRequest, ext *openrtb_ext.ExtImpMobileFuse) []openrtb2.Imp { + var validImps []openrtb2.Imp for _, imp := range bidRequest.Imp { if imp.Banner != nil || imp.Video != nil { @@ -187,7 +187,7 @@ func (adapter *MobileFuseAdapter) getValidImps(bidRequest *openrtb.BidRequest, e return validImps } -func (adapter *MobileFuseAdapter) getBidType(imp_id string, imps []openrtb.Imp) openrtb_ext.BidType { +func (adapter *MobileFuseAdapter) getBidType(imp_id string, imps []openrtb2.Imp) openrtb_ext.BidType { if imps[0].Video != nil { return openrtb_ext.BidTypeVideo } diff --git a/adapters/nanointeractive/nanointeractive.go b/adapters/nanointeractive/nanointeractive.go index 9dfee06eb42..4eb817e6036 100644 --- a/adapters/nanointeractive/nanointeractive.go +++ b/adapters/nanointeractive/nanointeractive.go @@ -5,21 +5,21 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type NanoInteractiveAdapter struct { endpoint string } -func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp var adapterRequests []*adapters.RequestData var referer string = "" @@ -47,7 +47,7 @@ func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb.BidRequest, re // set referer origin if referer != "" { if bidRequest.Site == nil { - bidRequest.Site = &openrtb.Site{} + bidRequest.Site = &openrtb2.Site{} } bidRequest.Site.Ref = referer } @@ -88,7 +88,7 @@ func (a *NanoInteractiveAdapter) MakeRequests(bidRequest *openrtb.BidRequest, re } func (a *NanoInteractiveAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { @@ -102,7 +102,7 @@ func (a *NanoInteractiveAdapter) MakeBids( }} } - var openRtbBidResponse openrtb.BidResponse + var openRtbBidResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &openRtbBidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ @@ -127,7 +127,7 @@ func (a *NanoInteractiveAdapter) MakeBids( return bidResponse, nil } -func checkImp(imp *openrtb.Imp) (string, error) { +func checkImp(imp *openrtb2.Imp) (string, error) { // We support only banner impression if imp.Banner == nil { return "", fmt.Errorf("invalid MediaType. NanoInteractive only supports Banner type. ImpID=%s", imp.ID) diff --git a/adapters/ninthdecimal/ninthdecimal.go b/adapters/ninthdecimal/ninthdecimal.go index 5cb631db6f1..251f56e13fa 100755 --- a/adapters/ninthdecimal/ninthdecimal.go +++ b/adapters/ninthdecimal/ninthdecimal.go @@ -6,12 +6,12 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type NinthDecimalAdapter struct { @@ -19,7 +19,7 @@ type NinthDecimalAdapter struct { } //MakeRequests prepares request information for prebid-server core -func (adapter *NinthDecimalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *NinthDecimalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "No impression in the bid request"}) @@ -49,10 +49,10 @@ func (adapter *NinthDecimalAdapter) MakeRequests(request *openrtb.BidRequest, re } // getImpressionsInfo checks each impression for validity and returns impressions copy with corresponding exts -func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpNinthDecimal][]openrtb.Imp, []openrtb.Imp, []error) { +func getImpressionsInfo(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpNinthDecimal][]openrtb2.Imp, []openrtb2.Imp, []error) { errors := make([]error, 0, len(imps)) - resImps := make([]openrtb.Imp, 0, len(imps)) - res := make(map[openrtb_ext.ExtImpNinthDecimal][]openrtb.Imp) + resImps := make([]openrtb2.Imp, 0, len(imps)) + res := make(map[openrtb_ext.ExtImpNinthDecimal][]openrtb2.Imp) for _, imp := range imps { impExt, err := getImpressionExt(&imp) @@ -71,7 +71,7 @@ func getImpressionsInfo(imps []openrtb.Imp) (map[openrtb_ext.ExtImpNinthDecimal] continue } if res[*impExt] == nil { - res[*impExt] = make([]openrtb.Imp, 0) + res[*impExt] = make([]openrtb2.Imp, 0) } res[*impExt] = append(res[*impExt], imp) resImps = append(resImps, imp) @@ -87,7 +87,7 @@ func validateImpression(impExt *openrtb_ext.ExtImpNinthDecimal) error { } //Alter impression info to comply with NinthDecimal platform requirements -func compatImpression(imp *openrtb.Imp) error { +func compatImpression(imp *openrtb2.Imp) error { imp.Ext = nil //do not forward ext to NinthDecimal platform if imp.Banner != nil { return compatBannerImpression(imp) @@ -95,7 +95,7 @@ func compatImpression(imp *openrtb.Imp) error { return nil } -func compatBannerImpression(imp *openrtb.Imp) error { +func compatBannerImpression(imp *openrtb2.Imp) error { // Create a copy of the banner, since imp is a shallow copy of the original. bannerCopy := *imp.Banner @@ -114,7 +114,7 @@ func compatBannerImpression(imp *openrtb.Imp) error { return nil } -func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpNinthDecimal, error) { +func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpNinthDecimal, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -130,7 +130,7 @@ func getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtImpNinthDecimal, error) return &NinthDecimalExt, nil } -func (adapter *NinthDecimalAdapter) buildAdapterRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb.Imp) (*adapters.RequestData, error) { +func (adapter *NinthDecimalAdapter) buildAdapterRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb2.Imp) (*adapters.RequestData, error) { newBidRequest := createBidRequest(prebidBidRequest, params, imps) reqJSON, err := json.Marshal(newBidRequest) if err != nil { @@ -154,7 +154,7 @@ func (adapter *NinthDecimalAdapter) buildAdapterRequest(prebidBidRequest *openrt Headers: headers}, nil } -func createBidRequest(prebidBidRequest *openrtb.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb.Imp) *openrtb.BidRequest { +func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpNinthDecimal, imps []openrtb2.Imp) *openrtb2.BidRequest { bidRequest := *prebidBidRequest bidRequest.Imp = imps for idx := range bidRequest.Imp { @@ -184,7 +184,7 @@ func (adapter *NinthDecimalAdapter) buildEndpointURL(params *openrtb_ext.ExtImpN } //MakeBids translates NinthDecimal bid response to prebid-server specific format -func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var msg = "" if response.StatusCode == http.StatusNoContent { return nil, nil @@ -194,7 +194,7 @@ func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb.BidRequest return nil, []error{&errortypes.BadServerResponse{Message: msg}} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { msg = fmt.Sprintf("Bad server response: %d", err) return nil, []error{&errortypes.BadServerResponse{Message: msg}} @@ -218,7 +218,7 @@ func (adapter *NinthDecimalAdapter) MakeBids(internalRequest *openrtb.BidRequest } // getMediaTypeForImp figures out which media type this bid is for -func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo diff --git a/adapters/nobid/nobid.go b/adapters/nobid/nobid.go index 77d1a7f806f..f7814d0e972 100644 --- a/adapters/nobid/nobid.go +++ b/adapters/nobid/nobid.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // NoBidAdapter - NoBid Adapter definition @@ -26,7 +26,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests Makes the OpenRTB request payload -func (a *NoBidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *NoBidAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ @@ -52,7 +52,7 @@ func (a *NoBidAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte } // MakeBids makes the bids -func (a *NoBidAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *NoBidAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -70,7 +70,7 @@ func (a *NoBidAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -98,7 +98,7 @@ func (a *NoBidAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, errs } -func getBidCount(bidResponse openrtb.BidResponse) int { +func getBidCount(bidResponse openrtb2.BidResponse) int { c := 0 for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) @@ -106,7 +106,7 @@ func getBidCount(bidResponse openrtb.BidResponse) int { return c } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/openrtb_util.go b/adapters/openrtb_util.go index 88023920b8d..3f70b48ffbc 100644 --- a/adapters/openrtb_util.go +++ b/adapters/openrtb_util.go @@ -6,7 +6,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func min(x, y int) int { @@ -37,37 +37,37 @@ func commonMediaTypes(l1 []pbs.MediaType, l2 []pbs.MediaType) []pbs.MediaType { return res[:i] } -func makeBanner(unit pbs.PBSAdUnit) *openrtb.Banner { - return &openrtb.Banner{ - W: openrtb.Uint64Ptr(unit.Sizes[0].W), - H: openrtb.Uint64Ptr(unit.Sizes[0].H), +func makeBanner(unit pbs.PBSAdUnit) *openrtb2.Banner { + return &openrtb2.Banner{ + W: openrtb2.Int64Ptr(unit.Sizes[0].W), + H: openrtb2.Int64Ptr(unit.Sizes[0].H), Format: copyFormats(unit.Sizes), // defensive copy because adapters may mutate Imps, and this is shared data TopFrame: unit.TopFrame, } } -func makeVideo(unit pbs.PBSAdUnit) *openrtb.Video { +func makeVideo(unit pbs.PBSAdUnit) *openrtb2.Video { // empty mimes array is a sign of uninitialized Video object if len(unit.Video.Mimes) < 1 { return nil } mimes := make([]string, len(unit.Video.Mimes)) copy(mimes, unit.Video.Mimes) - pbm := make([]openrtb.PlaybackMethod, 1) + pbm := make([]openrtb2.PlaybackMethod, 1) //this will become int8 soon, so we only care about the first index in the array - pbm[0] = openrtb.PlaybackMethod(unit.Video.PlaybackMethod) + pbm[0] = openrtb2.PlaybackMethod(unit.Video.PlaybackMethod) - protocols := make([]openrtb.Protocol, 0, len(unit.Video.Protocols)) + protocols := make([]openrtb2.Protocol, 0, len(unit.Video.Protocols)) for _, protocol := range unit.Video.Protocols { - protocols = append(protocols, openrtb.Protocol(protocol)) + protocols = append(protocols, openrtb2.Protocol(protocol)) } - return &openrtb.Video{ + return &openrtb2.Video{ MIMEs: mimes, MinDuration: unit.Video.Minduration, MaxDuration: unit.Video.Maxduration, W: unit.Sizes[0].W, H: unit.Sizes[0].H, - StartDelay: openrtb.StartDelay(unit.Video.Startdelay).Ptr(), + StartDelay: openrtb2.StartDelay(unit.Video.Startdelay).Ptr(), PlaybackMethod: pbm, Protocols: protocols, } @@ -77,8 +77,8 @@ func makeVideo(unit pbs.PBSAdUnit) *openrtb.Video { // // Any objects pointed to by the returned BidRequest *must not be mutated*, or we will get race conditions. // The only exception is the Imp property, whose objects will be created new by this method and can be mutated freely. -func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily string, allowedMediatypes []pbs.MediaType) (openrtb.BidRequest, error) { - imps := make([]openrtb.Imp, 0, len(bidder.AdUnits)*len(allowedMediatypes)) +func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily string, allowedMediatypes []pbs.MediaType) (openrtb2.BidRequest, error) { + imps := make([]openrtb2.Imp, 0, len(bidder.AdUnits)*len(allowedMediatypes)) for _, unit := range bidder.AdUnits { if len(unit.Sizes) <= 0 { continue @@ -88,7 +88,7 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily continue } - newImp := openrtb.Imp{ + newImp := openrtb2.Imp{ ID: unit.Code, Secure: &req.Secure, Instl: unit.Instl, @@ -101,7 +101,7 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily newImp.Video = makeVideo(unit) // It's strange to error here... but preserves legacy behavior in legacy code. See #603. if newImp.Video == nil { - return openrtb.BidRequest{}, &errortypes.BadInput{ + return openrtb2.BidRequest{}, &errortypes.BadInput{ Message: "Invalid AdUnit: VIDEO media type with no video data", } } @@ -113,19 +113,19 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily } if len(imps) < 1 { - return openrtb.BidRequest{}, &errortypes.BadInput{ + return openrtb2.BidRequest{}, &errortypes.BadInput{ Message: "openRTB bids need at least one Imp", } } if req.App != nil { - return openrtb.BidRequest{ + return openrtb2.BidRequest{ ID: req.Tid, Imp: imps, App: req.App, Device: req.Device, User: req.User, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: req.Tid, }, AT: 1, @@ -142,20 +142,20 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily userExt = req.User.Ext } - return openrtb.BidRequest{ + return openrtb2.BidRequest{ ID: req.Tid, Imp: imps, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Domain: req.Domain, Page: req.Url, }, Device: req.Device, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: buyerUID, ID: id, Ext: userExt, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ FD: 1, // upstream, aka header TID: req.Tid, }, @@ -165,8 +165,8 @@ func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily }, nil } -func copyFormats(sizes []openrtb.Format) []openrtb.Format { - sizesCopy := make([]openrtb.Format, len(sizes)) +func copyFormats(sizes []openrtb2.Format) []openrtb2.Format { + sizesCopy := make([]openrtb2.Format, len(sizes)) for i := 0; i < len(sizes); i++ { sizesCopy[i] = sizes[i] sizesCopy[i].Ext = append([]byte(nil), sizes[i].Ext...) diff --git a/adapters/openrtb_util_test.go b/adapters/openrtb_util_test.go index fbb9ab57991..887abe1f45b 100644 --- a/adapters/openrtb_util_test.go +++ b/adapters/openrtb_util_test.go @@ -5,9 +5,9 @@ import ( "encoding/json" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -42,7 +42,7 @@ func TestOpenRTB(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -73,7 +73,7 @@ func TestOpenRTBVideo(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -96,8 +96,8 @@ func TestOpenRTBVideo(t *testing.T) { assert.Equal(t, resp.Imp[0].ID, "unitCode") assert.EqualValues(t, resp.Imp[0].Video.MaxDuration, 30) assert.EqualValues(t, resp.Imp[0].Video.MinDuration, 15) - assert.EqualValues(t, *resp.Imp[0].Video.StartDelay, openrtb.StartDelay(5)) - assert.EqualValues(t, resp.Imp[0].Video.PlaybackMethod, []openrtb.PlaybackMethod{openrtb.PlaybackMethod(1)}) + assert.EqualValues(t, *resp.Imp[0].Video.StartDelay, openrtb2.StartDelay(5)) + assert.EqualValues(t, resp.Imp[0].Video.PlaybackMethod, []openrtb2.PlaybackMethod{openrtb2.PlaybackMethod(1)}) assert.EqualValues(t, resp.Imp[0].Video.MIMEs, []string{"video/mp4"}) } @@ -110,7 +110,7 @@ func TestOpenRTBVideoNoVideoData(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -134,7 +134,7 @@ func TestOpenRTBVideoFilteredOut(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -152,7 +152,7 @@ func TestOpenRTBVideoFilteredOut(t *testing.T) { { Code: "unitCode2", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -179,7 +179,7 @@ func TestOpenRTBMultiMediaImp(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO, pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -215,7 +215,7 @@ func TestOpenRTBMultiMediaImpFiltered(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO, pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -237,7 +237,7 @@ func TestOpenRTBMultiMediaImpFiltered(t *testing.T) { assert.Equal(t, len(resp.Imp), 1) assert.Equal(t, resp.Imp[0].ID, "unitCode") assert.EqualValues(t, *resp.Imp[0].Banner.W, 10) - assert.EqualValues(t, resp.Imp[0].Video, (*openrtb.Video)(nil)) + assert.EqualValues(t, resp.Imp[0].Video, (*openrtb2.Video)(nil)) } func TestOpenRTBNoSize(t *testing.T) { @@ -267,20 +267,20 @@ func TestOpenRTBMobile(t *testing.T) { MaxKeyLength: 20, Secure: 1, TimeoutMillis: 1000, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "AppNexus.PrebidMobileDemo", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "1995257847363113", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "test_ua", IP: "test_ip", Make: "test_make", Model: "test_model", IFA: "test_ifa", }, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: "test_buyeruid", }, } @@ -290,7 +290,7 @@ func TestOpenRTBMobile(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, @@ -318,7 +318,7 @@ func TestOpenRTBMobile(t *testing.T) { func TestOpenRTBEmptyUser(t *testing.T) { pbReq := pbs.PBSRequest{ - User: &openrtb.User{}, + User: &openrtb2.User{}, } pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", @@ -326,7 +326,7 @@ func TestOpenRTBEmptyUser(t *testing.T) { { Code: "unitCode2", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -337,14 +337,14 @@ func TestOpenRTBEmptyUser(t *testing.T) { } resp, err := MakeOpenRTBGeneric(&pbReq, &pbBidder, "test", []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}) assert.Equal(t, err, nil) - assert.EqualValues(t, resp.User, &openrtb.User{}) + assert.EqualValues(t, resp.User, &openrtb2.User{}) } func TestOpenRTBUserWithCookie(t *testing.T) { pbsCookie := usersync.NewPBSCookie() pbsCookie.TrySync("test", "abcde") pbReq := pbs.PBSRequest{ - User: &openrtb.User{}, + User: &openrtb2.User{}, } pbBidder := pbs.PBSBidder{ BidderCode: "bannerCode", @@ -352,7 +352,7 @@ func TestOpenRTBUserWithCookie(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, @@ -368,7 +368,7 @@ func TestOpenRTBUserWithCookie(t *testing.T) { } func TestSizesCopy(t *testing.T) { - formats := []openrtb.Format{ + formats := []openrtb2.Format{ { W: 10, }, @@ -402,7 +402,7 @@ func TestMakeVideo(t *testing.T) { adUnit := pbs.PBSAdUnit{ Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_VIDEO}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -421,7 +421,7 @@ func TestMakeVideo(t *testing.T) { video := makeVideo(adUnit) assert.EqualValues(t, video.MinDuration, 15) assert.EqualValues(t, video.MaxDuration, 30) - assert.EqualValues(t, *video.StartDelay, openrtb.StartDelay(5)) + assert.EqualValues(t, *video.StartDelay, openrtb2.StartDelay(5)) assert.EqualValues(t, len(video.PlaybackMethod), 1) assert.EqualValues(t, len(video.Protocols), 4) } @@ -435,10 +435,10 @@ func TestGDPR(t *testing.T) { regsExt, _ := json.Marshal(rawRegsExt) pbReq := pbs.PBSRequest{ - User: &openrtb.User{ + User: &openrtb2.User{ Ext: userExt, }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: regsExt, }, } @@ -449,7 +449,7 @@ func TestGDPR(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -486,24 +486,24 @@ func TestGDPRMobile(t *testing.T) { MaxKeyLength: 20, Secure: 1, TimeoutMillis: 1000, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "AppNexus.PrebidMobileDemo", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "1995257847363113", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "test_ua", IP: "test_ip", Make: "test_make", Model: "test_model", IFA: "test_ifa", }, - User: &openrtb.User{ + User: &openrtb2.User{ BuyerUID: "test_buyeruid", Ext: userExt, }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: regsExt, }, } @@ -513,7 +513,7 @@ func TestGDPRMobile(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 300, H: 250, diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index 21fbd37e99f..d76f44a3a39 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const hbconfig = "hb_pbs_1.0.0" @@ -28,10 +28,10 @@ type openxReqExt struct { BidderConfig string `json:"bc"` } -func (a *OpenxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *OpenxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var bannerImps []openrtb.Imp - var videoImps []openrtb.Imp + var bannerImps []openrtb2.Imp + var videoImps []openrtb2.Imp for _, imp := range request.Imp { // OpenX doesn't allow multi-type imp. Banner takes priority over video. @@ -55,7 +55,7 @@ func (a *OpenxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte // OpenX only supports single imp video request for _, videoImp := range videoImps { - reqCopy.Imp = []openrtb.Imp{videoImp} + reqCopy.Imp = []openrtb2.Imp{videoImp} adapterReq, errors := a.makeRequest(&reqCopy) if adapterReq != nil { adapterRequests = append(adapterRequests, adapterReq) @@ -66,9 +66,9 @@ func (a *OpenxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte return adapterRequests, errs } -func (a *OpenxAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *OpenxAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp reqExt := openxReqExt{BidderConfig: hbconfig} for _, imp := range request.Imp { @@ -111,7 +111,7 @@ func (a *OpenxAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Reque } // Mutate the imp to get it ready to send to openx. -func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error { +func preprocess(imp *openrtb2.Imp, reqExt *openxReqExt) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -158,7 +158,7 @@ func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error { return nil } -func (a *OpenxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *OpenxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -175,7 +175,7 @@ func (a *OpenxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -202,7 +202,7 @@ func (a *OpenxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq // // OpenX doesn't support multi-type impressions. // If both banner and video exist, take banner as we do not want in-banner video. -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/openx/openx_test.go b/adapters/openx/openx_test.go index 5eec4feb41a..6cd9d0ff34c 100644 --- a/adapters/openx/openx_test.go +++ b/adapters/openx/openx_test.go @@ -4,11 +4,11 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -41,10 +41,10 @@ func assertCurrencyInBidResponse(t *testing.T, expectedCurrency string, currency t.Fatalf("Builder returned unexpected error %v", buildErr) } - prebidRequest := &openrtb.BidRequest{ - Imp: []openrtb.Imp{}, + prebidRequest := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{}, } - mockedBidResponse := &openrtb.BidResponse{} + mockedBidResponse := &openrtb2.BidResponse{} if currency != nil { mockedBidResponse.Cur = *currency } diff --git a/adapters/orbidder/orbidder.go b/adapters/orbidder/orbidder.go index 4e13fc6f50e..73890360cd4 100644 --- a/adapters/orbidder/orbidder.go +++ b/adapters/orbidder/orbidder.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type OrbidderAdapter struct { @@ -17,9 +17,9 @@ type OrbidderAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids from orbidder. -func (rcv *OrbidderAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (rcv *OrbidderAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // check if imps exists, if not return error and do send request to orbidder. if len(request.Imp) == 0 { @@ -62,7 +62,7 @@ func (rcv *OrbidderAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a }}, errs } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return &errortypes.BadInput{ @@ -81,7 +81,7 @@ func preprocess(imp *openrtb.Imp) error { } // MakeBids unpacks server response into Bids. -func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -104,7 +104,7 @@ func (rcv OrbidderAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index b21e31ed930..0b48ece335c 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -11,13 +11,13 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -171,8 +171,8 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder } pbReq.Imp[i].TagID = strings.TrimSpace(adSlot[0]) - pbReq.Imp[i].Banner.H = openrtb.Uint64Ptr(uint64(height)) - pbReq.Imp[i].Banner.W = openrtb.Uint64Ptr(uint64(width)) + pbReq.Imp[i].Banner.H = openrtb2.Int64Ptr(int64(height)) + pbReq.Imp[i].Banner.W = openrtb2.Int64Ptr(int64(width)) if len(params.Keywords) != 0 { kvstr := prepareImpressionExt(params.Keywords) @@ -203,12 +203,12 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder if pbReq.Site != nil { siteCopy := *pbReq.Site - siteCopy.Publisher = &openrtb.Publisher{ID: params.PublisherId, Domain: req.Domain} + siteCopy.Publisher = &openrtb2.Publisher{ID: params.PublisherId, Domain: req.Domain} pbReq.Site = &siteCopy } if pbReq.App != nil { appCopy := *pbReq.App - appCopy.Publisher = &openrtb.Publisher{ID: params.PublisherId, Domain: req.Domain} + appCopy.Publisher = &openrtb2.Publisher{ID: params.PublisherId, Domain: req.Domain} pbReq.App = &appCopy } } @@ -277,7 +277,7 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder debug.ResponseBody = string(body) } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, &errortypes.BadServerResponse{ @@ -326,7 +326,7 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder return bids, nil } -func getBidderParam(request *openrtb.BidRequest, key string) ([]byte, error) { +func getBidderParam(request *openrtb2.BidRequest, key string) ([]byte, error) { var reqExt openrtb_ext.ExtRequest if len(request.Ext) <= 0 { return nil, nil @@ -361,7 +361,7 @@ func getBidderParam(request *openrtb.BidRequest, key string) ([]byte, error) { return bytes, nil } -func getCookiesFromRequest(request *openrtb.BidRequest) ([]string, error) { +func getCookiesFromRequest(request *openrtb2.BidRequest) ([]string, error) { cbytes, err := getBidderParam(request, "Cookie") if err != nil { return nil, err @@ -381,7 +381,7 @@ func getCookiesFromRequest(request *openrtb.BidRequest) ([]string, error) { return cookies, nil } -func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *PubmaticAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var err error @@ -422,7 +422,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada publisherCopy.ID = pubID siteCopy.Publisher = &publisherCopy } else { - siteCopy.Publisher = &openrtb.Publisher{ID: pubID} + siteCopy.Publisher = &openrtb2.Publisher{ID: pubID} } request.Site = &siteCopy } else if request.App != nil { @@ -432,7 +432,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada publisherCopy.ID = pubID appCopy.Publisher = &publisherCopy } else { - appCopy.Publisher = &openrtb.Publisher{ID: pubID} + appCopy.Publisher = &openrtb2.Publisher{ID: pubID} } request.App = &appCopy } @@ -442,17 +442,17 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada var userExt *openrtb_ext.ExtUser if err = json.Unmarshal(request.User.Ext, &userExt); err == nil { if userExt != nil && userExt.Eids != nil { - var eidArr []openrtb.Eid + var eidArr []openrtb2.Eid for _, eid := range userExt.Eids { - //var newEid openrtb.Eid - newEid := &openrtb.Eid{ + //var newEid openrtb2.Eid + newEid := &openrtb2.Eid{ ID: eid.ID, Source: eid.Source, Ext: eid.Ext, } - var uidArr []openrtb.Uid + var uidArr []openrtb2.Uid for _, uid := range eid.Uids { - newUID := &openrtb.Uid{ + newUID := &openrtb2.Uid{ ID: uid.ID, AType: uid.Atype, Ext: uid.Ext, @@ -506,7 +506,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada // validateAdslot validate the optional adslot string // valid formats are 'adslot@WxH', 'adslot' and no adslot -func validateAdSlot(adslot string, imp *openrtb.Imp) error { +func validateAdSlot(adslot string, imp *openrtb2.Imp) error { adSlotStr := strings.TrimSpace(adslot) if len(adSlotStr) == 0 { @@ -540,8 +540,8 @@ func validateAdSlot(adslot string, imp *openrtb.Imp) error { //In case of video, size could be derived from the player size if imp.Banner != nil && height != 0 && width != 0 { - imp.Banner.H = openrtb.Uint64Ptr(uint64(height)) - imp.Banner.W = openrtb.Uint64Ptr(uint64(width)) + imp.Banner.H = openrtb2.Int64Ptr(int64(height)) + imp.Banner.W = openrtb2.Int64Ptr(int64(width)) } } else { return errors.New(fmt.Sprintf("Invalid adSlot %v", adSlotStr)) @@ -550,7 +550,7 @@ func validateAdSlot(adslot string, imp *openrtb.Imp) error { return nil } -func assignBannerSize(banner *openrtb.Banner) error { +func assignBannerSize(banner *openrtb2.Banner) error { if banner == nil { return nil } @@ -563,16 +563,16 @@ func assignBannerSize(banner *openrtb.Banner) error { return errors.New(fmt.Sprintf("No sizes provided for Banner %v", banner.Format)) } - banner.W = new(uint64) + banner.W = new(int64) *banner.W = banner.Format[0].W - banner.H = new(uint64) + banner.H = new(int64) *banner.H = banner.Format[0].H return nil } // parseImpressionObject parse the imp to get it ready to send to pubmatic -func parseImpressionObject(imp *openrtb.Imp, wrapExt *pubmaticWrapperExt, pubID *string, wrapperExtSet *bool) error { +func parseImpressionObject(imp *openrtb2.Imp, wrapExt *pubmaticWrapperExt, pubID *string, wrapperExtSet *bool) error { // PubMatic supports banner and video impressions. if imp.Banner == nil && imp.Video == nil { return fmt.Errorf("Invalid MediaType. PubMatic only supports Banner and Video. Ignoring ImpID=%s", imp.ID) @@ -668,7 +668,7 @@ func prepareImpressionExt(keywords map[string]string) string { return kvStr } -func (a *PubmaticAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *PubmaticAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -683,7 +683,7 @@ func (a *PubmaticAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/pubmatic/pubmatic_test.go b/adapters/pubmatic/pubmatic_test.go index 6709414ac8a..06262bdbe1c 100644 --- a/adapters/pubmatic/pubmatic_test.go +++ b/adapters/pubmatic/pubmatic_test.go @@ -12,7 +12,6 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" @@ -20,6 +19,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func TestJsonSamples(t *testing.T) { @@ -35,7 +35,7 @@ func TestJsonSamples(t *testing.T) { // ---------------------------------------------------------------------------- // Code below this line tests the legacy, non-openrtb code flow. It can be deleted after we -// clean up the existing code and make everything openrtb. +// clean up the existing code and make everything openrtb2. func CompareStringValue(val1 string, val2 string, t *testing.T) { if val1 != val2 { @@ -51,29 +51,29 @@ func DummyPubMaticServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: breq.ID, BidID: "bidResponse_ID", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "pubmatic", - Bid: make([]openrtb.Bid, 0), + Bid: make([]openrtb2.Bid, 0), }, }, } rand.Seed(int64(time.Now().UnixNano())) - var bids []openrtb.Bid + var bids []openrtb2.Bid for i, imp := range breq.Imp { - bid := openrtb.Bid{ + bid := openrtb2.Bid{ ID: fmt.Sprintf("SeatID_%d", i), ImpID: imp.ID, Price: float64(int(rand.Float64()*1000)) / 100, @@ -132,7 +132,7 @@ func TestPubmaticTimeout(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -167,7 +167,7 @@ func TestPubmaticInvalidJson(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -203,7 +203,7 @@ func TestPubmaticInvalidStatusCode(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -236,7 +236,7 @@ func TestPubmaticInvalidInputParameters(t *testing.T) { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -308,7 +308,7 @@ func TestPubmaticBasicResponse_MandatoryParams(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -344,7 +344,7 @@ func TestPubmaticBasicResponse_AllParams(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -389,7 +389,7 @@ func TestPubmaticMultiImpressionResponse(t *testing.T) { Code: "unitCode1", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -401,7 +401,7 @@ func TestPubmaticMultiImpressionResponse(t *testing.T) { Code: "unitCode1", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 800, H: 200, @@ -437,7 +437,7 @@ func TestPubmaticMultiAdUnitResponse(t *testing.T) { Code: "unitCode1", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -449,7 +449,7 @@ func TestPubmaticMultiAdUnitResponse(t *testing.T) { Code: "unitCode2", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, BidID: "bidid", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 800, H: 200, @@ -486,7 +486,7 @@ func TestPubmaticMobileResponse(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 336, H: 280, @@ -497,7 +497,7 @@ func TestPubmaticMobileResponse(t *testing.T) { }, } - pbReq.App = &openrtb.App{ + pbReq.App = &openrtb2.App{ ID: "com.test", Name: "testApp", } @@ -526,7 +526,7 @@ func TestPubmaticInvalidLookupBidIDParameter(t *testing.T) { { Code: "unitCode", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -558,7 +558,7 @@ func TestPubmaticAdSlotParams(t *testing.T) { Code: "unitCode", BidID: "bidid", MediaTypes: []pbs.MediaType{pbs.MEDIA_TYPE_BANNER}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 120, H: 240, @@ -638,7 +638,7 @@ func TestPubmaticSampleRequest(t *testing.T) { } pbReq.AdUnits[0] = pbs.AdUnit{ Code: "adUnit_1", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 100, H: 120, diff --git a/adapters/pubnative/pubnative.go b/adapters/pubnative/pubnative.go index 36edceee53f..7009ad96730 100644 --- a/adapters/pubnative/pubnative.go +++ b/adapters/pubnative/pubnative.go @@ -7,18 +7,18 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type PubnativeAdapter struct { URI string } -func (a *PubnativeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *PubnativeAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { impCount := len(request.Imp) requestData := make([]*adapters.RequestData, 0, impCount) errs := []error{} @@ -53,7 +53,7 @@ func (a *PubnativeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad continue } - requestCopy.Imp = []openrtb.Imp{imp} + requestCopy.Imp = []openrtb2.Imp{imp} reqJSON, err := json.Marshal(&requestCopy) if err != nil { errs = append(errs, err) @@ -77,7 +77,7 @@ func (a *PubnativeAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad return requestData, errs } -func checkRequest(request *openrtb.BidRequest) error { +func checkRequest(request *openrtb2.BidRequest) error { if request.Device == nil || len(request.Device.OS) == 0 { return &errortypes.BadInput{ Message: "Impression is missing device OS information", @@ -87,7 +87,7 @@ func checkRequest(request *openrtb.BidRequest) error { return nil } -func convertImpression(imp *openrtb.Imp) error { +func convertImpression(imp *openrtb2.Imp) error { if imp.Banner == nil && imp.Video == nil && imp.Native == nil { return &errortypes.BadInput{ Message: "Pubnative only supports banner, video or native ads.", @@ -104,7 +104,7 @@ func convertImpression(imp *openrtb.Imp) error { } // make sure that banner has openrtb 2.3-compatible size information -func convertBanner(banner *openrtb.Banner) error { +func convertBanner(banner *openrtb2.Banner) error { if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { if len(banner.Format) > 0 { f := banner.Format[0] @@ -119,7 +119,7 @@ func convertBanner(banner *openrtb.Banner) error { return nil } -func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -136,7 +136,7 @@ func (a *PubnativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa }} } - var parsedResponse openrtb.BidResponse + var parsedResponse openrtb2.BidResponse if err := json.Unmarshal(response.Body, &parsedResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: err.Error(), @@ -167,7 +167,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/pulsepoint/pulsepoint.go b/adapters/pulsepoint/pulsepoint.go index 8025e9b29c8..dd0a8379d2d 100644 --- a/adapters/pulsepoint/pulsepoint.go +++ b/adapters/pulsepoint/pulsepoint.go @@ -11,12 +11,12 @@ import ( "io/ioutil" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -33,12 +33,12 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *PulsePointAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var err error pubID := "" - imps := make([]openrtb.Imp, 0, len(request.Imp)) + imps := make([]openrtb2.Imp, 0, len(request.Imp)) for i := 0; i < len(request.Imp); i++ { imp := request.Imp[i] var bidderExt adapters.ExtImpBidder @@ -77,7 +77,7 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a publisher.ID = pubID site.Publisher = &publisher } else { - site.Publisher = &openrtb.Publisher{ID: pubID} + site.Publisher = &openrtb2.Publisher{ID: pubID} } request.Site = &site } else if request.App != nil { @@ -87,7 +87,7 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a publisher.ID = pubID app.Publisher = &publisher } else { - app.Publisher = &openrtb.Publisher{ID: pubID} + app.Publisher = &openrtb2.Publisher{ID: pubID} } request.App = &app } @@ -109,7 +109,7 @@ func (a *PulsePointAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a }}, errs } -func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { // passback if response.StatusCode == http.StatusNoContent { return nil, nil @@ -127,14 +127,14 @@ func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern }} } // parse response - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) // map imps by id - impsByID := make(map[string]openrtb.Imp) + impsByID := make(map[string]openrtb2.Imp) for i := 0; i < len(internalRequest.Imp); i++ { impsByID[internalRequest.Imp[i].ID] = internalRequest.Imp[i] } @@ -156,7 +156,7 @@ func (a *PulsePointAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern return bidResponse, errs } -func getBidType(imp openrtb.Imp) openrtb_ext.BidType { +func getBidType(imp openrtb2.Imp) openrtb_ext.BidType { // derive the bidtype purely from the impression itself if imp.Banner != nil { return openrtb_ext.BidTypeBanner @@ -235,7 +235,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde break } ppReq.Imp[i].TagID = strconv.Itoa(params.TagId) - publisher := &openrtb.Publisher{ID: strconv.Itoa(params.PublisherId)} + publisher := &openrtb2.Publisher{ID: strconv.Itoa(params.PublisherId)} if ppReq.Site != nil { siteCopy := *ppReq.Site siteCopy.Publisher = publisher @@ -250,7 +250,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde if len(size) == 2 { width, err := strconv.Atoi(size[0]) if err == nil { - ppReq.Imp[i].Banner.W = openrtb.Uint64Ptr(uint64(width)) + ppReq.Imp[i].Banner.W = openrtb2.Int64Ptr(int64(width)) } else { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Invalid Width param %s", size[0]), @@ -258,7 +258,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde } height, err := strconv.Atoi(size[1]) if err == nil { - ppReq.Imp[i].Banner.H = openrtb.Uint64Ptr(uint64(height)) + ppReq.Imp[i].Banner.H = openrtb2.Int64Ptr(int64(height)) } else { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Invalid Height param %s", size[1]), @@ -318,7 +318,7 @@ func (a *PulsePointAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidde debug.ResponseBody = string(body) } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, &errortypes.BadServerResponse{ diff --git a/adapters/pulsepoint/pulsepoint_test.go b/adapters/pulsepoint/pulsepoint_test.go index 7e9b51016ea..36e540b5853 100644 --- a/adapters/pulsepoint/pulsepoint_test.go +++ b/adapters/pulsepoint/pulsepoint_test.go @@ -5,9 +5,9 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "bytes" "context" @@ -187,7 +187,7 @@ func TestMobileAppRequest(t *testing.T) { server := service.Server ctx := context.TODO() req := SampleRequest(1, t) - req.App = &openrtb.App{ + req.App = &openrtb2.App{ ID: "com.facebook.katana", Name: "facebook", } @@ -215,7 +215,7 @@ func SampleRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { for i := 0; i < numberOfImpressions; i++ { req.AdUnits[i] = pbs.AdUnit{ Code: fmt.Sprintf("div-adunit-%d", i+1), - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 10, H: 12, @@ -265,7 +265,7 @@ func SampleRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { */ func CreateService(tagsToBid map[string]bool) adapterstest.OrtbMockService { service := adapterstest.OrtbMockService{} - var lastBidRequest openrtb.BidRequest + var lastBidRequest openrtb2.BidRequest server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) @@ -273,14 +273,14 @@ func CreateService(tagsToBid map[string]bool) adapterstest.OrtbMockService { http.Error(w, err.Error(), http.StatusInternalServerError) return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } lastBidRequest = breq - var bids []openrtb.Bid + var bids []openrtb2.Bid for i, imp := range breq.Imp { if tagsToBid[imp.TagID] { bids = append(bids, adapterstest.SampleBid(imp.Banner.W, imp.Banner.H, imp.ID, i+1)) @@ -290,9 +290,9 @@ func CreateService(tagsToBid map[string]bool) adapterstest.OrtbMockService { if len(bids) == 0 { w.WriteHeader(204) } else { - // serialize the bids to openrtb.BidResponse - js, _ := json.Marshal(openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + // serialize the bids to openrtb2.BidResponse + js, _ := json.Marshal(openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { Bid: bids, }, diff --git a/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json b/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json index b5209ed4bbe..8d34bab0578 100644 --- a/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json +++ b/adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json @@ -83,7 +83,7 @@ }], "expectedBidResponses": [], "expectedMakeBidsErrors": [{ - "value": "json: cannot unmarshal string into Go struct field Bid.seatbid.bid.w of type uint64", + "value": "json: cannot unmarshal string into Go struct field Bid.seatbid.bid.w of type int64", "comparison": "literal" } ] diff --git a/adapters/revcontent/revcontent.go b/adapters/revcontent/revcontent.go index c6a7ff9d827..e4bd1a31bc1 100644 --- a/adapters/revcontent/revcontent.go +++ b/adapters/revcontent/revcontent.go @@ -3,11 +3,11 @@ package revcontent import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "net/http" ) @@ -23,7 +23,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { reqBody, err := json.Marshal(request) if err != nil { @@ -46,7 +46,7 @@ func (a *adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return []*adapters.RequestData{req}, nil } -func checkRequest(request *openrtb.BidRequest) error { +func checkRequest(request *openrtb2.BidRequest) error { if (request.App == nil || len(request.App.Name) == 0) && (request.Site == nil || len(request.Site.Domain) == 0) { return &errortypes.BadInput{ Message: "Impression is missing app name or site domain, and must contain one.", @@ -57,7 +57,7 @@ func checkRequest(request *openrtb.BidRequest) error { } // MakeBids make the bids for the bid response. -func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -74,7 +74,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} diff --git a/adapters/revcontent/revcontenttest/supplemental/bad_response.json b/adapters/revcontent/revcontenttest/supplemental/bad_response.json index bd562373f1b..751aed92c27 100644 --- a/adapters/revcontent/revcontenttest/supplemental/bad_response.json +++ b/adapters/revcontent/revcontenttest/supplemental/bad_response.json @@ -43,7 +43,7 @@ "expectedMakeBidsErrors": [ { "comparison": "literal", - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse" + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse" } ] } diff --git a/adapters/rhythmone/rhythmone.go b/adapters/rhythmone/rhythmone.go index e2fc9aa8f0d..32c581a3f8d 100644 --- a/adapters/rhythmone/rhythmone.go +++ b/adapters/rhythmone/rhythmone.go @@ -6,18 +6,18 @@ import ( "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type RhythmoneAdapter struct { endPoint string } -func (a *RhythmoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *RhythmoneAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) var uri string @@ -43,7 +43,7 @@ func (a *RhythmoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ad return nil, errs } -func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -59,7 +59,7 @@ func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa Message: fmt.Sprintf("unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("bad server response: %d. ", err), @@ -80,7 +80,7 @@ func (a *RhythmoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externa return bidResponse, errs } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { @@ -103,7 +103,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *RhythmoneAdapter) preProcess(req *openrtb.BidRequest, errors []error) (*openrtb.BidRequest, string, []error) { +func (a *RhythmoneAdapter) preProcess(req *openrtb2.BidRequest, errors []error) (*openrtb2.BidRequest, string, []error) { numRequests := len(req.Imp) var uri string = "" for i := 0; i < numRequests; i++ { diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index 26f85d4adad..43aec56d5db 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Builder builds a new instance of the RTBHouse adapter for the given bidder with the given config. @@ -27,7 +27,7 @@ type RTBHouseAdapter struct { // MakeRequests prepares the HTTP requests which should be made to fetch bids. func (adapter *RTBHouseAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -57,7 +57,7 @@ const unexpectedStatusCodeFormat = "" + // MakeBids unpacks the server's response into Bids. func (adapter *RTBHouseAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -81,7 +81,7 @@ func (adapter *RTBHouseAdapter) MakeBids( return nil, []error{err} } - var openRTBBidderResponse openrtb.BidResponse + var openRTBBidderResponse openrtb2.BidResponse if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { return nil, []error{err} } diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json b/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json index b6af4209f48..f84f5555259 100644 --- a/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json +++ b/adapters/rtbhouse/rtbhousetest/supplemental/bad_response.json @@ -54,7 +54,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index 7fe88640cb0..b8aa3ff72ec 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -16,10 +16,10 @@ import ( "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const badvLimitSize = 50 @@ -322,7 +322,7 @@ func findPrimary(alt []int) (int, []int) { return primary, alt } -func parseRubiconSizes(sizes []openrtb.Format) (primary int, alt []int, err error) { +func parseRubiconSizes(sizes []openrtb2.Format) (primary int, alt []int, err error) { // Fixes #317 if len(sizes) < 1 { err = &errortypes.BadInput{ @@ -381,7 +381,7 @@ func (a *RubiconAdapter) callOne(ctx context.Context, reqJSON bytes.Buffer) (res return } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { err = &errortypes.BadServerResponse{ @@ -519,14 +519,14 @@ func (a *RubiconAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder * if rubiReq.Site != nil { siteCopy := *rubiReq.Site siteCopy.Ext, err = json.Marshal(&siteExt) - siteCopy.Publisher = &openrtb.Publisher{} + siteCopy.Publisher = &openrtb2.Publisher{} siteCopy.Publisher.Ext, err = json.Marshal(&pubExt) - siteCopy.Content = &openrtb.Content{} + siteCopy.Content = &openrtb2.Content{} siteCopy.Content.Language = rubiconUser.Language rubiReq.Site = &siteCopy } else { - site := &openrtb.Site{} - site.Content = &openrtb.Content{} + site := &openrtb2.Site{} + site.Content = &openrtb2.Content{} site.Content.Language = rubiconUser.Language rubiReq.Site = site } @@ -534,12 +534,12 @@ func (a *RubiconAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder * if rubiReq.App != nil { appCopy := *rubiReq.App appCopy.Ext, err = json.Marshal(&siteExt) - appCopy.Publisher = &openrtb.Publisher{} + appCopy.Publisher = &openrtb2.Publisher{} appCopy.Publisher.Ext, err = json.Marshal(&pubExt) rubiReq.App = &appCopy } - rubiReq.Imp = []openrtb.Imp{thisImp} + rubiReq.Imp = []openrtb2.Imp{thisImp} var reqBuffer bytes.Buffer err = json.NewEncoder(&reqBuffer).Encode(rubiReq) @@ -612,7 +612,7 @@ func (a *RubiconAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder * return bids, nil } -func resolveVideoSizeId(placement openrtb.VideoPlacementType, instl int8, impId string) (sizeID int, err error) { +func resolveVideoSizeId(placement openrtb2.VideoPlacementType, instl int8, impId string) (sizeID int, err error) { if placement != 0 { if placement == 1 { return 201, nil @@ -670,7 +670,7 @@ func NewRubiconLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, uri string, } } -func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { numRequests := len(request.Imp) errs := make([]error, 0, len(request.Imp)) var err error @@ -844,14 +844,14 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap if request.Site != nil { siteCopy := *request.Site siteCopy.Ext, err = json.Marshal(&siteExt) - siteCopy.Publisher = &openrtb.Publisher{} + siteCopy.Publisher = &openrtb2.Publisher{} siteCopy.Publisher.Ext, err = json.Marshal(&pubExt) rubiconRequest.Site = &siteCopy } if request.App != nil { appCopy := *request.App appCopy.Ext, err = json.Marshal(&siteExt) - appCopy.Publisher = &openrtb.Publisher{} + appCopy.Publisher = &openrtb2.Publisher{} appCopy.Publisher.Ext, err = json.Marshal(&pubExt) rubiconRequest.App = &appCopy } @@ -863,7 +863,7 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap } } - rubiconRequest.Imp = []openrtb.Imp{thisImp} + rubiconRequest.Imp = []openrtb2.Imp{thisImp} rubiconRequest.Cur = nil rubiconRequest.Ext = nil @@ -972,7 +972,7 @@ func updateUserExtWithTpIdsAndSegments(userExtRP *rubiconUserExt, rubiconUidsPar return nil } -func isVideo(imp openrtb.Imp) bool { +func isVideo(imp openrtb2.Imp) bool { video := imp.Video if video != nil { // Do any other media types exist? Or check required video fields. @@ -981,12 +981,12 @@ func isVideo(imp openrtb.Imp) bool { return false } -func isFullyPopulatedVideo(video *openrtb.Video) bool { +func isFullyPopulatedVideo(video *openrtb2.Video) bool { // These are just recommended video fields for XAPI return video.MIMEs != nil && video.Protocols != nil && video.MaxDuration != 0 && video.Linearity != 0 && video.API != nil } -func (a *RubiconAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *RubiconAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -1003,14 +1003,14 @@ func (a *RubiconAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: err.Error(), }} } - var bidReq openrtb.BidRequest + var bidReq openrtb2.BidRequest if err := json.Unmarshal(externalRequest.Body, &bidReq); err != nil { return nil, []error{err} } @@ -1057,7 +1057,7 @@ func (a *RubiconAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR return bidResponse, nil } -func cmpOverrideFromBidRequest(bidRequest *openrtb.BidRequest) float64 { +func cmpOverrideFromBidRequest(bidRequest *openrtb2.BidRequest) float64 { var bidRequestExt bidRequestExt if err := json.Unmarshal(bidRequest.Ext, &bidRequestExt); err != nil { return 0 @@ -1066,7 +1066,7 @@ func cmpOverrideFromBidRequest(bidRequest *openrtb.BidRequest) float64 { return bidRequestExt.Prebid.Bidders.Rubicon.Debug.CpmOverride } -func mapImpIdToCpmOverride(imps []openrtb.Imp) map[string]float64 { +func mapImpIdToCpmOverride(imps []openrtb2.Imp) map[string]float64 { impIdToCmpOverride := make(map[string]float64) for _, imp := range imps { var bidderExt adapters.ExtImpBidder diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index 54953b213b1..d19d38b3f56 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -21,10 +21,10 @@ import ( "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -81,7 +81,7 @@ func DummyRubiconServer(w http.ResponseWriter, r *http.Request) { return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -126,14 +126,14 @@ func DummyRubiconServer(w http.ResponseWriter, r *http.Request) { return } - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 2), + Bid: make([]openrtb2.Bid, 2), }, }, } @@ -185,7 +185,7 @@ func DummyRubiconServer(w http.ResponseWriter, r *http.Request) { targeting := "{\"rp\":{\"targeting\":[{\"key\":\"key1\",\"values\":[\"value1\"]},{\"key\":\"key2\",\"values\":[\"value2\"]}]}}" rawTargeting := json.RawMessage(targeting) - resp.SeatBid[0].Bid[0] = openrtb.Bid{ + resp.SeatBid[0].Bid[0] = openrtb2.Bid{ ID: "random-id", ImpID: imp.ID, Price: rubidata.tags[ix].bid, @@ -320,8 +320,8 @@ func TestRubiconUserSyncInfo(t *testing.T) { assert.False(t, an.SkipNoCookies(), "SkipNoCookies should be false") } -func getTestSizes() map[int]openrtb.Format { - return map[int]openrtb.Format{ +func getTestSizes() map[int]openrtb2.Format { + return map[int]openrtb2.Format{ 15: {W: 300, H: 250}, 10: {W: 300, H: 600}, 2: {W: 728, H: 91}, @@ -335,7 +335,7 @@ func getTestSizes() map[int]openrtb.Format { func TestParseSizes(t *testing.T) { SIZE_ID := getTestSizes() - sizes := []openrtb.Format{ + sizes := []openrtb2.Format{ SIZE_ID[10], SIZE_ID[15], } @@ -345,7 +345,7 @@ func TestParseSizes(t *testing.T) { assert.Equal(t, 1, len(alt), "Alt not len 1") assert.Equal(t, 10, alt[0], "Alt not 10: %d", alt[0]) - sizes = []openrtb.Format{ + sizes = []openrtb2.Format{ { W: 1111, H: 2222, @@ -357,7 +357,7 @@ func TestParseSizes(t *testing.T) { assert.Equal(t, 15, primary, "Primary %d != 15", primary) assert.Equal(t, 0, len(alt), "Alt len %d != 0", len(alt)) - sizes = []openrtb.Format{ + sizes = []openrtb2.Format{ SIZE_ID[15], } primary, alt, err = parseRubiconSizes(sizes) @@ -365,7 +365,7 @@ func TestParseSizes(t *testing.T) { assert.Equal(t, 15, primary, "Primary %d != 15", primary) assert.Equal(t, 0, len(alt), "Alt len %d != 0", len(alt)) - sizes = []openrtb.Format{ + sizes = []openrtb2.Format{ { W: 1111, H: 1222, @@ -385,20 +385,20 @@ func TestMASAlgorithm(t *testing.T) { ok bool } type testStub struct { - input []openrtb.Format + input []openrtb2.Format output output } testStubs := []testStub{ { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[2], SIZE_ID[9], }, output{2, []int{9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[9], SIZE_ID[15], @@ -406,14 +406,14 @@ func TestMASAlgorithm(t *testing.T) { output{15, []int{9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[2], SIZE_ID[15], }, output{15, []int{2}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[15], SIZE_ID[9], SIZE_ID[2], @@ -421,7 +421,7 @@ func TestMASAlgorithm(t *testing.T) { output{15, []int{2, 9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[10], SIZE_ID[9], SIZE_ID[2], @@ -429,7 +429,7 @@ func TestMASAlgorithm(t *testing.T) { output{2, []int{10, 9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[15], @@ -437,7 +437,7 @@ func TestMASAlgorithm(t *testing.T) { output{15, []int{33, 8}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[9], @@ -446,7 +446,7 @@ func TestMASAlgorithm(t *testing.T) { output{2, []int{33, 8, 9}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[9], @@ -454,7 +454,7 @@ func TestMASAlgorithm(t *testing.T) { output{9, []int{33, 8}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[8], SIZE_ID[2], @@ -462,24 +462,24 @@ func TestMASAlgorithm(t *testing.T) { output{2, []int{33, 8}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[33], SIZE_ID[2], }, output{2, []int{33}, false}, }, { - []openrtb.Format{ + []openrtb2.Format{ SIZE_ID[8], }, output{8, []int{}, false}, }, { - []openrtb.Format{}, + []openrtb2.Format{}, output{0, []int{}, true}, }, { - []openrtb.Format{ + []openrtb2.Format{ {W: 1111, H: 2345, }, @@ -527,7 +527,7 @@ func TestAppendTracker(t *testing.T) { func TestResolveVideoSizeId(t *testing.T) { testScenarios := []struct { - placement openrtb.VideoPlacementType + placement openrtb2.VideoPlacementType instl int8 impId string expected int @@ -626,11 +626,11 @@ func TestWrongFormatResponse(t *testing.T) { func TestZeroSeatBidResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{}, + SeatBid: []openrtb2.SeatBid{}, } js, _ := json.Marshal(resp) w.Write(js) @@ -647,14 +647,14 @@ func TestZeroSeatBidResponse(t *testing.T) { func TestEmptyBidResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 0), + Bid: make([]openrtb2.Bid, 0), }, }, } @@ -673,18 +673,18 @@ func TestEmptyBidResponse(t *testing.T) { func TestWrongBidIdResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 2), + Bid: make([]openrtb2.Bid, 2), }, }, } - resp.SeatBid[0].Bid[0] = openrtb.Bid{ + resp.SeatBid[0].Bid[0] = openrtb2.Bid{ ID: "random-id", ImpID: "zma", Price: 1.67, @@ -710,18 +710,18 @@ func TestWrongBidIdResponse(t *testing.T) { func TestZeroPriceBidResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - resp := openrtb.BidResponse{ + resp := openrtb2.BidResponse{ ID: "test-response-id", BidID: "test-bid-id", Cur: "USD", - SeatBid: []openrtb.SeatBid{ + SeatBid: []openrtb2.SeatBid{ { Seat: "RUBICON", - Bid: make([]openrtb.Bid, 1), + Bid: make([]openrtb2.Bid, 1), }, }, } - resp.SeatBid[0].Bid[0] = openrtb.Bid{ + resp.SeatBid[0].Bid[0] = openrtb2.Bid{ ID: "test-bid-id", ImpID: "first-tag", Price: 0, @@ -747,7 +747,7 @@ func TestDifferentRequest(t *testing.T) { an, ctx, pbReq := CreatePrebidRequest(server, t) // test app not nil - pbReq.App = &openrtb.App{ + pbReq.App = &openrtb2.App{ ID: "com.test", Name: "testApp", } @@ -775,13 +775,13 @@ func TestDifferentRequest(t *testing.T) { pbReq.Bidders[0].AdUnits[0].Params = json.RawMessage(fmt.Sprintf("{\"zoneId\": %d, \"siteId\": %d, \"accountId\": %d, \"visitor\": %s, \"inventory\": %s}", 8394, rubidata.siteID, rubidata.accountID, rubidata.visitorTargeting, rubidata.inventoryTargeting)) // test invalid size - pbReq.Bidders[0].AdUnits[0].Sizes = []openrtb.Format{ + pbReq.Bidders[0].AdUnits[0].Sizes = []openrtb2.Format{ { W: 2222, H: 333, }, } - pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb.Format{ + pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb2.Format{ { W: 222, H: 3333, @@ -795,7 +795,7 @@ func TestDifferentRequest(t *testing.T) { b, err := an.Call(ctx, pbReq, pbReq.Bidders[0]) assert.NotNil(t, err, "Should have gotten an error: %v", err) - pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb.Format{ + pbReq.Bidders[0].AdUnits[1].Sizes = []openrtb2.Format{ { W: 222, H: 3333, @@ -861,7 +861,7 @@ func CreatePrebidRequest(server *httptest.Server, t *testing.T) (an *RubiconAdap pbin := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 3), - Device: &openrtb.Device{PxRatio: rubidata.devicePxRatio}, + Device: &openrtb2.Device{PxRatio: rubidata.devicePxRatio}, SDK: &pbs.SDK{Source: rubidata.sdkSource, Platform: rubidata.sdkPlatform, Version: rubidata.sdkVersion}, } @@ -869,7 +869,7 @@ func CreatePrebidRequest(server *httptest.Server, t *testing.T) (an *RubiconAdap pbin.AdUnits[i] = pbs.AdUnit{ Code: tag.code, MediaTypes: []string{tag.mediaType}, - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ SIZE_ID[10], SIZE_ID[15], }, @@ -946,12 +946,12 @@ func TestOpenRTBRequest(t *testing.T) { devicePxRatio: 4.0, } - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-banner-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, @@ -965,7 +965,7 @@ func TestOpenRTBRequest(t *testing.T) { }}`), }, { ID: "test-imp-video-id", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, @@ -988,10 +988,10 @@ func TestOpenRTBRequest(t *testing.T) { } }}`), }}, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ PxRatio: rubidata.devicePxRatio, }, - User: &openrtb.User{ + User: &openrtb2.User{ Ext: json.RawMessage(`{"digitrust": { "id": "some-digitrust-id", "keyv": 1, @@ -1015,7 +1015,7 @@ func TestOpenRTBRequest(t *testing.T) { httpReq := reqs[i] assert.Equal(t, "POST", httpReq.Method, "Expected a POST message. Got %s", httpReq.Method) - var rpRequest openrtb.BidRequest + var rpRequest openrtb2.BidRequest if err := json.Unmarshal(httpReq.Body, &rpRequest); err != nil { t.Fatalf("Failed to unmarshal HTTP request: %v", rpRequest) } @@ -1031,16 +1031,16 @@ func TestOpenRTBRequest(t *testing.T) { t.Fatal("Error unmarshalling request from the outgoing request.") } - assert.Equal(t, uint64(300), rpRequest.Imp[0].Banner.Format[0].W, + assert.Equal(t, int64(300), rpRequest.Imp[0].Banner.Format[0].W, "Banner width does not match. Expected %d, Got %d", 300, rpRequest.Imp[0].Banner.Format[0].W) - assert.Equal(t, uint64(250), rpRequest.Imp[0].Banner.Format[0].H, + assert.Equal(t, int64(250), rpRequest.Imp[0].Banner.Format[0].H, "Banner height does not match. Expected %d, Got %d", 250, rpRequest.Imp[0].Banner.Format[0].H) - assert.Equal(t, uint64(300), rpRequest.Imp[0].Banner.Format[1].W, + assert.Equal(t, int64(300), rpRequest.Imp[0].Banner.Format[1].W, "Banner width does not match. Expected %d, Got %d", 300, rpRequest.Imp[0].Banner.Format[1].W) - assert.Equal(t, uint64(600), rpRequest.Imp[0].Banner.Format[1].H, + assert.Equal(t, int64(600), rpRequest.Imp[0].Banner.Format[1].H, "Banner height does not match. Expected %d, Got %d", 600, rpRequest.Imp[0].Banner.Format[1].H) } else if rpRequest.Imp[0].ID == "test-imp-video-id" { var rpExt rubiconVideoExt @@ -1048,10 +1048,10 @@ func TestOpenRTBRequest(t *testing.T) { t.Fatal("Error unmarshalling request from the outgoing request.") } - assert.Equal(t, uint64(640), rpRequest.Imp[0].Video.W, + assert.Equal(t, int64(640), rpRequest.Imp[0].Video.W, "Video width does not match. Expected %d, Got %d", 640, rpRequest.Imp[0].Video.W) - assert.Equal(t, uint64(360), rpRequest.Imp[0].Video.H, + assert.Equal(t, int64(360), rpRequest.Imp[0].Video.H, "Video height does not match. Expected %d, Got %d", 360, rpRequest.Imp[0].Video.H) assert.Equal(t, "video/mp4", rpRequest.Imp[0].Video.MIMEs[0], "Video MIMEs do not match. Expected %s, Got %s", "video/mp4", rpRequest.Imp[0].Video.MIMEs[0]) @@ -1084,17 +1084,17 @@ func TestOpenRTBRequestWithBannerImpEvenIfImpHasVideo(t *testing.T) { SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, @@ -1115,7 +1115,7 @@ func TestOpenRTBRequestWithBannerImpEvenIfImpHasVideo(t *testing.T) { assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1131,12 +1131,12 @@ func TestOpenRTBRequestWithImpAndAdSlotIncluded(t *testing.T) { SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, @@ -1160,7 +1160,7 @@ func TestOpenRTBRequestWithImpAndAdSlotIncluded(t *testing.T) { reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1191,13 +1191,13 @@ func TestOpenRTBRequestWithBadvOverflowed(t *testing.T) { badvOverflowed[i] = strconv.Itoa(i) } - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", BAdv: badvOverflowed, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], }, }, @@ -1215,7 +1215,7 @@ func TestOpenRTBRequestWithBadvOverflowed(t *testing.T) { reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1228,12 +1228,12 @@ func TestOpenRTBRequestWithSpecificExtUserEids(t *testing.T) { SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, @@ -1244,7 +1244,7 @@ func TestOpenRTBRequestWithSpecificExtUserEids(t *testing.T) { "accountId": 7891 }}`), }}, - User: &openrtb.User{ + User: &openrtb2.User{ Ext: json.RawMessage(`{"eids": [ { "source": "pubcid", @@ -1283,7 +1283,7 @@ func TestOpenRTBRequestWithSpecificExtUserEids(t *testing.T) { reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1324,24 +1324,24 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t SIZE_ID := getTestSizes() bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ SIZE_ID[15], SIZE_ID[10], }, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, - Protocols: []openrtb.Protocol{openrtb.ProtocolVAST10}, + Protocols: []openrtb2.Protocol{openrtb2.ProtocolVAST10}, MaxDuration: 30, Linearity: 1, - API: []openrtb.APIFramework{}, + API: []openrtb2.APIFramework{}, }, Ext: json.RawMessage(`{"bidder": { "zoneId": 8394, @@ -1360,7 +1360,7 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t assert.Equal(t, 1, len(reqs), "Unexpected number of HTTP requests. Got %d. Expected %d", len(reqs), 1) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1376,18 +1376,18 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t func TestOpenRTBRequestWithVideoImpAndEnabledRewardedInventoryFlag(t *testing.T) { bidder := new(RubiconAdapter) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ W: 640, H: 360, MIMEs: []string{"video/mp4"}, - Protocols: []openrtb.Protocol{openrtb.ProtocolVAST10}, + Protocols: []openrtb2.Protocol{openrtb2.ProtocolVAST10}, MaxDuration: 30, Linearity: 1, - API: []openrtb.APIFramework{}, + API: []openrtb2.APIFramework{}, }, Ext: json.RawMessage(`{ "prebid":{ @@ -1401,7 +1401,7 @@ func TestOpenRTBRequestWithVideoImpAndEnabledRewardedInventoryFlag(t *testing.T) reqs, _ := bidder.MakeRequests(request, &adapters.ExtraRequestInfo{}) - rubiconReq := &openrtb.BidRequest{} + rubiconReq := &openrtb2.BidRequest{} if err := json.Unmarshal(reqs[0].Body, rubiconReq); err != nil { t.Fatalf("Unexpected error while decoding request: %s", err) } @@ -1439,12 +1439,12 @@ func TestOpenRTBSurpriseResponse(t *testing.T) { } func TestOpenRTBStandardResponse(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 320, H: 50, }}, @@ -1486,12 +1486,12 @@ func TestOpenRTBStandardResponse(t *testing.T) { } func TestOpenRTBResponseOverridePriceFromBidRequest(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 320, H: 50, }}, @@ -1533,12 +1533,12 @@ func TestOpenRTBResponseOverridePriceFromBidRequest(t *testing.T) { } func TestOpenRTBResponseOverridePriceFromCorrespondingImp(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "test-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 320, H: 50, }}, @@ -1583,9 +1583,9 @@ func TestOpenRTBResponseOverridePriceFromCorrespondingImp(t *testing.T) { } func TestOpenRTBCopyBidIdFromResponseIfZero(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{{}}, + Imp: []openrtb2.Imp{{}}, } requestJson, _ := json.Marshal(request) diff --git a/adapters/sharethrough/butler.go b/adapters/sharethrough/butler.go index 738d382a938..b1a498d7139 100644 --- a/adapters/sharethrough/butler.go +++ b/adapters/sharethrough/butler.go @@ -9,11 +9,11 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const defaultTmax = 10000 // 10 sec @@ -33,7 +33,7 @@ type StrAdSeverParams struct { } type StrOpenRTBInterface interface { - requestFromOpenRTB(openrtb.Imp, *openrtb.BidRequest, string) (*adapters.RequestData, error) + requestFromOpenRTB(openrtb2.Imp, *openrtb2.BidRequest, string) (*adapters.RequestData, error) responseToOpenRTB([]byte, *adapters.RequestData) (*adapters.BidderResponse, []error) } @@ -70,7 +70,7 @@ type StrOpenRTBTranslator struct { UserAgentParsers UserAgentParsers } -func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb.Imp, request *openrtb.BidRequest, domain string) (*adapters.RequestData, error) { +func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb2.Imp, request *openrtb2.BidRequest, domain string) (*adapters.RequestData, error) { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -111,8 +111,8 @@ func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb.Imp, request *openr ConsentString: userInfo.Consent, USPrivacySignal: usPolicySignal, Iframe: strImpParams.Iframe, - Height: height, - Width: width, + Height: uint64(height), + Width: uint64(width), InstantPlayCapable: s.Util.canAutoPlayVideo(request.Device.UA, s.UserAgentParsers), TheTradeDeskUserId: userInfo.TtdUid, SharethroughUserId: userInfo.StxUid, @@ -152,7 +152,7 @@ func (s StrOpenRTBTranslator) responseToOpenRTB(strRawResp []byte, btlrReq *adap return nil, errs } - bid := &openrtb.Bid{ + bid := &openrtb2.Bid{ AdID: strResp.AdServerRequestID, ID: strResp.BidID, ImpID: btlrParams.BidID, @@ -161,8 +161,8 @@ func (s StrOpenRTBTranslator) responseToOpenRTB(strRawResp []byte, btlrReq *adap CrID: creative.Metadata.CreativeKey, DealID: creative.Metadata.DealID, AdM: adm, - H: btlrParams.Height, - W: btlrParams.Width, + H: int64(btlrParams.Height), + W: int64(btlrParams.Width), } typedBid.Bid = bid @@ -171,7 +171,7 @@ func (s StrOpenRTBTranslator) responseToOpenRTB(strRawResp []byte, btlrReq *adap return bidResponse, errs } -func (h StrBodyHelper) buildBody(request *openrtb.BidRequest, strImpParams openrtb_ext.ExtImpSharethrough) (body []byte, err error) { +func (h StrBodyHelper) buildBody(request *openrtb2.BidRequest, strImpParams openrtb_ext.ExtImpSharethrough) (body []byte, err error) { timeout := request.TMax if timeout == 0 { timeout = defaultTmax diff --git a/adapters/sharethrough/butler_test.go b/adapters/sharethrough/butler_test.go index f6d43971f4e..16f5367b9ed 100644 --- a/adapters/sharethrough/butler_test.go +++ b/adapters/sharethrough/butler_test.go @@ -9,17 +9,17 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) type MockUtil struct { mockCanAutoPlayVideo func() bool mockGdprApplies func() bool - mockGetPlacementSize func() (uint64, uint64) + mockGetPlacementSize func() (int64, int64) mockParseUserInfo func() userInfo UtilityInterface } @@ -28,15 +28,15 @@ func (m MockUtil) canAutoPlayVideo(userAgent string, parsers UserAgentParsers) b return m.mockCanAutoPlayVideo() } -func (m MockUtil) gdprApplies(request *openrtb.BidRequest) bool { +func (m MockUtil) gdprApplies(request *openrtb2.BidRequest) bool { return m.mockGdprApplies() } -func (m MockUtil) getPlacementSize(imp openrtb.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height uint64, width uint64) { +func (m MockUtil) getPlacementSize(imp openrtb2.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height int64, width int64) { return m.mockGetPlacementSize() } -func (m MockUtil) parseUserInfo(user *openrtb.User) (ui userInfo) { +func (m MockUtil) parseUserInfo(user *openrtb2.User) (ui userInfo) { return m.mockParseUserInfo() } @@ -75,26 +75,26 @@ func assertRequestDataEquals(t *testing.T, testName string, expected *adapters.R func TestSuccessRequestFromOpenRTB(t *testing.T) { tests := map[string]struct { - inputImp openrtb.Imp - inputReq *openrtb.BidRequest + inputImp openrtb2.Imp + inputReq *openrtb2.BidRequest inputDom string expected *adapters.RequestData }{ "Generates the correct AdServer request from Imp (no user provided)": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ ID: "abc", Ext: []byte(`{ "bidder": {"pkey": "pkey", "iframe": true, "iframeSize": [10, 20], "bidfloor": 1.0} }`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }, - inputReq: &openrtb.BidRequest{ - App: &openrtb.App{Ext: []byte(`{}`)}, - Device: &openrtb.Device{ + inputReq: &openrtb2.BidRequest{ + App: &openrtb2.App{Ext: []byte(`{}`)}, + Device: &openrtb2.Device{ UA: "Android Chome/60", IP: "127.0.0.1", }, - Site: &openrtb.Site{Page: "http://a.domain.com/page"}, + Site: &openrtb2.Site{Page: "http://a.domain.com/page"}, BAdv: []string{"domain1.com", "domain2.com"}, TMax: 700, }, @@ -114,20 +114,20 @@ func TestSuccessRequestFromOpenRTB(t *testing.T) { }, }, "Generates width/height if not provided": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ ID: "abc", Ext: []byte(`{ "bidder": {"pkey": "pkey", "iframe": true} }`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }, - inputReq: &openrtb.BidRequest{ - App: &openrtb.App{Ext: []byte(`{}`)}, - Device: &openrtb.Device{ + inputReq: &openrtb2.BidRequest{ + App: &openrtb2.App{Ext: []byte(`{}`)}, + Device: &openrtb2.Device{ UA: "Android Chome/60", IP: "127.0.0.1", }, - Site: &openrtb.Site{Page: "http://a.domain.com/page"}, + Site: &openrtb2.Site{Page: "http://a.domain.com/page"}, BAdv: []string{"domain1.com", "domain2.com"}, TMax: 700, }, @@ -157,7 +157,7 @@ func TestSuccessRequestFromOpenRTB(t *testing.T) { mockUtil := MockUtil{ mockCanAutoPlayVideo: func() bool { return true }, mockGdprApplies: func() bool { return true }, - mockGetPlacementSize: func() (uint64, uint64) { return 100, 200 }, + mockGetPlacementSize: func() (int64, int64) { return 100, 200 }, mockParseUserInfo: func() userInfo { return userInfo{Consent: "ok", TtdUid: "ttduid", StxUid: "stxuid"} }, } @@ -177,27 +177,27 @@ func TestSuccessRequestFromOpenRTB(t *testing.T) { func TestFailureRequestFromOpenRTB(t *testing.T) { tests := map[string]struct { - inputImp openrtb.Imp - inputReq *openrtb.BidRequest + inputImp openrtb2.Imp + inputReq *openrtb2.BidRequest expectedError string }{ "Fails when unable to parse imp.Ext": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ Ext: []byte(`{"abc`), }, - inputReq: &openrtb.BidRequest{ - Device: &openrtb.Device{UA: "A", IP: "ip"}, - Site: &openrtb.Site{Page: "page"}, + inputReq: &openrtb2.BidRequest{ + Device: &openrtb2.Device{UA: "A", IP: "ip"}, + Site: &openrtb2.Site{Page: "page"}, }, expectedError: `unexpected end of JSON input`, }, "Fails when unable to parse imp.Ext.Bidder": { - inputImp: openrtb.Imp{ + inputImp: openrtb2.Imp{ Ext: []byte(`{ "bidder": "{ abc" }`), }, - inputReq: &openrtb.BidRequest{ - Device: &openrtb.Device{UA: "A", IP: "ip"}, - Site: &openrtb.Site{Page: "page"}, + inputReq: &openrtb2.BidRequest{ + Device: &openrtb2.Device{UA: "A", IP: "ip"}, + Site: &openrtb2.Site{Page: "page"}, }, expectedError: `json: cannot unmarshal string into Go value of type openrtb_ext.ExtImpSharethrough`, }, @@ -212,7 +212,7 @@ func TestFailureRequestFromOpenRTB(t *testing.T) { mockUtil := MockUtil{ mockCanAutoPlayVideo: func() bool { return true }, mockGdprApplies: func() bool { return true }, - mockGetPlacementSize: func() (uint64, uint64) { return 100, 200 }, + mockGetPlacementSize: func() (int64, int64) { return 100, 200 }, mockParseUserInfo: func() userInfo { return userInfo{Consent: "ok", TtdUid: "ttduid", StxUid: "stxuid"} }, } @@ -288,7 +288,7 @@ func TestSuccessResponseToOpenRTB(t *testing.T) { expectedSuccess: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{{ BidType: openrtb_ext.BidTypeBanner, - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ AdID: "arid", ID: "bid", ImpID: "bidid", @@ -376,19 +376,19 @@ func TestFailResponseToOpenRTB(t *testing.T) { func TestBuildBody(t *testing.T) { tests := map[string]struct { - inputRequest *openrtb.BidRequest + inputRequest *openrtb2.BidRequest inputImp openrtb_ext.ExtImpSharethrough expectedJson []byte expectedError error }{ "Empty input: skips badomains, tmax default to 10 sec and sets deadline accordingly": { - inputRequest: &openrtb.BidRequest{}, + inputRequest: &openrtb2.BidRequest{}, inputImp: openrtb_ext.ExtImpSharethrough{}, expectedJson: []byte(`{"tmax":10000, "deadline":"2019-09-12T11:29:10.000123456Z"}`), expectedError: nil, }, "Sets badv as list of domains according to Badv (tmax default to 10 sec and sets deadline accordingly)": { - inputRequest: &openrtb.BidRequest{ + inputRequest: &openrtb2.BidRequest{ BAdv: []string{"dom1.com", "dom2.com"}, }, inputImp: openrtb_ext.ExtImpSharethrough{}, @@ -396,7 +396,7 @@ func TestBuildBody(t *testing.T) { expectedError: nil, }, "Sets tmax and deadline according to Tmax": { - inputRequest: &openrtb.BidRequest{ + inputRequest: &openrtb2.BidRequest{ TMax: 500, }, inputImp: openrtb_ext.ExtImpSharethrough{}, @@ -404,7 +404,7 @@ func TestBuildBody(t *testing.T) { expectedError: nil, }, "Sets bidfloor according to the Imp object": { - inputRequest: &openrtb.BidRequest{}, + inputRequest: &openrtb2.BidRequest{}, inputImp: openrtb_ext.ExtImpSharethrough{ BidFloor: 1.23, }, @@ -428,7 +428,7 @@ func TestBuildBody(t *testing.T) { func TestBuildUri(t *testing.T) { tests := map[string]struct { inputParams StrAdSeverParams - inputApp *openrtb.App + inputApp *openrtb2.App expected []string }{ "Generates expected URL, appending all params": { diff --git a/adapters/sharethrough/sharethrough.go b/adapters/sharethrough/sharethrough.go index 63958d029f1..1e835da1b8f 100644 --- a/adapters/sharethrough/sharethrough.go +++ b/adapters/sharethrough/sharethrough.go @@ -5,11 +5,11 @@ import ( "net/http" "regexp" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const supplyId = "FGMrCMMc" @@ -35,7 +35,7 @@ type SharethroughAdapter struct { AdServer StrOpenRTBInterface } -func (a SharethroughAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a SharethroughAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var reqs []*adapters.RequestData if request.Site == nil { @@ -56,7 +56,7 @@ func (a SharethroughAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo * return reqs, []error{} } -func (a SharethroughAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a SharethroughAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } diff --git a/adapters/sharethrough/sharethrough_test.go b/adapters/sharethrough/sharethrough_test.go index 0e31a90bac4..c0a8be4b5fa 100644 --- a/adapters/sharethrough/sharethrough_test.go +++ b/adapters/sharethrough/sharethrough_test.go @@ -6,11 +6,11 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -21,7 +21,7 @@ type MockStrAdServer struct { StrOpenRTBInterface } -func (m MockStrAdServer) requestFromOpenRTB(imp openrtb.Imp, request *openrtb.BidRequest, domain string) (*adapters.RequestData, error) { +func (m MockStrAdServer) requestFromOpenRTB(imp openrtb2.Imp, request *openrtb2.BidRequest, domain string) (*adapters.RequestData, error) { return m.mockRequestFromOpenRTB() } @@ -88,22 +88,22 @@ func TestSuccessMakeRequests(t *testing.T) { } tests := map[string]struct { - input *openrtb.BidRequest + input *openrtb2.BidRequest expected []*adapters.RequestData }{ "Generates expected Request": { - input: &openrtb.BidRequest{ - Site: &openrtb.Site{ + input: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "test.com", }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "Android Chome/60", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "abc", Ext: []byte(`{"pkey": "pkey", "iframe": true, "iframeSize": [10, 20]}`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }}, }, @@ -137,22 +137,22 @@ func TestSuccessMakeRequests(t *testing.T) { func TestFailureMakeRequests(t *testing.T) { tests := map[string]struct { - input *openrtb.BidRequest + input *openrtb2.BidRequest expected string }{ "Returns nil if failed to generate request": { - input: &openrtb.BidRequest{ - Site: &openrtb.Site{ + input: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "test.com", }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "Android Chome/60", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "abc", Ext: []byte(`{"pkey": "pkey", "iframe": true, "iframeSize": [10, 20]}`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{H: 30, W: 40}}, + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{H: 30, W: 40}}, }, }}, }, @@ -216,7 +216,7 @@ func TestSuccessMakeBids(t *testing.T) { for testName, test := range tests { t.Logf("Test case: %s\n", testName) - response, errors := adapter.MakeBids(&openrtb.BidRequest{}, &adapters.RequestData{}, test.inputResponse) + response, errors := adapter.MakeBids(&openrtb2.BidRequest{}, &adapters.RequestData{}, test.inputResponse) if len(errors) > 0 { t.Errorf("Expected no errors, got %d\n", len(errors)) } @@ -264,7 +264,7 @@ func TestFailureMakeBids(t *testing.T) { for testName, test := range tests { t.Logf("Test case: %s\n", testName) - response, errors := adapter.MakeBids(&openrtb.BidRequest{}, &adapters.RequestData{}, test.inputResponse) + response, errors := adapter.MakeBids(&openrtb2.BidRequest{}, &adapters.RequestData{}, test.inputResponse) if response != nil { t.Errorf("Expected response to be nil, got %+v\n", response) } diff --git a/adapters/sharethrough/utils.go b/adapters/sharethrough/utils.go index 2dc22615aa7..21e0ae856ad 100644 --- a/adapters/sharethrough/utils.go +++ b/adapters/sharethrough/utils.go @@ -5,9 +5,9 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" "html/template" "net" "net/url" @@ -20,12 +20,12 @@ const minChromeVersion = 53 const minSafariVersion = 10 type UtilityInterface interface { - gdprApplies(*openrtb.BidRequest) bool - parseUserInfo(*openrtb.User) userInfo + gdprApplies(*openrtb2.BidRequest) bool + parseUserInfo(*openrtb2.User) userInfo getAdMarkup([]byte, openrtb_ext.ExtImpSharethroughResponse, *StrAdSeverParams) (string, error) - getBestFormat([]openrtb.Format) (uint64, uint64) - getPlacementSize(openrtb.Imp, openrtb_ext.ExtImpSharethrough) (uint64, uint64) + getBestFormat([]openrtb2.Format) (int64, int64) + getPlacementSize(openrtb2.Imp, openrtb_ext.ExtImpSharethrough) (int64, int64) canAutoPlayVideo(string, UserAgentParsers) bool isAndroid(string) bool @@ -123,10 +123,10 @@ func (u Util) getAdMarkup(strRawResp []byte, strResp openrtb_ext.ExtImpSharethro return templatedBuf.String(), nil } -func (u Util) getPlacementSize(imp openrtb.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height uint64, width uint64) { +func (u Util) getPlacementSize(imp openrtb2.Imp, strImpParams openrtb_ext.ExtImpSharethrough) (height, width int64) { height, width = 1, 1 if len(strImpParams.IframeSize) >= 2 { - height, width = uint64(strImpParams.IframeSize[0]), uint64(strImpParams.IframeSize[1]) + height, width = int64(strImpParams.IframeSize[0]), int64(strImpParams.IframeSize[1]) } else if imp.Banner != nil { height, width = u.getBestFormat(imp.Banner.Format) } @@ -134,7 +134,7 @@ func (u Util) getPlacementSize(imp openrtb.Imp, strImpParams openrtb_ext.ExtImpS return } -func (u Util) getBestFormat(formats []openrtb.Format) (height uint64, width uint64) { +func (u Util) getBestFormat(formats []openrtb2.Format) (height, width int64) { height, width = 1, 1 for i := 0; i < len(formats); i++ { format := formats[i] @@ -195,7 +195,7 @@ func (u Util) isAtMinSafariVersion(userAgent string, parser *regexp.Regexp) bool return u.isAtMinVersion(userAgent, parser, minSafariVersion) } -func (u Util) gdprApplies(request *openrtb.BidRequest) bool { +func (u Util) gdprApplies(request *openrtb2.BidRequest) bool { var gdprApplies int64 if request.Regs != nil { @@ -208,7 +208,7 @@ func (u Util) gdprApplies(request *openrtb.BidRequest) bool { return gdprApplies != 0 } -func (u Util) parseUserInfo(user *openrtb.User) (ui userInfo) { +func (u Util) parseUserInfo(user *openrtb2.User) (ui userInfo) { if user == nil { return } diff --git a/adapters/sharethrough/utils_test.go b/adapters/sharethrough/utils_test.go index aa5ae58cc5c..0e3289dbe98 100644 --- a/adapters/sharethrough/utils_test.go +++ b/adapters/sharethrough/utils_test.go @@ -4,8 +4,8 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "regexp" "testing" @@ -71,31 +71,31 @@ func TestGetAdMarkup(t *testing.T) { func TestGetPlacementSize(t *testing.T) { tests := map[string]struct { - imp openrtb.Imp + imp openrtb2.Imp strImpParams openrtb_ext.ExtImpSharethrough - expectedHeight uint64 - expectedWidth uint64 + expectedHeight int64 + expectedWidth int64 }{ "Returns size from STR params if provided": { - imp: openrtb.Imp{}, + imp: openrtb2.Imp{}, strImpParams: openrtb_ext.ExtImpSharethrough{IframeSize: []int{100, 200}}, expectedHeight: 100, expectedWidth: 200, }, "Skips size from STR params if malformed": { - imp: openrtb.Imp{}, + imp: openrtb2.Imp{}, strImpParams: openrtb_ext.ExtImpSharethrough{IframeSize: []int{100}}, expectedHeight: 1, expectedWidth: 1, }, "Returns size from banner format if provided": { - imp: openrtb.Imp{Banner: &openrtb.Banner{Format: []openrtb.Format{{H: 100, W: 200}}}}, + imp: openrtb2.Imp{Banner: &openrtb2.Banner{Format: []openrtb2.Format{{H: 100, W: 200}}}}, strImpParams: openrtb_ext.ExtImpSharethrough{}, expectedHeight: 100, expectedWidth: 200, }, "Defaults to 1x1": { - imp: openrtb.Imp{}, + imp: openrtb2.Imp{}, strImpParams: openrtb_ext.ExtImpSharethrough{}, expectedHeight: 1, expectedWidth: 1, @@ -114,22 +114,22 @@ func TestGetPlacementSize(t *testing.T) { func TestGetBestFormat(t *testing.T) { tests := map[string]struct { - input []openrtb.Format - expectedHeight uint64 - expectedWidth uint64 + input []openrtb2.Format + expectedHeight int64 + expectedWidth int64 }{ "Returns default size if empty input": { - input: []openrtb.Format{}, + input: []openrtb2.Format{}, expectedHeight: 1, expectedWidth: 1, }, "Returns size if only one is passed": { - input: []openrtb.Format{{H: 100, W: 100}}, + input: []openrtb2.Format{{H: 100, W: 100}}, expectedHeight: 100, expectedWidth: 100, }, "Returns biggest size if multiple are passed": { - input: []openrtb.Format{{H: 100, W: 100}, {H: 200, W: 200}, {H: 50, W: 50}}, + input: []openrtb2.Format{{H: 100, W: 100}, {H: 200, W: 200}, {H: 50, W: 50}}, expectedHeight: 200, expectedWidth: 200, }, @@ -344,27 +344,27 @@ func TestIsAtMinSafariVersion(t *testing.T) { } func TestGdprApplies(t *testing.T) { - bidRequestGdpr := openrtb.BidRequest{ - Regs: &openrtb.Regs{ + bidRequestGdpr := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ Ext: []byte(`{"gdpr": 1}`), }, } - bidRequestNonGdpr := openrtb.BidRequest{ - Regs: &openrtb.Regs{ + bidRequestNonGdpr := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ Ext: []byte(`{"gdpr": 0}`), }, } - bidRequestEmptyGdpr := openrtb.BidRequest{ - Regs: &openrtb.Regs{ + bidRequestEmptyGdpr := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{ Ext: []byte(``), }, } - bidRequestEmptyRegs := openrtb.BidRequest{ - Regs: &openrtb.Regs{}, + bidRequestEmptyRegs := openrtb2.BidRequest{ + Regs: &openrtb2.Regs{}, } tests := map[string]struct { - input *openrtb.BidRequest + input *openrtb2.BidRequest expected bool }{ "Return true if gdpr set to 1": { @@ -396,7 +396,7 @@ func TestGdprApplies(t *testing.T) { func TestParseUserInfo(t *testing.T) { tests := map[string]struct { - input *openrtb.User + input *openrtb2.User expected userInfo }{ "Return empty strings if no User": { @@ -404,31 +404,31 @@ func TestParseUserInfo(t *testing.T) { expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Return empty strings if no uids": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": []}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": []}] }`)}, expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Return empty strings if ID is not defined or empty string": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": null}]}, {"source": "adserver.org", "uids": [{"id": ""}]}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": null}]}, {"source": "adserver.org", "uids": [{"id": ""}]}] }`)}, expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Return consent correctly": { - input: &openrtb.User{Ext: []byte(`{ "consent": "abc" }`)}, + input: &openrtb2.User{Ext: []byte(`{ "consent": "abc" }`)}, expected: userInfo{Consent: "abc", TtdUid: "", StxUid: ""}, }, "Return ttd uid correctly": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, expected: userInfo{Consent: "", TtdUid: "abc123", StxUid: ""}, }, "Ignore non-trade-desk uid": { - input: &openrtb.User{Ext: []byte(`{ "eids": [{"source": "something", "uids": [{"id": "xyz"}]}] }`)}, + input: &openrtb2.User{Ext: []byte(`{ "eids": [{"source": "something", "uids": [{"id": "xyz"}]}] }`)}, expected: userInfo{Consent: "", TtdUid: "", StxUid: ""}, }, "Returns STX user id from buyer id": { - input: &openrtb.User{BuyerUID: "myid"}, + input: &openrtb2.User{BuyerUID: "myid"}, expected: userInfo{Consent: "", TtdUid: "", StxUid: "myid"}, }, "Full test": { - input: &openrtb.User{BuyerUID: "myid", Ext: []byte(`{ "consent": "abc", "eids": [{"source": "something", "uids": [{"id": "xyz"}]}, {"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, + input: &openrtb2.User{BuyerUID: "myid", Ext: []byte(`{ "consent": "abc", "eids": [{"source": "something", "uids": [{"id": "xyz"}]}, {"source": "adserver.org", "uids": [{"id": "abc123"}]}] }`)}, expected: userInfo{Consent: "abc", TtdUid: "abc123", StxUid: "myid"}, }, } diff --git a/adapters/silvermob/silvermob.go b/adapters/silvermob/silvermob.go index 0e79f44369f..96a9e466563 100644 --- a/adapters/silvermob/silvermob.go +++ b/adapters/silvermob/silvermob.go @@ -6,12 +6,12 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type SilverMobAdapter struct { @@ -31,7 +31,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func GetHeaders(request *openrtb.BidRequest) *http.Header { +func GetHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -55,7 +55,7 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header { } func (a *SilverMobAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( []*adapters.RequestData, @@ -84,7 +84,7 @@ func (a *SilverMobAdapter) MakeRequests( continue } - requestCopy.Imp = []openrtb.Imp{imp} + requestCopy.Imp = []openrtb2.Imp{imp} reqJSON, err := json.Marshal(requestCopy) if err != nil { errs = append(errs, err) @@ -104,7 +104,7 @@ func (a *SilverMobAdapter) MakeRequests( return requestData, errs } -func (a *SilverMobAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtSilverMob, error) { +func (a *SilverMobAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtSilverMob, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -126,7 +126,7 @@ func (a *SilverMobAdapter) buildEndpointURL(params *openrtb_ext.ExtSilverMob) (s } func (a *SilverMobAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -149,7 +149,7 @@ func (a *SilverMobAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Error unmarshaling server Response: %s", err), @@ -176,7 +176,7 @@ func (a *SilverMobAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/silvermob/silvermobtest/supplemental/invalid-response.json b/adapters/silvermob/silvermobtest/supplemental/invalid-response.json index d2a1e890df0..4970678bef9 100644 --- a/adapters/silvermob/silvermobtest/supplemental/invalid-response.json +++ b/adapters/silvermob/silvermobtest/supplemental/invalid-response.json @@ -111,7 +111,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "Error unmarshaling server Response: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "Error unmarshaling server Response: json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 2873f1311a4..7119aa9431d 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -6,12 +6,12 @@ import ( "net/http" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const clientVersion = "prebid_server_0.1" @@ -58,7 +58,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SmaatoAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) if len(request.Imp) == 0 { errs = append(errs, &errortypes.BadInput{Message: "no impressions in bid request"}) @@ -83,7 +83,7 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } if request.Site != nil { siteCopy := *request.Site - siteCopy.Publisher = &openrtb.Publisher{ID: publisherID} + siteCopy.Publisher = &openrtb2.Publisher{ID: publisherID} if request.Site.Ext != nil { var siteExt siteExt @@ -155,7 +155,7 @@ func (a *SmaatoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // MakeBids unpacks the server's response into Bids. -func (a *SmaatoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SmaatoAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -170,7 +170,7 @@ func (a *SmaatoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return nil, []error{fmt.Errorf("unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -251,7 +251,7 @@ func getAdMarkupType(response *adapters.ResponseData, adMarkup string) (adMarkup return "", fmt.Errorf("Invalid ad markup %s", adMarkup) } -func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { +func assignBannerSize(banner *openrtb2.Banner) (*openrtb2.Banner, error) { if banner.W != nil && banner.H != nil { return banner, nil } @@ -259,16 +259,14 @@ func assignBannerSize(banner *openrtb.Banner) (*openrtb.Banner, error) { return banner, fmt.Errorf("No sizes provided for Banner %v", banner.Format) } bannerCopy := *banner - bannerCopy.W = new(uint64) - *bannerCopy.W = banner.Format[0].W - bannerCopy.H = new(uint64) - *bannerCopy.H = banner.Format[0].H + bannerCopy.W = openrtb2.Int64Ptr(banner.Format[0].W) + bannerCopy.H = openrtb2.Int64Ptr(banner.Format[0].H) return &bannerCopy, nil } // parseImpressionObject parse the imp to get it ready to send to smaato -func parseImpressionObject(imp *openrtb.Imp) error { +func parseImpressionObject(imp *openrtb2.Imp) error { adSpaceID, err := jsonparser.GetString(imp.Ext, "bidder", "adspaceId") if err != nil { return err @@ -295,7 +293,7 @@ func parseImpressionObject(imp *openrtb.Imp) error { return fmt.Errorf("invalid MediaType. SMAATO only supports Banner and Video. Ignoring ImpID=%s", imp.ID) } -func extractUserExtAttributes(userExt userExt, userCopy *openrtb.User) { +func extractUserExtAttributes(userExt userExt, userCopy *openrtb2.User) { gender := userExt.Data.Gender if gender != "" { userCopy.Gender = gender diff --git a/adapters/smartadserver/smartadserver.go b/adapters/smartadserver/smartadserver.go index 1231ab677ec..b3030b3a90a 100644 --- a/adapters/smartadserver/smartadserver.go +++ b/adapters/smartadserver/smartadserver.go @@ -8,11 +8,11 @@ import ( "path" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type SmartAdserverAdapter struct { @@ -28,7 +28,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SmartAdserverAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impression in the bid request", @@ -43,7 +43,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // We create or copy the Site object. if smartRequest.Site == nil { - smartRequest.Site = &openrtb.Site{} + smartRequest.Site = &openrtb2.Site{} } else { site := *smartRequest.Site smartRequest.Site = &site @@ -51,7 +51,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // We create or copy the Publisher object. if smartRequest.Site.Publisher == nil { - smartRequest.Site.Publisher = &openrtb.Publisher{} + smartRequest.Site.Publisher = &openrtb2.Publisher{} } else { publisher := *smartRequest.Site.Publisher smartRequest.Site.Publisher = &publisher @@ -79,7 +79,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo smartRequest.Site.Publisher.ID = strconv.Itoa(smartadserverExt.NetworkID) // We send one request for each impression. - smartRequest.Imp = []openrtb.Imp{imp} + smartRequest.Imp = []openrtb2.Imp{imp} var errMarshal error if imp.Ext, errMarshal = json.Marshal(smartadserverExt); errMarshal != nil { @@ -117,7 +117,7 @@ func (a *SmartAdserverAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo } // MakeBids unpacks the server's response into Bids. -func (a *SmartAdserverAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SmartAdserverAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -134,7 +134,7 @@ func (a *SmartAdserverAdapter) MakeBids(internalRequest *openrtb.BidRequest, ext }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -169,7 +169,7 @@ func (a *SmartAdserverAdapter) BuildEndpointURL(params *openrtb_ext.ExtImpSmarta return uri.String(), nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { for _, imp := range imps { if imp.ID == impID { if imp.Video != nil { diff --git a/adapters/smartrtb/smartrtb.go b/adapters/smartrtb/smartrtb.go index 0613bb6815f..56ab502eda1 100644 --- a/adapters/smartrtb/smartrtb.go +++ b/adapters/smartrtb/smartrtb.go @@ -6,12 +6,12 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Base adapter structure. @@ -59,7 +59,7 @@ func (adapter *SmartRTBAdapter) buildEndpointURL(pubID string) (string, error) { return macros.ResolveMacros(adapter.EndpointTemplate, endpointParams) } -func parseExtImp(dst *bidRequestExt, imp *openrtb.Imp) error { +func parseExtImp(dst *bidRequestExt, imp *openrtb2.Imp) error { var ext adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &ext); err != nil { return adapters.BadInput(err.Error()) @@ -80,8 +80,8 @@ func parseExtImp(dst *bidRequestExt, imp *openrtb.Imp) error { return nil } -func (s *SmartRTBAdapter) MakeRequests(brq *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - var imps []openrtb.Imp +func (s *SmartRTBAdapter) MakeRequests(brq *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var imps []openrtb2.Imp var err error ext := bidRequestExt{} nrImps := len(brq.Imp) @@ -140,7 +140,7 @@ func (s *SmartRTBAdapter) MakeRequests(brq *openrtb.BidRequest, reqInfo *adapter } func (s *SmartRTBAdapter) MakeBids( - brq *openrtb.BidRequest, drq *adapters.RequestData, + brq *openrtb2.BidRequest, drq *adapters.RequestData, rs *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { if rs.StatusCode == http.StatusNoContent { @@ -153,7 +153,7 @@ func (s *SmartRTBAdapter) MakeBids( }} } - var brs openrtb.BidResponse + var brs openrtb2.BidResponse if err := json.Unmarshal(rs.Body, &brs); err != nil { return nil, []error{err} } diff --git a/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json b/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json index c56e7f21515..3d9f92df4a7 100644 --- a/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json +++ b/adapters/smartrtb/smartrtbtest/supplemental/invalid-bid-json.json @@ -69,7 +69,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/smartyads/smartyads.go b/adapters/smartyads/smartyads.go index 93a94a74568..b50a7909979 100644 --- a/adapters/smartyads/smartyads.go +++ b/adapters/smartyads/smartyads.go @@ -7,12 +7,12 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type SmartyAdsAdapter struct { @@ -32,7 +32,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func GetHeaders(request *openrtb.BidRequest) *http.Header { +func GetHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -64,7 +64,7 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header { } func (a *SmartyAdsAdapter) MakeRequests( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo, ) ( requestsToBidder []*adapters.RequestData, @@ -106,7 +106,7 @@ func (a *SmartyAdsAdapter) MakeRequests( }}, nil } -func (a *SmartyAdsAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtSmartyAds, error) { +func (a *SmartyAdsAdapter) getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtSmartyAds, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -154,7 +154,7 @@ func (a *SmartyAdsAdapter) CheckResponseStatusCodes(response *adapters.ResponseD } func (a *SmartyAdsAdapter) MakeBids( - openRTBRequest *openrtb.BidRequest, + openRTBRequest *openrtb2.BidRequest, requestToBidder *adapters.RequestData, bidderRawResponse *adapters.ResponseData, ) ( @@ -167,7 +167,7 @@ func (a *SmartyAdsAdapter) MakeBids( } responseBody := bidderRawResponse.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Bad Server Response", @@ -192,7 +192,7 @@ func (a *SmartyAdsAdapter) MakeBids( return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/somoaudience/somoaudience.go b/adapters/somoaudience/somoaudience.go index 2e096dfe1b3..7c88eccacf8 100644 --- a/adapters/somoaudience/somoaudience.go +++ b/adapters/somoaudience/somoaudience.go @@ -11,7 +11,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const hbconfig = "hb_pbs_1.0.0" @@ -24,12 +24,12 @@ type somoaudienceReqExt struct { BidderConfig string `json:"prebid"` } -func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SomoaudienceAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error - var bannerImps []openrtb.Imp - var videoImps []openrtb.Imp - var nativeImps []openrtb.Imp + var bannerImps []openrtb2.Imp + var videoImps []openrtb2.Imp + var nativeImps []openrtb2.Imp for _, imp := range request.Imp { if imp.Banner != nil { @@ -53,7 +53,7 @@ func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // Somoaudience only supports single imp video request for _, videoImp := range videoImps { - reqCopy.Imp = []openrtb.Imp{videoImp} + reqCopy.Imp = []openrtb2.Imp{videoImp} adapterReq, errors := a.makeRequest(&reqCopy) if adapterReq != nil { adapterRequests = append(adapterRequests, adapterReq) @@ -63,7 +63,7 @@ func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // Somoaudience only supports single imp video request for _, nativeImp := range nativeImps { - reqCopy.Imp = []openrtb.Imp{nativeImp} + reqCopy.Imp = []openrtb2.Imp{nativeImp} adapterReq, errors := a.makeRequest(&reqCopy) if adapterReq != nil { adapterRequests = append(adapterRequests, adapterReq) @@ -74,10 +74,10 @@ func (a *SomoaudienceAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo } -func (a *SomoaudienceAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *SomoaudienceAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error var err error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp reqExt := somoaudienceReqExt{BidderConfig: hbconfig} var placementHash string @@ -132,7 +132,7 @@ func (a *SomoaudienceAdapter) makeRequest(request *openrtb.BidRequest) (*adapter }, errs } -func preprocess(imp *openrtb.Imp, reqExt *somoaudienceReqExt) (string, error) { +func preprocess(imp *openrtb2.Imp, reqExt *somoaudienceReqExt) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return "", &errortypes.BadInput{ @@ -153,7 +153,7 @@ func preprocess(imp *openrtb.Imp, reqExt *somoaudienceReqExt) (string, error) { return somoExt.PlacementHash, nil } -func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -171,7 +171,7 @@ func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapt }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -190,7 +190,7 @@ func (a *SomoaudienceAdapter) MakeBids(bidReq *openrtb.BidRequest, unused *adapt return bidResponse, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/sonobi/sonobi.go b/adapters/sonobi/sonobi.go index 3deebbbd9d4..7b156a945d8 100644 --- a/adapters/sonobi/sonobi.go +++ b/adapters/sonobi/sonobi.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // SonobiAdapter - Sonobi SonobiAdapter definition @@ -30,7 +30,7 @@ type sonobiParams struct { } // MakeRequests Makes the OpenRTB request payload -func (a *SonobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SonobiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var sonobiExt openrtb_ext.ExtImpSonobi var err error @@ -42,7 +42,7 @@ func (a *SonobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt for _, imp := range request.Imp { // Make a copy as we don't want to change the original request reqCopy := *request - reqCopy.Imp = append(make([]openrtb.Imp, 0, 1), imp) + reqCopy.Imp = append(make([]openrtb2.Imp, 0, 1), imp) var bidderExt adapters.ExtImpBidder if err = json.Unmarshal(reqCopy.Imp[0].Ext, &bidderExt); err != nil { @@ -69,7 +69,7 @@ func (a *SonobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // makeRequest helper method to crete the http request data -func (a *SonobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *SonobiAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error @@ -92,7 +92,7 @@ func (a *SonobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Requ } // MakeBids makes the bids -func (a *SonobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SonobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { var errs []error if response.StatusCode == http.StatusNoContent { @@ -111,7 +111,7 @@ func (a *SonobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -136,7 +136,7 @@ func (a *SonobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe return bidResponse, errs } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impID { diff --git a/adapters/sovrn/sovrn.go b/adapters/sovrn/sovrn.go index 24920fa7998..f4d59e3f693 100644 --- a/adapters/sovrn/sovrn.go +++ b/adapters/sovrn/sovrn.go @@ -12,12 +12,12 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -49,7 +49,7 @@ func (s *SovrnAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pb return nil, err } - sovrnReq := openrtb.BidRequest{ + sovrnReq := openrtb2.BidRequest{ ID: sReq.ID, Imp: sReq.Imp, Site: sReq.Site, @@ -133,7 +133,7 @@ func (s *SovrnAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pb debug.ResponseBody = responseBody } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse err = json.Unmarshal(body, &bidResp) if err != nil { return nil, &errortypes.BadServerResponse{ @@ -173,7 +173,7 @@ func (s *SovrnAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pb return bids, nil } -func (s *SovrnAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (s *SovrnAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) for i := 0; i < len(request.Imp); i++ { @@ -228,7 +228,7 @@ func addHeaderIfNonEmpty(headers http.Header, headerName string, headerValue str } } -func (s *SovrnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (s *SovrnAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -245,7 +245,7 @@ func (s *SovrnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: err.Error(), @@ -271,7 +271,7 @@ func (s *SovrnAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, nil } -func preprocess(imp *openrtb.Imp) (string, error) { +func preprocess(imp *openrtb2.Imp) (string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return "", &errortypes.BadInput{ diff --git a/adapters/sovrn/sovrn_test.go b/adapters/sovrn/sovrn_test.go index 5f43c1a569f..85cf4672218 100644 --- a/adapters/sovrn/sovrn_test.go +++ b/adapters/sovrn/sovrn_test.go @@ -8,10 +8,10 @@ import ( "net/http/httptest" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" "context" "net/http" @@ -38,7 +38,7 @@ func TestJsonSamples(t *testing.T) { // ---------------------------------------------------------------------------- // Code below this line tests the legacy, non-openrtb code flow. It can be deleted after we -// clean up the existing code and make everything openrtb. +// clean up the existing code and make everything openrtb2. var testSovrnUserId = "SovrnUser123" var testUserAgent = "user-agent-test" @@ -144,12 +144,12 @@ func checkHttpRequest(req http.Request, t *testing.T) { func SampleSovrnRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { dnt := int8(0) - device := openrtb.Device{ + device := openrtb2.Device{ Language: "murican", DNT: &dnt, } - user := openrtb.User{ + user := openrtb2.User{ ID: testSovrnUserId, } @@ -165,7 +165,7 @@ func SampleSovrnRequest(numberOfImpressions int, t *testing.T) *pbs.PBSRequest { for i := 0; i < numberOfImpressions; i++ { req.AdUnits[i] = pbs.AdUnit{ Code: fmt.Sprintf("div-adunit-%d", i+1), - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 728, H: 90, @@ -251,7 +251,7 @@ func TestNotFoundResponse(t *testing.T) { func CreateSovrnService(tagsToBid map[string]bool) adapterstest.OrtbMockService { service := adapterstest.OrtbMockService{} - var lastBidRequest openrtb.BidRequest + var lastBidRequest openrtb2.BidRequest var lastHttpReq http.Request server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -262,23 +262,23 @@ func CreateSovrnService(tagsToBid map[string]bool) adapterstest.OrtbMockService http.Error(w, err.Error(), http.StatusInternalServerError) return } - var breq openrtb.BidRequest + var breq openrtb2.BidRequest err = json.Unmarshal(body, &breq) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } lastBidRequest = breq - var bids []openrtb.Bid + var bids []openrtb2.Bid for i, imp := range breq.Imp { if tagsToBid[imp.TagID] { bids = append(bids, adapterstest.SampleBid(imp.Banner.W, imp.Banner.H, imp.ID, i+1)) } } - // serialize the bids to openrtb.BidResponse - js, _ := json.Marshal(openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + // serialize the bids to openrtb2.BidResponse + js, _ := json.Marshal(openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { Bid: bids, }, diff --git a/adapters/spotx/spotx.go b/adapters/spotx/spotx.go index 6b9c4ff2ea1..8f57dc9e42a 100644 --- a/adapters/spotx/spotx.go +++ b/adapters/spotx/spotx.go @@ -6,18 +6,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type Adapter struct { url string } -func (a *Adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *Adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -42,7 +42,7 @@ func (a *Adapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.Ex return adapterRequests, errs } -func makeRequest(a *Adapter, originalReq *openrtb.BidRequest, imp openrtb.Imp) (*adapters.RequestData, []error) { +func makeRequest(a *Adapter, originalReq *openrtb2.BidRequest, imp openrtb2.Imp) (*adapters.RequestData, []error) { var errs []error var bidderExt adapters.ExtImpBidder @@ -113,12 +113,12 @@ func makeRequest(a *Adapter, originalReq *openrtb.BidRequest, imp openrtb.Imp) ( return &adapters.RequestData{ Method: "POST", Uri: fmt.Sprintf("%s/%s", a.url, spotxExt.ChannelID), - Body: reqJSON, //TODO: This is a custom request struct, other adapters are sending this openrtb.BidRequest + Body: reqJSON, //TODO: This is a custom request struct, other adapters are sending this openrtb2.BidRequest Headers: headers, }, errs } -func (a *Adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *Adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -135,7 +135,7 @@ func (a *Adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -155,7 +155,7 @@ func (a *Adapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest return bidResponse, nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID && imp.Video != nil { return openrtb_ext.BidTypeVideo, nil diff --git a/adapters/spotx/spotx_test.go b/adapters/spotx/spotx_test.go index a6641b27c0f..3c806400174 100644 --- a/adapters/spotx/spotx_test.go +++ b/adapters/spotx/spotx_test.go @@ -2,9 +2,9 @@ package spotx import ( "encoding/json" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/magiconair/properties/assert" + "github.com/mxmCherry/openrtb/v15/openrtb2" "testing" ) @@ -23,12 +23,12 @@ func TestSpotxMakeBid(t *testing.T) { } }`) - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "1559039248176", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "28635736ddc2bb", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: []string{"video/3gpp"}, }, Secure: &secure, diff --git a/adapters/synacormedia/synacormedia.go b/adapters/synacormedia/synacormedia.go index e87c665da59..86194ac2254 100644 --- a/adapters/synacormedia/synacormedia.go +++ b/adapters/synacormedia/synacormedia.go @@ -6,12 +6,12 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type SynacorMediaAdapter struct { @@ -40,7 +40,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *SynacorMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *SynacorMediaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var bidRequests []*adapters.RequestData @@ -53,9 +53,9 @@ func (a *SynacorMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo return bidRequests, errs } -func (a *SynacorMediaAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *SynacorMediaAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error - var validImps []openrtb.Imp + var validImps []openrtb2.Imp var re *ReqExt var firstExtImp *openrtb_ext.ExtImpSynacormedia = nil @@ -130,7 +130,7 @@ func (adapter *SynacorMediaAdapter) buildEndpointURL(params *openrtb_ext.ExtImpS return macros.ResolveMacros(adapter.EndpointTemplate, macros.EndpointTemplateParams{Host: params.SeatId}) } -func getExtImpObj(imp *openrtb.Imp) (*openrtb_ext.ExtImpSynacormedia, error) { +func getExtImpObj(imp *openrtb2.Imp) (*openrtb_ext.ExtImpSynacormedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -149,7 +149,7 @@ func getExtImpObj(imp *openrtb.Imp) (*openrtb_ext.ExtImpSynacormedia, error) { } // MakeBids make the bids for the bid response. -func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { const errorMessage string = "Unexpected status code: %d. Run with request.debug = 1 for more info" switch { case response.StatusCode == http.StatusNoContent: @@ -164,7 +164,7 @@ func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -187,7 +187,7 @@ func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte return bidResponse, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/synacormedia/synacormediatest/supplemental/bad_response.json b/adapters/synacormedia/synacormediatest/supplemental/bad_response.json index 8e8b9a4d944..520f415bcf4 100644 --- a/adapters/synacormedia/synacormediatest/supplemental/bad_response.json +++ b/adapters/synacormedia/synacormediatest/supplemental/bad_response.json @@ -64,7 +64,7 @@ "expectedMakeBidsErrors": [ { "comparison": "literal", - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse" + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse" } ] } diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index 2e044e82bb9..57720cb8217 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -9,12 +9,12 @@ import ( "text/template" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const TAPPX_BIDDER_VERSION = "1.1" @@ -37,7 +37,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *TappxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TappxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{&errortypes.BadInput{ Message: "No impression in the bid request", @@ -146,7 +146,7 @@ func (a *TappxAdapter) buildEndpointURL(params *openrtb_ext.ExtImpTappx, test in return thisURI.String(), nil } -func (a *TappxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TappxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -161,7 +161,7 @@ func (a *TappxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -181,7 +181,7 @@ func (a *TappxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalReq return bidResponse, []error{} } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/telaria/telaria.go b/adapters/telaria/telaria.go index 57cb53929b8..f6285c07c51 100644 --- a/adapters/telaria/telaria.go +++ b/adapters/telaria/telaria.go @@ -6,11 +6,11 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const Endpoint = "https://ads.tremorhub.com/ad/rtb/prebid" @@ -35,7 +35,7 @@ func (a *TelariaAdapter) FetchEndpoint() string { } // Checker method to ensure len(request.Imp) > 0 -func (a *TelariaAdapter) CheckHasImps(request *openrtb.BidRequest) error { +func (a *TelariaAdapter) CheckHasImps(request *openrtb2.BidRequest) error { if len(request.Imp) == 0 { err := &errortypes.BadInput{ Message: "Telaria: Missing Imp Object", @@ -46,7 +46,7 @@ func (a *TelariaAdapter) CheckHasImps(request *openrtb.BidRequest) error { } // Checking if Imp[i].Video exists and Imp[i].Banner doesn't exist -func (a *TelariaAdapter) CheckHasVideoObject(request *openrtb.BidRequest) error { +func (a *TelariaAdapter) CheckHasVideoObject(request *openrtb2.BidRequest) error { hasVideoObject := false for _, imp := range request.Imp { @@ -69,7 +69,7 @@ func (a *TelariaAdapter) CheckHasVideoObject(request *openrtb.BidRequest) error } // Fetches the populated header object -func GetHeaders(request *openrtb.BidRequest) *http.Header { +func GetHeaders(request *openrtb2.BidRequest) *http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") headers.Add("Accept", "application/json") @@ -97,7 +97,7 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header { } // Checks the imp[i].ext object and returns a imp.ext object as per ExtImpTelaria format -func (a *TelariaAdapter) FetchTelariaExtImpParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpTelaria, error) { +func (a *TelariaAdapter) FetchTelariaExtImpParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpTelaria, error) { var bidderExt adapters.ExtImpBidder err := json.Unmarshal(imp.Ext, &bidderExt) @@ -125,7 +125,7 @@ func (a *TelariaAdapter) FetchTelariaExtImpParams(imp *openrtb.Imp) (*openrtb_ex // Method to fetch the original publisher ID. Note that this method must be called // before we replace publisher.ID with seatCode -func (a *TelariaAdapter) FetchOriginalPublisherID(request *openrtb.BidRequest) string { +func (a *TelariaAdapter) FetchOriginalPublisherID(request *openrtb2.BidRequest) string { if request.Site != nil && request.Site.Publisher != nil { return request.Site.Publisher.ID @@ -137,8 +137,8 @@ func (a *TelariaAdapter) FetchOriginalPublisherID(request *openrtb.BidRequest) s } // Method to do a deep copy of the publisher object. It also adds the seatCode as publisher.ID -func (a *TelariaAdapter) MakePublisherObject(seatCode string, publisher *openrtb.Publisher) *openrtb.Publisher { - var pub = &openrtb.Publisher{ID: seatCode} +func (a *TelariaAdapter) MakePublisherObject(seatCode string, publisher *openrtb2.Publisher) *openrtb2.Publisher { + var pub = &openrtb2.Publisher{ID: seatCode} if publisher != nil { pub.Domain = publisher.Domain @@ -151,7 +151,7 @@ func (a *TelariaAdapter) MakePublisherObject(seatCode string, publisher *openrtb } // This method changes .publisher.id to the seatCode -func (a *TelariaAdapter) PopulatePublisherId(request *openrtb.BidRequest, seatCode string) (*openrtb.Site, *openrtb.App) { +func (a *TelariaAdapter) PopulatePublisherId(request *openrtb2.BidRequest, seatCode string) (*openrtb2.Site, *openrtb2.App) { if request.Site != nil { siteCopy := *request.Site siteCopy.Publisher = a.MakePublisherObject(seatCode, request.Site.Publisher) @@ -164,7 +164,7 @@ func (a *TelariaAdapter) PopulatePublisherId(request *openrtb.BidRequest, seatCo return nil, nil } -func (a *TelariaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TelariaAdapter) MakeRequests(requestIn *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { // make a copy of the incoming request request := *requestIn @@ -263,7 +263,7 @@ func (a *TelariaAdapter) CheckResponseStatusCodes(response *adapters.ResponseDat return nil } -func (a *TelariaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TelariaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { httpStatusError := a.CheckResponseStatusCodes(response) if httpStatusError != nil { @@ -272,7 +272,7 @@ func (a *TelariaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR responseBody := response.Body - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(responseBody, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: "Telaria: Bad Server Response", diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 6b9f5ecfd41..5f126f48e10 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type TripleliftAdapter struct { @@ -32,7 +32,7 @@ func getBidType(ext TripleliftRespExt) openrtb_ext.BidType { return openrtb_ext.BidTypeBanner } -func processImp(imp *openrtb.Imp) error { +func processImp(imp *openrtb2.Imp) error { // get the triplelift extension var ext adapters.ExtImpBidder var tlext openrtb_ext.ExtImpTriplelift @@ -56,13 +56,13 @@ func processImp(imp *openrtb.Imp) error { return nil } -func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TripleliftAdapter) MakeRequests(request *openrtb2.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)+1) reqs := make([]*adapters.RequestData, 0, 1) // copy the request, because we are going to mutate it tlRequest := *request // this will contain all the valid impressions - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // pre-process the imps for _, imp := range tlRequest.Imp { if err := processImp(&imp); err == nil { @@ -94,7 +94,7 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest, extra *ada return reqs, errs } -func getBidCount(bidResponse openrtb.BidResponse) int { +func getBidCount(bidResponse openrtb2.BidResponse) int { c := 0 for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) @@ -102,7 +102,7 @@ func getBidCount(bidResponse openrtb.BidResponse) int { return c } -func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -116,7 +116,7 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern if response.StatusCode != http.StatusOK { return nil, []error{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 65c6994c0b3..c292788fdb7 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type TripleliftNativeAdapter struct { @@ -37,7 +37,7 @@ func getBidType(ext TripleliftRespExt) openrtb_ext.BidType { return openrtb_ext.BidTypeNative } -func processImp(imp *openrtb.Imp) error { +func processImp(imp *openrtb2.Imp) error { // get the triplelift extension var ext adapters.ExtImpBidder var tlext openrtb_ext.ExtImpTriplelift @@ -64,7 +64,7 @@ func processImp(imp *openrtb.Imp) error { } // Returns the effective publisher ID -func effectivePubID(pub *openrtb.Publisher) string { +func effectivePubID(pub *openrtb2.Publisher) string { if pub != nil { if pub.Ext != nil { var pubExt openrtb_ext.ExtPublisher @@ -80,13 +80,13 @@ func effectivePubID(pub *openrtb.Publisher) string { return "unknown" } -func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb2.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)+1) reqs := make([]*adapters.RequestData, 0, 1) // copy the request, because we are going to mutate it tlRequest := *request // this will contain all the valid impressions - var validImps []openrtb.Imp + var validImps []openrtb2.Imp // pre-process the imps for _, imp := range tlRequest.Imp { if err := processImp(&imp); err == nil { @@ -124,14 +124,14 @@ func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb.BidRequest, extr return reqs, errs } -func getPublisher(request *openrtb.BidRequest) *openrtb.Publisher { +func getPublisher(request *openrtb2.BidRequest) *openrtb2.Publisher { if request.App != nil { return request.App.Publisher } return request.Site.Publisher } -func getBidCount(bidResponse openrtb.BidResponse) int { +func getBidCount(bidResponse openrtb2.BidResponse) int { c := 0 for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) @@ -139,7 +139,7 @@ func getBidCount(bidResponse openrtb.BidResponse) int { return c } -func (a *TripleliftNativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TripleliftNativeAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -153,7 +153,7 @@ func (a *TripleliftNativeAdapter) MakeBids(internalRequest *openrtb.BidRequest, 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 openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } diff --git a/adapters/ucfunnel/ucfunnel.go b/adapters/ucfunnel/ucfunnel.go index 7a6060f2930..d2d8682b77a 100644 --- a/adapters/ucfunnel/ucfunnel.go +++ b/adapters/ucfunnel/ucfunnel.go @@ -6,11 +6,11 @@ import ( "net/http" "net/url" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type UcfunnelAdapter struct { @@ -25,7 +25,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -43,12 +43,12 @@ func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } var errs []error - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } - var bidReq openrtb.BidRequest + var bidReq openrtb2.BidRequest if err := json.Unmarshal(externalRequest.Body, &bidReq); err != nil { return nil, []error{err} } @@ -69,7 +69,7 @@ func (a *UcfunnelAdapter) MakeBids(internalRequest *openrtb.BidRequest, external return bidResponse, errs } -func (a *UcfunnelAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *UcfunnelAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) // If all the requests were malformed, don't bother making a server call with no impressions. @@ -101,7 +101,7 @@ func (a *UcfunnelAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada }}, errs } -func getPartnerId(request *openrtb.BidRequest) (string, []error) { +func getPartnerId(request *openrtb2.BidRequest) (string, []error) { var ext ExtBidderUcfunnel var errs = []error{} err := json.Unmarshal(request.Imp[0].Ext, &ext) @@ -125,7 +125,7 @@ func checkBidderParameter(ext ExtBidderUcfunnel) []error { return nil } -func getBidType(bidReq openrtb.BidRequest, impid string) openrtb_ext.BidType { +func getBidType(bidReq openrtb2.BidRequest, impid string) openrtb_ext.BidType { for i := range bidReq.Imp { if bidReq.Imp[i].ID == impid { if bidReq.Imp[i].Banner != nil { diff --git a/adapters/ucfunnel/ucfunnel_test.go b/adapters/ucfunnel/ucfunnel_test.go index 3860c988b32..b58dfecce5c 100644 --- a/adapters/ucfunnel/ucfunnel_test.go +++ b/adapters/ucfunnel/ucfunnel_test.go @@ -5,40 +5,40 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func TestMakeRequests(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "1234", - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, } - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "1235", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imp3 := openrtb.Imp{ + imp3 := openrtb2.Imp{ ID: "1236", - Audio: &openrtb.Audio{}, + Audio: &openrtb2.Audio{}, } - imp4 := openrtb.Imp{ + imp4 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - imp5 := openrtb.Imp{ + imp5 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - internalRequest01 := openrtb.BidRequest{Imp: []openrtb.Imp{}} - internalRequest02 := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2, imp3, imp4, imp5}} - internalRequest03 := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2, imp3, imp4, imp5}} + internalRequest01 := openrtb2.BidRequest{Imp: []openrtb2.Imp{}} + internalRequest02 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2, imp3, imp4, imp5}} + internalRequest03 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2, imp3, imp4, imp5}} internalRequest03.Imp[0].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) internalRequest03.Imp[1].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) @@ -54,12 +54,12 @@ func TestMakeRequests(t *testing.T) { } var testCases = []struct { - in []openrtb.BidRequest + in []openrtb2.BidRequest out1 [](int) out2 [](bool) }{ { - in: []openrtb.BidRequest{internalRequest01, internalRequest02, internalRequest03}, + in: []openrtb2.BidRequest{internalRequest01, internalRequest02, internalRequest03}, out1: [](int){1, 1, 0}, out2: [](bool){false, false, true}, }, @@ -76,31 +76,31 @@ func TestMakeRequests(t *testing.T) { } func TestMakeBids(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "1234", - Banner: &openrtb.Banner{}, + Banner: &openrtb2.Banner{}, } - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "1235", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imp3 := openrtb.Imp{ + imp3 := openrtb2.Imp{ ID: "1236", - Audio: &openrtb.Audio{}, + Audio: &openrtb2.Audio{}, } - imp4 := openrtb.Imp{ + imp4 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - imp5 := openrtb.Imp{ + imp5 := openrtb2.Imp{ ID: "1237", - Native: &openrtb.Native{}, + Native: &openrtb2.Native{}, } - internalRequest03 := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2, imp3, imp4, imp5}} - internalRequest04 := openrtb.BidRequest{Imp: []openrtb.Imp{imp}} + internalRequest03 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2, imp3, imp4, imp5}} + internalRequest04 := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp}} internalRequest03.Imp[0].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) internalRequest03.Imp[1].Ext = []byte(`{"bidder": {"adunitid": "ad-488663D474E44841E8A293379892348","partnerid": "par-7E6D2DB9A8922AB07B44A444D2BA67"}}`) @@ -126,14 +126,14 @@ func TestMakeBids(t *testing.T) { } var testCases = []struct { - in1 []openrtb.BidRequest + in1 []openrtb2.BidRequest in2 []adapters.RequestData in3 []adapters.ResponseData out1 [](bool) out2 [](bool) }{ { - in1: []openrtb.BidRequest{internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest04}, + in1: []openrtb2.BidRequest{internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest03, internalRequest04}, in2: []adapters.RequestData{RequestData01, RequestData01, RequestData01, RequestData01, RequestData01, RequestData02}, in3: []adapters.ResponseData{mockResponse200, mockResponse203, mockResponse204, mockResponse400, mockResponseError, mockResponse200}, out1: [](bool){true, false, false, false, false, false}, diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index 131e53af393..977316a5636 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type UnrulyAdapter struct { @@ -24,13 +24,13 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (a *UnrulyAdapter) ReplaceImp(imp openrtb.Imp, request *openrtb.BidRequest) *openrtb.BidRequest { +func (a *UnrulyAdapter) ReplaceImp(imp openrtb2.Imp, request *openrtb2.BidRequest) *openrtb2.BidRequest { reqCopy := *request - reqCopy.Imp = append(make([]openrtb.Imp, 0, 1), imp) + reqCopy.Imp = append(make([]openrtb2.Imp, 0, 1), imp) return &reqCopy } -func (a *UnrulyAdapter) BuildRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *UnrulyAdapter) BuildRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { reqJSON, err := json.Marshal(request) if err != nil { return nil, []error{err} @@ -52,7 +52,7 @@ func AddHeadersToRequest() http.Header { return headers } -func (a *UnrulyAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *UnrulyAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData for _, imp := range request.Imp { @@ -71,7 +71,7 @@ func (a *UnrulyAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt return adapterRequests, errs } -func getMediaTypeForImpWithId(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImpWithId(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { return openrtb_ext.BidTypeVideo, nil @@ -91,9 +91,9 @@ func CheckResponse(response *adapters.ResponseData) error { return nil } -func convertToAdapterBidResponse(response *adapters.ResponseData, internalRequest *openrtb.BidRequest) (*adapters.BidderResponse, []error) { +func convertToAdapterBidResponse(response *adapters.ResponseData, internalRequest *openrtb2.BidRequest) (*adapters.BidderResponse, []error) { var errs []error - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -115,7 +115,7 @@ func convertToAdapterBidResponse(response *adapters.ResponseData, internalReques return bidResponse, errs } -func convertBidderNameInExt(imp *openrtb.Imp) (*openrtb.Imp, error) { +func convertBidderNameInExt(imp *openrtb2.Imp) (*openrtb2.Imp, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, err @@ -136,7 +136,7 @@ func convertBidderNameInExt(imp *openrtb.Imp) (*openrtb.Imp, error) { return imp, nil } -func (a *UnrulyAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *UnrulyAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if err := CheckResponse(response); err != nil { return nil, []error{err} } diff --git a/adapters/unruly/unruly_test.go b/adapters/unruly/unruly_test.go index e0f3ccc75e0..7f37cba85db 100644 --- a/adapters/unruly/unruly_test.go +++ b/adapters/unruly/unruly_test.go @@ -7,12 +7,12 @@ import ( "reflect" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -41,7 +41,7 @@ func TestReturnsNewUnrulyBidderWithParams(t *testing.T) { } func TestBuildRequest(t *testing.T) { - request := openrtb.BidRequest{} + request := openrtb2.BidRequest{} expectedJson, _ := json.Marshal(request) mockHeaders := http.Header{} mockHeaders.Add("Content-Type", "application/json;charset=utf-8") @@ -65,19 +65,19 @@ func TestBuildRequest(t *testing.T) { } func TestReplaceImp(t *testing.T) { - imp1 := openrtb.Imp{ID: "imp1"} - imp2 := openrtb.Imp{ID: "imp2"} - imp3 := openrtb.Imp{ID: "imp3"} - newImp := openrtb.Imp{ID: "imp4"} - request := openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}} + imp1 := openrtb2.Imp{ID: "imp1"} + imp2 := openrtb2.Imp{ID: "imp2"} + imp3 := openrtb2.Imp{ID: "imp3"} + newImp := openrtb2.Imp{ID: "imp4"} + request := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}} adapter := UnrulyAdapter{URI: "http://mockEndpoint.com"} newRequest := adapter.ReplaceImp(newImp, &request) if len(newRequest.Imp) != 1 { t.Errorf("Size of Imp Array should be 1") } - if !reflect.DeepEqual(request, openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}}) { - t.Errorf("actual = %v expected = %v", request, openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}}) + if !reflect.DeepEqual(request, openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}}) { + t.Errorf("actual = %v expected = %v", request, openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}}) } if !reflect.DeepEqual(newImp, newRequest.Imp[0]) { t.Errorf("actual = %v expected = %v", newRequest.Imp[0], newImp) @@ -85,7 +85,7 @@ func TestReplaceImp(t *testing.T) { } func TestConvertBidderNameInExt(t *testing.T) { - imp := openrtb.Imp{Ext: json.RawMessage(`{"bidder": {"uuid": "1234", "siteid": "aSiteID"}}`)} + imp := openrtb2.Imp{Ext: json.RawMessage(`{"bidder": {"uuid": "1234", "siteid": "aSiteID"}}`)} actualImp, err := convertBidderNameInExt(&imp) @@ -112,17 +112,17 @@ func TestConvertBidderNameInExt(t *testing.T) { func TestMakeRequests(t *testing.T) { adapter := UnrulyAdapter{URI: "http://mockEndpoint.com"} - imp1 := openrtb.Imp{ID: "imp1", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid1", "siteid": "siteID1"}}`)} - imp2 := openrtb.Imp{ID: "imp2", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid2", "siteid": "siteID2"}}`)} - imp3 := openrtb.Imp{ID: "imp3", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid3", "siteid": "siteID3"}}`)} + imp1 := openrtb2.Imp{ID: "imp1", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid1", "siteid": "siteID1"}}`)} + imp2 := openrtb2.Imp{ID: "imp2", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid2", "siteid": "siteID2"}}`)} + imp3 := openrtb2.Imp{ID: "imp3", Ext: json.RawMessage(`{"bidder": {"uuid": "uuid3", "siteid": "siteID3"}}`)} - expectImp1 := openrtb.Imp{ID: "imp1", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid1", "siteid": "siteID1"}}`)} - expectImp2 := openrtb.Imp{ID: "imp2", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid2", "siteid": "siteID2"}}`)} - expectImp3 := openrtb.Imp{ID: "imp3", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid3", "siteid": "siteID3"}}`)} + expectImp1 := openrtb2.Imp{ID: "imp1", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid1", "siteid": "siteID1"}}`)} + expectImp2 := openrtb2.Imp{ID: "imp2", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid2", "siteid": "siteID2"}}`)} + expectImp3 := openrtb2.Imp{ID: "imp3", Ext: json.RawMessage(`{"unruly": {"uuid": "uuid3", "siteid": "siteID3"}}`)} - expectImps := []openrtb.Imp{expectImp1, expectImp2, expectImp3} + expectImps := []openrtb2.Imp{expectImp1, expectImp2, expectImp3} - inputRequest := openrtb.BidRequest{Imp: []openrtb.Imp{imp1, imp2, imp3}} + inputRequest := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp1, imp2, imp3}} actualAdapterRequests, _ := adapter.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) mockHeaders := http.Header{} mockHeaders.Add("Content-Type", "application/json;charset=utf-8") @@ -132,7 +132,7 @@ func TestMakeRequests(t *testing.T) { t.Errorf("should have 3 imps") } for n, imp := range expectImps { - request := openrtb.BidRequest{Imp: []openrtb.Imp{imp}} + request := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp}} expectedJson, _ := json.Marshal(request) data := adapters.RequestData{ Method: "POST", @@ -149,11 +149,11 @@ func TestMakeRequests(t *testing.T) { func TestGetMediaTypeForImpIsVideo(t *testing.T) { testID := string("4321") testBidMediaType := openrtb_ext.BidTypeVideo - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: testID, - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imps := []openrtb.Imp{imp} + imps := []openrtb2.Imp{imp} actual, _ := getMediaTypeForImpWithId(testID, imps) if actual != "video" { @@ -162,11 +162,11 @@ func TestGetMediaTypeForImpIsVideo(t *testing.T) { } func TestGetMediaTypeForImpWithNoIDPresent(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "4321", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imps := []openrtb.Imp{imp} + imps := []openrtb2.Imp{imp} _, err := getMediaTypeForImpWithId("1234", imps) expected := &errortypes.BadInput{ Message: fmt.Sprintf("Failed to find impression \"%s\" ", "1234"), @@ -177,26 +177,26 @@ func TestGetMediaTypeForImpWithNoIDPresent(t *testing.T) { } func TestConvertToAdapterBidResponseHasCorrectNumberOfBids(t *testing.T) { - imp := openrtb.Imp{ + imp := openrtb2.Imp{ ID: "1234", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } - imp2 := openrtb.Imp{ + imp2 := openrtb2.Imp{ ID: "1235", - Video: &openrtb.Video{}, + Video: &openrtb2.Video{}, } mockResponse := adapters.ResponseData{StatusCode: 200, Body: json.RawMessage(`{"seatbid":[{"bid":[{"impid":"1234"}]},{"bid":[{"impid":"1235"}]}]}`)} - internalRequest := openrtb.BidRequest{Imp: []openrtb.Imp{imp, imp2}} + internalRequest := openrtb2.BidRequest{Imp: []openrtb2.Imp{imp, imp2}} mockBidResponse := adapters.NewBidderResponseWithBidsCapacity(5) typedBid := &adapters.TypedBid{ - Bid: &openrtb.Bid{ImpID: "1234"}, + Bid: &openrtb2.Bid{ImpID: "1234"}, BidType: "Video", } typedBid2 := &adapters.TypedBid{ - Bid: &openrtb.Bid{ImpID: "1235"}, + Bid: &openrtb2.Bid{ImpID: "1235"}, BidType: "Video", } diff --git a/adapters/valueimpression/valueimpression.go b/adapters/valueimpression/valueimpression.go index 87b66674f85..eacfc8e2feb 100644 --- a/adapters/valueimpression/valueimpression.go +++ b/adapters/valueimpression/valueimpression.go @@ -5,18 +5,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ValueImpressionAdapter struct { endpoint string } -func (a *ValueImpressionAdapter) MakeRequests(request *openrtb.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ValueImpressionAdapter) MakeRequests(request *openrtb2.BidRequest, unused *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -36,7 +36,7 @@ func (a *ValueImpressionAdapter) MakeRequests(request *openrtb.BidRequest, unuse return adapterRequests, errs } -func (a *ValueImpressionAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, error) { +func (a *ValueImpressionAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { var err error jsonBody, err := json.Marshal(request) @@ -55,7 +55,7 @@ func (a *ValueImpressionAdapter) makeRequest(request *openrtb.BidRequest) (*adap }, nil } -func preprocess(request *openrtb.BidRequest) error { +func preprocess(request *openrtb2.BidRequest) error { if len(request.Imp) == 0 { return &errortypes.BadInput{ Message: "No Imps in Bid Request", @@ -85,7 +85,7 @@ func preprocess(request *openrtb.BidRequest) error { } // MakeBids based on valueimpression server response -func (a *ValueImpressionAdapter) MakeBids(bidRequest *openrtb.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *ValueImpressionAdapter) MakeBids(bidRequest *openrtb2.BidRequest, unused *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if responseData.StatusCode == http.StatusNoContent { return nil, nil } @@ -102,7 +102,7 @@ func (a *ValueImpressionAdapter) MakeBids(bidRequest *openrtb.BidRequest, unused }} } - var bidResponse openrtb.BidResponse + var bidResponse openrtb2.BidResponse if err := json.Unmarshal(responseData.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ diff --git a/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json b/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json index c854548b78b..2de5213d686 100644 --- a/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json +++ b/adapters/valueimpression/valueimpressiontest/supplemental/invalid-response-unmarshall-error.json @@ -59,7 +59,7 @@ ], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type uint64", + "value": "json: cannot unmarshal string into Go struct field Bid(\\.seatbid\\.bid)?\\.w of type int64", "comparison": "regex" } ] diff --git a/adapters/verizonmedia/verizonmedia.go b/adapters/verizonmedia/verizonmedia.go index d90deea324b..715eb949e13 100644 --- a/adapters/verizonmedia/verizonmedia.go +++ b/adapters/verizonmedia/verizonmedia.go @@ -6,18 +6,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type VerizonMediaAdapter struct { URI string } -func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *VerizonMediaAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0, 1) if len(request.Imp) == 0 { @@ -79,7 +79,7 @@ func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo // Split up multi-impression requests into multiple requests so that // each split request is only associated to a single impression reqCopy := *request - reqCopy.Imp = []openrtb.Imp{imp} + reqCopy.Imp = []openrtb2.Imp{imp} if request.Site != nil { siteCopy := *request.Site @@ -111,7 +111,7 @@ func (a *VerizonMediaAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo return reqs, errors } -func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -123,7 +123,7 @@ func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d.", err), @@ -156,7 +156,7 @@ func (a *VerizonMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte return bidResponse, nil } -func getImpInfo(impId string, imps []openrtb.Imp) (bool, openrtb_ext.BidType) { +func getImpInfo(impId string, imps []openrtb2.Imp) (bool, openrtb_ext.BidType) { var mediaType openrtb_ext.BidType var exists bool for _, imp := range imps { @@ -171,7 +171,7 @@ func getImpInfo(impId string, imps []openrtb.Imp) (bool, openrtb_ext.BidType) { return exists, mediaType } -func changeRequestForBidService(request *openrtb.BidRequest, extension *openrtb_ext.ExtImpVerizonMedia) error { +func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb_ext.ExtImpVerizonMedia) error { /* Always override the tag ID and (site ID or app ID) of the request */ request.Imp[0].TagID = extension.Pos if request.Site != nil { @@ -198,10 +198,8 @@ func changeRequestForBidService(request *openrtb.BidRequest, extension *openrtb_ return errors.New(fmt.Sprintf("No sizes provided for Banner %v", banner.Format)) } - banner.W = new(uint64) - *banner.W = banner.Format[0].W - banner.H = new(uint64) - *banner.H = banner.Format[0].H + banner.W = openrtb2.Int64Ptr(banner.Format[0].W) + banner.H = openrtb2.Int64Ptr(banner.Format[0].H) return nil } diff --git a/adapters/visx/visx.go b/adapters/visx/visx.go index 2a00b2def69..28a03acd8d9 100644 --- a/adapters/visx/visx.go +++ b/adapters/visx/visx.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type VisxAdapter struct { @@ -38,7 +38,7 @@ type visxResponse struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *VisxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *VisxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) // copy the request, because we are going to mutate it @@ -65,7 +65,7 @@ func (a *VisxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapter } // MakeBids unpacks the server's response into Bids. -func (a *VisxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *VisxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -91,14 +91,14 @@ func (a *VisxAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequ for _, sb := range bidResp.SeatBid { for i := range sb.Bid { - bid := openrtb.Bid{} + bid := openrtb2.Bid{} bid.ID = internalRequest.ID bid.CrID = sb.Bid[i].CrID bid.ImpID = sb.Bid[i].ImpID bid.Price = sb.Bid[i].Price bid.AdM = sb.Bid[i].AdM - bid.W = sb.Bid[i].W - bid.H = sb.Bid[i].H + bid.W = int64(sb.Bid[i].W) + bid.H = int64(sb.Bid[i].H) bid.ADomain = sb.Bid[i].ADomain bid.DealID = sb.Bid[i].DealID diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index 5d4bd705d2f..5a545dc8c04 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -5,18 +5,18 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type VrtcalAdapter struct { endpoint string } -func (a *VrtcalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *VrtcalAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -42,7 +42,7 @@ func (a *VrtcalAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapt } // MakeBids make the bids for the bid response. -func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil @@ -60,7 +60,7 @@ func (a *VrtcalAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRe }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} diff --git a/adapters/yeahmobi/yeahmobi.go b/adapters/yeahmobi/yeahmobi.go index 0e342052008..d66b614cd64 100644 --- a/adapters/yeahmobi/yeahmobi.go +++ b/adapters/yeahmobi/yeahmobi.go @@ -7,13 +7,13 @@ import ( "net/url" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type YeahmobiAdapter struct { @@ -33,7 +33,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func (adapter *YeahmobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (adapter *YeahmobiAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var adapterRequests []*adapters.RequestData adapterRequest, errs := adapter.makeRequest(request) @@ -44,7 +44,7 @@ func (adapter *YeahmobiAdapter) MakeRequests(request *openrtb.BidRequest, reqInf return adapterRequests, errs } -func (adapter *YeahmobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (adapter *YeahmobiAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error yeahmobiExt, errs := getYeahmobiExt(request) @@ -75,7 +75,7 @@ func (adapter *YeahmobiAdapter) makeRequest(request *openrtb.BidRequest) (*adapt }, errs } -func transform(request *openrtb.BidRequest) { +func transform(request *openrtb2.BidRequest) { for i, imp := range request.Imp { if imp.Native != nil { var nativeRequest map[string]interface{} @@ -101,7 +101,7 @@ func transform(request *openrtb.BidRequest) { } } -func getYeahmobiExt(request *openrtb.BidRequest) (*openrtb_ext.ExtImpYeahmobi, []error) { +func getYeahmobiExt(request *openrtb2.BidRequest) (*openrtb_ext.ExtImpYeahmobi, []error) { var extImpYeahmobi openrtb_ext.ExtImpYeahmobi var errs []error @@ -129,7 +129,7 @@ func (adapter *YeahmobiAdapter) getEndpoint(ext *openrtb_ext.ExtImpYeahmobi) (st } // MakeBids make the bids for the bid response. -func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -146,7 +146,7 @@ func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, external }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -167,7 +167,7 @@ func (a *YeahmobiAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } -func getBidType(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getBidType(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { diff --git a/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json b/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json index 22939466309..0d77e5af93a 100644 --- a/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json +++ b/adapters/yeahmobi/yeahmobitest/supplemental/bad_response.json @@ -49,7 +49,7 @@ "expectedMakeBidsErrors": [ { "comparison": "literal", - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse" + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse" } ] } diff --git a/adapters/yieldlab/yieldlab.go b/adapters/yieldlab/yieldlab.go index adce598d60d..a3eb297fff9 100644 --- a/adapters/yieldlab/yieldlab.go +++ b/adapters/yieldlab/yieldlab.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/text/currency" "github.com/PubMatic-OpenWrap/prebid-server/adapters" @@ -36,7 +36,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters } // Builds endpoint url based on adapter-specific pub settings from imp.ext -func (a *YieldlabAdapter) makeEndpointURL(req *openrtb.BidRequest, params *openrtb_ext.ExtImpYieldlab) (string, error) { +func (a *YieldlabAdapter) makeEndpointURL(req *openrtb2.BidRequest, params *openrtb_ext.ExtImpYieldlab) (string, error) { uri, err := url.Parse(a.endpoint) if err != nil { return "", fmt.Errorf("failed to parse yieldlab endpoint: %v", err) @@ -86,7 +86,7 @@ func (a *YieldlabAdapter) makeEndpointURL(req *openrtb.BidRequest, params *openr return uri.String(), nil } -func (a *YieldlabAdapter) getGDPR(request *openrtb.BidRequest) (string, string, error) { +func (a *YieldlabAdapter) getGDPR(request *openrtb2.BidRequest) (string, string, error) { gdpr := "" var extRegs openrtb_ext.ExtRegs if request.Regs != nil { @@ -118,7 +118,7 @@ func (a *YieldlabAdapter) makeTargetingValues(params *openrtb_ext.ExtImpYieldlab return values.Encode() } -func (a *YieldlabAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *YieldlabAdapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { if len(request.Imp) == 0 { return nil, []error{fmt.Errorf("invalid request %+v, no Impressions given", request)} } @@ -149,7 +149,7 @@ func (a *YieldlabAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters. } // parseRequest extracts the Yieldlab request information from the request -func (a *YieldlabAdapter) parseRequest(request *openrtb.BidRequest) []*openrtb_ext.ExtImpYieldlab { +func (a *YieldlabAdapter) parseRequest(request *openrtb2.BidRequest) []*openrtb_ext.ExtImpYieldlab { params := make([]*openrtb_ext.ExtImpYieldlab, 0) for i := 0; i < len(request.Imp); i++ { @@ -187,7 +187,7 @@ func (a *YieldlabAdapter) mergeParams(params []*openrtb_ext.ExtImpYieldlab) *ope } // MakeBids make the bids for the bid response. -func (a *YieldlabAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YieldlabAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode != 200 { return nil, []error{ &errortypes.BadServerResponse{ @@ -226,14 +226,14 @@ func (a *YieldlabAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } var bidType openrtb_ext.BidType - responseBid := &openrtb.Bid{ + responseBid := &openrtb2.Bid{ ID: strconv.FormatUint(bid.ID, 10), Price: float64(bid.Price) / 100, ImpID: internalRequest.Imp[i].ID, CrID: a.makeCreativeID(req, bid), DealID: strconv.FormatUint(bid.Pid, 10), - W: width, - H: height, + W: int64(width), + H: int64(height), } if internalRequest.Imp[i].Video != nil { @@ -268,11 +268,11 @@ func (a *YieldlabAdapter) findBidReq(adslotID uint64, params []*openrtb_ext.ExtI return nil } -func (a *YieldlabAdapter) makeBannerAdSource(req *openrtb.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { +func (a *YieldlabAdapter) makeBannerAdSource(req *openrtb2.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { return fmt.Sprintf(adSourceBanner, a.makeAdSourceURL(req, ext, res)) } -func (a *YieldlabAdapter) makeAdSourceURL(req *openrtb.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { +func (a *YieldlabAdapter) makeAdSourceURL(req *openrtb2.BidRequest, ext *openrtb_ext.ExtImpYieldlab, res *bidResponse) string { val := url.Values{} val.Set("ts", a.cacheBuster()) val.Set("id", ext.ExtId) diff --git a/adapters/yieldmo/yieldmo.go b/adapters/yieldmo/yieldmo.go index 95fbfa33f48..7fc8ad5b1ca 100644 --- a/adapters/yieldmo/yieldmo.go +++ b/adapters/yieldmo/yieldmo.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type YieldmoAdapter struct { @@ -20,7 +20,7 @@ type Ext struct { PlacementId string `json:"placement_id"` } -func (a *YieldmoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *YieldmoAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errs []error var adapterRequests []*adapters.RequestData @@ -33,7 +33,7 @@ func (a *YieldmoAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap return adapterRequests, errors } -func (a *YieldmoAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { +func (a *YieldmoAdapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, []error) { var errs []error if err := preprocess(request); err != nil { @@ -59,7 +59,7 @@ func (a *YieldmoAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.Req } // Mutate the request to get it ready to send to yieldmo. -func preprocess(request *openrtb.BidRequest) error { +func preprocess(request *openrtb2.BidRequest) error { for i := 0; i < len(request.Imp); i++ { var imp = request.Imp[i] var bidderExt adapters.ExtImpBidder @@ -95,7 +95,7 @@ func preprocess(request *openrtb.BidRequest) error { } // MakeBids make the bids for the bid response. -func (a *YieldmoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YieldmoAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -112,7 +112,7 @@ func (a *YieldmoAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -140,7 +140,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType { //default to video unless banner exists in impression for _, imp := range imps { if imp.ID == impId && imp.Banner != nil { diff --git a/adapters/yieldone/yieldone.go b/adapters/yieldone/yieldone.go index 33debb26bd9..90c8cf06e78 100644 --- a/adapters/yieldone/yieldone.go +++ b/adapters/yieldone/yieldone.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type YieldoneAdapter struct { @@ -17,10 +17,10 @@ type YieldoneAdapter struct { } // MakeRequests makes the HTTP requests which should be made to fetch bids. -func (a *YieldoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *YieldoneAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { var errors = make([]error, 0) - var validImps []openrtb.Imp + var validImps []openrtb2.Imp for i := 0; i < len(request.Imp); i++ { if err := preprocess(&request.Imp[i]); err == nil { validImps = append(validImps, request.Imp[i]) @@ -49,7 +49,7 @@ func (a *YieldoneAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada } // MakeBids unpacks the server's response into Bids. -func (a *YieldoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *YieldoneAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { if response.StatusCode == http.StatusNoContent { return nil, nil } @@ -66,7 +66,7 @@ func (a *YieldoneAdapter) MakeBids(internalRequest *openrtb.BidRequest, external }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } @@ -98,7 +98,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters return bidder, nil } -func preprocess(imp *openrtb.Imp) error { +func preprocess(imp *openrtb2.Imp) error { var ext adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &ext); err != nil { @@ -122,7 +122,7 @@ func preprocess(imp *openrtb.Imp) error { return nil } -func getMediaTypeForImp(impID string, imps []openrtb.Imp) (openrtb_ext.BidType, error) { +func getMediaTypeForImp(impID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { for _, imp := range imps { if imp.ID == impID { if imp.Banner != nil { diff --git a/adapters/yieldone/yieldonetest/supplemental/bad_response.json b/adapters/yieldone/yieldonetest/supplemental/bad_response.json index fa993a2fff5..3112d1f7ba0 100644 --- a/adapters/yieldone/yieldonetest/supplemental/bad_response.json +++ b/adapters/yieldone/yieldonetest/supplemental/bad_response.json @@ -58,7 +58,7 @@ "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/adapters/zeroclickfraud/zeroclickfraud.go b/adapters/zeroclickfraud/zeroclickfraud.go index eb98aed1ece..206981101f6 100644 --- a/adapters/zeroclickfraud/zeroclickfraud.go +++ b/adapters/zeroclickfraud/zeroclickfraud.go @@ -7,19 +7,19 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/macros" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ZeroClickFraudAdapter struct { EndpointTemplate template.Template } -func (a *ZeroClickFraudAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a *ZeroClickFraudAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) headers := http.Header{ @@ -69,7 +69,7 @@ func (a *ZeroClickFraudAdapter) MakeRequests(request *openrtb.BidRequest, reqInf internal original request in OpenRTB, external = result of us having converted it (what comes out of MakeRequests) */ func (a *ZeroClickFraudAdapter) MakeBids( - internalRequest *openrtb.BidRequest, + internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData, ) (*adapters.BidderResponse, []error) { @@ -88,7 +88,7 @@ func (a *ZeroClickFraudAdapter) MakeBids( }} } - var bidResp openrtb.BidResponse + var bidResp openrtb2.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} @@ -110,9 +110,9 @@ func (a *ZeroClickFraudAdapter) MakeBids( return bidResponse, nil } -func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpZeroClickFraud][]openrtb.Imp, error) { +func splitImpressions(imps []openrtb2.Imp) (map[openrtb_ext.ExtImpZeroClickFraud][]openrtb2.Imp, error) { - var m = make(map[openrtb_ext.ExtImpZeroClickFraud][]openrtb.Imp) + var m = make(map[openrtb_ext.ExtImpZeroClickFraud][]openrtb2.Imp) for _, imp := range imps { bidderParams, err := getBidderParams(&imp) @@ -126,7 +126,7 @@ func splitImpressions(imps []openrtb.Imp) (map[openrtb_ext.ExtImpZeroClickFraud] return m, nil } -func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpZeroClickFraud, error) { +func getBidderParams(imp *openrtb2.Imp) (*openrtb_ext.ExtImpZeroClickFraud, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return nil, &errortypes.BadInput{ @@ -155,7 +155,7 @@ func getBidderParams(imp *openrtb.Imp) (*openrtb_ext.ExtImpZeroClickFraud, error return &zeroclickfraudExt, nil } -func getMediaType(impID string, imps []openrtb.Imp) openrtb_ext.BidType { +func getMediaType(impID string, imps []openrtb2.Imp) openrtb_ext.BidType { bidType := openrtb_ext.BidTypeBanner diff --git a/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json b/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json index 84d6bd9d889..87ad168467d 100644 --- a/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json +++ b/adapters/zeroclickfraud/zeroclickfraudtest/supplemental/bad-response-body.json @@ -81,7 +81,7 @@ }], "expectedMakeBidsErrors": [ { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "value": "json: cannot unmarshal string into Go value of type openrtb2.BidResponse", "comparison": "literal" } ] diff --git a/amp/parse.go b/amp/parse.go index c3606e83563..05e43aca1e2 100644 --- a/amp/parse.go +++ b/amp/parse.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Params defines the paramters of an AMP request. @@ -24,11 +24,11 @@ type Params struct { // Size defines size information of an AMP request. type Size struct { - Height uint64 - Multisize []openrtb.Format - OverrideHeight uint64 - OverrideWidth uint64 - Width uint64 + Height int64 + Multisize []openrtb2.Format + OverrideHeight int64 + OverrideWidth int64 + Width int64 } // ParseParams parses the AMP paramters from a HTTP request. @@ -67,26 +67,26 @@ func parseIntPtr(value string) *uint64 { return nil } -func parseInt(value string) uint64 { - if parsed, err := strconv.ParseUint(value, 10, 64); err == nil { +func parseInt(value string) int64 { + if parsed, err := strconv.ParseInt(value, 10, 64); err == nil { return parsed } return 0 } -func parseMultisize(multisize string) []openrtb.Format { +func parseMultisize(multisize string) []openrtb2.Format { if multisize == "" { return nil } sizeStrings := strings.Split(multisize, ",") - sizes := make([]openrtb.Format, 0, len(sizeStrings)) + sizes := make([]openrtb2.Format, 0, len(sizeStrings)) for _, sizeString := range sizeStrings { wh := strings.Split(sizeString, "x") if len(wh) != 2 { return nil } - f := openrtb.Format{ + f := openrtb2.Format{ W: parseInt(wh[0]), H: parseInt(wh[1]), } diff --git a/amp/parse_test.go b/amp/parse_test.go index 1b9d30804da..91027f8e67c 100644 --- a/amp/parse_test.go +++ b/amp/parse_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -40,7 +40,7 @@ func TestParseParams(t *testing.T) { OverrideHeight: 3, OverrideWidth: 4, Width: 2, - Multisize: []openrtb.Format{ + Multisize: []openrtb2.Format{ {W: 10, H: 11}, {W: 12, H: 13}, }, }, @@ -96,7 +96,7 @@ func TestParseMultisize(t *testing.T) { testCases := []struct { description string multisize string - expectedFormats []openrtb.Format + expectedFormats []openrtb2.Format }{ { description: "Empty", @@ -106,18 +106,18 @@ func TestParseMultisize(t *testing.T) { { description: "One", multisize: "1x2", - expectedFormats: []openrtb.Format{{W: 1, H: 2}}, + expectedFormats: []openrtb2.Format{{W: 1, H: 2}}, }, { description: "Many", multisize: "1x2,3x4", - expectedFormats: []openrtb.Format{{W: 1, H: 2}, {W: 3, H: 4}}, + expectedFormats: []openrtb2.Format{{W: 1, H: 2}, {W: 3, H: 4}}, }, { // Existing Behavior: The " 3" token in the second size is parsed as 0. description: "Many With Space - Quirky Result", multisize: "1x2, 3x4", - expectedFormats: []openrtb.Format{{W: 1, H: 2}, {W: 0, H: 4}}, + expectedFormats: []openrtb2.Format{{W: 1, H: 2}, {W: 0, H: 4}}, }, { description: "One - Zero Size - Ignored", diff --git a/analytics/config/config_test.go b/analytics/config/config_test.go index 02ea6a54261..ec7fca7d73e 100644 --- a/analytics/config/config_test.go +++ b/analytics/config/config_test.go @@ -6,9 +6,9 @@ import ( "os" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const TEST_DIR string = "testFiles" @@ -19,8 +19,8 @@ func TestSampleModule(t *testing.T) { am.LogAuctionObject(&analytics.AuctionObject{ Status: http.StatusOK, Errors: nil, - Request: &openrtb.BidRequest{}, - Response: &openrtb.BidResponse{}, + Request: &openrtb2.BidRequest{}, + Response: &openrtb2.BidResponse{}, }) if count != 1 { t.Errorf("PBSAnalyticsModule failed at LogAuctionObject") diff --git a/analytics/core.go b/analytics/core.go index 78ca1df2c9a..647a0d9f5dd 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -3,10 +3,10 @@ package analytics import ( "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) /* @@ -30,8 +30,8 @@ type PBSAnalyticsModule interface { type AuctionObject struct { Status int Errors []error - Request *openrtb.BidRequest - Response *openrtb.BidResponse + Request *openrtb2.BidRequest + Response *openrtb2.BidResponse Account *config.Account StartTime time.Time } @@ -40,8 +40,8 @@ type AuctionObject struct { type AmpObject struct { Status int Errors []error - Request *openrtb.BidRequest - AuctionResponse *openrtb.BidResponse + Request *openrtb2.BidRequest + AuctionResponse *openrtb2.BidResponse AmpTargetingValues map[string]string Origin string StartTime time.Time @@ -51,8 +51,8 @@ type AmpObject struct { type VideoObject struct { Status int Errors []error - Request *openrtb.BidRequest - Response *openrtb.BidResponse + Request *openrtb2.BidRequest + Response *openrtb2.BidResponse VideoRequest *openrtb_ext.BidRequestVideo VideoResponse *openrtb_ext.BidResponseVideo StartTime time.Time diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index e46e9259319..4c46d538cb0 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -7,9 +7,9 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const TEST_DIR string = "testFiles" @@ -18,7 +18,7 @@ func TestAmpObject_ToJson(t *testing.T) { ao := &analytics.AmpObject{ Status: http.StatusOK, Errors: make([]error, 0), - AuctionResponse: &openrtb.BidResponse{}, + AuctionResponse: &openrtb2.BidResponse{}, AmpTargetingValues: map[string]string{}, } if aoJson := jsonifyAmpObject(ao); strings.Contains(aoJson, "Transactional Logs Error") { diff --git a/analytics/pubstack/README.md b/analytics/pubstack/README.md index 51c5fdb6bb3..f2bfb33c221 100644 --- a/analytics/pubstack/README.md +++ b/analytics/pubstack/README.md @@ -6,7 +6,7 @@ You can configure the server using the following environment variables: ```bash export PBS_ANALYTICS_PUBSTACK_ENABLED="true" -export PBS_ANALYTICS_PUBSTACK_ENDPOINT="https://openrtb.preview.pubstack.io/v1/openrtb2" +export PBS_ANALYTICS_PUBSTACK_ENDPOINT="https://openrtb2.preview.pubstack.io/v1/openrtb2" export PBS_ANALYTICS_PUBSTACK_SCOPEID= # should be an UUIDv4 ``` @@ -17,7 +17,7 @@ analytics: pubstack: # Required properties enabled: true - endpoint: "https://openrtb.preview.pubstack.io/v1/openrtb2" + endpoint: "https://openrtb2.preview.pubstack.io/v1/openrtb2" scopeid: "" # The scopeId provided by the Pubstack Support Team # Optional properties (advanced configuration) configuration_refresh_delay: "2h" # Dynamic configuration delay diff --git a/analytics/pubstack/helpers/json_test.go b/analytics/pubstack/helpers/json_test.go index 4f453ccdf58..addc182204e 100644 --- a/analytics/pubstack/helpers/json_test.go +++ b/analytics/pubstack/helpers/json_test.go @@ -1,9 +1,9 @@ package helpers import ( - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/mxmCherry/openrtb/v15/openrtb2" "net/http" "testing" ) @@ -52,7 +52,7 @@ func TestJsonifyAmpObject(t *testing.T) { ao := &analytics.AmpObject{ Status: http.StatusOK, Errors: make([]error, 0), - AuctionResponse: &openrtb.BidResponse{}, + AuctionResponse: &openrtb2.BidResponse{}, AmpTargetingValues: map[string]string{}, } if _, err := JsonifyAmpObject(ao, "scopeId"); err != nil { diff --git a/analytics/pubstack/pubstack_module_test.go b/analytics/pubstack/pubstack_module_test.go index 143fb217913..ab317fd6202 100644 --- a/analytics/pubstack/pubstack_module_test.go +++ b/analytics/pubstack/pubstack_module_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/analytics" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -21,7 +21,7 @@ func loadJSONFromFile() (*analytics.AuctionObject, error) { } defer req.Close() - reqCtn := openrtb.BidRequest{} + reqCtn := openrtb2.BidRequest{} reqPayload, err := ioutil.ReadAll(req) if err != nil { return nil, err @@ -38,7 +38,7 @@ func loadJSONFromFile() (*analytics.AuctionObject, error) { } defer res.Close() - resCtn := openrtb.BidResponse{} + resCtn := openrtb2.BidResponse{} resPayload, err := ioutil.ReadAll(res) if err != nil { return nil, err diff --git a/endpoints/auction.go b/endpoints/auction.go index 4416b602f1a..737e7b7fae8 100644 --- a/endpoints/auction.go +++ b/endpoints/auction.go @@ -307,8 +307,8 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr hbSize := "" if bid.Width != 0 && bid.Height != 0 { - width := strconv.FormatUint(bid.Width, 10) - height := strconv.FormatUint(bid.Height, 10) + width := strconv.FormatInt(bid.Width, 10) + height := strconv.FormatInt(bid.Height, 10) hbSize = width + "x" + height } diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index 331ddc2500c..83beb2fa40e 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -10,7 +10,6 @@ import ( "net/http/httptest" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/gdpr" @@ -21,6 +20,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" gdprPolicy "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" "github.com/PubMatic-OpenWrap/prebid-server/usersync/usersyncers" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/spf13/viper" "github.com/stretchr/testify/assert" @@ -518,7 +518,7 @@ func TestBidSizeValidate(t *testing.T) { AdUnits: []pbs.PBSAdUnit{ { BidID: "test_bidid1", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 350, H: 250, @@ -535,7 +535,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid2", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 100, H: 100, @@ -548,7 +548,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid3", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 200, H: 200, @@ -561,7 +561,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid_video", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 400, H: 400, @@ -574,7 +574,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid3", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 150, H: 150, @@ -587,7 +587,7 @@ func TestBidSizeValidate(t *testing.T) { }, { BidID: "test_bidid_y", - Sizes: []openrtb.Format{ + Sizes: []openrtb2.Format{ { W: 150, H: 150, diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index f6cef770694..4cd1764ee4b 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/openrtb" accountService "github.com/PubMatic-OpenWrap/prebid-server/account" "github.com/PubMatic-OpenWrap/prebid-server/amp" "github.com/PubMatic-OpenWrap/prebid-server/analytics" @@ -30,6 +29,7 @@ import ( "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const defaultAmpRequestTimeoutMillis = 900 @@ -286,7 +286,7 @@ func (deps *endpointDeps) AmpAuction(w http.ResponseWriter, r *http.Request, _ h // possible, it will return errors with messages that suggest improvements. // // If the errors list has at least one element, then no guarantees are made about the returned request. -func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openrtb.BidRequest, errs []error) { +func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openrtb2.BidRequest, errs []error) { // Load the stored request for the AMP ID. req, e := deps.loadRequestJSONForAmp(httpRequest) if errs = append(errs, e...); errortypes.ContainsFatalError(errs) { @@ -310,8 +310,8 @@ func (deps *endpointDeps) parseAmpRequest(httpRequest *http.Request) (req *openr } // Load the stored OpenRTB request for an incoming AMP request, or return the errors found. -func (deps *endpointDeps) loadRequestJSONForAmp(httpRequest *http.Request) (req *openrtb.BidRequest, errs []error) { - req = &openrtb.BidRequest{} +func (deps *endpointDeps) loadRequestJSONForAmp(httpRequest *http.Request) (req *openrtb2.BidRequest, errs []error) { + req = &openrtb2.BidRequest{} errs = nil ampParams, err := amp.ParseParams(httpRequest) @@ -369,9 +369,9 @@ func (deps *endpointDeps) loadRequestJSONForAmp(httpRequest *http.Request) (req return } -func (deps *endpointDeps) overrideWithParams(ampParams amp.Params, req *openrtb.BidRequest) []error { +func (deps *endpointDeps) overrideWithParams(ampParams amp.Params, req *openrtb2.BidRequest) []error { if req.Site == nil { - req.Site = &openrtb.Site{} + req.Site = &openrtb2.Site{} } // Override the stored request sizes with AMP ones, if they exist. @@ -420,25 +420,25 @@ func (deps *endpointDeps) overrideWithParams(ampParams amp.Params, req *openrtb. return nil } -func makeFormatReplacement(size amp.Size) []openrtb.Format { - var formats []openrtb.Format +func makeFormatReplacement(size amp.Size) []openrtb2.Format { + var formats []openrtb2.Format if size.OverrideWidth != 0 && size.OverrideHeight != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.OverrideWidth, H: size.OverrideHeight, }} } else if size.OverrideWidth != 0 && size.Height != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.OverrideWidth, H: size.Height, }} } else if size.Width != 0 && size.OverrideHeight != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.Width, H: size.OverrideHeight, }} } else if size.Width != 0 && size.Height != 0 { - formats = []openrtb.Format{{ + formats = []openrtb2.Format{{ W: size.Width, H: size.Height, }} @@ -447,13 +447,13 @@ func makeFormatReplacement(size amp.Size) []openrtb.Format { return append(formats, size.Multisize...) } -func setWidths(formats []openrtb.Format, width uint64) { +func setWidths(formats []openrtb2.Format, width int64) { for i := 0; i < len(formats); i++ { formats[i].W = width } } -func setHeights(formats []openrtb.Format, height uint64) { +func setHeights(formats []openrtb2.Format, height int64) { for i := 0; i < len(formats); i++ { formats[i].H = height } @@ -461,7 +461,7 @@ func setHeights(formats []openrtb.Format, height uint64) { // AMP won't function unless ext.prebid.targeting and ext.prebid.cache.bids are defined. // If the user didn't include them, default those here. -func defaultRequestExt(req *openrtb.BidRequest) (errs []error) { +func defaultRequestExt(req *openrtb2.BidRequest) (errs []error) { errs = nil extRequest := &openrtb_ext.ExtRequest{} if req.Ext != nil && len(req.Ext) > 0 { @@ -503,7 +503,7 @@ func defaultRequestExt(req *openrtb.BidRequest) (errs []error) { return } -func setAmpExt(site *openrtb.Site, value string) { +func setAmpExt(site *openrtb2.Site, value string) { if len(site.Ext) > 0 { if _, dataType, _, _ := jsonparser.Get(site.Ext, "amp"); dataType == jsonparser.NotExist { if val, err := jsonparser.Set(site.Ext, []byte(value), "amp"); err == nil { @@ -534,16 +534,16 @@ func readPolicy(consent string) (privacy.PolicyWriter, error) { } // Sets the effective publisher ID for amp request -func setEffectiveAmpPubID(req *openrtb.BidRequest, account string) { - var pub *openrtb.Publisher +func setEffectiveAmpPubID(req *openrtb2.BidRequest, account string) { + var pub *openrtb2.Publisher if req.App != nil { if req.App.Publisher == nil { - req.App.Publisher = new(openrtb.Publisher) + req.App.Publisher = new(openrtb2.Publisher) } pub = req.App.Publisher } else if req.Site != nil { if req.Site.Publisher == nil { - req.Site.Publisher = new(openrtb.Publisher) + req.Site.Publisher = new(openrtb2.Publisher) } pub = req.Site.Publisher } diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index cbff32413ba..6826858f965 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -14,12 +14,12 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/PubMatic-OpenWrap/openrtb" analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/exchange" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" gometrics "github.com/rcrowley/go-metrics" "github.com/stretchr/testify/assert" ) @@ -189,7 +189,7 @@ func TestGDPRConsent(t *testing.T) { // Build Request bid, err := getTestBidRequest(test.nilUser, test.userExt, true, nil) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -341,7 +341,7 @@ func TestCCPAConsent(t *testing.T) { // Build Request bid, err := getTestBidRequest(true, nil, test.nilRegs, test.regsExt) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -399,7 +399,7 @@ func TestNoConsent(t *testing.T) { // Build Request bid, err := getTestBidRequest(true, nil, true, nil) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -444,7 +444,7 @@ func TestInvalidConsent(t *testing.T) { // Build Request bid, err := getTestBidRequest(true, nil, true, nil) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -527,7 +527,7 @@ func TestNewAndLegacyConsentBothProvided(t *testing.T) { // Build Request bid, err := getTestBidRequest(false, nil, true, nil) if err != nil { - t.Fatalf("Failed to marshal the complete openrtb.BidRequest object %v", err) + t.Fatalf("Failed to marshal the complete openrtb2.BidRequest object %v", err) } // Simulated Stored Request Backend @@ -696,7 +696,7 @@ func TestAmpDebug(t *testing.T) { // Prevents #452 func TestAmpTargetingDefaults(t *testing.T) { - req := &openrtb.BidRequest{} + req := &openrtb2.BidRequest{} if errs := defaultRequestExt(req); len(errs) != 0 { t.Fatalf("Unexpected error defaulting request.ext for AMP: %v", errs) } @@ -781,7 +781,7 @@ func TestOverrideDimensions(t *testing.T) { formatOverrideSpec{ overrideWidth: 20, overrideHeight: 40, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }}, @@ -792,7 +792,7 @@ func TestOverrideHeightNormalWidth(t *testing.T) { formatOverrideSpec{ width: 20, overrideHeight: 40, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }}, @@ -803,7 +803,7 @@ func TestOverrideWidthNormalHeight(t *testing.T) { formatOverrideSpec{ overrideWidth: 20, height: 40, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }}, @@ -813,7 +813,7 @@ func TestOverrideWidthNormalHeight(t *testing.T) { func TestMultisize(t *testing.T) { formatOverrideSpec{ multisize: "200x50,100x60", - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 200, H: 50, }, { @@ -828,7 +828,7 @@ func TestSizeWithMultisize(t *testing.T) { width: 20, height: 40, multisize: "200x50,100x60", - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 20, H: 40, }, { @@ -844,7 +844,7 @@ func TestSizeWithMultisize(t *testing.T) { func TestHeightOnly(t *testing.T) { formatOverrideSpec{ height: 200, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 300, H: 200, }}, @@ -854,7 +854,7 @@ func TestHeightOnly(t *testing.T) { func TestWidthOnly(t *testing.T) { formatOverrideSpec{ width: 150, - expect: []openrtb.Format{{ + expect: []openrtb2.Format{{ W: 150, H: 600, }}, @@ -868,7 +868,7 @@ type formatOverrideSpec struct { overrideHeight uint64 multisize string account string - expect []openrtb.Format + expect []openrtb2.Format } func (s formatOverrideSpec) execute(t *testing.T) { @@ -926,7 +926,7 @@ func (cf *mockAmpStoredReqFetcher) FetchRequests(ctx context.Context, requestIDs } type mockAmpExchange struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest } var expectedErrorsFromHoldAuction map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError = map[openrtb_ext.BidderName][]openrtb_ext.ExtBidderError{ @@ -938,12 +938,12 @@ var expectedErrorsFromHoldAuction map[openrtb_ext.BidderName][]openrtb_ext.ExtBi }, } -func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest - response := &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + response := &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", Ext: json.RawMessage(`{ "prebid": {"targeting": { "hb_pb": "1.20", "hb_appnexus_pb": "1.20", "hb_cache_id": "some_id"}}}`), }}, @@ -963,16 +963,16 @@ func (m *mockAmpExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq } func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, regsExt *openrtb_ext.ExtRegs) ([]byte, error) { - var width uint64 = 300 - var height uint64 = 300 - bidRequest := &openrtb.BidRequest{ + var width int64 = 300 + var height int64 = 300 + bidRequest := &openrtb2.BidRequest{ ID: "test-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "/19968336/header-bid-tag-0", Ext: json.RawMessage(`{"appnexus": { "placementId":12883451 }}`), - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: width, H: 250, @@ -987,7 +987,7 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, }, }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "site-id", Page: "some-page", }, @@ -1003,7 +1003,7 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, } if !nilUser { - bidRequest.User = &openrtb.User{ + bidRequest.User = &openrtb2.User{ ID: "aUserId", BuyerUID: "aBuyerID", Ext: userExtData, @@ -1020,7 +1020,7 @@ func getTestBidRequest(nilUser bool, userExt *openrtb_ext.ExtUser, nilRegs bool, } if !nilRegs { - bidRequest.Regs = &openrtb.Regs{ + bidRequest.Regs = &openrtb2.Regs{ COPPA: 1, Ext: regsExtData, } @@ -1034,14 +1034,14 @@ func TestSetEffectiveAmpPubID(t *testing.T) { testCases := []struct { description string - req *openrtb.BidRequest + req *openrtb2.BidRequest account string expectedPubID string }{ { description: "No publisher ID provided", - req: &openrtb.BidRequest{ - App: &openrtb.App{ + req: &openrtb2.BidRequest{ + App: &openrtb2.App{ Publisher: nil, }, }, @@ -1049,9 +1049,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "Publisher ID present in req.App.Publisher.ID", - req: &openrtb.BidRequest{ - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: testPubID, }, }, @@ -1060,9 +1060,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "Publisher ID present in req.Site.Publisher.ID", - req: &openrtb.BidRequest{ - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: testPubID, }, }, @@ -1071,9 +1071,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "Publisher ID present in account parameter", - req: &openrtb.BidRequest{ - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "", }, }, @@ -1083,9 +1083,9 @@ func TestSetEffectiveAmpPubID(t *testing.T) { }, { description: "req.Site.Publisher present but ID set to empty string", - req: &openrtb.BidRequest{ - Site: &openrtb.Site{ - Publisher: &openrtb.Publisher{ + req: &openrtb2.BidRequest{ + Site: &openrtb2.Site{ + Publisher: &openrtb2.Publisher{ ID: "", }, }, @@ -1176,21 +1176,21 @@ func TestBuildAmpObject(t *testing.T) { expectedAmpObject: &analytics.AmpObject{ Status: http.StatusOK, Errors: nil, - Request: &openrtb.BidRequest{ + Request: &openrtb2.BidRequest{ ID: "some-request-id", - Device: &openrtb.Device{ + Device: &openrtb2.Device{ IP: "192.0.2.1", }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Page: "prebid.org", - Publisher: &openrtb.Publisher{}, + Publisher: &openrtb2.Publisher{}, Ext: json.RawMessage(`{"amp":1}`), }, - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "some-impression-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: 300, H: 250, @@ -1205,9 +1205,9 @@ func TestBuildAmpObject(t *testing.T) { TMax: 500, Ext: json.RawMessage(`{"prebid":{"cache":{"bids":{"returnCreative":null},"vastxml":null},"targeting":{"pricegranularity":{"precision":2,"ranges":[{"min":0,"max":20,"increment":0.1}]},"includewinners":true,"includebidderkeys":true,"includebrandcategory":null,"includeformat":false,"durationrangesec":null,"preferdeals":false}}}`), }, - AuctionResponse: &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + AuctionResponse: &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", Ext: json.RawMessage(`{ "prebid": {"targeting": { "hb_pb": "1.20", "hb_appnexus_pb": "1.20", "hb_cache_id": "some_id"}}}`), }}, diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index fa48daf30ad..32a2d934776 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -13,9 +13,6 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/openrtb" - "github.com/PubMatic-OpenWrap/openrtb/native" - nativeRequests "github.com/PubMatic-OpenWrap/openrtb/native/request" accountService "github.com/PubMatic-OpenWrap/prebid-server/account" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/config" @@ -35,6 +32,9 @@ import ( "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/julienschmidt/httprouter" + "github.com/mxmCherry/openrtb/v15/native1" + nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/publicsuffix" ) @@ -220,8 +220,8 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http // possible, it will return errors with messages that suggest improvements. // // If the errors list has at least one element, then no guarantees are made about the returned request. -func (deps *endpointDeps) parseRequest(httpRequest *http.Request) (req *openrtb.BidRequest, errs []error) { - req = &openrtb.BidRequest{} +func (deps *endpointDeps) parseRequest(httpRequest *http.Request) (req *openrtb2.BidRequest, errs []error) { + req = &openrtb2.BidRequest{} errs = nil // Pull the request body into a buffer, so we have it for later usage. @@ -287,7 +287,7 @@ func parseTimeout(requestJson []byte, defaultTimeout time.Duration) time.Duratio return defaultTimeout } -func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error { +func (deps *endpointDeps) validateRequest(req *openrtb2.BidRequest) []error { errL := []error{} if req.ID == "" { return []error{errors.New("request missing required field: \"id\"")} @@ -394,9 +394,9 @@ func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error { return errL } -func validateAndFillSourceTID(req *openrtb.BidRequest) error { +func validateAndFillSourceTID(req *openrtb2.BidRequest) error { if req.Source == nil { - req.Source = &openrtb.Source{} + req.Source = &openrtb2.Source{} } if req.Source.TID == "" { if rawUUID, err := uuid.NewV4(); err == nil { @@ -472,7 +472,7 @@ func validateBidders(bidders []string, knownBidders map[string]openrtb_ext.Bidde return nil } -func (deps *endpointDeps) validateImp(imp *openrtb.Imp, aliases map[string]string, index int) []error { +func (deps *endpointDeps) validateImp(imp *openrtb2.Imp, aliases map[string]string, index int) []error { if imp.ID == "" { return []error{fmt.Errorf("request.imp[%d] missing required field: \"id\"", index)} } @@ -513,7 +513,7 @@ func (deps *endpointDeps) validateImp(imp *openrtb.Imp, aliases map[string]strin return nil } -func validateBanner(banner *openrtb.Banner, impIndex int) error { +func validateBanner(banner *openrtb2.Banner, impIndex int) error { if banner == nil { return nil } @@ -547,7 +547,7 @@ func validateBanner(banner *openrtb.Banner, impIndex int) error { } // fillAndValidateNative validates the request, and assigns the Asset IDs as recommended by the Native v1.2 spec. -func fillAndValidateNative(n *openrtb.Native, impIndex int) error { +func fillAndValidateNative(n *openrtb2.Native, impIndex int) error { if n == nil { return nil } @@ -581,53 +581,53 @@ func fillAndValidateNative(n *openrtb.Native, impIndex int) error { return nil } -func validateNativeContextTypes(cType native.ContextType, cSubtype native.ContextSubType, impIndex int) error { +func validateNativeContextTypes(cType native1.ContextType, cSubtype native1.ContextSubType, impIndex int) error { if cType == 0 { // Context is only recommended, so none is a valid type. return nil } - if cType < native.ContextTypeContent || cType > native.ContextTypeProduct { - return fmt.Errorf("request.imp[%d].native.request.context is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) + if cType < native1.ContextTypeContent || cType > native1.ContextTypeProduct { + return fmt.Errorf("request.imp[%d].native1.request.context is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } if cSubtype < 0 { - return fmt.Errorf("request.imp[%d].native.request.contextsubtype value can't be less than 0. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) + return fmt.Errorf("request.imp[%d].native1.request.contextsubtype value can't be less than 0. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } if cSubtype == 0 { return nil } if cSubtype >= 500 { - return fmt.Errorf("request.imp[%d].native.request.contextsubtype can't be greater than or equal to 500. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) + return fmt.Errorf("request.imp[%d].native1.request.contextsubtype can't be greater than or equal to 500. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } - if cSubtype >= native.ContextSubTypeGeneral && cSubtype <= native.ContextSubTypeUserGenerated { - if cType != native.ContextTypeContent { - return fmt.Errorf("request.imp[%d].native.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) + if cSubtype >= native1.ContextSubTypeGeneral && cSubtype <= native1.ContextSubTypeUserGenerated { + if cType != native1.ContextTypeContent { + return fmt.Errorf("request.imp[%d].native1.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) } return nil } - if cSubtype >= native.ContextSubTypeSocial && cSubtype <= native.ContextSubTypeChat { - if cType != native.ContextTypeSocial { - return fmt.Errorf("request.imp[%d].native.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) + if cSubtype >= native1.ContextSubTypeSocial && cSubtype <= native1.ContextSubTypeChat { + if cType != native1.ContextTypeSocial { + return fmt.Errorf("request.imp[%d].native1.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) } return nil } - if cSubtype >= native.ContextSubTypeSelling && cSubtype <= native.ContextSubTypeProductReview { - if cType != native.ContextTypeProduct { - return fmt.Errorf("request.imp[%d].native.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) + if cSubtype >= native1.ContextSubTypeSelling && cSubtype <= native1.ContextSubTypeProductReview { + if cType != native1.ContextTypeProduct { + return fmt.Errorf("request.imp[%d].native1.request.context is %d, but contextsubtype is %d. This is an invalid combination. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex, cType, cSubtype) } return nil } - return fmt.Errorf("request.imp[%d].native.request.contextsubtype is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) + return fmt.Errorf("request.imp[%d].native1.request.contextsubtype is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=39", impIndex) } -func validateNativePlacementType(pt native.PlacementType, impIndex int) error { +func validateNativePlacementType(pt native1.PlacementType, impIndex int) error { if pt == 0 { // Placement Type is only reccomended, not required. return nil } - if pt < native.PlacementTypeFeed || pt > native.PlacementTypeRecommendationWidget { - return fmt.Errorf("request.imp[%d].native.request.plcmttype is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=40", impIndex) + if pt < native1.PlacementTypeFeed || pt > native1.PlacementTypeRecommendationWidget { + return fmt.Errorf("request.imp[%d].native1.request.plcmttype is invalid. See https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=40", impIndex) } return nil } @@ -658,7 +658,7 @@ func fillAndValidateNativeAssets(assets []nativeRequests.Asset, impIndex int) er // Each asset should have a unique ID thats assigned by the caller if _, ok := assetIDs[assets[i].ID]; ok { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].id is already being used by another asset. Each asset ID must be unique.", impIndex, i) + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].id is already being used by another asset. Each asset ID must be unique.", impIndex, i) } assetIDs[assets[i].ID] = struct{}{} @@ -668,7 +668,7 @@ func fillAndValidateNativeAssets(assets []nativeRequests.Asset, impIndex int) er } func validateNativeAsset(asset nativeRequests.Asset, impIndex int, assetIndex int) error { - assetErr := "request.imp[%d].native.request.assets[%d] must define exactly one of {title, img, video, data}" + assetErr := "request.imp[%d].native1.request.assets[%d] must define exactly one of {title, img, video, data}" foundType := false if asset.Title != nil { @@ -683,7 +683,9 @@ func validateNativeAsset(asset nativeRequests.Asset, impIndex int, assetIndex in return fmt.Errorf(assetErr, impIndex, assetIndex) } foundType = true - // It is technically valid to have neither w/h nor wmin/hmin, so no check + if err := validateNativeAssetImage(asset.Img, impIndex, assetIndex); err != nil { + return err + } } if asset.Video != nil { @@ -713,6 +715,22 @@ func validateNativeAsset(asset nativeRequests.Asset, impIndex int, assetIndex in return nil } +func validateNativeAssetImage(img *nativeRequests.Image, impIndex int, assetIndex int) error { + if img.W < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.w must be a positive integer", impIndex, assetIndex) + } + if img.H < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.h must be a positive integer", impIndex, assetIndex) + } + if img.WMin < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.wmin must be a positive integer", impIndex, assetIndex) + } + if img.HMin < 0 { + return fmt.Errorf("request.imp[%d].native.request.assets[%d].img.hmin must be a positive integer", impIndex, assetIndex) + } + return nil +} + func validateNativeEventTrackers(trackers []nativeRequests.EventTracker, impIndex int) error { for i := 0; i < len(trackers); i++ { if err := validateNativeEventTracker(trackers[i], impIndex, i); err != nil { @@ -724,21 +742,21 @@ func validateNativeEventTrackers(trackers []nativeRequests.EventTracker, impInde func validateNativeAssetTitle(title *nativeRequests.Title, impIndex int, assetIndex int) error { if title.Len < 1 { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].title.len must be a positive integer", impIndex, assetIndex) + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].title.len must be a positive integer", impIndex, assetIndex) } return nil } func validateNativeEventTracker(tracker nativeRequests.EventTracker, impIndex int, eventIndex int) error { - if tracker.Event < native.EventTypeImpression || tracker.Event > native.EventTypeViewableVideo50 { - return fmt.Errorf("request.imp[%d].native.request.eventtrackers[%d].event is invalid. See section 7.6: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex) + if tracker.Event < native1.EventTypeImpression || tracker.Event > native1.EventTypeViewableVideo50 { + return fmt.Errorf("request.imp[%d].native1.request.eventtrackers[%d].event is invalid. See section 7.6: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex) } if len(tracker.Methods) < 1 { - return fmt.Errorf("request.imp[%d].native.request.eventtrackers[%d].method is required. See section 7.7: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex) + return fmt.Errorf("request.imp[%d].native1.request.eventtrackers[%d].method is required. See section 7.7: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex) } for methodIndex, method := range tracker.Methods { - if method < native.EventTrackingMethodImage || method > native.EventTrackingMethodJS { - return fmt.Errorf("request.imp[%d].native.request.eventtrackers[%d].methods[%d] is invalid. See section 7.7: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex, methodIndex) + if method < native1.EventTrackingMethodImage || method > native1.EventTrackingMethodJS { + return fmt.Errorf("request.imp[%d].native1.request.eventtrackers[%d].methods[%d] is invalid. See section 7.7: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=43", impIndex, eventIndex, methodIndex) } } @@ -747,13 +765,13 @@ func validateNativeEventTracker(tracker nativeRequests.EventTracker, impIndex in func validateNativeAssetVideo(video *nativeRequests.Video, impIndex int, assetIndex int) error { if len(video.MIMEs) < 1 { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.mimes must be an array with at least one MIME type", impIndex, assetIndex) + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].video.mimes must be an array with at least one MIME type", impIndex, assetIndex) } if video.MinDuration < 1 { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.minduration must be a positive integer", impIndex, assetIndex) + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].video.minduration must be a positive integer", impIndex, assetIndex) } if video.MaxDuration < 1 { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.maxduration must be a positive integer", impIndex, assetIndex) + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].video.maxduration must be a positive integer", impIndex, assetIndex) } if err := validateNativeVideoProtocols(video.Protocols, impIndex, assetIndex); err != nil { return err @@ -763,16 +781,16 @@ func validateNativeAssetVideo(video *nativeRequests.Video, impIndex int, assetIn } func validateNativeAssetData(data *nativeRequests.Data, impIndex int, assetIndex int) error { - if data.Type < native.DataAssetTypeSponsored || data.Type > native.DataAssetTypeCTAText { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].data.type is invalid. See section 7.4: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=40", impIndex, assetIndex) + if data.Type < native1.DataAssetTypeSponsored || data.Type > native1.DataAssetTypeCTAText { + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].data.type is invalid. See section 7.4: https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf#page=40", impIndex, assetIndex) } return nil } -func validateNativeVideoProtocols(protocols []native.Protocol, impIndex int, assetIndex int) error { +func validateNativeVideoProtocols(protocols []native1.Protocol, impIndex int, assetIndex int) error { if len(protocols) < 1 { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.protocols must be an array with at least one element", impIndex, assetIndex) + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].video.protocols must be an array with at least one element", impIndex, assetIndex) } for i := 0; i < len(protocols); i++ { if err := validateNativeVideoProtocol(protocols[i], impIndex, assetIndex, i); err != nil { @@ -782,14 +800,14 @@ func validateNativeVideoProtocols(protocols []native.Protocol, impIndex int, ass return nil } -func validateNativeVideoProtocol(protocol native.Protocol, impIndex int, assetIndex int, protocolIndex int) error { - if protocol < native.ProtocolVAST10 || protocol > native.ProtocolDAAST10Wrapper { - return fmt.Errorf("request.imp[%d].native.request.assets[%d].video.protocols[%d] is invalid. See Section 5.8: https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf#page=52", impIndex, assetIndex, protocolIndex) +func validateNativeVideoProtocol(protocol native1.Protocol, impIndex int, assetIndex int, protocolIndex int) error { + if protocol < native1.ProtocolVAST10 || protocol > native1.ProtocolDAAST10Wrapper { + return fmt.Errorf("request.imp[%d].native1.request.assets[%d].video.protocols[%d] is invalid. See Section 5.8: https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf#page=52", impIndex, assetIndex, protocolIndex) } return nil } -func validateFormat(format *openrtb.Format, impIndex int, formatIndex int) error { +func validateFormat(format *openrtb2.Format, impIndex int, formatIndex int) error { usesHW := format.W != 0 || format.H != 0 usesRatios := format.WMin != 0 || format.WRatio != 0 || format.HRatio != 0 if usesHW && usesRatios { @@ -807,7 +825,7 @@ func validateFormat(format *openrtb.Format, impIndex int, formatIndex int) error return nil } -func validatePmp(pmp *openrtb.PMP, impIndex int) error { +func validatePmp(pmp *openrtb2.PMP, impIndex int) error { if pmp == nil { return nil } @@ -820,7 +838,7 @@ func validatePmp(pmp *openrtb.PMP, impIndex int) error { return nil } -func (deps *endpointDeps) validateImpExt(imp *openrtb.Imp, aliases map[string]string, impIndex int) []error { +func (deps *endpointDeps) validateImpExt(imp *openrtb2.Imp, aliases map[string]string, impIndex int) []error { errL := []error{} if len(imp.Ext) == 0 { return []error{fmt.Errorf("request.imp[%d].ext is required", impIndex)} @@ -939,7 +957,7 @@ func (deps *endpointDeps) validateAliases(aliases map[string]string) error { return nil } -func (deps *endpointDeps) validateSite(site *openrtb.Site) error { +func (deps *endpointDeps) validateSite(site *openrtb2.Site) error { if site == nil { return nil } @@ -957,7 +975,7 @@ func (deps *endpointDeps) validateSite(site *openrtb.Site) error { return nil } -func (deps *endpointDeps) validateApp(app *openrtb.App) error { +func (deps *endpointDeps) validateApp(app *openrtb2.App) error { if app == nil { return nil } @@ -978,7 +996,7 @@ func (deps *endpointDeps) validateApp(app *openrtb.App) error { return nil } -func (deps *endpointDeps) validateUser(user *openrtb.User, aliases map[string]string) error { +func (deps *endpointDeps) validateUser(user *openrtb2.User, aliases map[string]string) error { // DigiTrust support if user != nil && user.Ext != nil { // Creating ExtUser object to check if DigiTrust is valid @@ -1040,7 +1058,7 @@ func (deps *endpointDeps) validateUser(user *openrtb.User, aliases map[string]st return nil } -func validateRegs(regs *openrtb.Regs) error { +func validateRegs(regs *openrtb2.Regs) error { if regs != nil && len(regs.Ext) > 0 { var regsExt openrtb_ext.ExtRegs if err := json.Unmarshal(regs.Ext, ®sExt); err != nil { @@ -1053,7 +1071,7 @@ func validateRegs(regs *openrtb.Regs) error { return nil } -func sanitizeRequest(r *openrtb.BidRequest, ipValidator iputil.IPValidator) { +func sanitizeRequest(r *openrtb2.BidRequest, ipValidator iputil.IPValidator) { if r.Device != nil { if ip, ver := iputil.ParseIP(r.Device.IP); ip == nil || ver != iputil.IPv4 || !ipValidator.IsValid(ip, ver) { r.Device.IP = "" @@ -1070,7 +1088,7 @@ func sanitizeRequest(r *openrtb.BidRequest, ipValidator iputil.IPValidator) { // OpenRTB properties from the headers and other implicit info. // // This function _should not_ override any fields which were defined explicitly by the caller in the request. -func (deps *endpointDeps) setFieldsImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func (deps *endpointDeps) setFieldsImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { sanitizeRequest(bidReq, deps.privateNetworkIPValidator) setDeviceImplicitly(httpReq, bidReq, deps.privateNetworkIPValidator) @@ -1085,7 +1103,7 @@ func (deps *endpointDeps) setFieldsImplicitly(httpReq *http.Request, bidReq *ope } // setDeviceImplicitly uses implicit info from httpReq to populate bidReq.Device -func setDeviceImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipValidtor iputil.IPValidator) { +func setDeviceImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest, ipValidtor iputil.IPValidator) { setIPImplicitly(httpReq, bidReq, ipValidtor) setUAImplicitly(httpReq, bidReq) setDoNotTrackImplicitly(httpReq, bidReq) @@ -1094,7 +1112,7 @@ func setDeviceImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipVa // setAuctionTypeImplicitly sets the auction type to 1 if it wasn't on the request, // since header bidding is generally a first-price auction. -func setAuctionTypeImplicitly(bidReq *openrtb.BidRequest) { +func setAuctionTypeImplicitly(bidReq *openrtb2.BidRequest) { if bidReq.AT == 0 { bidReq.AT = 1 } @@ -1102,13 +1120,13 @@ func setAuctionTypeImplicitly(bidReq *openrtb.BidRequest) { } // setSiteImplicitly uses implicit info from httpReq to populate bidReq.Site -func setSiteImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func setSiteImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { if bidReq.Site == nil || bidReq.Site.Page == "" || bidReq.Site.Domain == "" { referrerCandidate := httpReq.Referer() if parsedUrl, err := url.Parse(referrerCandidate); err == nil { if domain, err := publicsuffix.EffectiveTLDPlusOne(parsedUrl.Host); err == nil { if bidReq.Site == nil { - bidReq.Site = &openrtb.Site{} + bidReq.Site = &openrtb2.Site{} } if bidReq.Site.Domain == "" { bidReq.Site.Domain = domain @@ -1127,7 +1145,7 @@ func setSiteImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { } } -func setImpsImplicitly(httpReq *http.Request, imps []openrtb.Imp) { +func setImpsImplicitly(httpReq *http.Request, imps []openrtb2.Imp) { secure := int8(1) for i := 0; i < len(imps); i++ { if imps[i].Secure == nil && httputil.IsSecure(httpReq) { @@ -1287,18 +1305,18 @@ func getStoredRequestId(data []byte) (string, bool, error) { } // setIPImplicitly sets the IP address on bidReq, if it's not explicitly defined and we can figure it out. -func setIPImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipValidator iputil.IPValidator) { +func setIPImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest, ipValidator iputil.IPValidator) { if bidReq.Device == nil || (bidReq.Device.IP == "" && bidReq.Device.IPv6 == "") { if ip, ver := httputil.FindIP(httpReq, ipValidator); ip != nil { switch ver { case iputil.IPv4: if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } bidReq.Device.IP = ip.String() case iputil.IPv6: if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } bidReq.Device.IPv6 = ip.String() } @@ -1307,23 +1325,23 @@ func setIPImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest, ipValida } // setUAImplicitly sets the User Agent on bidReq, if it's not explicitly defined and it's defined on the request. -func setUAImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func setUAImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { if bidReq.Device == nil || bidReq.Device.UA == "" { if ua := httpReq.UserAgent(); ua != "" { if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } bidReq.Device.UA = ua } } } -func setDoNotTrackImplicitly(httpReq *http.Request, bidReq *openrtb.BidRequest) { +func setDoNotTrackImplicitly(httpReq *http.Request, bidReq *openrtb2.BidRequest) { if bidReq.Device == nil || bidReq.Device.DNT == nil { dnt := httpReq.Header.Get(dntKey) if dnt == "0" || dnt == "1" { if bidReq.Device == nil { - bidReq.Device = &openrtb.Device{} + bidReq.Device = &openrtb2.Device{} } switch dnt { @@ -1370,7 +1388,7 @@ func writeError(errs []error, w http.ResponseWriter, labels *metrics.Labels) boo } // Returns the account ID for the request -func getAccountID(pub *openrtb.Publisher) string { +func getAccountID(pub *openrtb2.Publisher) string { if pub != nil { if pub.Ext != nil { var pubExt openrtb_ext.ExtPublisher diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index 7e67770173c..1112e33241c 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -20,7 +20,6 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/openrtb" analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" @@ -31,6 +30,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -153,8 +153,8 @@ func runTestCase(t *testing.T, fileData []byte, testFile string) { } if len(test.ExpectedBidResponse) > 0 { - var expectedBidResponse openrtb.BidResponse - var actualBidResponse openrtb.BidResponse + var expectedBidResponse openrtb2.BidResponse + var actualBidResponse openrtb2.BidResponse var err error err = json.Unmarshal(test.ExpectedBidResponse, &expectedBidResponse) @@ -242,7 +242,7 @@ func (tc *testConfigValues) getAdaptersConfigMap() map[string]config.Adapter { // Once unmarshalled, bidResponse objects can't simply be compared with an `assert.Equalf()` call // because tests fail if the elements inside the `bidResponse.SeatBid` and `bidResponse.SeatBid.Bid` // arrays, if any, are not listed in the exact same order in the actual version and in the expected version. -func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse openrtb.BidResponse, actualBidResponse openrtb.BidResponse) { +func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse openrtb2.BidResponse, actualBidResponse openrtb2.BidResponse) { //Assert non-array BidResponse fields assert.Equalf(t, expectedBidResponse.ID, actualBidResponse.ID, "BidResponse.ID doesn't match expected. Test: %s\n", testFile) @@ -253,12 +253,12 @@ func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse o assert.Len(t, actualBidResponse.SeatBid, len(expectedBidResponse.SeatBid), "BidResponse.SeatBid array doesn't match expected. Test: %s\n", testFile) //Given that bidResponses have the same length, compare them in an order-independent way using maps - var actualSeatBidsMap map[string]openrtb.SeatBid = make(map[string]openrtb.SeatBid, 0) + var actualSeatBidsMap map[string]openrtb2.SeatBid = make(map[string]openrtb2.SeatBid, 0) for _, seatBid := range actualBidResponse.SeatBid { actualSeatBidsMap[seatBid.Seat] = seatBid } - var expectedSeatBidsMap map[string]openrtb.SeatBid = make(map[string]openrtb.SeatBid, 0) + var expectedSeatBidsMap map[string]openrtb2.SeatBid = make(map[string]openrtb2.SeatBid, 0) for _, seatBid := range expectedBidResponse.SeatBid { expectedSeatBidsMap[seatBid.Seat] = seatBid } @@ -276,76 +276,76 @@ func assertBidResponseEqual(t *testing.T, testFile string, expectedBidResponse o } func TestBidRequestAssert(t *testing.T) { - appnexusB1 := openrtb.Bid{ID: "appnexus-bid-1", Price: 5.00} - appnexusB2 := openrtb.Bid{ID: "appnexus-bid-2", Price: 7.00} - rubiconB1 := openrtb.Bid{ID: "rubicon-bid-1", Price: 1.50} - rubiconB2 := openrtb.Bid{ID: "rubicon-bid-2", Price: 4.00} + appnexusB1 := openrtb2.Bid{ID: "appnexus-bid-1", Price: 5.00} + appnexusB2 := openrtb2.Bid{ID: "appnexus-bid-2", Price: 7.00} + rubiconB1 := openrtb2.Bid{ID: "rubicon-bid-1", Price: 1.50} + rubiconB2 := openrtb2.Bid{ID: "rubicon-bid-2", Price: 4.00} - sampleSeatBids := []openrtb.SeatBid{ + sampleSeatBids := []openrtb2.SeatBid{ { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB1, appnexusB2}, + Bid: []openrtb2.Bid{appnexusB1, appnexusB2}, }, { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB1, rubiconB2}, + Bid: []openrtb2.Bid{rubiconB1, rubiconB2}, }, } testSuites := []struct { description string - expectedBidResponse openrtb.BidResponse - actualBidResponse openrtb.BidResponse + expectedBidResponse openrtb2.BidResponse + actualBidResponse openrtb2.BidResponse }{ { "identical SeatBids, exact same SeatBid and Bid arrays order", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, }, { "identical SeatBids but Seatbid array elements come in different order", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", - SeatBid: []openrtb.SeatBid{ + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", + SeatBid: []openrtb2.SeatBid{ { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB1, rubiconB2}, + Bid: []openrtb2.Bid{rubiconB1, rubiconB2}, }, { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB1, appnexusB2}, + Bid: []openrtb2.Bid{appnexusB1, appnexusB2}, }, }, }, }, { "SeatBids seem to be identical except for the different order of Bid array elements in one of them", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", - SeatBid: []openrtb.SeatBid{ + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", + SeatBid: []openrtb2.SeatBid{ { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB2, appnexusB1}, + Bid: []openrtb2.Bid{appnexusB2, appnexusB1}, }, { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB1, rubiconB2}, + Bid: []openrtb2.Bid{rubiconB1, rubiconB2}, }, }, }, }, { "Both SeatBid elements and bid elements come in different order", - openrtb.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, - openrtb.BidResponse{ID: "anId", BidID: "bidId", - SeatBid: []openrtb.SeatBid{ + openrtb2.BidResponse{ID: "anId", BidID: "bidId", SeatBid: sampleSeatBids}, + openrtb2.BidResponse{ID: "anId", BidID: "bidId", + SeatBid: []openrtb2.SeatBid{ { Seat: "rubicon-bids", - Bid: []openrtb.Bid{rubiconB2, rubiconB1}, + Bid: []openrtb2.Bid{rubiconB2, rubiconB1}, }, { Seat: "appnexus-bids", - Bid: []openrtb.Bid{appnexusB2, appnexusB1}, + Bid: []openrtb2.Bid{appnexusB2, appnexusB1}, }, }, }, @@ -627,7 +627,7 @@ func TestExchangeError(t *testing.T) { func TestUserAgentSetting(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set("User-Agent", "foo") - bidReq := &openrtb.BidRequest{} + bidReq := &openrtb2.BidRequest{} setUAImplicitly(httpReq, bidReq) @@ -643,8 +643,8 @@ func TestUserAgentSetting(t *testing.T) { func TestUserAgentOverride(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set("User-Agent", "foo") - bidReq := &openrtb.BidRequest{ - Device: &openrtb.Device{ + bidReq := &openrtb2.BidRequest{ + Device: &openrtb2.Device{ UA: "bar", }, } @@ -657,7 +657,7 @@ func TestUserAgentOverride(t *testing.T) { } func TestAuctionTypeDefault(t *testing.T) { - bidReq := &openrtb.BidRequest{} + bidReq := &openrtb2.BidRequest{} setAuctionTypeImplicitly(bidReq) if bidReq.AT != 1 { @@ -758,21 +758,21 @@ func TestImplicitDNT(t *testing.T) { testCases := []struct { description string dntHeader string - request openrtb.BidRequest - expectedRequest openrtb.BidRequest + request openrtb2.BidRequest + expectedRequest openrtb2.BidRequest }{ { description: "Device Missing - Not Set In Header", dntHeader: "", - request: openrtb.BidRequest{}, - expectedRequest: openrtb.BidRequest{}, + request: openrtb2.BidRequest{}, + expectedRequest: openrtb2.BidRequest{}, }, { description: "Device Missing - Set To 0 In Header", dntHeader: "0", - request: openrtb.BidRequest{}, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{}, + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &disabled, }, }, @@ -780,9 +780,9 @@ func TestImplicitDNT(t *testing.T) { { description: "Device Missing - Set To 1 In Header", dntHeader: "1", - request: openrtb.BidRequest{}, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{}, + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -790,21 +790,21 @@ func TestImplicitDNT(t *testing.T) { { description: "Not Set In Request - Not Set In Header", dntHeader: "", - request: openrtb.BidRequest{ - Device: &openrtb.Device{}, + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{}, + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, }, { description: "Not Set In Request - Set To 0 In Header", dntHeader: "0", - request: openrtb.BidRequest{ - Device: &openrtb.Device{}, + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &disabled, }, }, @@ -812,11 +812,11 @@ func TestImplicitDNT(t *testing.T) { { description: "Not Set In Request - Set To 1 In Header", dntHeader: "1", - request: openrtb.BidRequest{ - Device: &openrtb.Device{}, + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{}, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -824,13 +824,13 @@ func TestImplicitDNT(t *testing.T) { { description: "Set In Request - Not Set In Header", dntHeader: "", - request: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -838,13 +838,13 @@ func TestImplicitDNT(t *testing.T) { { description: "Set In Request - Set To 0 In Header", dntHeader: "0", - request: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -852,13 +852,13 @@ func TestImplicitDNT(t *testing.T) { { description: "Set In Request - Set To 1 In Header", dntHeader: "1", - request: openrtb.BidRequest{ - Device: &openrtb.Device{ + request: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, - expectedRequest: openrtb.BidRequest{ - Device: &openrtb.Device{ + expectedRequest: openrtb2.BidRequest{ + Device: &openrtb2.Device{ DNT: &enabled, }, }, @@ -946,7 +946,7 @@ func TestImplicitSecure(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set(http.CanonicalHeaderKey("X-Forwarded-Proto"), "https") - imps := []openrtb.Imp{ + imps := []openrtb2.Imp{ {}, {}, } @@ -961,7 +961,7 @@ func TestImplicitSecure(t *testing.T) { func TestRefererParsing(t *testing.T) { httpReq := httptest.NewRequest("POST", "/openrtb2/auction", strings.NewReader(validRequest(t, "site.json"))) httpReq.Header.Set("Referer", "http://test.mysite.com") - bidReq := &openrtb.BidRequest{} + bidReq := &openrtb2.BidRequest{} setSiteImplicitly(httpReq, bidReq) @@ -1123,8 +1123,8 @@ func TestImplicitAMPNoExt(t *testing.T) { return } - bidReq := openrtb.BidRequest{ - Site: &openrtb.Site{}, + bidReq := openrtb2.BidRequest{ + Site: &openrtb2.Site{}, } setSiteImplicitly(httpReq, &bidReq) assert.JSONEq(t, `{"amp":0}`, string(bidReq.Site.Ext)) @@ -1136,8 +1136,8 @@ func TestImplicitAMPOtherExt(t *testing.T) { return } - bidReq := openrtb.BidRequest{ - Site: &openrtb.Site{ + bidReq := openrtb2.BidRequest{ + Site: &openrtb2.Site{ Ext: json.RawMessage(`{"other":true}`), }, } @@ -1151,8 +1151,8 @@ func TestExplicitAMP(t *testing.T) { return } - bidReq := openrtb.BidRequest{ - Site: &openrtb.Site{ + bidReq := openrtb2.BidRequest{ + Site: &openrtb2.Site{ Ext: json.RawMessage(`{"amp":1}`), }, } @@ -1394,7 +1394,7 @@ func TestValidateImpExt(t *testing.T) { for _, group := range testGroups { for _, test := range group.testCases { - imp := &openrtb.Imp{Ext: test.impExt} + imp := &openrtb2.Imp{Ext: test.impExt} errs := deps.validateImpExt(imp, nil, 0) @@ -1438,20 +1438,20 @@ func TestCurrencyTrunc(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, Cur: []string{"USD", "EUR"}, @@ -1482,23 +1482,23 @@ func TestCCPAInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy": "invalid by length"}`), }, } @@ -1530,23 +1530,23 @@ func TestNoSaleInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy": "1NYN"}`), }, Ext: json.RawMessage(`{"prebid": {"nosale": ["*", "appnexus"]} }`), @@ -1581,20 +1581,20 @@ func TestValidateSourceTID(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, } @@ -1622,20 +1622,20 @@ func TestSChainInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, Ext: json.RawMessage(`{"prebid":{"schains":[{"bidders":["appnexus"],"schain":{"complete":1,"nodes":[{"asi":"directseller1.com","sid":"00001","rid":"BidRequest1","hp":1}],"ver":"1.0"}}, {"bidders":["appnexus"],"schain":{"complete":1,"nodes":[{"asi":"directseller2.com","sid":"00002","rid":"BidRequest2","hp":1}],"ver":"1.0"}}]}}`), @@ -1660,12 +1660,12 @@ func TestGetAccountID(t *testing.T) { testCases := []struct { description string - pub *openrtb.Publisher + pub *openrtb2.Publisher expectedAccID string }{ { description: "Publisher.ID and Publisher.Ext.Prebid.ParentAccount both present", - pub: &openrtb.Publisher{ + pub: &openrtb2.Publisher{ ID: testPubID, Ext: testPubExtJSON, }, @@ -1673,7 +1673,7 @@ func TestGetAccountID(t *testing.T) { }, { description: "Only Publisher.Ext.Prebid.ParentAccount present", - pub: &openrtb.Publisher{ + pub: &openrtb2.Publisher{ ID: "", Ext: testPubExtJSON, }, @@ -1681,14 +1681,14 @@ func TestGetAccountID(t *testing.T) { }, { description: "Only Publisher.ID present", - pub: &openrtb.Publisher{ + pub: &openrtb2.Publisher{ ID: testPubID, }, expectedAccID: testPubID, }, { description: "Neither Publisher.ID or Publisher.Ext.Prebid.ParentAccount present", - pub: &openrtb.Publisher{}, + pub: &openrtb2.Publisher{}, expectedAccID: metrics.PublisherUnknown, }, { @@ -1707,15 +1707,15 @@ func TestGetAccountID(t *testing.T) { func TestSanitizeRequest(t *testing.T) { testCases := []struct { description string - req *openrtb.BidRequest + req *openrtb2.BidRequest ipValidator iputil.IPValidator expectedIPv4 string expectedIPv6 string }{ { description: "Empty", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "", IPv6: "", }, @@ -1725,8 +1725,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Valid", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "1.1.1.1", IPv6: "1111::", }, @@ -1737,8 +1737,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Invalid", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "1.1.1.1", IPv6: "1111::", }, @@ -1749,8 +1749,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Invalid - Wrong IP Types", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "1111::", IPv6: "1.1.1.1", }, @@ -1761,8 +1761,8 @@ func TestSanitizeRequest(t *testing.T) { }, { description: "Malformed", - req: &openrtb.BidRequest{ - Device: &openrtb.Device{ + req: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ IP: "malformed", IPv6: "malformed", }, @@ -1783,26 +1783,26 @@ func TestValidateAndFillSourceTID(t *testing.T) { testTID := "some-tid" testCases := []struct { description string - req *openrtb.BidRequest + req *openrtb2.BidRequest expectRandTID bool expectedTID string }{ { description: "req.Source not present. Expecting a randomly generated TID value", - req: &openrtb.BidRequest{}, + req: &openrtb2.BidRequest{}, expectRandTID: true, }, { description: "req.Source.TID not present. Expecting a randomly generated TID value", - req: &openrtb.BidRequest{ - Source: &openrtb.Source{}, + req: &openrtb2.BidRequest{ + Source: &openrtb2.Source{}, }, expectRandTID: true, }, { description: "req.Source.TID present. Expecting no change", - req: &openrtb.BidRequest{ - Source: &openrtb.Source{ + req: &openrtb2.BidRequest{ + Source: &openrtb2.Source{ TID: testTID, }, }, @@ -1841,20 +1841,20 @@ func TestEidPermissionsInvalid(t *testing.T) { hardcodedResponseIPValidator{response: true}, } - ui := uint64(1) - req := openrtb.BidRequest{ + ui := int64(1) + req := openrtb2.BidRequest{ ID: "anyRequestID", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "anyImpID", - Banner: &openrtb.Banner{ + Banner: &openrtb2.Banner{ W: &ui, H: &ui, }, Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "anySiteID", }, Ext: json.RawMessage(`{"prebid": {"data": {"eidpermissions": [{"source":"a", "bidders":[]}]} } }`), @@ -2078,32 +2078,32 @@ func TestValidateBidders(t *testing.T) { // nobidExchange is a well-behaved exchange which always bids "no bid". type nobidExchange struct { - gotRequest *openrtb.BidRequest + gotRequest *openrtb2.BidRequest } -func (e *nobidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (e *nobidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { e.gotRequest = r.BidRequest - return &openrtb.BidResponse{ + return &openrtb2.BidResponse{ ID: r.BidRequest.ID, BidID: "test bid id", - NBR: openrtb.NoBidReasonCodeUnknownError.Ptr(), + NBR: openrtb2.NoBidReasonCodeUnknownError.Ptr(), }, nil } type mockBidExchange struct { - gotRequest *openrtb.BidRequest + gotRequest *openrtb2.BidRequest } // mockBidExchange is a well-behaved exchange that lists the bidders found in every bidRequest.Imp[i].Ext // into the bidResponse.Ext to assert the bidder adapters that were not filtered out in the validation process -func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { - bidResponse := &openrtb.BidResponse{ +func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { + bidResponse := &openrtb2.BidResponse{ ID: r.BidRequest.ID, BidID: "test bid id", - NBR: openrtb.NoBidReasonCodeUnknownError.Ptr(), + NBR: openrtb2.NoBidReasonCodeUnknownError.Ptr(), } if len(r.BidRequest.Imp) > 0 { - var SeatBidMap = make(map[string]openrtb.SeatBid, 0) + var SeatBidMap = make(map[string]openrtb2.SeatBid, 0) for _, imp := range r.BidRequest.Imp { var bidderExts map[string]json.RawMessage if err := json.Unmarshal(imp.Ext, &bidderExts); err != nil { @@ -2126,9 +2126,9 @@ func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq for bidderNameOrAlias := range bidderExts { if isBidderToValidate(bidderNameOrAlias) { if val, ok := SeatBidMap[bidderNameOrAlias]; ok { - val.Bid = append(val.Bid, openrtb.Bid{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}) + val.Bid = append(val.Bid, openrtb2.Bid{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}) } else { - SeatBidMap[bidderNameOrAlias] = openrtb.SeatBid{Seat: fmt.Sprintf("%s-bids", bidderNameOrAlias), Bid: []openrtb.Bid{{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}}} + SeatBidMap[bidderNameOrAlias] = openrtb2.SeatBid{Seat: fmt.Sprintf("%s-bids", bidderNameOrAlias), Bid: []openrtb2.Bid{{ID: fmt.Sprintf("%s-bid", bidderNameOrAlias)}}} } } } @@ -2143,7 +2143,7 @@ func (e *mockBidExchange) HoldAuction(ctx context.Context, r exchange.AuctionReq type brokenExchange struct{} -func (e *brokenExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (e *brokenExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { return nil, errors.New("Critical, unrecoverable error.") } @@ -2506,14 +2506,14 @@ func (af mockAccountFetcher) FetchAccount(ctx context.Context, accountID string) } type mockExchange struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest } -func (m *mockExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchange) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ - Bid: []openrtb.Bid{{ + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ + Bid: []openrtb2.Bid{{ AdM: "", }}, }}, diff --git a/endpoints/openrtb2/ctv/response/adpod_generator.go b/endpoints/openrtb2/ctv/response/adpod_generator.go index 1f5eb3d3d2b..760bd3943c3 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator.go +++ b/endpoints/openrtb2/ctv/response/adpod_generator.go @@ -5,13 +5,13 @@ import ( "sync" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/combination" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) /********************* AdPodGenerator Functions *********************/ @@ -40,7 +40,7 @@ type highestCombination struct { //AdPodGenerator AdPodGenerator type AdPodGenerator struct { IAdPodGenerator - request *openrtb.BidRequest + request *openrtb2.BidRequest impIndex int buckets types.BidsBuckets comb combination.ICombination @@ -49,7 +49,7 @@ type AdPodGenerator struct { } //NewAdPodGenerator will generate adpod based on configuration -func NewAdPodGenerator(request *openrtb.BidRequest, impIndex int, buckets types.BidsBuckets, comb combination.ICombination, adpod *openrtb_ext.VideoAdPod, met metrics.MetricsEngine) *AdPodGenerator { +func NewAdPodGenerator(request *openrtb2.BidRequest, impIndex int, buckets types.BidsBuckets, comb combination.ICombination, adpod *openrtb_ext.VideoAdPod, met metrics.MetricsEngine) *AdPodGenerator { return &AdPodGenerator{ request: request, impIndex: impIndex, diff --git a/endpoints/openrtb2/ctv/response/adpod_generator_test.go b/endpoints/openrtb2/ctv/response/adpod_generator_test.go index ac18b316c85..d5f31237cb4 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator_test.go +++ b/endpoints/openrtb2/ctv/response/adpod_generator_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func Test_findUniqueCombinations(t *testing.T) { @@ -27,38 +27,38 @@ func Test_findUniqueCombinations(t *testing.T) { data: [][]*types.Bid{ { { - Bid: &openrtb.Bid{ID: "3-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 6.339115524232314}, + Bid: &openrtb2.Bid{ID: "3-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 6.339115524232314}, DealTierSatisfied: true, }, { - Bid: &openrtb.Bid{ID: "4-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 3.532468782358357}, + Bid: &openrtb2.Bid{ID: "4-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 3.532468782358357}, DealTierSatisfied: true, }, { - Bid: &openrtb.Bid{ID: "7-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, + Bid: &openrtb2.Bid{ID: "7-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, DealTierSatisfied: false, }, { - Bid: &openrtb.Bid{ID: "8-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, + Bid: &openrtb2.Bid{ID: "8-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, DealTierSatisfied: false, }, }, //20 { { - Bid: &openrtb.Bid{ID: "2-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 3.4502433547413878}, + Bid: &openrtb2.Bid{ID: "2-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 3.4502433547413878}, DealTierSatisfied: true, }, { - Bid: &openrtb.Bid{ID: "1-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 3.329644588311827}, + Bid: &openrtb2.Bid{ID: "1-ed72b572-ba62-4220-abba-c19c0bf6346b", Price: 3.329644588311827}, DealTierSatisfied: true, }, { - Bid: &openrtb.Bid{ID: "5-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, + Bid: &openrtb2.Bid{ID: "5-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, DealTierSatisfied: false, }, { - Bid: &openrtb.Bid{ID: "6-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, + Bid: &openrtb2.Bid{ID: "6-VIDEO12-89A1-41F1-8708-978FD3C0912A", Price: 5}, DealTierSatisfied: false, }, }, //25 diff --git a/endpoints/openrtb2/ctv/types/adpod_types.go b/endpoints/openrtb2/ctv/types/adpod_types.go index a3348d7d816..7af21cfc5ef 100644 --- a/endpoints/openrtb2/ctv/types/adpod_types.go +++ b/endpoints/openrtb2/ctv/types/adpod_types.go @@ -1,14 +1,14 @@ package types import ( - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) //Bid openrtb bid object with extra parameters type Bid struct { - *openrtb.Bid + *openrtb2.Bid Duration int FilterReasonCode constant.FilterReasonCode DealTierSatisfied bool @@ -22,7 +22,7 @@ type ExtCTVBidResponse struct { //BidResponseAdPodExt object for ctv bidresponse adpod object type BidResponseAdPodExt struct { - Response openrtb.BidResponse `json:"bidresponse,omitempty"` + Response openrtb2.BidResponse `json:"bidresponse,omitempty"` Config map[string]*ImpData `json:"config,omitempty"` } diff --git a/endpoints/openrtb2/ctv/util/util.go b/endpoints/openrtb2/ctv/util/util.go index d80c89300cf..f9b0ca1bcaf 100644 --- a/endpoints/openrtb2/ctv/util/util.go +++ b/endpoints/openrtb2/ctv/util/util.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" @@ -93,7 +93,7 @@ func TimeTrack(start time.Time, name string) { // it is expected that bid.Ext contains prebid.targeting map // if value not present or any error occured empty value will be returned // along with error. -func GetTargeting(key openrtb_ext.TargetingKey, bidder openrtb_ext.BidderName, bid openrtb.Bid) (string, error) { +func GetTargeting(key openrtb_ext.TargetingKey, bidder openrtb_ext.BidderName, bid openrtb2.Bid) (string, error) { bidderSpecificKey := key.BidderKey(openrtb_ext.BidderName(bidder), 20) return jsonparser.GetString(bid.Ext, "prebid", "targeting", bidderSpecificKey) } diff --git a/endpoints/openrtb2/ctv/util/util_test.go b/endpoints/openrtb2/ctv/util/util_test.go index 0f49b04f6bb..f18cabb6144 100644 --- a/endpoints/openrtb2/ctv/util/util_test.go +++ b/endpoints/openrtb2/ctv/util/util_test.go @@ -6,7 +6,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" "github.com/stretchr/testify/assert" @@ -144,7 +144,7 @@ func TestSortByDealPriority(t *testing.T) { newBid := func(bid testbid) *types.Bid { return &types.Bid{ - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ID: bid.id, Price: bid.price, //Ext: json.RawMessage(`{"prebid":{ "dealTierSatisfied" : ` + bid.isDealBid + ` }}`), @@ -193,7 +193,7 @@ func TestGetTargeting(t *testing.T) { for _, test := range tests { t.Run(test.scenario, func(t *testing.T) { - bid := new(openrtb.Bid) + bid := new(openrtb2.Bid) bid.Ext = []byte(`{"prebid" : { "targeting" : ` + test.targeting + `}}`) value, err := GetTargeting(test.key, openrtb_ext.BidderName(test.bidder), *bid) if test.expectError { diff --git a/endpoints/openrtb2/ctv_auction.go b/endpoints/openrtb2/ctv_auction.go index 670bb4c438a..d958701969d 100644 --- a/endpoints/openrtb2/ctv_auction.go +++ b/endpoints/openrtb2/ctv_auction.go @@ -13,7 +13,6 @@ import ( "time" "github.com/PubMatic-OpenWrap/etree" - "github.com/PubMatic-OpenWrap/openrtb" accountService "github.com/PubMatic-OpenWrap/prebid-server/account" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/config" @@ -34,15 +33,16 @@ import ( uuid "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/julienschmidt/httprouter" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) //CTV Specific Endpoint type ctvEndpointDeps struct { endpointDeps - request *openrtb.BidRequest + request *openrtb2.BidRequest reqExt *openrtb_ext.ExtRequestAdPod impData []*types.ImpData - videoSeats []*openrtb.SeatBid //stores pure video impression bids + videoSeats []*openrtb2.SeatBid //stores pure video impression bids impIndices map[string]int isAdPodRequest bool @@ -100,8 +100,8 @@ func NewCTVEndpoint( func (deps *ctvEndpointDeps) CTVAuctionEndpoint(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { defer util.TimeTrack(time.Now(), "CTVAuctionEndpoint") - var request *openrtb.BidRequest - var response *openrtb.BidResponse + var request *openrtb2.BidRequest + var response *openrtb2.BidResponse var err error var errL []error @@ -244,13 +244,13 @@ func (deps *ctvEndpointDeps) CTVAuctionEndpoint(w http.ResponseWriter, r *http.R } } -func (deps *ctvEndpointDeps) holdAuction(request *openrtb.BidRequest, usersyncs *usersync.PBSCookie, account *config.Account, startTime time.Time) (*openrtb.BidResponse, error) { +func (deps *ctvEndpointDeps) holdAuction(request *openrtb2.BidRequest, usersyncs *usersync.PBSCookie, account *config.Account, startTime time.Time) (*openrtb2.BidResponse, error) { defer util.TimeTrack(time.Now(), fmt.Sprintf("Tid:%v CTVHoldAuction", deps.request.ID)) //Hold OpenRTB Standard Auction if len(request.Imp) == 0 { //Dummy Response Object - return &openrtb.BidResponse{ID: request.ID}, nil + return &openrtb2.BidResponse{ID: request.ID}, nil } auctionRequest := exchange.AuctionRequest{ @@ -267,7 +267,7 @@ func (deps *ctvEndpointDeps) holdAuction(request *openrtb.BidRequest, usersyncs /********************* BidRequest Processing *********************/ -func (deps *ctvEndpointDeps) init(req *openrtb.BidRequest) { +func (deps *ctvEndpointDeps) init(req *openrtb2.BidRequest) { deps.request = req deps.impData = make([]*types.ImpData, len(req.Imp)) deps.impIndices = make(map[string]int, len(req.Imp)) @@ -410,7 +410,7 @@ func (deps *ctvEndpointDeps) validateBidRequest() (err []error) { /********************* Creating CTV BidRequest *********************/ //createBidRequest will return new bid request with all things copy from bid request except impression objects -func (deps *ctvEndpointDeps) createBidRequest(req *openrtb.BidRequest) *openrtb.BidRequest { +func (deps *ctvEndpointDeps) createBidRequest(req *openrtb2.BidRequest) *openrtb2.BidRequest { ctvRequest := *req //get configurations for all impressions @@ -439,7 +439,7 @@ func (deps *ctvEndpointDeps) getAllAdPodImpsConfigs() { } //getAdPodImpsConfigs will return number of impressions configurations within adpod -func (deps *ctvEndpointDeps) getAdPodImpsConfigs(imp *openrtb.Imp, adpod *openrtb_ext.VideoAdPod) []*types.ImpAdPodConfig { +func (deps *ctvEndpointDeps) getAdPodImpsConfigs(imp *openrtb2.Imp, adpod *openrtb_ext.VideoAdPod) []*types.ImpAdPodConfig { selectedAlgorithm := impressions.MinMaxAlgorithm labels := metrics.PodLabels{AlgorithmName: impressions.MonitorKey[selectedAlgorithm], NoOfImpressions: new(int)} @@ -463,7 +463,7 @@ func (deps *ctvEndpointDeps) getAdPodImpsConfigs(imp *openrtb.Imp, adpod *openrt } //createImpressions will create multiple impressions based on adpod configurations -func (deps *ctvEndpointDeps) createImpressions() []openrtb.Imp { +func (deps *ctvEndpointDeps) createImpressions() []openrtb2.Imp { impCount := 0 for _, imp := range deps.impData { if nil == imp.ErrorCode { @@ -476,7 +476,7 @@ func (deps *ctvEndpointDeps) createImpressions() []openrtb.Imp { } count := 0 - imps := make([]openrtb.Imp, impCount) + imps := make([]openrtb2.Imp, impCount) for index, imp := range deps.request.Imp { if nil == deps.impData[index].ErrorCode { adPodConfig := deps.impData[index].Config @@ -497,7 +497,7 @@ func (deps *ctvEndpointDeps) createImpressions() []openrtb.Imp { } //newImpression will clone existing impression object and create video object with ImpAdPodConfig. -func newImpression(imp *openrtb.Imp, config *types.ImpAdPodConfig) *openrtb.Imp { +func newImpression(imp *openrtb2.Imp, config *types.ImpAdPodConfig) *openrtb2.Imp { video := *imp.Video video.MinDuration = config.MinDuration video.MaxDuration = config.MaxDuration @@ -515,15 +515,15 @@ func newImpression(imp *openrtb.Imp, config *types.ImpAdPodConfig) *openrtb.Imp /********************* Prebid BidResponse Processing *********************/ //validateBidResponse -func (deps *ctvEndpointDeps) validateBidResponse(req *openrtb.BidRequest, resp *openrtb.BidResponse) error { +func (deps *ctvEndpointDeps) validateBidResponse(req *openrtb2.BidRequest, resp *openrtb2.BidResponse) error { //remove bids withoug cat and adomain return nil } //getBids reads bids from bidresponse object -func (deps *ctvEndpointDeps) getBids(resp *openrtb.BidResponse) { - var vseat *openrtb.SeatBid +func (deps *ctvEndpointDeps) getBids(resp *openrtb2.BidResponse) { + var vseat *openrtb2.SeatBid result := make(map[string]*types.AdPodBid) for i := range resp.SeatBid { @@ -567,7 +567,7 @@ func (deps *ctvEndpointDeps) getBids(resp *openrtb.BidResponse) { if len(deps.impData[index].Config) == 0 { //adding pure video bids if vseat == nil { - vseat = &openrtb.SeatBid{ + vseat = &openrtb2.SeatBid{ Seat: seat.Seat, Group: seat.Group, Ext: seat.Ext, @@ -675,10 +675,10 @@ func (deps *ctvEndpointDeps) doAdPodExclusions() types.AdPodBids { /********************* Creating CTV BidResponse *********************/ //createBidResponse -func (deps *ctvEndpointDeps) createBidResponse(resp *openrtb.BidResponse, adpods types.AdPodBids) *openrtb.BidResponse { +func (deps *ctvEndpointDeps) createBidResponse(resp *openrtb2.BidResponse, adpods types.AdPodBids) *openrtb2.BidResponse { defer util.TimeTrack(time.Now(), fmt.Sprintf("Tid:%v createBidResponse", deps.request.ID)) - bidResp := &openrtb.BidResponse{ + bidResp := &openrtb2.BidResponse{ ID: resp.ID, Cur: resp.Cur, CustomData: resp.CustomData, @@ -690,15 +690,15 @@ func (deps *ctvEndpointDeps) createBidResponse(resp *openrtb.BidResponse, adpods return bidResp } -func (deps *ctvEndpointDeps) getBidResponseSeatBids(adpods types.AdPodBids) []openrtb.SeatBid { - seats := []openrtb.SeatBid{} +func (deps *ctvEndpointDeps) getBidResponseSeatBids(adpods types.AdPodBids) []openrtb2.SeatBid { + seats := []openrtb2.SeatBid{} //append pure video request seats for _, seat := range deps.videoSeats { seats = append(seats, *seat) } - var adpodSeat *openrtb.SeatBid + var adpodSeat *openrtb2.SeatBid for _, adpod := range adpods { if len(adpod.Bids) == 0 { continue @@ -707,7 +707,7 @@ func (deps *ctvEndpointDeps) getBidResponseSeatBids(adpods types.AdPodBids) []op bid := deps.getAdPodBid(adpod) if bid != nil { if nil == adpodSeat { - adpodSeat = &openrtb.SeatBid{ + adpodSeat = &openrtb2.SeatBid{ Seat: adpod.SeatName, } } @@ -721,7 +721,7 @@ func (deps *ctvEndpointDeps) getBidResponseSeatBids(adpods types.AdPodBids) []op } //getBidResponseExt will return extension object -func (deps *ctvEndpointDeps) getBidResponseExt(resp *openrtb.BidResponse) (data json.RawMessage) { +func (deps *ctvEndpointDeps) getBidResponseExt(resp *openrtb2.BidResponse) (data json.RawMessage) { var err error adpodExt := types.BidResponseAdPodExt{ @@ -787,7 +787,7 @@ func (deps *ctvEndpointDeps) getBidResponseExt(resp *openrtb.BidResponse) (data //getAdPodBid func (deps *ctvEndpointDeps) getAdPodBid(adpod *types.AdPodBid) *types.Bid { bid := types.Bid{ - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, } //TODO: Write single for loop to get all details @@ -808,7 +808,7 @@ func (deps *ctvEndpointDeps) getAdPodBid(adpod *types.AdPodBid) *types.Bid { } //getAdPodBidCreative get commulative adpod bid details -func getAdPodBidCreative(video *openrtb.Video, adpod *types.AdPodBid) *string { +func getAdPodBidCreative(video *openrtb2.Video, adpod *types.AdPodBid) *string { doc := etree.NewDocument() vast := doc.CreateElement(constant.VASTElement) sequenceNumber := 1 @@ -888,7 +888,7 @@ func getAdPodBidExtension(adpod *types.AdPodBid) json.RawMessage { //it will try to get the actual ad duration returned by the bidder using prebid.video.duration //if prebid.video.duration = 0 or there is error occured in determing it then //impress -func getAdDuration(bid openrtb.Bid, defaultDuration int64) int { +func getAdDuration(bid openrtb2.Bid, defaultDuration int64) int { duration, err := jsonparser.GetInt(bid.Ext, "prebid", "video", "duration") if nil != err || duration <= 0 { duration = defaultDuration @@ -896,7 +896,7 @@ func getAdDuration(bid openrtb.Bid, defaultDuration int64) int { return int(duration) } -func addTargetingKey(bid *openrtb.Bid, key openrtb_ext.TargetingKey, value string) error { +func addTargetingKey(bid *openrtb2.Bid, key openrtb_ext.TargetingKey, value string) error { if nil == bid { return errors.New("Invalid bid") } diff --git a/endpoints/openrtb2/ctv_auction_test.go b/endpoints/openrtb2/ctv_auction_test.go index 1e6a0907c72..9c75316d3b8 100644 --- a/endpoints/openrtb2/ctv_auction_test.go +++ b/endpoints/openrtb2/ctv_auction_test.go @@ -4,8 +4,8 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -24,7 +24,7 @@ func TestGetAdDuration(t *testing.T) { } for _, test := range tests { t.Run(test.scenario, func(t *testing.T) { - bid := openrtb.Bid{ + bid := openrtb2.Bid{ Ext: []byte(`{"prebid" : {"video" : {"duration" : ` + test.adDuration + `}}}`), } assert.Equal(t, test.expect, getAdDuration(bid, int64(test.maxAdDuration))) @@ -45,7 +45,7 @@ func TestAddTargetingKeys(t *testing.T) { } for _, test := range tests { t.Run(test.scenario, func(t *testing.T) { - bid := new(openrtb.Bid) + bid := new(openrtb2.Bid) bid.Ext = []byte(test.bidExt) key := openrtb_ext.TargetingKey(test.key) assert.Nil(t, addTargetingKey(bid, key, test.value)) diff --git a/endpoints/openrtb2/interstitial.go b/endpoints/openrtb2/interstitial.go index 2f9c48fcd79..7c2af1b9de0 100644 --- a/endpoints/openrtb2/interstitial.go +++ b/endpoints/openrtb2/interstitial.go @@ -4,13 +4,13 @@ import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) -func processInterstitials(req *openrtb.BidRequest) error { +func processInterstitials(req *openrtb2.BidRequest) error { var devExt openrtb_ext.ExtDevice unmarshalled := true for i := range req.Imp { @@ -38,8 +38,8 @@ func processInterstitials(req *openrtb.BidRequest) error { return nil } -func processInterstitialsForImp(imp *openrtb.Imp, devExt *openrtb_ext.ExtDevice, device *openrtb.Device) error { - var maxWidth, maxHeight, minWidth, minHeight uint64 +func processInterstitialsForImp(imp *openrtb2.Imp, devExt *openrtb_ext.ExtDevice, device *openrtb2.Device) error { + var maxWidth, maxHeight, minWidth, minHeight int64 if imp.Banner == nil { // custom interstitial support is only available for banner requests. return nil @@ -56,8 +56,8 @@ func processInterstitialsForImp(imp *openrtb.Imp, devExt *openrtb_ext.ExtDevice, maxWidth = device.W maxHeight = device.H } - minWidth = (maxWidth * devExt.Prebid.Interstitial.MinWidthPerc) / 100 - minHeight = (maxHeight * devExt.Prebid.Interstitial.MinHeightPerc) / 100 + minWidth = (maxWidth * int64(devExt.Prebid.Interstitial.MinWidthPerc)) / 100 + minHeight = (maxHeight * int64(devExt.Prebid.Interstitial.MinHeightPerc)) / 100 imp.Banner.Format = genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight) if len(imp.Banner.Format) == 0 { return &errortypes.BadInput{Message: fmt.Sprintf("Unable to set interstitial size list for Imp id=%s (No valid sizes between %dx%d and %dx%d)", imp.ID, minWidth, minHeight, maxWidth, maxHeight)} @@ -65,10 +65,10 @@ func processInterstitialsForImp(imp *openrtb.Imp, devExt *openrtb_ext.ExtDevice, return nil } -func genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight uint64) []openrtb.Format { +func genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight int64) []openrtb2.Format { sizes := make([]config.InterstitialSize, 0, 10) for _, size := range config.ResolvedInterstitialSizes { - if size.Width >= minWidth && size.Width <= maxWidth && size.Height >= minHeight && size.Height <= maxHeight { + if int64(size.Width) >= minWidth && int64(size.Width) <= maxWidth && int64(size.Height) >= minHeight && int64(size.Height) <= maxHeight { sizes = append(sizes, size) if len(sizes) >= 10 { // we have enough sizes @@ -76,9 +76,9 @@ func genInterstitialFormat(minWidth, maxWidth, minHeight, maxHeight uint64) []op } } } - formatList := make([]openrtb.Format, 0, len(sizes)) + formatList := make([]openrtb2.Format, 0, len(sizes)) for _, size := range sizes { - formatList = append(formatList, openrtb.Format{W: size.Width, H: size.Height}) + formatList = append(formatList, openrtb2.Format{W: int64(size.Width), H: int64(size.Height)}) } return formatList } diff --git a/endpoints/openrtb2/interstitial_test.go b/endpoints/openrtb2/interstitial_test.go index 93d310525c8..1d7ad9e3d6b 100644 --- a/endpoints/openrtb2/interstitial_test.go +++ b/endpoints/openrtb2/interstitial_test.go @@ -4,17 +4,17 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) -var request = &openrtb.BidRequest{ +var request = &openrtb2.BidRequest{ ID: "some-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "my-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{ { W: 300, H: 600, @@ -25,7 +25,7 @@ var request = &openrtb.BidRequest{ Ext: json.RawMessage(`{"appnexus": {"placementId": 12883451}}`), }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ H: 640, W: 320, Ext: json.RawMessage(`{"prebid": {"interstitial": {"minwidthperc": 60, "minheightperc": 60}}}`), @@ -37,7 +37,7 @@ func TestInterstitial(t *testing.T) { if err := processInterstitials(myRequest); err != nil { t.Fatalf("Error processing interstitials: %v", err) } - targetFormat := []openrtb.Format{ + targetFormat := []openrtb2.Format{ { W: 300, H: 600, diff --git a/endpoints/openrtb2/sample-requests/invalid-native/empty-object.json b/endpoints/openrtb2/sample-requests/invalid-native/empty-object.json index 3833c25746b..d8bd43c266b 100644 --- a/endpoints/openrtb2/sample-requests/invalid-native/empty-object.json +++ b/endpoints/openrtb2/sample-requests/invalid-native/empty-object.json @@ -13,7 +13,7 @@ "request": "{}" }, "ext": { - "appnexus": { + "pubmatic": { "placementId": 12883451 } } diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index 1c1846a7c9d..0b7a64ee7cf 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -20,7 +20,6 @@ import ( jsonpatch "github.com/evanphx/json-patch" "github.com/gofrs/uuid" - "github.com/PubMatic-OpenWrap/openrtb" accountService "github.com/PubMatic-OpenWrap/prebid-server/account" "github.com/PubMatic-OpenWrap/prebid-server/analytics" "github.com/PubMatic-OpenWrap/prebid-server/config" @@ -32,6 +31,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/usersync" "github.com/golang/glog" "github.com/julienschmidt/httprouter" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) var defaultRequestTimeout int64 = 5000 @@ -197,7 +197,7 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re vo.VideoRequest = videoBidReq - var bidReq = &openrtb.BidRequest{} + var bidReq = &openrtb2.BidRequest{} if deps.defaultRequest { if err := json.Unmarshal(deps.defReqJSON, bidReq); err != nil { err = fmt.Errorf("Invalid JSON in Default Request Settings: %s", err) @@ -370,13 +370,13 @@ func handleError(labels *metrics.Labels, w http.ResponseWriter, errL []error, vo vo.Errors = append(vo.Errors, errL...) } -func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVideo, podErrors []PodError) ([]openrtb.Imp, []PodError) { +func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVideo, podErrors []PodError) ([]openrtb2.Imp, []PodError) { videoDur := videoReq.PodConfig.DurationRangeSec minDuration, maxDuration := minMax(videoDur) reqExactDur := videoReq.PodConfig.RequireExactDuration videoData := videoReq.Video - finalImpsArray := make([]openrtb.Imp, 0) + finalImpsArray := make([]openrtb2.Imp, 0) for ind, pod := range videoReq.PodConfig.Pods { //load stored impression @@ -400,7 +400,7 @@ func (deps *endpointDeps) createImpressions(videoReq *openrtb_ext.BidRequestVide } impDivNumber := numImps / len(videoDur) - impsArray := make([]openrtb.Imp, numImps) + impsArray := make([]openrtb2.Imp, numImps) for impInd := range impsArray { newImp := createImpressionTemplate(storedImp, videoData) impsArray[impInd] = newImp @@ -432,18 +432,18 @@ func max(a, b int) int { return b } -func createImpressionTemplate(imp openrtb.Imp, video *openrtb.Video) openrtb.Imp { +func createImpressionTemplate(imp openrtb2.Imp, video *openrtb2.Video) openrtb2.Imp { //for every new impression we need to have it's own copy of video object, because we customize it in further processing newVideo := *video imp.Video = &newVideo return imp } -func (deps *endpointDeps) loadStoredImp(storedImpId string) (openrtb.Imp, []error) { +func (deps *endpointDeps) loadStoredImp(storedImpId string) (openrtb2.Imp, []error) { ctx, cancel := context.WithTimeout(context.Background(), time.Duration(storedRequestTimeoutMillis)*time.Millisecond) defer cancel() - impr := openrtb.Imp{} + impr := openrtb2.Imp{} _, imp, err := deps.storedReqFetcher.FetchRequests(ctx, []string{}, []string{storedImpId}) if err != nil { return impr, err @@ -469,7 +469,7 @@ func minMax(array []int) (int, int) { return min, max } -func buildVideoResponse(bidresponse *openrtb.BidResponse, podErrors []PodError) (*openrtb_ext.BidResponseVideo, error) { +func buildVideoResponse(bidresponse *openrtb2.BidResponse, podErrors []PodError) (*openrtb_ext.BidResponseVideo, error) { adPods := make([]*openrtb_ext.AdPod, 0) anyBidsReturned := false @@ -561,7 +561,7 @@ func getVideoStoredRequestId(request []byte) (string, error) { return string(value), nil } -func mergeData(videoRequest *openrtb_ext.BidRequestVideo, bidRequest *openrtb.BidRequest) error { +func mergeData(videoRequest *openrtb_ext.BidRequestVideo, bidRequest *openrtb2.BidRequest) error { if videoRequest.Site != nil { bidRequest.Site = videoRequest.Site diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index 9bcf6522ec6..855e7055afb 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -12,7 +12,6 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/analytics" analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" "github.com/PubMatic-OpenWrap/prebid-server/config" @@ -21,6 +20,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -364,7 +364,7 @@ func TestVideoEndpointValidationsPositive(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -375,13 +375,13 @@ func TestVideoEndpointValidationsPositive(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -407,7 +407,7 @@ func TestVideoEndpointValidationsCritical(t *testing.T) { mimes = append(mimes, "") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) req := openrtb_ext.BidRequestVideo{ StoredRequestId: "", @@ -419,7 +419,7 @@ func TestVideoEndpointValidationsCritical(t *testing.T) { IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 0, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -476,7 +476,7 @@ func TestVideoEndpointValidationsPodErrors(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -487,13 +487,13 @@ func TestVideoEndpointValidationsPodErrors(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -546,7 +546,7 @@ func TestVideoEndpointValidationsSiteAndApp(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -557,16 +557,16 @@ func TestVideoEndpointValidationsSiteAndApp(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ ID: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -604,7 +604,7 @@ func TestVideoEndpointValidationsSiteMissingRequiredField(t *testing.T) { mimes = append(mimes, "mp4") mimes = append(mimes, "") - videoProtocols := make([]openrtb.Protocol, 0) + videoProtocols := make([]openrtb2.Protocol, 0) videoProtocols = append(videoProtocols, 15) videoProtocols = append(videoProtocols, 30) @@ -615,13 +615,13 @@ func TestVideoEndpointValidationsSiteMissingRequiredField(t *testing.T) { RequireExactDuration: true, Pods: pods, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Domain: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ PrimaryAdserver: 1, }, - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: mimes, Protocols: videoProtocols, }, @@ -655,7 +655,7 @@ func TestVideoEndpointValidationsMissingVideo(t *testing.T) { }, }, }, - App: &openrtb.App{ + App: &openrtb2.App{ Bundle: "pbs.com", }, IncludeBrandCategory: &openrtb_ext.IncludeBrandCategory{ @@ -670,16 +670,16 @@ func TestVideoEndpointValidationsMissingVideo(t *testing.T) { } func TestVideoBuildVideoResponseMissedCacheForOneBid(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0) - seatBids := make([]openrtb.SeatBid, 0) - seatBid := openrtb.SeatBid{} + seatBids := make([]openrtb2.SeatBid, 0) + seatBid := openrtb2.SeatBid{} - bids := make([]openrtb.Bid, 0) - bid1 := openrtb.Bid{} - bid2 := openrtb.Bid{} - bid3 := openrtb.Bid{} + bids := make([]openrtb2.Bid, 0) + bid1 := openrtb2.Bid{} + bid2 := openrtb2.Bid{} + bid3 := openrtb2.Bid{} extBid1 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_123_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) extBid2 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_456_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) @@ -708,16 +708,16 @@ func TestVideoBuildVideoResponseMissedCacheForOneBid(t *testing.T) { } func TestVideoBuildVideoResponseMissedCacheForAllBids(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0) - seatBids := make([]openrtb.SeatBid, 0) - seatBid := openrtb.SeatBid{} + seatBids := make([]openrtb2.SeatBid, 0) + seatBid := openrtb2.SeatBid{} - bids := make([]openrtb.Bid, 0) - bid1 := openrtb.Bid{} - bid2 := openrtb.Bid{} - bid3 := openrtb.Bid{} + bids := make([]openrtb2.Bid, 0) + bid1 := openrtb2.Bid{} + bid2 := openrtb2.Bid{} + bid3 := openrtb2.Bid{} extBid1 := []byte(`{"prebid":{"targeting":{"hb_bidder":"appnexus","hb_pb":"17.00","hb_pb_cat_dur":"17.00_123_30s","hb_size":"1x1"}}}`) extBid2 := []byte(`{"prebid":{"targeting":{"hb_bidder":"appnexus","hb_pb":"17.00","hb_pb_cat_dur":"17.00_456_30s","hb_size":"1x1"}}}`) @@ -742,15 +742,15 @@ func TestVideoBuildVideoResponseMissedCacheForAllBids(t *testing.T) { } func TestVideoBuildVideoResponsePodErrors(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0, 2) - seatBids := make([]openrtb.SeatBid, 0) - seatBid := openrtb.SeatBid{} + seatBids := make([]openrtb2.SeatBid, 0) + seatBid := openrtb2.SeatBid{} - bids := make([]openrtb.Bid, 0) - bid1 := openrtb.Bid{} - bid2 := openrtb.Bid{} + bids := make([]openrtb2.Bid, 0) + bid1 := openrtb2.Bid{} + bid2 := openrtb2.Bid{} extBid1 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_123_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) extBid2 := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"17.00","hb_pb_cat_dur_appnex":"17.00_456_30s","hb_size":"1x1","hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"}}}`) @@ -785,30 +785,30 @@ func TestVideoBuildVideoResponsePodErrors(t *testing.T) { } func TestVideoBuildVideoResponseNoBids(t *testing.T) { - openRtbBidResp := openrtb.BidResponse{} + openRtbBidResp := openrtb2.BidResponse{} podErrors := make([]PodError, 0, 0) - openRtbBidResp.SeatBid = make([]openrtb.SeatBid, 0) + openRtbBidResp.SeatBid = make([]openrtb2.SeatBid, 0) bidRespVideo, err := buildVideoResponse(&openRtbBidResp, podErrors) assert.NoError(t, err, "Error should be nil") assert.Len(t, bidRespVideo.AdPods, 0, "AdPods length should be 0") } func TestMergeOpenRTBToVideoRequest(t *testing.T) { - var bidReq = &openrtb.BidRequest{} + var bidReq = &openrtb2.BidRequest{} var videoReq = &openrtb_ext.BidRequestVideo{} - videoReq.App = &openrtb.App{ + videoReq.App = &openrtb2.App{ Domain: "test.com", Bundle: "test.bundle", } - videoReq.Site = &openrtb.Site{ + videoReq.Site = &openrtb2.Site{ Page: "site.com/index", } var dnt int8 = 4 var lmt int8 = 5 - videoReq.Device = openrtb.Device{ + videoReq.Device = openrtb2.Device{ DNT: &dnt, Lmt: &lmt, } @@ -816,11 +816,11 @@ func TestMergeOpenRTBToVideoRequest(t *testing.T) { videoReq.BCat = []string{"test1", "test2"} videoReq.BAdv = []string{"test3", "test4"} - videoReq.Regs = &openrtb.Regs{ + videoReq.Regs = &openrtb2.Regs{ Ext: json.RawMessage(`{"gdpr":1,"us_privacy":"1NYY","existing":"any","consent":"anyConsent"}`), } - videoReq.User = &openrtb.User{ + videoReq.User = &openrtb2.User{ BuyerUID: "test UID", Yob: 1980, Keywords: "test keywords", @@ -1057,27 +1057,27 @@ func TestHandleErrorDebugLog(t *testing.T) { func TestCreateImpressionTemplate(t *testing.T) { - imp := openrtb.Imp{} - imp.Video = &openrtb.Video{} - imp.Video.Protocols = []openrtb.Protocol{1, 2} + imp := openrtb2.Imp{} + imp.Video = &openrtb2.Video{} + imp.Video.Protocols = []openrtb2.Protocol{1, 2} imp.Video.MIMEs = []string{"video/mp4"} imp.Video.H = 200 imp.Video.W = 400 - imp.Video.PlaybackMethod = []openrtb.PlaybackMethod{5, 6} + imp.Video.PlaybackMethod = []openrtb2.PlaybackMethod{5, 6} - video := openrtb.Video{} - video.Protocols = []openrtb.Protocol{3, 4} + video := openrtb2.Video{} + video.Protocols = []openrtb2.Protocol{3, 4} video.MIMEs = []string{"video/flv"} video.H = 300 video.W = 0 - video.PlaybackMethod = []openrtb.PlaybackMethod{7, 8} + video.PlaybackMethod = []openrtb2.PlaybackMethod{7, 8} res := createImpressionTemplate(imp, &video) - assert.Equal(t, res.Video.Protocols, []openrtb.Protocol{3, 4}, "Incorrect video protocols") + assert.Equal(t, res.Video.Protocols, []openrtb2.Protocol{3, 4}, "Incorrect video protocols") assert.Equal(t, res.Video.MIMEs, []string{"video/flv"}, "Incorrect video MIMEs") assert.Equal(t, int(res.Video.H), 300, "Incorrect video height") assert.Equal(t, int(res.Video.W), 0, "Incorrect video width") - assert.Equal(t, res.Video.PlaybackMethod, []openrtb.PlaybackMethod{7, 8}, "Incorrect video playback method") + assert.Equal(t, res.Video.PlaybackMethod, []openrtb2.PlaybackMethod{7, 8}, "Incorrect video playback method") } func TestCCPA(t *testing.T) { @@ -1331,20 +1331,20 @@ func (cf mockVideoStoredReqFetcher) FetchRequests(ctx context.Context, requestID } type mockExchangeVideo struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest cache *mockCacheClient } -func (m *mockExchangeVideo) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchangeVideo) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest if debugLog != nil && debugLog.Enabled { m.cache.called = true } ext := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"20.00","hb_pb_cat_dur_appnex":"20.00_395_30s","hb_size":"1x1", "hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"},"type":"video","dealpriority":0,"dealtiersatisfied":false},"bidder":{"appnexus":{"brand_id":1,"auction_id":7840037870526938650,"bidder_id":2,"bid_ad_type":1,"creative_info":{"video":{"duration":30,"mimes":["video\/mp4"]}}}}}`) - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ Seat: "appnexus", - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ {ID: "01", ImpID: "1_0", Ext: ext}, {ID: "02", ImpID: "1_1", Ext: ext}, {ID: "03", ImpID: "1_2", Ext: ext}, @@ -1367,20 +1367,20 @@ func (m *mockExchangeVideo) HoldAuction(ctx context.Context, r exchange.AuctionR } type mockExchangeAppendBidderNames struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest cache *mockCacheClient } -func (m *mockExchangeAppendBidderNames) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchangeAppendBidderNames) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest if debugLog != nil && debugLog.Enabled { m.cache.called = true } ext := []byte(`{"prebid":{"targeting":{"hb_bidder_appnexus":"appnexus","hb_pb_appnexus":"20.00","hb_pb_cat_dur_appnex":"20.00_395_30s_appnexus","hb_size":"1x1", "hb_uuid_appnexus":"837ea3b7-5598-4958-8c45-8e9ef2bf7cc1"},"type":"video"},"bidder":{"appnexus":{"brand_id":1,"auction_id":7840037870526938650,"bidder_id":2,"bid_ad_type":1,"creative_info":{"video":{"duration":30,"mimes":["video\/mp4"]}}}}}`) - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{ + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{ Seat: "appnexus", - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ {ID: "01", ImpID: "1_0", Ext: ext}, {ID: "02", ImpID: "1_1", Ext: ext}, {ID: "03", ImpID: "1_2", Ext: ext}, @@ -1403,14 +1403,14 @@ func (m *mockExchangeAppendBidderNames) HoldAuction(ctx context.Context, r excha } type mockExchangeVideoNoBids struct { - lastRequest *openrtb.BidRequest + lastRequest *openrtb2.BidRequest cache *mockCacheClient } -func (m *mockExchangeVideoNoBids) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb.BidResponse, error) { +func (m *mockExchangeVideoNoBids) HoldAuction(ctx context.Context, r exchange.AuctionRequest, debugLog *exchange.DebugLog) (*openrtb2.BidResponse, error) { m.lastRequest = r.BidRequest - return &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{{}}, + return &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{{}}, }, nil } diff --git a/exchange/adapter_util_test.go b/exchange/adapter_util_test.go index 05cdd7e9648..58904a750a9 100644 --- a/exchange/adapter_util_test.go +++ b/exchange/adapter_util_test.go @@ -6,7 +6,6 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" @@ -15,6 +14,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/currency" metrics "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -397,7 +397,7 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) { type fakeAdaptedBidder struct{} -func (fakeAdaptedBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (fakeAdaptedBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { return nil, nil } @@ -405,11 +405,11 @@ type fakeBidder struct { name string } -func (fakeBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (fakeBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return nil, nil } -func (fakeBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (fakeBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { return nil, nil } diff --git a/exchange/auction.go b/exchange/auction.go index b8143d4e1a8..965712490d6 100644 --- a/exchange/auction.go +++ b/exchange/auction.go @@ -10,11 +10,11 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" uuid "github.com/gofrs/uuid" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type DebugLog struct { @@ -125,7 +125,7 @@ func newAuction(seatBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, numImps int } // isNewWinningBid calculates if the new bid (nbid) will win against the current winning bid (wbid) given preferDeals. -func isNewWinningBid(bid, wbid *openrtb.Bid, preferDeals bool) bool { +func isNewWinningBid(bid, wbid *openrtb2.Bid, preferDeals bool) bool { if preferDeals { if len(wbid.DealID) > 0 && len(bid.DealID) == 0 { return false @@ -147,7 +147,7 @@ func (a *auction) setRoundedPrices(priceGranularity openrtb_ext.PriceGranularity a.roundedPrices = roundedPrices } -func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, evTracking *eventTracking, bidRequest *openrtb.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string, debugLog *DebugLog) []error { +func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, evTracking *eventTracking, bidRequest *openrtb2.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string, debugLog *DebugLog) []error { var bids, vast, includeBidderKeys, includeWinners bool = targData.includeCacheBids, targData.includeCacheVast, targData.includeBidderKeys, targData.includeWinners if !((bids || vast) && (includeBidderKeys || includeWinners)) { return nil @@ -155,8 +155,8 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, var errs []error expectNumBids := valOrZero(bids, len(a.roundedPrices)) expectNumVast := valOrZero(vast, len(a.roundedPrices)) - bidIndices := make(map[int]*openrtb.Bid, expectNumBids) - vastIndices := make(map[int]*openrtb.Bid, expectNumVast) + bidIndices := make(map[int]*openrtb2.Bid, expectNumBids) + vastIndices := make(map[int]*openrtb2.Bid, expectNumVast) toCache := make([]prebid_cache_client.Cacheable, 0, expectNumBids+expectNumVast) expByImp := make(map[string]int64) competitiveExclusion := false @@ -257,7 +257,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, } if bids { - a.cacheIds = make(map[*openrtb.Bid]string, len(bidIndices)) + a.cacheIds = make(map[*openrtb2.Bid]string, len(bidIndices)) for index, bid := range bidIndices { if ids[index] != "" { a.cacheIds[bid] = ids[index] @@ -265,7 +265,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, } } if vast { - a.vastCacheIds = make(map[*openrtb.Bid]string, len(vastIndices)) + a.vastCacheIds = make(map[*openrtb2.Bid]string, len(vastIndices)) for index, bid := range vastIndices { if ids[index] != "" { if competitiveExclusion && strings.HasSuffix(ids[index], hbCacheID) { @@ -282,7 +282,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, // makeVAST returns some VAST XML for the given bid. If AdM is defined, // it takes precedence. Otherwise the Nurl will be wrapped in a redirect tag. -func makeVAST(bid *openrtb.Bid) string { +func makeVAST(bid *openrtb2.Bid) string { if bid.AdM == "" { return `` + `prebid.org wrapper` + @@ -355,7 +355,7 @@ type auction struct { // roundedPrices stores the price strings rounded for each bid according to the price granularity. roundedPrices map[*pbsOrtbBid]string // cacheIds stores the UUIDs from Prebid Cache for fetching the full bid JSON. - cacheIds map[*openrtb.Bid]string + cacheIds map[*openrtb2.Bid]string // vastCacheIds stores UUIDS from Prebid cache for fetching the VAST markup to video bids. - vastCacheIds map[*openrtb.Bid]string + vastCacheIds map[*openrtb2.Bid]string } diff --git a/exchange/auction_test.go b/exchange/auction_test.go index ba9f12077c9..ddf89d6a336 100644 --- a/exchange/auction_test.go +++ b/exchange/auction_test.go @@ -15,13 +15,13 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) func TestMakeVASTGiven(t *testing.T) { const expect = `` - bid := &openrtb.Bid{ + bid := &openrtb2.Bid{ AdM: expect, } vast := makeVAST(bid) @@ -35,7 +35,7 @@ func TestMakeVASTNurl(t *testing.T) { `` + `` + `` - bid := &openrtb.Bid{ + bid := &openrtb2.Bid{ NURL: url, } vast := makeVAST(bid) @@ -268,45 +268,45 @@ func runCacheSpec(t *testing.T, fileDisplayName string, specData *cacheSpec) { func TestNewAuction(t *testing.T) { bid1p077 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 0.77, }, } bid1p123 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 1.23, }, } bid1p230 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 2.30, }, } bid1p088d := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 0.88, DealID: "SpecialDeal", }, } bid1p166d := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp1", Price: 1.66, DealID: "BigDeal", }, } bid2p123 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp2", Price: 1.23, }, } bid2p144 := pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "imp2", Price: 1.44, }, @@ -486,7 +486,7 @@ func TestNewAuction(t *testing.T) { } type cacheSpec struct { - BidRequest openrtb.BidRequest `json:"bidRequest"` + BidRequest openrtb2.BidRequest `json:"bidRequest"` PbsBids []pbsBid `json:"pbsBids"` ExpectedCacheables []prebid_cache_client.Cacheable `json:"expectedCacheables"` DefaultTTLs config.DefaultTTLs `json:"defaultTTLs"` @@ -500,7 +500,7 @@ type cacheSpec struct { } type pbsBid struct { - Bid *openrtb.Bid `json:"bid"` + Bid *openrtb2.Bid `json:"bid"` BidType openrtb_ext.BidType `json:"bidType"` Bidder openrtb_ext.BidderName `json:"bidder"` } diff --git a/exchange/bidder.go b/exchange/bidder.go index b426fce9322..da5a59b6cb3 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -16,14 +16,14 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/currency" "github.com/golang/glog" - "github.com/PubMatic-OpenWrap/openrtb" - nativeRequests "github.com/PubMatic-OpenWrap/openrtb/native/request" - nativeResponse "github.com/PubMatic-OpenWrap/openrtb/native/response" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" + nativeResponse "github.com/mxmCherry/openrtb/v15/native1/response" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) @@ -49,7 +49,7 @@ type adaptedBidder interface { // // Any errors will be user-facing in the API. // Error messages should help publishers understand what might account for "bad" bids. - requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) + requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) } // pbsOrtbBid is a Bid returned by an adaptedBidder. @@ -62,7 +62,7 @@ type adaptedBidder interface { // pbsOrtbBid.dealPriority is optionally provided by adapters and used internally by the exchange to support deal targeted campaigns. // pbsOrtbBid.dealTierSatisfied is set to true by exchange.updateHbPbCatDur if deal tier satisfied otherwise it will be set to false type pbsOrtbBid struct { - bid *openrtb.Bid + bid *openrtb2.Bid bidType openrtb_ext.BidType bidTargets map[string]string bidVideo *openrtb_ext.ExtBidPrebidVideo @@ -73,7 +73,7 @@ type pbsOrtbBid struct { // pbsOrtbSeatBid is a SeatBid returned by an adaptedBidder. // -// This is distinct from the openrtb.SeatBid so that the prebid-server ext can be passed back with typesafety. +// This is distinct from the openrtb2.SeatBid so that the prebid-server ext can be passed back with typesafety. type pbsOrtbSeatBid struct { // bids is the list of bids which this adaptedBidder wishes to make. bids []*pbsOrtbBid @@ -128,7 +128,7 @@ type bidderAdapterConfig struct { DebugInfo adapters.DebugInfo } -func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { reqData, errs := bidder.Bidder.MakeRequests(request, reqInfo) if len(reqData) == 0 { @@ -245,7 +245,7 @@ func (bidder *bidderAdapter) requestBid(ctx context.Context, request *openrtb.Bi return seatBid, errs } -func addNativeTypes(bid *openrtb.Bid, request *openrtb.BidRequest) (*nativeResponse.Response, []error) { +func addNativeTypes(bid *openrtb2.Bid, request *openrtb2.BidRequest) (*nativeResponse.Response, []error) { var errs []error var nativeMarkup *nativeResponse.Response if err := json.Unmarshal(json.RawMessage(bid.AdM), &nativeMarkup); err != nil || len(nativeMarkup.Assets) == 0 { @@ -275,13 +275,13 @@ func addNativeTypes(bid *openrtb.Bid, request *openrtb.BidRequest) (*nativeRespo func setAssetTypes(asset nativeResponse.Asset, nativePayload nativeRequests.Request) error { if asset.Img != nil { - if tempAsset, err := getAssetByID(asset.ID, nativePayload.Assets); err == nil { + if tempAsset, err := getAssetByID(*asset.ID, nativePayload.Assets); err == nil { if tempAsset.Img != nil { if tempAsset.Img.Type != 0 { asset.Img.Type = tempAsset.Img.Type } } else { - return fmt.Errorf("Response has an Image asset with ID:%d present that doesn't exist in the request", asset.ID) + return fmt.Errorf("Response has an Image asset with ID:%d present that doesn't exist in the request", *asset.ID) } } else { return err @@ -289,13 +289,13 @@ func setAssetTypes(asset nativeResponse.Asset, nativePayload nativeRequests.Requ } if asset.Data != nil { - if tempAsset, err := getAssetByID(asset.ID, nativePayload.Assets); err == nil { + if tempAsset, err := getAssetByID(*asset.ID, nativePayload.Assets); err == nil { if tempAsset.Data != nil { if tempAsset.Data.Type != 0 { asset.Data.Type = tempAsset.Data.Type } } else { - return fmt.Errorf("Response has a Data asset with ID:%d present that doesn't exist in the request", asset.ID) + return fmt.Errorf("Response has a Data asset with ID:%d present that doesn't exist in the request", *asset.ID) } } else { return err @@ -304,7 +304,7 @@ func setAssetTypes(asset nativeResponse.Asset, nativePayload nativeRequests.Requ return nil } -func getNativeImpByImpID(impID string, request *openrtb.BidRequest) (*openrtb.Native, error) { +func getNativeImpByImpID(impID string, request *openrtb2.BidRequest) (*openrtb2.Native, error) { for _, impInRequest := range request.Imp { if impInRequest.ID == impID && impInRequest.Native != nil { return impInRequest.Native, nil diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index 66f976c0b66..bdec701c380 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -15,7 +15,6 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/currency" @@ -23,11 +22,12 @@ import ( metricsConfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - nativeRequests "github.com/PubMatic-OpenWrap/openrtb/native/request" - nativeResponse "github.com/PubMatic-OpenWrap/openrtb/native/response" + nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" + nativeResponse "github.com/mxmCherry/openrtb/v15/native1/response" ) // TestSingleBidder makes sure that the following things work if the Bidder needs only one request. @@ -75,14 +75,14 @@ func TestSingleBidder(t *testing.T) { mockBidderResponse := &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ Price: firstInitialPrice, }, BidType: openrtb_ext.BidTypeBanner, DealPriority: 4, }, { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ Price: secondInitialPrice, }, BidType: openrtb_ext.BidTypeVideo, @@ -95,7 +95,7 @@ func TestSingleBidder(t *testing.T) { bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, test.debugInfo) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - seatBid, errs := bidder.requestBid(ctx, &openrtb.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(ctx, &openrtb2.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) // Make sure the goodSingleBidder was called with the expected arguments. if bidderImpl.httpResponse == nil { @@ -157,11 +157,11 @@ func TestMultiBidder(t *testing.T) { mockBidderResponse := &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeBanner, }, { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeVideo, }, }, @@ -184,7 +184,7 @@ func TestMultiBidder(t *testing.T) { } bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, nil) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) if seatBid == nil { t.Fatalf("SeatBid should exist, because bids exist.") @@ -514,7 +514,7 @@ func TestMultiCurrencies(t *testing.T) { mockBidderResponses[i] = &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ Price: bid.price, }, BidType: openrtb_ext.BidTypeBanner, @@ -555,7 +555,7 @@ func TestMultiCurrencies(t *testing.T) { seatBid, errs := bidder.requestBid( context.Background(), - &openrtb.BidRequest{}, + &openrtb2.BidRequest{}, "test", 1, currencyConverter.Rates(), @@ -680,7 +680,7 @@ func TestMultiCurrencies_RateConverterNotSet(t *testing.T) { mockBidderResponses[i] = &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeBanner, }, }, @@ -700,7 +700,7 @@ func TestMultiCurrencies_RateConverterNotSet(t *testing.T) { currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) seatBid, errs := bidder.requestBid( context.Background(), - &openrtb.BidRequest{}, + &openrtb2.BidRequest{}, "test", 1, currencyConverter.Rates(), @@ -843,7 +843,7 @@ func TestMultiCurrencies_RequestCurrencyPick(t *testing.T) { { Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{}, + Bid: &openrtb2.Bid{}, BidType: openrtb_ext.BidTypeBanner, }, }, @@ -871,7 +871,7 @@ func TestMultiCurrencies_RequestCurrencyPick(t *testing.T) { ) seatBid, errs := bidder.requestBid( context.Background(), - &openrtb.BidRequest{ + &openrtb2.BidRequest{ Cur: tc.bidRequestCurrencies, }, "test", @@ -983,27 +983,27 @@ func TestMobileNativeTypes(t *testing.T) { reqURL := server.URL testCases := []struct { - mockBidderRequest *openrtb.BidRequest + mockBidderRequest *openrtb2.BidRequest mockBidderResponse *adapters.BidderResponse expectedValue string description string }{ { - mockBidderRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ + mockBidderRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ { ID: "some-imp-id", - Native: &openrtb.Native{ + Native: &openrtb2.Native{ Request: "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}}]}", }, }, }, - App: &openrtb.App{}, + App: &openrtb2.App{}, }, mockBidderResponse: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ImpID: "some-imp-id", AdM: "{\"assets\":[{\"id\":2,\"img\":{\"url\":\"http://vcdn.adnxs.com/p/creative-image/f8/7f/0f/13/f87f0f13-230c-4f05-8087-db9216e393de.jpg\",\"w\":989,\"h\":742,\"ext\":{\"appnexus\":{\"prevent_crop\":0}}}},{\"id\":1,\"title\":{\"text\":\"This is a Prebid Native Creative\"}},{\"id\":3,\"data\":{\"value\":\"Prebid.org\"}},{\"id\":4,\"data\":{\"value\":\"This is a Prebid Native Creative. There are many like it, but this one is mine.\"}}],\"link\":{\"url\":\"http://some-url.com\"},\"imptrackers\":[\"http://someimptracker.com\"],\"jstracker\":\"some-js-tracker\"}", Price: 10, @@ -1016,21 +1016,21 @@ func TestMobileNativeTypes(t *testing.T) { description: "Checks types in response", }, { - mockBidderRequest: &openrtb.BidRequest{ - Imp: []openrtb.Imp{ + mockBidderRequest: &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ { ID: "some-imp-id", - Native: &openrtb.Native{ + Native: &openrtb2.Native{ Request: "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}}]}", }, }, }, - App: &openrtb.App{}, + App: &openrtb2.App{}, }, mockBidderResponse: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{ + Bid: &openrtb2.Bid{ ImpID: "some-imp-id", AdM: "{\"some-diff-markup\":\"creative\"}", Price: 10, @@ -1078,7 +1078,7 @@ func TestMobileNativeTypes(t *testing.T) { func TestErrorReporting(t *testing.T) { bidder := adaptBidder(&bidRejector{}, nil, &config.Configuration{}, &metricsConfig.DummyMetricsEngine{}, openrtb_ext.BidderAppnexus, nil) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - bids, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + bids, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, "test", 1.0, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) if bids != nil { t.Errorf("There should be no seatbid if no http requests are returned.") } @@ -1099,7 +1099,7 @@ func TestSetAssetTypes(t *testing.T) { }{ { respAsset: nativeResponse.Asset{ - ID: 1, + ID: openrtb2.Int64Ptr(1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1125,7 +1125,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 2, + ID: openrtb2.Int64Ptr(2), Data: &nativeResponse.Data{ Label: "some label", }, @@ -1151,7 +1151,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 1, + ID: openrtb2.Int64Ptr(1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1171,7 +1171,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 2, + ID: openrtb2.Int64Ptr(2), Data: &nativeResponse.Data{ Label: "some label", }, @@ -1191,7 +1191,7 @@ func TestSetAssetTypes(t *testing.T) { }, { respAsset: nativeResponse.Asset{ - ID: 1, + ID: openrtb2.Int64Ptr(1), Img: &nativeResponse.Image{ URL: "http://some-url", }, @@ -1261,7 +1261,7 @@ func TestCallRecordAdapterConnections(t *testing.T) { // Run requestBid using an http.Client with a mock handler bidder := adaptBidder(bidderImpl, server.Client(), &config.Configuration{}, metrics, openrtb_ext.BidderAppnexus, nil) currencyConverter := currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) - _, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) + _, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, "test", bidAdjustment, currencyConverter.Rates(), &adapters.ExtraRequestInfo{}, true) // Assert no errors assert.Equal(t, 0, len(errs), "bidder.requestBid returned errors %v \n", errs) @@ -1466,31 +1466,31 @@ func wrapWithBidderInfo(bidder adapters.Bidder) adapters.Bidder { } type goodSingleBidder struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest httpRequest *adapters.RequestData httpResponse *adapters.ResponseData bidResponse *adapters.BidderResponse } -func (bidder *goodSingleBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *goodSingleBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { bidder.bidRequest = request return []*adapters.RequestData{bidder.httpRequest}, nil } -func (bidder *goodSingleBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *goodSingleBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidder.httpResponse = response return bidder.bidResponse, nil } type goodMultiHTTPCallsBidder struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest httpRequest []*adapters.RequestData httpResponses []*adapters.ResponseData bidResponses []*adapters.BidderResponse bidResponseNumber int } -func (bidder *goodMultiHTTPCallsBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *goodMultiHTTPCallsBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { bidder.bidRequest = request response := make([]*adapters.RequestData, len(bidder.httpRequest)) @@ -1500,7 +1500,7 @@ func (bidder *goodMultiHTTPCallsBidder) MakeRequests(request *openrtb.BidRequest return response, nil } -func (bidder *goodMultiHTTPCallsBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *goodMultiHTTPCallsBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { br := bidder.bidResponses[bidder.bidResponseNumber] bidder.bidResponseNumber++ bidder.httpResponses = append(bidder.httpResponses, response) @@ -1509,18 +1509,18 @@ func (bidder *goodMultiHTTPCallsBidder) MakeBids(internalRequest *openrtb.BidReq } type mixedMultiBidder struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest httpRequests []*adapters.RequestData httpResponses []*adapters.ResponseData bidResponse *adapters.BidderResponse } -func (bidder *mixedMultiBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *mixedMultiBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { bidder.bidRequest = request return bidder.httpRequests, []error{errors.New("The requests weren't ideal.")} } -func (bidder *mixedMultiBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *mixedMultiBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidder.httpResponses = append(bidder.httpResponses, response) return bidder.bidResponse, []error{errors.New("The bidResponse weren't ideal.")} } @@ -1530,11 +1530,11 @@ type bidRejector struct { httpResponse *adapters.ResponseData } -func (bidder *bidRejector) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *bidRejector) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return nil, []error{errors.New("Invalid params on BidRequest.")} } -func (bidder *bidRejector) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *bidRejector) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidder.httpResponse = response return nil, []error{errors.New("Can't make a response.")} } @@ -1544,11 +1544,11 @@ type notifyingBidder struct { notifyRequest adapters.RequestData } -func (bidder *notifyingBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (bidder *notifyingBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return bidder.requests, nil } -func (bidder *notifyingBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (bidder *notifyingBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { return nil, nil } diff --git a/exchange/bidder_validate_bids.go b/exchange/bidder_validate_bids.go index 9ea357336fa..4346adafdaa 100644 --- a/exchange/bidder_validate_bids.go +++ b/exchange/bidder_validate_bids.go @@ -6,10 +6,10 @@ import ( "fmt" "strings" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/currency" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" goCurrency "golang.org/x/text/currency" ) @@ -28,7 +28,7 @@ type validatedBidder struct { bidder adaptedBidder } -func (v *validatedBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (v *validatedBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { seatBid, errs := v.bidder.requestBid(ctx, request, name, bidAdjustment, conversions, reqInfo, accountDebugAllowed) if validationErrors := removeInvalidBids(request, seatBid); len(validationErrors) > 0 { errs = append(errs, validationErrors...) @@ -37,7 +37,7 @@ func (v *validatedBidder) requestBid(ctx context.Context, request *openrtb.BidRe } // validateBids will run some validation checks on the returned bids and excise any invalid bids -func removeInvalidBids(request *openrtb.BidRequest, seatBid *pbsOrtbSeatBid) []error { +func removeInvalidBids(request *openrtb2.BidRequest, seatBid *pbsOrtbSeatBid) []error { // Exit early if there is nothing to do. if seatBid == nil || len(seatBid.bids) == 0 { return nil diff --git a/exchange/bidder_validate_bids_test.go b/exchange/bidder_validate_bids_test.go index a2ec026f5d7..948168e58c0 100644 --- a/exchange/bidder_validate_bids_test.go +++ b/exchange/bidder_validate_bids_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/currency" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -16,7 +16,7 @@ func TestAllValidBids(t *testing.T) { bidResponse: &pbsOrtbSeatBid{ bids: []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", ImpID: "thisImp", Price: 0.45, @@ -24,7 +24,7 @@ func TestAllValidBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", Price: 0.40, @@ -32,7 +32,7 @@ func TestAllValidBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "123", ImpID: "456", Price: 0.44, @@ -42,7 +42,7 @@ func TestAllValidBids(t *testing.T) { }, }, }) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) assert.Len(t, seatBid.bids, 3) assert.Len(t, errs, 0) } @@ -52,28 +52,28 @@ func TestAllBadBids(t *testing.T) { bidResponse: &pbsOrtbSeatBid{ bids: []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", Price: 0.45, CrID: "thisCreative", }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", CrID: "thatCreative", }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "123", ImpID: "456", Price: 0.44, }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "456", Price: 0.44, CrID: "blah", @@ -83,7 +83,7 @@ func TestAllBadBids(t *testing.T) { }, }, }) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) assert.Len(t, seatBid.bids, 0) assert.Len(t, errs, 5) } @@ -93,7 +93,7 @@ func TestMixedBids(t *testing.T) { bidResponse: &pbsOrtbSeatBid{ bids: []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", ImpID: "thisImp", Price: 0.45, @@ -101,14 +101,14 @@ func TestMixedBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", CrID: "thatCreative", }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "123", ImpID: "456", Price: 0.44, @@ -116,7 +116,7 @@ func TestMixedBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ImpID: "456", Price: 0.44, CrID: "blah", @@ -126,7 +126,7 @@ func TestMixedBids(t *testing.T) { }, }, }) - seatBid, errs := bidder.requestBid(context.Background(), &openrtb.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) + seatBid, errs := bidder.requestBid(context.Background(), &openrtb2.BidRequest{}, openrtb_ext.BidderAppnexus, 1.0, currency.NewConstantRates(), &adapters.ExtraRequestInfo{}, true) assert.Len(t, seatBid.bids, 2) assert.Len(t, errs, 3) } @@ -210,7 +210,7 @@ func TestCurrencyBids(t *testing.T) { for _, tc := range currencyTestCases { bids := []*pbsOrtbBid{ { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "one-bid", ImpID: "thisImp", Price: 0.45, @@ -218,7 +218,7 @@ func TestCurrencyBids(t *testing.T) { }, }, { - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: "thatBid", ImpID: "thatImp", Price: 0.44, @@ -242,7 +242,7 @@ func TestCurrencyBids(t *testing.T) { expectedValidBids = 0 } - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ Cur: tc.brqCur, } @@ -257,6 +257,6 @@ type mockAdaptedBidder struct { errorResponse []error } -func (b *mockAdaptedBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (b *mockAdaptedBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { return b.bidResponse, b.errorResponse } diff --git a/exchange/events_test.go b/exchange/events_test.go index 3315dfaae7b..5cdb7d6f430 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -3,8 +3,8 @@ package exchange import ( "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -60,7 +60,7 @@ func Test_eventsData_makeBidExtEvents(t *testing.T) { auctionTimestampMs: 1234567890, externalURL: "http://localhost", } - bid := &pbsOrtbBid{bid: &openrtb.Bid{ID: "BID-1"}, bidType: tt.args.bidType} + bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType} assert.Equal(t, tt.want, evData.makeBidExtEvents(bid, openrtb_ext.BidderOpenx)) }) } @@ -124,7 +124,7 @@ func Test_eventsData_modifyBidJSON(t *testing.T) { auctionTimestampMs: 1234567890, externalURL: "http://localhost", } - bid := &pbsOrtbBid{bid: &openrtb.Bid{ID: "BID-1"}, bidType: tt.args.bidType} + bid := &pbsOrtbBid{bid: &openrtb2.Bid{ID: "BID-1"}, bidType: tt.args.bidType} modifiedJSON, err := evData.modifyBidJSON(bid, openrtb_ext.BidderOpenx, tt.jsonBytes) if tt.want != nil { assert.NoError(t, err, "Unexpected error") diff --git a/exchange/exchange.go b/exchange/exchange.go index 43866d230cc..18b9451cc0b 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -16,7 +16,6 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/currency" @@ -26,6 +25,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type ContextKey string @@ -39,7 +39,7 @@ type extCacheInstructions struct { // Exchange runs Auctions. Implementations must be threadsafe, and will be shared across many goroutines. type Exchange interface { // HoldAuction executes an OpenRTB v2.5 Auction. - HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb.BidResponse, error) + HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb2.BidResponse, error) } // IdFetcher can find the user's ID for a specific Bidder. @@ -101,7 +101,7 @@ func NewExchange(adapters map[openrtb_ext.BidderName]adaptedBidder, cache prebid // AuctionRequest holds the bid request for the auction // and all other information needed to process that request type AuctionRequest struct { - BidRequest *openrtb.BidRequest + BidRequest *openrtb2.BidRequest Account config.Account UserSyncs IdFetcher RequestType metrics.RequestType @@ -115,13 +115,13 @@ type AuctionRequest struct { // BidderRequest holds the bidder specific request and all other // information needed to process that bidder request. type BidderRequest struct { - BidRequest *openrtb.BidRequest + BidRequest *openrtb2.BidRequest BidderName openrtb_ext.BidderName BidderCoreName openrtb_ext.BidderName BidderLabels metrics.AdapterLabels } -func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb.BidResponse, error) { +func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog *DebugLog) (*openrtb2.BidResponse, error) { var err error requestExt, err := extractBidRequestExt(r.BidRequest) if err != nil { @@ -240,9 +240,9 @@ func (e *exchange) HoldAuction(ctx context.Context, r AuctionRequest, debugLog * return e.buildBidResponse(ctx, liveAdapters, adapterBids, r.BidRequest, adapterExtra, auc, bidResponseExt, cacheInstructions.returnCreative, errs) } -func (e *exchange) parseUsersyncIfAmbiguous(bidRequest *openrtb.BidRequest) bool { +func (e *exchange) parseUsersyncIfAmbiguous(bidRequest *openrtb2.BidRequest) bool { usersyncIfAmbiguous := e.UsersyncIfAmbiguous - var geo *openrtb.Geo = nil + var geo *openrtb2.Geo = nil if bidRequest.User != nil && bidRequest.User.Geo != nil { geo = bidRequest.User.Geo @@ -263,7 +263,7 @@ func (e *exchange) parseUsersyncIfAmbiguous(bidRequest *openrtb.BidRequest) bool return usersyncIfAmbiguous } -func recordImpMetrics(bidRequest *openrtb.BidRequest, metricsEngine metrics.MetricsEngine) { +func recordImpMetrics(bidRequest *openrtb2.BidRequest, metricsEngine metrics.MetricsEngine) { for _, impInRequest := range bidRequest.Imp { var impLabels metrics.ImpLabels = metrics.ImpLabels{ BannerImps: impInRequest.Banner != nil, @@ -276,7 +276,7 @@ func recordImpMetrics(bidRequest *openrtb.BidRequest, metricsEngine metrics.Metr } // applyDealSupport updates targeting keys with deal prefixes if minimum deal tier exceeded -func applyDealSupport(bidRequest *openrtb.BidRequest, auc *auction, bidCategory map[string]string) []error { +func applyDealSupport(bidRequest *openrtb2.BidRequest, auc *auction, bidCategory map[string]string) []error { errs := []error{} impDealMap := getDealTiers(bidRequest) @@ -297,7 +297,7 @@ func applyDealSupport(bidRequest *openrtb.BidRequest, auc *auction, bidCategory } // getDealTiers creates map of impression to bidder deal tier configuration -func getDealTiers(bidRequest *openrtb.BidRequest) map[string]openrtb_ext.DealTierBidderMap { +func getDealTiers(bidRequest *openrtb2.BidRequest) map[string]openrtb_ext.DealTierBidderMap { impDealMap := make(map[string]openrtb_ext.DealTierBidderMap) for _, imp := range bidRequest.Imp { @@ -513,19 +513,19 @@ func errsToBidderErrors(errs []error) []openrtb_ext.ExtBidderError { } // This piece takes all the bids supplied by the adapters and crafts an openRTB response to send back to the requester -func (e *exchange) buildBidResponse(ctx context.Context, liveAdapters []openrtb_ext.BidderName, adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, bidRequest *openrtb.BidRequest, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, bidResponseExt *openrtb_ext.ExtBidResponse, returnCreative bool, errList []error) (*openrtb.BidResponse, error) { - bidResponse := new(openrtb.BidResponse) +func (e *exchange) buildBidResponse(ctx context.Context, liveAdapters []openrtb_ext.BidderName, adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, bidRequest *openrtb2.BidRequest, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, bidResponseExt *openrtb_ext.ExtBidResponse, returnCreative bool, errList []error) (*openrtb2.BidResponse, error) { + bidResponse := new(openrtb2.BidResponse) var err error bidResponse.ID = bidRequest.ID if len(liveAdapters) == 0 { // signal "Invalid Request" if no valid bidders. - bidResponse.NBR = openrtb.NoBidReasonCode.Ptr(openrtb.NoBidReasonCodeInvalidRequest) + bidResponse.NBR = openrtb2.NoBidReasonCode.Ptr(openrtb2.NoBidReasonCodeInvalidRequest) } // Create the SeatBids. We use a zero sized slice so that we can append non-zero seat bids, and not include seatBid // objects for seatBids without any bids. Preallocate the max possible size to avoid reallocating the array as we go. - seatBids := make([]openrtb.SeatBid, 0, len(liveAdapters)) + seatBids := make([]openrtb2.SeatBid, 0, len(liveAdapters)) for _, a := range liveAdapters { //while processing every single bib, do we need to handle categories here? if adapterBids[a] != nil && len(adapterBids[a].bids) > 0 { @@ -552,7 +552,7 @@ func encodeBidResponseExt(bidResponseExt *openrtb_ext.ExtBidResponse) ([]byte, e return buffer.Bytes(), err } -func applyCategoryMapping(ctx context.Context, bidRequest *openrtb.BidRequest, requestExt *openrtb_ext.ExtRequest, seatBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, categoriesFetcher stored_requests.CategoryFetcher, targData *targetData) (map[string]string, map[openrtb_ext.BidderName]*pbsOrtbSeatBid, []string, error) { +func applyCategoryMapping(ctx context.Context, bidRequest *openrtb2.BidRequest, requestExt *openrtb_ext.ExtRequest, seatBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, categoriesFetcher stored_requests.CategoryFetcher, targData *targetData) (map[string]string, map[openrtb_ext.BidderName]*pbsOrtbSeatBid, []string, error) { res := make(map[string]string) type bidDedupe struct { @@ -564,7 +564,7 @@ func applyCategoryMapping(ctx context.Context, bidRequest *openrtb.BidRequest, r dedupe := make(map[string]bidDedupe) - impMap := make(map[string]*openrtb.Imp) + impMap := make(map[string]*openrtb2.Imp) // applyCategoryMapping doesn't get called unless // requestExt.Prebid.Targeting != nil && requestExt.Prebid.Targeting.IncludeBrandCategory != nil @@ -811,8 +811,8 @@ func (e *exchange) makeExtBidResponse(adapterBids map[openrtb_ext.BidderName]*pb // Return an openrtb seatBid for a bidder // BuildBidResponse is responsible for ensuring nil bid seatbids are not included -func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.BidderName, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, returnCreative bool) *openrtb.SeatBid { - seatBid := new(openrtb.SeatBid) +func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.BidderName, adapterExtra map[openrtb_ext.BidderName]*seatResponseExtra, auc *auction, returnCreative bool) *openrtb2.SeatBid { + seatBid := new(openrtb2.SeatBid) seatBid.Seat = adapter.String() // Prebid cannot support roadblocking seatBid.Group = 0 @@ -843,8 +843,8 @@ func (e *exchange) makeSeatBid(adapterBid *pbsOrtbSeatBid, adapter openrtb_ext.B } // Create the Bid array inside of SeatBid -func (e *exchange) makeBid(Bids []*pbsOrtbBid, auc *auction, returnCreative bool) ([]openrtb.Bid, []error) { - bids := make([]openrtb.Bid, 0, len(Bids)) +func (e *exchange) makeBid(Bids []*pbsOrtbBid, auc *auction, returnCreative bool) ([]openrtb2.Bid, []error) { + bids := make([]openrtb2.Bid, 0, len(Bids)) errList := make([]error, 0, 1) for _, thisBid := range Bids { bidExt := &openrtb_ext.ExtBid{ @@ -877,7 +877,7 @@ func (e *exchange) makeBid(Bids []*pbsOrtbBid, auc *auction, returnCreative bool return bids, errList } -// If bid got cached inside `(a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, bidRequest *openrtb.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string)`, +// If bid got cached inside `(a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, targData *targetData, bidRequest *openrtb2.BidRequest, ttlBuffer int64, defaultTTLs *config.DefaultTTLs, bidCategory map[string]string)`, // a UUID should be found inside `a.cacheIds` or `a.vastCacheIds`. This function returns the UUID along with the internal cache URL func (e *exchange) getBidCacheInfo(bid *pbsOrtbBid, auction *auction) (cacheInfo openrtb_ext.ExtBidPrebidCacheBids, found bool) { uuid, found := findCacheID(bid, auction) diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 6362741a6b8..d697bc6cd78 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -27,7 +27,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/file_fetcher" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/buger/jsonparser" "github.com/stretchr/testify/assert" "github.com/yudai/gojsondiff" @@ -70,7 +70,7 @@ func TestNewExchange(t *testing.T) { } } -// The objective is to get to execute e.buildBidResponse(ctx.Background(), liveA... ) (*openrtb.BidResponse, error) +// The objective is to get to execute e.buildBidResponse(ctx.Background(), liveA... ) (*openrtb2.BidResponse, error) // and check whether the returned request successfully prints any '&' characters as it should // To do so, we: // 1) Write the endpoint adapter URL with an '&' character into a new config,Configuration struct @@ -114,16 +114,16 @@ func TestCharacterEscape(t *testing.T) { adapterBids := make(map[openrtb_ext.BidderName]*pbsOrtbSeatBid, 1) adapterBids["appnexus"] = &pbsOrtbSeatBid{currency: "USD"} - //An openrtb.BidRequest struct as specified in https://github.com/PubMatic-OpenWrap/prebid-server/issues/465 - bidRequest := &openrtb.BidRequest{ + //An openrtb2.BidRequest struct as specified in https://github.com/PubMatic-OpenWrap/prebid-server/issues/465 + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 1}}}],"tmax": 500}`), @@ -154,7 +154,7 @@ func TestCharacterEscape(t *testing.T) { } // TestDebugBehaviour asserts the HttpCalls object is included inside the json "debug" field of the bidResponse extension when the -// openrtb.BidRequest "Test" value is set to 1 or the openrtb.BidRequest.Ext.Debug boolean field is set to true +// openrtb2.BidRequest "Test" value is set to 1 or the openrtb2.BidRequest.Ext.Debug boolean field is set to true func TestDebugBehaviour(t *testing.T) { // Define test cases @@ -240,15 +240,15 @@ func TestDebugBehaviour(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, } @@ -388,15 +388,15 @@ func TestTwoBiddersDebugDisabledAndEnabled(t *testing.T) { debugLog := DebugLog{} for _, testCase := range testCases { - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"telaria": {"placementId": 1}, "appnexus": {"placementid": 2}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, } @@ -583,7 +583,7 @@ func TestReturnCreativeEndToEnd(t *testing.T) { bidResponse: &adapters.BidderResponse{ Bids: []*adapters.TypedBid{ { - Bid: &openrtb.Bid{AdM: sampleAd}, + Bid: &openrtb2.Bid{AdM: sampleAd}, }, }, }, @@ -600,14 +600,14 @@ func TestReturnCreativeEndToEnd(t *testing.T) { e.categoriesFetcher = categoriesFetcher // Define mock incoming bid requeset - mockBidRequest := &openrtb.BidRequest{ + mockBidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 1}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, } // Run tests @@ -692,7 +692,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { liveAdapters := []openrtb_ext.BidderName{bidderName} //adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid, - bids := []*openrtb.Bid{ + bids := []*openrtb2.Bid{ { ID: "some-imp-id", ImpID: "", @@ -724,7 +724,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { }, } auc := &auction{ - cacheIds: map[*openrtb.Bid]string{ + cacheIds: map[*openrtb2.Bid]string{ bids[0]: testUUID, }, } @@ -758,14 +758,14 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { }, }, } - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", TMax: 1000, - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "test-div", - Secure: openrtb.Int8Ptr(0), - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}}}, + Secure: openrtb2.Int8Ptr(0), + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}}}, Ext: json.RawMessage(` { "rubicon": { "accountId": 1001, @@ -780,9 +780,9 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { }`), }, }, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Page: "http://rubitest.com/index.html", - Publisher: &openrtb.Publisher{ID: "1001"}, + Publisher: &openrtb2.Publisher{ID: "1001"}, }, Test: 1, Ext: json.RawMessage(`{"prebid": { "cache": { "bids": {}, "vastxml": {} }, "targeting": { "pricegranularity": "med", "includewinners": true, "includebidderkeys": false } }}`), @@ -796,11 +796,11 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { /* 5) Assert we have no errors and the bid response we expected*/ assert.NoError(t, err, "[TestGetBidCacheInfo] buildBidResponse() threw an error") - expectedBidResponse := &openrtb.BidResponse{ - SeatBid: []openrtb.SeatBid{ + expectedBidResponse := &openrtb2.BidResponse{ + SeatBid: []openrtb2.SeatBid{ { Seat: string(bidderName), - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ { Ext: json.RawMessage(`{ "prebid": { "cache": { "bids": { "cacheId": "` + testUUID + `", "url": "` + testExternalCacheScheme + `://` + testExternalCacheHost + `/` + testExternalCachePath + `?uuid=` + testUUID + `" }, "key": "", "url": "" }`), }, @@ -829,7 +829,7 @@ func TestGetBidCacheInfoEndToEnd(t *testing.T) { func TestBidReturnsCreative(t *testing.T) { sampleAd := "" - sampleOpenrtbBid := &openrtb.Bid{ID: "some-bid-id", AdM: sampleAd} + sampleOpenrtbBid := &openrtb2.Bid{ID: "some-bid-id", AdM: sampleAd} // Define test cases testCases := []struct { @@ -857,7 +857,7 @@ func TestBidReturnsCreative(t *testing.T) { bidTargets: map[string]string{}, }, } - sampleAuction := &auction{cacheIds: map[*openrtb.Bid]string{sampleOpenrtbBid: "CACHE_UUID_1234"}} + sampleAuction := &auction{cacheIds: map[*openrtb2.Bid]string{sampleOpenrtbBid: "CACHE_UUID_1234"}} noBidHandler := func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(204) } server := httptest.NewServer(http.HandlerFunc(noBidHandler)) @@ -896,7 +896,7 @@ func TestBidReturnsCreative(t *testing.T) { } func TestGetBidCacheInfo(t *testing.T) { - bid := &openrtb.Bid{ID: "42"} + bid := &openrtb2.Bid{ID: "42"} testCases := []struct { description string scheme string @@ -914,7 +914,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "https://prebid.org/cache?uuid=anyID", @@ -925,7 +925,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{vastCacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{vastCacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "https://prebid.org/cache?uuid=anyID", @@ -946,7 +946,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "prebid.org/cache?uuid=anyID", @@ -954,7 +954,7 @@ func TestGetBidCacheInfo(t *testing.T) { { description: "Host And Path Not Provided - Without Scheme", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "", @@ -963,7 +963,7 @@ func TestGetBidCacheInfo(t *testing.T) { description: "Host And Path Not Provided - With Scheme", scheme: "https", bid: &pbsOrtbBid{bid: bid}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: true, expectedCacheID: "anyID", expectedCacheURL: "", @@ -974,7 +974,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: nil, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: false, expectedCacheID: "", expectedCacheURL: "", @@ -985,7 +985,7 @@ func TestGetBidCacheInfo(t *testing.T) { host: "prebid.org", path: "cache", bid: &pbsOrtbBid{bid: nil}, - auction: &auction{cacheIds: map[*openrtb.Bid]string{bid: "anyID"}}, + auction: &auction{cacheIds: map[*openrtb2.Bid]string{bid: "anyID"}}, expectedFound: false, expectedCacheID: "", expectedCacheURL: "", @@ -1041,15 +1041,15 @@ func TestBidResponseCurrency(t *testing.T) { liveAdapters := make([]openrtb_ext.BidderName, 1) liveAdapters[0] = "appnexus" - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-impression-id", - Banner: &openrtb.Banner{Format: []openrtb.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, + Banner: &openrtb2.Banner{Format: []openrtb2.Format{{W: 300, H: 250}, {W: 300, H: 600}}}, Ext: json.RawMessage(`{"appnexus": {"placementId": 10433394}}`), }}, - Site: &openrtb.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, - Device: &openrtb.Device{UA: "curl/7.54.0", IP: "::1"}, + Site: &openrtb2.Site{Page: "prebid.org", Ext: json.RawMessage(`{"amp":0}`)}, + Device: &openrtb2.Device{UA: "curl/7.54.0", IP: "::1"}, AT: 1, TMax: 500, Ext: json.RawMessage(`{"id": "some-request-id","site": {"page": "prebid.org"},"imp": [{"id": "some-impression-id","banner": {"format": [{"w": 300,"h": 250},{"w": 300,"h": 600}]},"ext": {"appnexus": {"placementId": 10433394}}}],"tmax": 500}`), @@ -1061,7 +1061,7 @@ func TestBidResponseCurrency(t *testing.T) { var errList []error - sampleBid := &openrtb.Bid{ + sampleBid := &openrtb2.Bid{ ID: "some-imp-id", Price: 9.517803, W: 300, @@ -1069,10 +1069,10 @@ func TestBidResponseCurrency(t *testing.T) { Ext: nil, } aPbsOrtbBidArr := []*pbsOrtbBid{{bid: sampleBid, bidType: openrtb_ext.BidTypeBanner}} - sampleSeatBid := []openrtb.SeatBid{ + sampleSeatBid := []openrtb2.SeatBid{ { Seat: "appnexus", - Bid: []openrtb.Bid{ + Bid: []openrtb2.Bid{ { ID: "some-imp-id", Price: 9.517803, @@ -1083,13 +1083,13 @@ func TestBidResponseCurrency(t *testing.T) { }, }, } - emptySeatBid := []openrtb.SeatBid{} + emptySeatBid := []openrtb2.SeatBid{} // Test cases type aTest struct { description string adapterBids map[openrtb_ext.BidderName]*pbsOrtbSeatBid - expectedBidResponse *openrtb.BidResponse + expectedBidResponse *openrtb2.BidResponse } testCases := []aTest{ { @@ -1100,7 +1100,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "USD", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: sampleSeatBid, Cur: "USD", @@ -1116,7 +1116,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "USD", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: emptySeatBid, Cur: "", @@ -1132,7 +1132,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: sampleSeatBid, Cur: "", @@ -1148,7 +1148,7 @@ func TestBidResponseCurrency(t *testing.T) { currency: "", }, }, - expectedBidResponse: &openrtb.BidResponse{ + expectedBidResponse: &openrtb2.BidResponse{ ID: "some-request-id", SeatBid: emptySeatBid, Cur: "", @@ -1239,39 +1239,39 @@ func newCategoryFetcher(directory string) (stored_requests.CategoryFetcher, erro // newRaceCheckingRequest builds a BidRequest from all the params in the // adapters/{bidder}/{bidder}test/params/race/*.json files -func newRaceCheckingRequest(t *testing.T) *openrtb.BidRequest { +func newRaceCheckingRequest(t *testing.T) *openrtb2.BidRequest { dnt := int8(1) - return &openrtb.BidRequest{ - Site: &openrtb.Site{ + return &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ UA: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", IFA: "ifa", IP: "132.173.230.74", DNT: &dnt, Language: "EN", }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ COPPA: 1, Ext: json.RawMessage(`{"gdpr":1}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1281,7 +1281,7 @@ func newRaceCheckingRequest(t *testing.T) *openrtb.BidRequest { }, Ext: buildImpExt(t, "banner"), }, { - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: []string{"video/mp4"}, MinDuration: 1, MaxDuration: 300, @@ -1329,14 +1329,14 @@ func TestPanicRecovery(t *testing.T) { BidderName: "bidder1", BidderCoreName: "appnexus", BidderLabels: apnLabels, - BidRequest: &openrtb.BidRequest{ + BidRequest: &openrtb2.BidRequest{ ID: "b-1", }, }, { BidderName: "bidder2", BidderCoreName: "bidder2", - BidRequest: &openrtb.BidRequest{ + BidRequest: &openrtb2.BidRequest{ ID: "b-2", }, }, @@ -1405,23 +1405,23 @@ func TestPanicRecoveryHighLevel(t *testing.T) { e.adapterMap[openrtb_ext.BidderBeachfront] = panicingAdapter{} e.adapterMap[openrtb_ext.BidderAppnexus] = panicingAdapter{} - request := &openrtb.BidRequest{ - Site: &openrtb.Site{ + request := &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1612,7 +1612,7 @@ func runSpec(t *testing.T, filename string, spec *exchangeSpec) { } } -func findBiddersInAuction(t *testing.T, context string, req *openrtb.BidRequest) []string { +func findBiddersInAuction(t *testing.T, context string, req *openrtb2.BidRequest) []string { if splitImps, err := splitImps(req.Imp); err != nil { t.Errorf("%s: Failed to parse Bidders from request: %v", context, err) return nil @@ -1628,7 +1628,7 @@ func findBiddersInAuction(t *testing.T, context string, req *openrtb.BidRequest) // extractResponseTimes validates the format of bid.ext.responsetimemillis, and then removes it. // This is done because the response time will change from run to run, so it's impossible to hardcode a value // into the JSON. The best we can do is make sure that the property exists. -func extractResponseTimes(t *testing.T, context string, bid *openrtb.BidResponse) map[string]int { +func extractResponseTimes(t *testing.T, context string, bid *openrtb2.BidResponse) map[string]int { if data, dataType, _, err := jsonparser.Get(bid.Ext, "responsetimemillis"); err != nil || dataType != jsonparser.Object { t.Errorf("%s: Exchange did not return ext.responsetimemillis object: %v", context, err) return nil @@ -1764,7 +1764,7 @@ func TestCategoryMapping(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequest() targData := &targetData{ @@ -1780,10 +1780,10 @@ func TestCategoryMapping(t *testing.T) { cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -1821,7 +1821,7 @@ func TestCategoryMappingNoIncludeBrandCategory(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequestNoBrandCat() targData := &targetData{ @@ -1836,10 +1836,10 @@ func TestCategoryMappingNoIncludeBrandCategory(t *testing.T) { cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 40.0000, Cat: cats4, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -1877,7 +1877,7 @@ func TestCategoryMappingTranslateCategoriesNil(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequestTranslateCategories(nil) targData := &targetData{ @@ -1892,9 +1892,9 @@ func TestCategoryMappingTranslateCategoriesNil(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -1960,7 +1960,7 @@ func TestCategoryMappingTranslateCategoriesFalse(t *testing.T) { } translateCategories := false - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequestTranslateCategories(&translateCategories) targData := &targetData{ @@ -1975,9 +1975,9 @@ func TestCategoryMappingTranslateCategoriesFalse(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} cats3 := []string{"IAB1-1000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 20.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 30.0000, Cat: cats3, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 40}, nil, 0, false} @@ -2012,7 +2012,7 @@ func TestCategoryDedupe(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequest() targData := &targetData{ @@ -2026,11 +2026,11 @@ func TestCategoryDedupe(t *testing.T) { cats2 := []string{"IAB1-4"} // bid3 will be same price, category, and duration as bid1 so one of them should get removed cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 15.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} - bid5 := openrtb.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 20.0000, Cat: cats1, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 15.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} + bid5 := openrtb2.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 20.0000, Cat: cats1, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 50}, nil, 0, false} @@ -2093,7 +2093,7 @@ func TestNoCategoryDedupe(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequestNoBrandCat() targData := &targetData{ @@ -2106,11 +2106,11 @@ func TestNoCategoryDedupe(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} cats4 := []string{"IAB1-2000"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 14.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 14.0000, Cat: cats2, W: 1, H: 1} - bid3 := openrtb.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} - bid4 := openrtb.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} - bid5 := openrtb.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 14.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 14.0000, Cat: cats2, W: 1, H: 1} + bid3 := openrtb2.Bid{ID: "bid_id3", ImpID: "imp_id3", Price: 20.0000, Cat: cats1, W: 1, H: 1} + bid4 := openrtb2.Bid{ID: "bid_id4", ImpID: "imp_id4", Price: 20.0000, Cat: cats4, W: 1, H: 1} + bid5 := openrtb2.Bid{ID: "bid_id5", ImpID: "imp_id5", Price: 10.0000, Cat: cats1, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2175,7 +2175,7 @@ func TestCategoryMappingBidderName(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequest() requestExt.Prebid.Targeting.AppendBidderNames = true @@ -2190,8 +2190,8 @@ func TestCategoryMappingBidderName(t *testing.T) { cats1 := []string{"IAB1-1"} cats2 := []string{"IAB1-2"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 10.0000, Cat: cats2, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 10.0000, Cat: cats2, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2230,7 +2230,7 @@ func TestCategoryMappingBidderNameNoCategories(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequestNoBrandCat() requestExt.Prebid.Targeting.AppendBidderNames = true @@ -2245,8 +2245,8 @@ func TestCategoryMappingBidderNameNoCategories(t *testing.T) { cats1 := []string{"IAB1-1"} cats2 := []string{"IAB1-2"} - bid1 := openrtb.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bid2 := openrtb.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 12.0000, Cat: cats2, W: 1, H: 1} + bid1 := openrtb2.Bid{ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bid2 := openrtb2.Bid{ID: "bid_id2", ImpID: "imp_id2", Price: 12.0000, Cat: cats2, W: 1, H: 1} bid1_1 := pbsOrtbBid{&bid1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_2 := pbsOrtbBid{&bid2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2303,7 +2303,7 @@ func TestBidRejectionErrors(t *testing.T) { testCases := []struct { description string reqExt openrtb_ext.ExtRequest - bids []*openrtb.Bid + bids []*openrtb2.Bid duration int expectedRejections []string expectedCatDur string @@ -2311,7 +2311,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to not containing a category", reqExt: requestExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{}, W: 1, H: 1}, }, duration: 30, @@ -2322,7 +2322,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to missing category mapping file", reqExt: invalidReqExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, }, duration: 30, @@ -2333,7 +2333,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to duration exceeding maximum", reqExt: requestExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, }, duration: 70, @@ -2344,7 +2344,7 @@ func TestBidRejectionErrors(t *testing.T) { { description: "Bid should be rejected due to duplicate bid", reqExt: requestExt, - bids: []*openrtb.Bid{ + bids: []*openrtb2.Bid{ {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, {ID: "bid_id1", ImpID: "imp_id1", Price: 10.0000, Cat: []string{"IAB1-1"}, W: 1, H: 1}, }, @@ -2365,7 +2365,7 @@ func TestBidRejectionErrors(t *testing.T) { innerBids = append(innerBids, ¤tBid) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} seatBid := pbsOrtbSeatBid{innerBids, "USD", nil, nil} adapterBids[bidderName] = &seatBid @@ -2394,7 +2394,7 @@ func TestCategoryMappingTwoBiddersOneBidEachNoCategorySamePrice(t *testing.T) { t.Errorf("Failed to create a category Fetcher: %v", error) } - bidRequest := &openrtb.BidRequest{} + bidRequest := &openrtb2.BidRequest{} requestExt := newExtRequestTranslateCategories(nil) targData := &targetData{ @@ -2408,8 +2408,8 @@ func TestCategoryMappingTwoBiddersOneBidEachNoCategorySamePrice(t *testing.T) { cats1 := []string{"IAB1-3"} cats2 := []string{"IAB1-4"} - bidApn1 := openrtb.Bid{ID: "bid_idApn1", ImpID: "imp_idApn1", Price: 10.0000, Cat: cats1, W: 1, H: 1} - bidApn2 := openrtb.Bid{ID: "bid_idApn2", ImpID: "imp_idApn2", Price: 10.0000, Cat: cats2, W: 1, H: 1} + bidApn1 := openrtb2.Bid{ID: "bid_idApn1", ImpID: "imp_idApn1", Price: 10.0000, Cat: cats1, W: 1, H: 1} + bidApn2 := openrtb2.Bid{ID: "bid_idApn2", ImpID: "imp_idApn2", Price: 10.0000, Cat: cats2, W: 1, H: 1} bid1_Apn1 := pbsOrtbBid{&bidApn1, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} bid1_Apn2 := pbsOrtbBid{&bidApn2, "video", nil, &openrtb_ext.ExtBidPrebidVideo{Duration: 30}, nil, 0, false} @@ -2529,9 +2529,9 @@ func TestApplyDealSupport(t *testing.T) { bidderName := openrtb_ext.BidderName("appnexus") for _, test := range testCases { - bidRequest := &openrtb.BidRequest{ + bidRequest := &openrtb2.BidRequest{ ID: "some-request-id", - Imp: []openrtb.Imp{ + Imp: []openrtb2.Imp{ { ID: "imp_id1", Ext: test.impExt, @@ -2539,7 +2539,7 @@ func TestApplyDealSupport(t *testing.T) { }, } - bid := pbsOrtbBid{&openrtb.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} + bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} bidCategory := map[string]string{ bid.bid.ID: test.targ["hb_pb_cat_dur"], } @@ -2565,20 +2565,20 @@ func TestApplyDealSupport(t *testing.T) { func TestGetDealTiers(t *testing.T) { testCases := []struct { description string - request openrtb.BidRequest + request openrtb2.BidRequest expected map[string]openrtb_ext.DealTierBidderMap }{ { description: "None", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{}, + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{}, }, expected: map[string]openrtb_ext.DealTierBidderMap{}, }, { description: "One", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{ + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 5, "prefix": "tier"}}}`)}, }, }, @@ -2588,8 +2588,8 @@ func TestGetDealTiers(t *testing.T) { }, { description: "Many", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{ + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 5, "prefix": "tier1"}}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 8, "prefix": "tier2"}}}`)}, }, @@ -2601,8 +2601,8 @@ func TestGetDealTiers(t *testing.T) { }, { description: "Many - Skips Malformed", - request: openrtb.BidRequest{ - Imp: []openrtb.Imp{ + request: openrtb2.BidRequest{ + Imp: []openrtb2.Imp{ {ID: "imp1", Ext: json.RawMessage(`{"appnexus": {"dealTier": {"minDealTier": 5, "prefix": "tier1"}}}`)}, {ID: "imp2", Ext: json.RawMessage(`{"appnexus": {"dealTier": "wrong type"}}`)}, }, @@ -2706,7 +2706,7 @@ func TestUpdateHbPbCatDur(t *testing.T) { } for _, test := range testCases { - bid := pbsOrtbBid{&openrtb.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} + bid := pbsOrtbBid{&openrtb2.Bid{ID: "123456"}, "video", map[string]string{}, &openrtb_ext.ExtBidPrebidVideo{}, nil, test.dealPriority, false} bidCategory := map[string]string{ bid.bid.ID: test.targ["hb_pb_cat_dur"], } @@ -2748,7 +2748,7 @@ func TestRecordAdaptorDuplicateBidIDs(t *testing.T) { bidCount := 0 for ; bidCount < collisions; bidCount++ { bids = append(bids, &pbsOrtbBid{ - bid: &openrtb.Bid{ + bid: &openrtb2.Bid{ ID: testBidID, }, }) @@ -2776,12 +2776,12 @@ type exchangeSpec struct { } type exchangeRequest struct { - OrtbRequest openrtb.BidRequest `json:"ortbRequest"` + OrtbRequest openrtb2.BidRequest `json:"ortbRequest"` Usersyncs map[string]string `json:"usersyncs"` } type exchangeResponse struct { - Bids *openrtb.BidResponse `json:"bids"` + Bids *openrtb2.BidResponse `json:"bids"` Error string `json:"error,omitempty"` Ext json.RawMessage `json:"ext,omitempty"` } @@ -2793,7 +2793,7 @@ type bidderSpec struct { } type bidderRequest struct { - OrtbRequest openrtb.BidRequest `json:"ortbRequest"` + OrtbRequest openrtb2.BidRequest `json:"ortbRequest"` BidAdjustment float64 `json:"bidAdjustment"` } @@ -2813,7 +2813,7 @@ type bidderSeatBid struct { // bidderBid is basically a subset of pbsOrtbBid from exchange/bidder.go. // See the comment on bidderSeatBid for more info. type bidderBid struct { - Bid *openrtb.Bid `json:"ortbBid,omitempty"` + Bid *openrtb2.Bid `json:"ortbBid,omitempty"` Type string `json:"bidType,omitempty"` } @@ -2838,7 +2838,7 @@ type validatingBidder struct { mockResponses map[string]bidderResponse } -func (b *validatingBidder) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (seatBid *pbsOrtbSeatBid, errs []error) { +func (b *validatingBidder) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (seatBid *pbsOrtbSeatBid, errs []error) { if expectedRequest, ok := b.expectations[string(name)]; ok { if expectedRequest != nil { if expectedRequest.BidAdjustment != bidAdjustment { @@ -2881,7 +2881,7 @@ func (b *validatingBidder) requestBid(ctx context.Context, request *openrtb.BidR return } -func diffOrtbRequests(t *testing.T, description string, expected *openrtb.BidRequest, actual *openrtb.BidRequest) { +func diffOrtbRequests(t *testing.T, description string, expected *openrtb2.BidRequest, actual *openrtb2.BidRequest) { t.Helper() actualJSON, err := json.Marshal(actual) if err != nil { @@ -2896,7 +2896,7 @@ func diffOrtbRequests(t *testing.T, description string, expected *openrtb.BidReq diffJson(t, description, actualJSON, expectedJSON) } -func diffOrtbResponses(t *testing.T, description string, expected *openrtb.BidResponse, actual *openrtb.BidResponse) { +func diffOrtbResponses(t *testing.T, description string, expected *openrtb2.BidResponse, actual *openrtb2.BidResponse) { t.Helper() // The OpenRTB spec is wonky here. Since "bidresponse.seatbid" is an array, order technically matters to any JSON diff or // deep equals method. However, for all intents and purposes it really *doesn't* matter. ...so this nasty logic makes compares @@ -2919,8 +2919,8 @@ func diffOrtbResponses(t *testing.T, description string, expected *openrtb.BidRe diffJson(t, description, actualJSON, expectedJSON) } -func mapifySeatBids(t *testing.T, context string, seatBids []openrtb.SeatBid) map[string]*openrtb.SeatBid { - seatMap := make(map[string]*openrtb.SeatBid, len(seatBids)) +func mapifySeatBids(t *testing.T, context string, seatBids []openrtb2.SeatBid) map[string]*openrtb2.SeatBid { + seatMap := make(map[string]*openrtb2.SeatBid, len(seatBids)) for i := 0; i < len(seatBids); i++ { seatName := seatBids[i].Seat if _, ok := seatMap[seatName]; ok { @@ -3017,7 +3017,7 @@ func (e *mockUsersync) LiveSyncCount() int { type panicingAdapter struct{} -func (panicingAdapter) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (posb *pbsOrtbSeatBid, errs []error) { +func (panicingAdapter) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (posb *pbsOrtbSeatBid, errs []error) { panic("Panic! Panic! The world is ending!") } diff --git a/exchange/gdpr.go b/exchange/gdpr.go index 6b6a073bb23..03952ea8209 100644 --- a/exchange/gdpr.go +++ b/exchange/gdpr.go @@ -3,12 +3,12 @@ package exchange import ( "encoding/json" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/gdpr" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // ExtractGDPR will pull the gdpr flag from an openrtb request -func extractGDPR(bidRequest *openrtb.BidRequest) (gdpr.Signal, error) { +func extractGDPR(bidRequest *openrtb2.BidRequest) (gdpr.Signal, error) { var re regsExt var err error if bidRequest.Regs != nil && bidRequest.Regs.Ext != nil { @@ -21,7 +21,7 @@ func extractGDPR(bidRequest *openrtb.BidRequest) (gdpr.Signal, error) { } // ExtractConsent will pull the consent string from an openrtb request -func extractConsent(bidRequest *openrtb.BidRequest) (consent string, err error) { +func extractConsent(bidRequest *openrtb2.BidRequest) (consent string, err error) { var ue userExt if bidRequest.User != nil && bidRequest.User.Ext != nil { err = json.Unmarshal(bidRequest.User.Ext, &ue) diff --git a/exchange/gdpr_test.go b/exchange/gdpr_test.go index e767c269b3b..e11b6782aa7 100644 --- a/exchange/gdpr_test.go +++ b/exchange/gdpr_test.go @@ -4,31 +4,31 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/gdpr" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) func TestExtractGDPR(t *testing.T) { tests := []struct { description string - giveRegs *openrtb.Regs + giveRegs *openrtb2.Regs wantGDPR gdpr.Signal wantError bool }{ { description: "Regs Ext GDPR = 0", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": 0}`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"gdpr": 0}`)}, wantGDPR: gdpr.SignalNo, }, { description: "Regs Ext GDPR = 1", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": 1}`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"gdpr": 1}`)}, wantGDPR: gdpr.SignalYes, }, { description: "Regs Ext GDPR = null", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": null}`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"gdpr": null}`)}, wantGDPR: gdpr.SignalAmbiguous, }, { @@ -38,19 +38,19 @@ func TestExtractGDPR(t *testing.T) { }, { description: "Regs Ext is nil", - giveRegs: &openrtb.Regs{Ext: nil}, + giveRegs: &openrtb2.Regs{Ext: nil}, wantGDPR: gdpr.SignalAmbiguous, }, { description: "JSON unmarshal error", - giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"`)}, + giveRegs: &openrtb2.Regs{Ext: json.RawMessage(`{"`)}, wantGDPR: gdpr.SignalAmbiguous, wantError: true, }, } for _, tt := range tests { - bidReq := openrtb.BidRequest{ + bidReq := openrtb2.BidRequest{ Regs: tt.giveRegs, } @@ -68,23 +68,23 @@ func TestExtractGDPR(t *testing.T) { func TestExtractConsent(t *testing.T) { tests := []struct { description string - giveUser *openrtb.User + giveUser *openrtb2.User wantConsent string wantError bool }{ { description: "User Ext Consent is not empty", - giveUser: &openrtb.User{Ext: json.RawMessage(`{"consent": "BOS2bx5OS2bx5ABABBAAABoAAAAAFA"}`)}, + giveUser: &openrtb2.User{Ext: json.RawMessage(`{"consent": "BOS2bx5OS2bx5ABABBAAABoAAAAAFA"}`)}, wantConsent: "BOS2bx5OS2bx5ABABBAAABoAAAAAFA", }, { description: "User Ext Consent is empty", - giveUser: &openrtb.User{Ext: json.RawMessage(`{"consent": ""}`)}, + giveUser: &openrtb2.User{Ext: json.RawMessage(`{"consent": ""}`)}, wantConsent: "", }, { description: "User Ext is nil", - giveUser: &openrtb.User{Ext: nil}, + giveUser: &openrtb2.User{Ext: nil}, wantConsent: "", }, { @@ -94,14 +94,14 @@ func TestExtractConsent(t *testing.T) { }, { description: "JSON unmarshal error", - giveUser: &openrtb.User{Ext: json.RawMessage(`{`)}, + giveUser: &openrtb2.User{Ext: json.RawMessage(`{`)}, wantConsent: "", wantError: true, }, } for _, tt := range tests { - bidReq := openrtb.BidRequest{ + bidReq := openrtb2.BidRequest{ User: tt.giveUser, } diff --git a/exchange/legacy.go b/exchange/legacy.go index dac7c7b59f6..b3b9e32e6e0 100644 --- a/exchange/legacy.go +++ b/exchange/legacy.go @@ -6,13 +6,13 @@ import ( "errors" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/currency" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/PubMatic-OpenWrap/prebid-server/usersync" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // AdaptLegacyAdapter turns a bidder.Adapter into an adaptedBidder. @@ -34,7 +34,7 @@ type adaptedAdapter struct { // // This is not ideal. OpenRTB provides a superset of the legacy data structures. // For requests which use those features, the best we can do is respond with "no bid". -func (bidder *adaptedAdapter) requestBid(ctx context.Context, request *openrtb.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { +func (bidder *adaptedAdapter) requestBid(ctx context.Context, request *openrtb2.BidRequest, name openrtb_ext.BidderName, bidAdjustment float64, conversions currency.Conversions, reqInfo *adapters.ExtraRequestInfo, accountDebugAllowed bool) (*pbsOrtbSeatBid, []error) { legacyRequest, legacyBidder, errs := bidder.toLegacyAdapterInputs(request, name) if legacyRequest == nil || legacyBidder == nil { return nil, errs @@ -59,7 +59,7 @@ func (bidder *adaptedAdapter) requestBid(ctx context.Context, request *openrtb.B // toLegacyAdapterInputs is a best-effort transformation of an OpenRTB BidRequest into the args needed to run a legacy Adapter. // If the OpenRTB request is too complex, it fails with an error. // If the error is nil, then the PBSRequest and PBSBidder are valid. -func (bidder *adaptedAdapter) toLegacyAdapterInputs(req *openrtb.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSRequest, *pbs.PBSBidder, []error) { +func (bidder *adaptedAdapter) toLegacyAdapterInputs(req *openrtb2.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSRequest, *pbs.PBSBidder, []error) { legacyReq, err := bidder.toLegacyRequest(req) if err != nil { return nil, nil, []error{err} @@ -73,7 +73,7 @@ func (bidder *adaptedAdapter) toLegacyAdapterInputs(req *openrtb.BidRequest, nam return legacyReq, legacyBidder, errs } -func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb.BidRequest) (*pbs.PBSRequest, error) { +func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb2.BidRequest) (*pbs.PBSRequest, error) { acctId, err := toAccountId(req) if err != nil { return nil, err @@ -135,7 +135,7 @@ func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb.BidRequest) (*pbs.PBS App: req.App, Device: req.Device, // PBSUser is excluded because rubicon is the only adapter which reads from it, and they're supporting OpenRTB directly - // SDK is excluded because that information doesn't exist in OpenRTB. + // SDK is excluded because that information doesn't exist in openrtb2. // Bidders is excluded because no legacy adapters read from it User: req.User, Cookie: cookie, @@ -146,7 +146,7 @@ func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb.BidRequest) (*pbs.PBS }, nil } -func toAccountId(req *openrtb.BidRequest) (string, error) { +func toAccountId(req *openrtb2.BidRequest) (string, error) { if req.Site != nil && req.Site.Publisher != nil { return req.Site.Publisher.ID, nil } @@ -156,14 +156,14 @@ func toAccountId(req *openrtb.BidRequest) (string, error) { return "", errors.New("bidrequest.site.publisher.id or bidrequest.app.publisher.id required for legacy bidders.") } -func toTransactionId(req *openrtb.BidRequest) (string, error) { +func toTransactionId(req *openrtb2.BidRequest) (string, error) { if req.Source != nil { return req.Source.TID, nil } return "", errors.New("bidrequest.source.tid required for legacy bidders.") } -func toSecure(req *openrtb.BidRequest) (secure int8, err error) { +func toSecure(req *openrtb2.BidRequest) (secure int8, err error) { secure = -1 for _, imp := range req.Imp { if imp.Secure != nil { @@ -190,7 +190,7 @@ func toSecure(req *openrtb.BidRequest) (secure int8, err error) { return } -func toLegacyBidder(req *openrtb.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSBidder, []error) { +func toLegacyBidder(req *openrtb2.BidRequest, name openrtb_ext.BidderName) (*pbs.PBSBidder, []error) { adUnits, errs := toPBSAdUnits(req) if len(adUnits) > 0 { return &pbs.PBSBidder{ @@ -211,7 +211,7 @@ func toLegacyBidder(req *openrtb.BidRequest, name openrtb_ext.BidderName) (*pbs. } } -func toPBSAdUnits(req *openrtb.BidRequest) ([]pbs.PBSAdUnit, []error) { +func toPBSAdUnits(req *openrtb2.BidRequest) ([]pbs.PBSAdUnit, []error) { adUnits := make([]pbs.PBSAdUnit, len(req.Imp)) var errs []error = nil nextAdUnit := 0 @@ -226,8 +226,8 @@ func toPBSAdUnits(req *openrtb.BidRequest) ([]pbs.PBSAdUnit, []error) { return adUnits[:nextAdUnit], errs } -func initPBSAdUnit(imp *openrtb.Imp, adUnit *pbs.PBSAdUnit) error { - var sizes []openrtb.Format = nil +func initPBSAdUnit(imp *openrtb2.Imp, adUnit *pbs.PBSAdUnit) error { + var sizes []openrtb2.Format = nil video := pbs.PBSVideo{} if imp.Video != nil { @@ -251,7 +251,7 @@ func initPBSAdUnit(imp *openrtb.Imp, adUnit *pbs.PBSAdUnit) error { } // Fixes #360 if imp.Video.W != 0 && imp.Video.H != 0 { - sizes = append(sizes, openrtb.Format{ + sizes = append(sizes, openrtb2.Format{ W: imp.Video.W, H: imp.Video.H, }) @@ -333,12 +333,12 @@ func transformBid(legacyBid *pbs.PBSBid) (*pbsOrtbBid, error) { }, nil } -func transformBidToOrtb(legacyBid *pbs.PBSBid) *openrtb.Bid { - return &openrtb.Bid{ +func transformBidToOrtb(legacyBid *pbs.PBSBid) *openrtb2.Bid { + return &openrtb2.Bid{ ID: legacyBid.BidID, ImpID: legacyBid.AdUnitCode, CrID: legacyBid.Creative_id, - // legacyBid.CreativeMediaType is handled by transformBid(), because it doesn't exist on the openrtb.Bid + // legacyBid.CreativeMediaType is handled by transformBid(), because it doesn't exist on the openrtb2.Bid // legacyBid.BidderCode is handled by the exchange, which already knows which bidder we are. // legacyBid.BidHash is ignored, because it doesn't get sent in the response anyway Price: legacyBid.Price, diff --git a/exchange/legacy_test.go b/exchange/legacy_test.go index 2474fda50e1..a3f282acc72 100644 --- a/exchange/legacy_test.go +++ b/exchange/legacy_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/currency" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" @@ -17,38 +16,39 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/usersync" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) func TestSiteVideo(t *testing.T) { - ortbRequest := &openrtb.BidRequest{ + ortbRequest := &openrtb2.BidRequest{ ID: "request-id", TMax: 1000, - Site: &openrtb.Site{ + Site: &openrtb2.Site{ Page: "http://www.site.com", Domain: "site.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "host-id", BuyerUID: "bidder-id", }, Test: 1, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Video: &openrtb.Video{ + Video: &openrtb2.Video{ MIMEs: []string{"video/mp4"}, MinDuration: 20, MaxDuration: 40, - Protocols: []openrtb.Protocol{openrtb.ProtocolVAST10}, - StartDelay: openrtb.StartDelayGenericMidRoll.Ptr(), + Protocols: []openrtb2.Protocol{openrtb2.ProtocolVAST10}, + StartDelay: openrtb2.StartDelayGenericMidRoll.Ptr(), }, - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -85,7 +85,7 @@ func TestSiteVideo(t *testing.T) { func TestAppBanner(t *testing.T) { ortbRequest := newAppOrtbRequest() ortbRequest.TMax = 1000 - ortbRequest.User = &openrtb.User{ + ortbRequest.User = &openrtb2.User{ ID: "host-id", BuyerUID: "bidder-id", } @@ -187,8 +187,8 @@ func TestBidTransforms(t *testing.T) { func TestInsecureImps(t *testing.T) { insecure := int8(0) - bidReq := &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ + bidReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ Secure: &insecure, }, { Secure: &insecure, @@ -205,8 +205,8 @@ func TestInsecureImps(t *testing.T) { func TestSecureImps(t *testing.T) { secure := int8(1) - bidReq := &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ + bidReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ Secure: &secure, }, { Secure: &secure, @@ -224,8 +224,8 @@ func TestSecureImps(t *testing.T) { func TestMixedSecureImps(t *testing.T) { insecure := int8(0) secure := int8(1) - bidReq := &openrtb.BidRequest{ - Imp: []openrtb.Imp{{ + bidReq := &openrtb2.BidRequest{ + Imp: []openrtb2.Imp{{ Secure: &insecure, }, { Secure: &secure, @@ -237,21 +237,21 @@ func TestMixedSecureImps(t *testing.T) { } } -func newAppOrtbRequest() *openrtb.BidRequest { - return &openrtb.BidRequest{ +func newAppOrtbRequest() *openrtb2.BidRequest { + return &openrtb2.BidRequest{ ID: "request-id", - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -262,20 +262,20 @@ func newAppOrtbRequest() *openrtb.BidRequest { } func TestErrorResponse(t *testing.T) { - ortbRequest := &openrtb.BidRequest{ + ortbRequest := &openrtb2.BidRequest{ ID: "request-id", - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -300,20 +300,20 @@ func TestErrorResponse(t *testing.T) { } func TestWithTargeting(t *testing.T) { - ortbRequest := &openrtb.BidRequest{ + ortbRequest := &openrtb2.BidRequest{ ID: "request-id", - App: &openrtb.App{ - Publisher: &openrtb.Publisher{ + App: &openrtb2.App{ + Publisher: &openrtb2.Publisher{ ID: "b1c81a38-1415-42b7-8238-0d2d64016c27", }, }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "transaction-id", }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }}, @@ -343,7 +343,7 @@ func TestWithTargeting(t *testing.T) { // assertEquivalentFields compares the OpenRTB request with the legacy request, using the mappings defined here: // https://gist.github.com/dbemiller/68aa3387189fa17d3addfb9818dd4d97 -func assertEquivalentRequests(t *testing.T, req *openrtb.BidRequest, legacy *pbs.PBSRequest) { +func assertEquivalentRequests(t *testing.T, req *openrtb2.BidRequest, legacy *pbs.PBSRequest) { if req.Site != nil { if req.Site.Publisher.ID != legacy.AccountID { t.Errorf("Account ID did not translate. OpenRTB: %s, Legacy: %s.", req.Site.Publisher.ID, legacy.AccountID) @@ -399,7 +399,7 @@ func assertEquivalentRequests(t *testing.T, req *openrtb.BidRequest, legacy *pbs } } -func assertEquivalentBidder(t *testing.T, req *openrtb.BidRequest, legacy *pbs.PBSBidder) { +func assertEquivalentBidder(t *testing.T, req *openrtb2.BidRequest, legacy *pbs.PBSBidder) { if len(req.Imp) != len(legacy.AdUnits) { t.Errorf("Wrong number of Imps. Expected %d, got %d", len(req.Imp), len(legacy.AdUnits)) return @@ -409,7 +409,7 @@ func assertEquivalentBidder(t *testing.T, req *openrtb.BidRequest, legacy *pbs.P } } -func assertEquivalentImp(t *testing.T, index int, imp *openrtb.Imp, legacy *pbs.PBSAdUnit) { +func assertEquivalentImp(t *testing.T, index int, imp *openrtb2.Imp, legacy *pbs.PBSAdUnit) { if imp.ID != legacy.BidID { t.Errorf("imp[%d].id did not translate. OpenRTB %s, legacy %s", index, imp.ID, legacy.BidID) } diff --git a/exchange/targeting.go b/exchange/targeting.go index 31db7114f67..33f72b675b3 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -3,8 +3,8 @@ package exchange import ( "strconv" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const MaxKeyLength = 20 @@ -91,9 +91,9 @@ func (targData *targetData) addKeys(keys map[string]string, key openrtb_ext.Targ } } -func makeHbSize(bid *openrtb.Bid) string { +func makeHbSize(bid *openrtb2.Bid) string { if bid.W != 0 && bid.H != 0 { - return strconv.FormatUint(bid.W, 10) + "x" + strconv.FormatUint(bid.H, 10) + return strconv.FormatInt(bid.W, 10) + "x" + strconv.FormatInt(bid.H, 10) } return "" } diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index e6db921529c..4a2b27e4619 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -16,14 +16,14 @@ import ( metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" metricsConfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/adapters" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) // Using this set of bids in more than one test -var mockBids = map[openrtb_ext.BidderName][]*openrtb.Bid{ +var mockBids = map[openrtb_ext.BidderName][]*openrtb2.Bid{ openrtb_ext.BidderAppnexus: {{ ID: "losing-bid", ImpID: "some-imp", @@ -67,7 +67,7 @@ func TestTargetingCache(t *testing.T) { } -func assertKeyExists(t *testing.T, bid *openrtb.Bid, key string, expected bool) { +func assertKeyExists(t *testing.T, bid *openrtb2.Bid, key string, expected bool) { t.Helper() targets := parseTargets(t, bid) if _, ok := targets[key]; ok != expected { @@ -77,7 +77,7 @@ func assertKeyExists(t *testing.T, bid *openrtb.Bid, key string, expected bool) // runAuction takes a bunch of mock bids by Bidder and runs an auction. It returns a map of Bids indexed by their ImpID. // If includeCache is true, the auction will be run with cacheing as well, so the cache targeting keys should exist. -func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid, includeCache bool, includeWinners bool, includeBidderKeys bool, isApp bool) map[string]*openrtb.Bid { +func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb2.Bid, includeCache bool, includeWinners bool, includeBidderKeys bool, isApp bool) map[string]*openrtb2.Bid { server := httptest.NewServer(http.HandlerFunc(mockServer)) defer server.Close() @@ -99,14 +99,14 @@ func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*op imps := buildImps(t, mockBids) - req := &openrtb.BidRequest{ + req := &openrtb2.BidRequest{ Imp: imps, Ext: buildTargetingExt(includeCache, includeWinners, includeBidderKeys), } if isApp { - req.App = &openrtb.App{} + req.App = &openrtb2.App{} } else { - req.Site = &openrtb.Site{} + req.Site = &openrtb2.Site{} } auctionRequest := AuctionRequest{ @@ -128,7 +128,7 @@ func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*op return buildBidMap(bidResp.SeatBid, len(mockBids)) } -func buildBidderList(bids map[openrtb_ext.BidderName][]*openrtb.Bid) []openrtb_ext.BidderName { +func buildBidderList(bids map[openrtb_ext.BidderName][]*openrtb2.Bid) []openrtb_ext.BidderName { bidders := make([]openrtb_ext.BidderName, 0, len(bids)) for name := range bids { bidders = append(bidders, name) @@ -136,7 +136,7 @@ func buildBidderList(bids map[openrtb_ext.BidderName][]*openrtb.Bid) []openrtb_e return bidders } -func buildAdapterMap(bids map[openrtb_ext.BidderName][]*openrtb.Bid, mockServerURL string, client *http.Client) map[openrtb_ext.BidderName]adaptedBidder { +func buildAdapterMap(bids map[openrtb_ext.BidderName][]*openrtb2.Bid, mockServerURL string, client *http.Client) map[openrtb_ext.BidderName]adaptedBidder { adapterMap := make(map[openrtb_ext.BidderName]adaptedBidder, len(bids)) for bidder, bids := range bids { adapterMap[bidder] = adaptBidder(&mockTargetingBidder{ @@ -166,7 +166,7 @@ func buildTargetingExt(includeCache bool, includeWinners bool, includeBidderKeys return json.RawMessage(`{"prebid":{"targeting":` + targeting + `}}`) } -func buildParams(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) json.RawMessage { +func buildParams(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb2.Bid) json.RawMessage { params := make(map[string]json.RawMessage) for bidder := range mockBids { params[string(bidder)] = json.RawMessage(`{"whatever":true}`) @@ -178,7 +178,7 @@ func buildParams(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bi return ext } -func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) []openrtb.Imp { +func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb2.Bid) []openrtb2.Imp { impExt := buildParams(t, mockBids) var s struct{} @@ -189,9 +189,9 @@ func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) } } - imps := make([]openrtb.Imp, 0, len(impIds)) + imps := make([]openrtb2.Imp, 0, len(impIds)) for impId := range impIds { - imps = append(imps, openrtb.Imp{ + imps = append(imps, openrtb2.Imp{ ID: impId, Ext: impExt, }) @@ -199,8 +199,8 @@ func buildImps(t *testing.T, mockBids map[openrtb_ext.BidderName][]*openrtb.Bid) return imps } -func buildBidMap(seatBids []openrtb.SeatBid, numBids int) map[string]*openrtb.Bid { - bids := make(map[string]*openrtb.Bid, numBids) +func buildBidMap(seatBids []openrtb2.SeatBid, numBids int) map[string]*openrtb2.Bid { + bids := make(map[string]*openrtb2.Bid, numBids) for _, seatBid := range seatBids { for i := 0; i < len(seatBid.Bid); i++ { bid := seatBid.Bid[i] @@ -210,7 +210,7 @@ func buildBidMap(seatBids []openrtb.SeatBid, numBids int) map[string]*openrtb.Bi return bids } -func parseTargets(t *testing.T, bid *openrtb.Bid) map[string]string { +func parseTargets(t *testing.T, bid *openrtb2.Bid) map[string]string { t.Helper() var parsed openrtb_ext.ExtBid if err := json.Unmarshal(bid.Ext, &parsed); err != nil { @@ -221,10 +221,10 @@ func parseTargets(t *testing.T, bid *openrtb.Bid) map[string]string { type mockTargetingBidder struct { mockServerURL string - bids []*openrtb.Bid + bids []*openrtb2.Bid } -func (m *mockTargetingBidder) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (m *mockTargetingBidder) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { return []*adapters.RequestData{{ Method: "POST", Uri: m.mockServerURL, @@ -233,7 +233,7 @@ func (m *mockTargetingBidder) MakeRequests(request *openrtb.BidRequest, reqInfo }}, nil } -func (m *mockTargetingBidder) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (m *mockTargetingBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { bidResponse := &adapters.BidderResponse{ Bids: make([]*adapters.TypedBid, len(m.bids)), } @@ -259,15 +259,15 @@ type TargetingTestData struct { ExpectedBidTargetsByBidder map[string]map[openrtb_ext.BidderName]map[string]string } -var bid123 *openrtb.Bid = &openrtb.Bid{ +var bid123 *openrtb2.Bid = &openrtb2.Bid{ Price: 1.23, } -var bid111 *openrtb.Bid = &openrtb.Bid{ +var bid111 *openrtb2.Bid = &openrtb2.Bid{ Price: 1.11, DealID: "mydeal", } -var bid084 *openrtb.Bid = &openrtb.Bid{ +var bid084 *openrtb2.Bid = &openrtb2.Bid{ Price: 0.84, } @@ -396,7 +396,7 @@ var TargetingTests []TargetingTestData = []TargetingTestData{ }, }, }, - cacheIds: map[*openrtb.Bid]string{ + cacheIds: map[*openrtb2.Bid]string{ bid123: "55555", bid111: "cacheme", }, diff --git a/exchange/utils.go b/exchange/utils.go index 13de8ab4f5b..17041295fd8 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -8,7 +8,6 @@ import ( "github.com/prebid/go-gdpr/vendorconsent" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/gdpr" "github.com/PubMatic-OpenWrap/prebid-server/metrics" @@ -17,6 +16,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" "github.com/PubMatic-OpenWrap/prebid-server/privacy/lmt" "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) var integrationTypeMap = map[metrics.RequestType]config.IntegrationType{ @@ -152,7 +152,7 @@ func ccpaEnabled(account *config.Account, privacyConfig config.Privacy, requestT return privacyConfig.CCPA.Enforce } -func extractCCPA(orig *openrtb.BidRequest, privacyConfig config.Privacy, account *config.Account, aliases map[string]string, requestType config.IntegrationType) (privacy.PolicyEnforcer, error) { +func extractCCPA(orig *openrtb2.BidRequest, privacyConfig config.Privacy, account *config.Account, aliases map[string]string, requestType config.IntegrationType) (privacy.PolicyEnforcer, error) { ccpaPolicy, err := ccpa.ReadFromRequest(orig) if err != nil { return privacy.NilPolicyEnforcer{}, err @@ -171,7 +171,7 @@ func extractCCPA(orig *openrtb.BidRequest, privacyConfig config.Privacy, account return ccpaEnforcer, nil } -func extractLMT(orig *openrtb.BidRequest, privacyConfig config.Privacy) privacy.PolicyEnforcer { +func extractLMT(orig *openrtb2.BidRequest, privacyConfig config.Privacy) privacy.PolicyEnforcer { return privacy.EnabledPolicyEnforcer{ Enabled: privacyConfig.LMT.Enforce, PolicyEnforcer: lmt.ReadFromRequest(orig), @@ -203,7 +203,7 @@ func getBidderExts(reqExt *openrtb_ext.ExtRequest) (map[string]map[string]interf func getAuctionBidderRequests(req AuctionRequest, requestExt *openrtb_ext.ExtRequest, - impsByBidder map[string][]openrtb.Imp, + impsByBidder map[string][]openrtb2.Imp, aliases map[string]string) ([]BidderRequest, []error) { bidderRequests := make([]BidderRequest, 0, len(impsByBidder)) @@ -286,7 +286,7 @@ func getAuctionBidderRequests(req AuctionRequest, return bidderRequests, errs } -func getExtJson(req *openrtb.BidRequest, unpackedExt *openrtb_ext.ExtRequest) (json.RawMessage, error) { +func getExtJson(req *openrtb2.BidRequest, unpackedExt *openrtb_ext.ExtRequest) (json.RawMessage, error) { if len(req.Ext) == 0 || unpackedExt == nil { return json.RawMessage(``), nil } @@ -296,7 +296,7 @@ func getExtJson(req *openrtb.BidRequest, unpackedExt *openrtb_ext.ExtRequest) (j return json.Marshal(extCopy) } -func prepareSource(req *openrtb.BidRequest, bidder string, sChainsByBidder map[string]*openrtb_ext.ExtRequestPrebidSChainSChain) { +func prepareSource(req *openrtb2.BidRequest, bidder string, sChainsByBidder map[string]*openrtb_ext.ExtRequestPrebidSChainSChain) { const sChainWildCard = "*" var selectedSChain *openrtb_ext.ExtRequestPrebidSChainSChain @@ -316,7 +316,7 @@ func prepareSource(req *openrtb.BidRequest, bidder string, sChainsByBidder map[s // set source if req.Source == nil { - req.Source = &openrtb.Source{} + req.Source = &openrtb2.Source{} } schain := openrtb_ext.ExtRequestPrebidSChain{ SChain: *selectedSChain, @@ -329,7 +329,7 @@ func prepareSource(req *openrtb.BidRequest, bidder string, sChainsByBidder map[s // extractBuyerUIDs parses the values from user.ext.prebid.buyeruids, and then deletes those values from the ext. // This prevents a Bidder from using these values to figure out who else is involved in the Auction. -func extractBuyerUIDs(user *openrtb.User) (map[string]string, error) { +func extractBuyerUIDs(user *openrtb2.User) (map[string]string, error) { if user == nil { return nil, nil } @@ -371,13 +371,13 @@ func extractBuyerUIDs(user *openrtb.User) (map[string]string, error) { // The "imp.ext" value of the rubicon Imp will only contain the "prebid" values, and "rubicon" value at the "bidder" key. // // The goal here is so that Bidders only get Imps and Imp.Ext values which are intended for them. -func splitImps(imps []openrtb.Imp) (map[string][]openrtb.Imp, []error) { +func splitImps(imps []openrtb2.Imp) (map[string][]openrtb2.Imp, []error) { impExts, err := parseImpExts(imps) if err != nil { return nil, []error{err} } - splitImps := make(map[string][]openrtb.Imp, len(imps)) + splitImps := make(map[string][]openrtb2.Imp, len(imps)) var errList []error for i := 0; i < len(imps); i++ { @@ -414,11 +414,11 @@ func splitImps(imps []openrtb.Imp) (map[string][]openrtb.Imp, []error) { // sanitizedImpCopy returns a copy of imp with its ext filtered so that only "prebid", "context", and bidder params exist. // It will not mutate the input imp. // This function will write the new imps to the output map passed in -func sanitizedImpCopy(imp *openrtb.Imp, +func sanitizedImpCopy(imp *openrtb2.Imp, bidderExts map[string]json.RawMessage, rawPrebidExt json.RawMessage, firstPartyDataContext json.RawMessage, - out *map[string][]openrtb.Imp) []error { + out *map[string][]openrtb2.Imp) []error { var prebidExt map[string]json.RawMessage var errs []error @@ -478,7 +478,7 @@ func sanitizedImpCopy(imp *openrtb.Imp, // // In this function, "givenBidder" may or may not be an alias. "coreBidder" must *not* be an alias. // It returns true if a Cookie User Sync existed, and false otherwise. -func prepareUser(req *openrtb.BidRequest, givenBidder string, coreBidder openrtb_ext.BidderName, explicitBuyerUIDs map[string]string, usersyncs IdFetcher) bool { +func prepareUser(req *openrtb2.BidRequest, givenBidder string, coreBidder openrtb_ext.BidderName, explicitBuyerUIDs map[string]string, usersyncs IdFetcher) bool { cookieId, hadCookie := usersyncs.GetId(coreBidder) if id, ok := explicitBuyerUIDs[givenBidder]; ok { @@ -492,9 +492,9 @@ func prepareUser(req *openrtb.BidRequest, givenBidder string, coreBidder openrtb // copyWithBuyerUID either overwrites the BuyerUID property on user with the argument, or returns // a new (empty) User with the BuyerUID already set. -func copyWithBuyerUID(user *openrtb.User, buyerUID string) *openrtb.User { +func copyWithBuyerUID(user *openrtb2.User, buyerUID string) *openrtb2.User { if user == nil { - return &openrtb.User{ + return &openrtb2.User{ BuyerUID: buyerUID, } } @@ -507,7 +507,7 @@ func copyWithBuyerUID(user *openrtb.User, buyerUID string) *openrtb.User { } // removeUnpermissionedEids modifies the request to remove any request.user.ext.eids not permissions for the specific bidder -func removeUnpermissionedEids(request *openrtb.BidRequest, bidder string, requestExt *openrtb_ext.ExtRequest) error { +func removeUnpermissionedEids(request *openrtb2.BidRequest, bidder string, requestExt *openrtb_ext.ExtRequest) error { // ensure request might have eids (as much as we can check before unmarshalling) if request.User == nil || len(request.User.Ext) == 0 { return nil @@ -594,7 +594,7 @@ func removeUnpermissionedEids(request *openrtb.BidRequest, bidder string, reques return nil } -func setUserExtWithCopy(request *openrtb.BidRequest, userExtJSON json.RawMessage) { +func setUserExtWithCopy(request *openrtb2.BidRequest, userExtJSON json.RawMessage) { userCopy := *request.User userCopy.Ext = userExtJSON request.User = &userCopy @@ -610,7 +610,7 @@ func resolveBidder(bidder string, aliases map[string]string) openrtb_ext.BidderN // parseImpExts does a partial-unmarshal of the imp[].Ext field. // The keys in the returned map are expected to be "prebid", "context", CoreBidderNames, or Aliases for this request. -func parseImpExts(imps []openrtb.Imp) ([]map[string]json.RawMessage, error) { +func parseImpExts(imps []openrtb2.Imp) ([]map[string]json.RawMessage, error) { exts := make([]map[string]json.RawMessage, len(imps)) // Loop over every impression in the request for i := 0; i < len(imps); i++ { @@ -624,7 +624,7 @@ func parseImpExts(imps []openrtb.Imp) ([]map[string]json.RawMessage, error) { } // parseAliases parses the aliases from the BidRequest -func parseAliases(orig *openrtb.BidRequest) (map[string]string, []error) { +func parseAliases(orig *openrtb2.BidRequest) (map[string]string, []error) { var aliases map[string]string if value, dataType, _, err := jsonparser.Get(orig.Ext, openrtb_ext.PrebidExtKey, "aliases"); dataType == jsonparser.Object && err == nil { if err := json.Unmarshal(value, &aliases); err != nil { @@ -657,7 +657,7 @@ func randomizeList(list []openrtb_ext.BidderName) { } } -func extractBidRequestExt(bidRequest *openrtb.BidRequest) (*openrtb_ext.ExtRequest, error) { +func extractBidRequestExt(bidRequest *openrtb2.BidRequest) (*openrtb_ext.ExtRequest, error) { requestExt := &openrtb_ext.ExtRequest{} if bidRequest == nil { @@ -720,7 +720,7 @@ func getExtTargetData(requestExt *openrtb_ext.ExtRequest, cacheInstructions *ext return targData } -func getDebugInfo(bidRequest *openrtb.BidRequest, requestExt *openrtb_ext.ExtRequest) bool { +func getDebugInfo(bidRequest *openrtb2.BidRequest, requestExt *openrtb_ext.ExtRequest) bool { return (bidRequest != nil && bidRequest.Test == 1) || (requestExt != nil && requestExt.Prebid.Debug) } diff --git a/exchange/utils_test.go b/exchange/utils_test.go index e222103e44c..1b0684a819c 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -7,12 +7,12 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/errortypes" "github.com/PubMatic-OpenWrap/prebid-server/gdpr" "github.com/PubMatic-OpenWrap/prebid-server/metrics" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -219,7 +219,7 @@ func TestCleanOpenRTBRequestsCCPA(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) req.Ext = test.reqExt - req.Regs = &openrtb.Regs{ + req.Regs = &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy":"` + test.ccpaConsent + `"}`), } @@ -286,7 +286,7 @@ func TestCleanOpenRTBRequestsCCPAErrors(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) req.Ext = test.reqExt - req.Regs = &openrtb.Regs{Ext: test.reqRegsExt} + req.Regs = &openrtb2.Regs{Ext: test.reqRegsExt} var reqExtStruct openrtb_ext.ExtRequest err := json.Unmarshal(req.Ext, &reqExtStruct) @@ -335,7 +335,7 @@ func TestCleanOpenRTBRequestsCOPPA(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) - req.Regs = &openrtb.Regs{COPPA: test.coppa} + req.Regs = &openrtb2.Regs{COPPA: test.coppa} auctionReq := AuctionRequest{ BidRequest: req, @@ -469,13 +469,13 @@ func TestExtractBidRequestExt(t *testing.T) { testCases := []struct { desc string - inBidRequest *openrtb.BidRequest + inBidRequest *openrtb2.BidRequest outRequestExt *openrtb_ext.ExtRequest outError error }{ { desc: "Valid vastxml.returnCreative set to false", - inBidRequest: &openrtb.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":false}}}}`)}, + inBidRequest: &openrtb2.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":false}}}}`)}, outRequestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ Debug: true, @@ -490,7 +490,7 @@ func TestExtractBidRequestExt(t *testing.T) { }, { desc: "Valid vastxml.returnCreative set to true", - inBidRequest: &openrtb.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":true}}}}`)}, + inBidRequest: &openrtb2.BidRequest{Ext: json.RawMessage(`{"prebid":{"debug":true,"cache":{"vastxml":{"returnCreative":true}}}}`)}, outRequestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ Debug: true, @@ -511,13 +511,13 @@ func TestExtractBidRequestExt(t *testing.T) { }, { desc: "Non-nil bidRequest with empty Ext, we expect a blank requestExt", - inBidRequest: &openrtb.BidRequest{}, + inBidRequest: &openrtb2.BidRequest{}, outRequestExt: &openrtb_ext.ExtRequest{}, outError: nil, }, { desc: "Non-nil bidRequest with non-empty, invalid Ext, we expect unmarshaling error", - inBidRequest: &openrtb.BidRequest{Ext: json.RawMessage(`invalid`)}, + inBidRequest: &openrtb2.BidRequest{Ext: json.RawMessage(`invalid`)}, outRequestExt: &openrtb_ext.ExtRequest{}, outError: fmt.Errorf("Error decoding Request.ext : invalid character 'i' looking for beginning of value"), }, @@ -885,7 +885,7 @@ func TestGetExtTargetData(t *testing.T) { func TestGetDebugInfo(t *testing.T) { type inTest struct { - bidRequest *openrtb.BidRequest + bidRequest *openrtb2.BidRequest requestExt *openrtb_ext.ExtRequest } testCases := []struct { @@ -900,7 +900,7 @@ func TestGetDebugInfo(t *testing.T) { }, { desc: "bid request test == 0, nil requestExt", - in: inTest{&openrtb.BidRequest{Test: 0}, nil}, + in: inTest{&openrtb2.BidRequest{Test: 0}, nil}, out: false, }, { @@ -910,22 +910,22 @@ func TestGetDebugInfo(t *testing.T) { }, { desc: "bid request test == 0, requestExt debug flag false", - in: inTest{&openrtb.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, + in: inTest{&openrtb2.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, out: false, }, { desc: "bid request test == 1, requestExt debug flag false", - in: inTest{&openrtb.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, + in: inTest{&openrtb2.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: false}}}, out: true, }, { desc: "bid request test == 0, requestExt debug flag true", - in: inTest{&openrtb.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, + in: inTest{&openrtb2.BidRequest{Test: 0}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, out: true, }, { desc: "bid request test == 1, requestExt debug flag true", - in: inTest{&openrtb.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, + in: inTest{&openrtb2.BidRequest{Test: 1}, &openrtb_ext.ExtRequest{Prebid: openrtb_ext.ExtRequestPrebid{Debug: true}}}, out: true, }, } @@ -1215,7 +1215,7 @@ func TestCleanOpenRTBRequestsGDPR(t *testing.T) { for _, test := range testCases { req := newBidRequest(t) req.User.Ext = json.RawMessage(`{"consent":"` + test.gdprConsent + `"}`) - req.Regs = &openrtb.Regs{ + req.Regs = &openrtb2.Regs{ Ext: json.RawMessage(`{"gdpr":` + test.gdpr + `}`), } @@ -1268,17 +1268,17 @@ func TestCleanOpenRTBRequestsGDPR(t *testing.T) { } // newAdapterAliasBidRequest builds a BidRequest with aliases -func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { +func newAdapterAliasBidRequest(t *testing.T) *openrtb2.BidRequest { dnt := int8(1) - return &openrtb.BidRequest{ - Site: &openrtb.Site{ + return &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ DIDMD5: "some device ID hash", UA: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", IFA: "ifa", @@ -1286,21 +1286,21 @@ func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { DNT: &dnt, Language: "EN", }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Regs: &openrtb.Regs{ + Regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"gdpr":1}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1314,35 +1314,35 @@ func newAdapterAliasBidRequest(t *testing.T) *openrtb.BidRequest { } } -func newBidRequest(t *testing.T) *openrtb.BidRequest { - return &openrtb.BidRequest{ - Site: &openrtb.Site{ +func newBidRequest(t *testing.T) *openrtb2.BidRequest { + return &openrtb2.BidRequest{ + Site: &openrtb2.Site{ Page: "www.some.domain.com", Domain: "domain.com", - Publisher: &openrtb.Publisher{ + Publisher: &openrtb2.Publisher{ ID: "some-publisher-id", }, }, - Device: &openrtb.Device{ + Device: &openrtb2.Device{ DIDMD5: "some device ID hash", UA: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", IFA: "ifa", IP: "132.173.230.74", Language: "EN", }, - Source: &openrtb.Source{ + Source: &openrtb2.Source{ TID: "61018dc9-fa61-4c41-b7dc-f90b9ae80e87", }, - User: &openrtb.User{ + User: &openrtb2.User{ ID: "our-id", BuyerUID: "their-id", Yob: 1982, Ext: json.RawMessage(`{"digitrust":{"id":"digi-id","keyv":1,"pref":1}}`), }, - Imp: []openrtb.Imp{{ + Imp: []openrtb2.Imp{{ ID: "some-imp-id", - Banner: &openrtb.Banner{ - Format: []openrtb.Format{{ + Banner: &openrtb2.Banner{ + Format: []openrtb2.Format{{ W: 300, H: 250, }, { @@ -1591,8 +1591,8 @@ func TestRemoveUnpermissionedEids(t *testing.T) { } for _, test := range testCases { - request := &openrtb.BidRequest{ - User: &openrtb.User{Ext: test.userExt}, + request := &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: test.userExt}, } requestExt := &openrtb_ext.ExtRequest{ @@ -1603,8 +1603,8 @@ func TestRemoveUnpermissionedEids(t *testing.T) { }, } - expectedRequest := &openrtb.BidRequest{ - User: &openrtb.User{Ext: test.expectedUserExt}, + expectedRequest := &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: test.expectedUserExt}, } resultErr := removeUnpermissionedEids(request, bidder, requestExt) @@ -1637,8 +1637,8 @@ func TestRemoveUnpermissionedEidsUnmarshalErrors(t *testing.T) { } for _, test := range testCases { - request := &openrtb.BidRequest{ - User: &openrtb.User{Ext: test.userExt}, + request := &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: test.userExt}, } requestExt := &openrtb_ext.ExtRequest{ @@ -1659,12 +1659,12 @@ func TestRemoveUnpermissionedEidsUnmarshalErrors(t *testing.T) { func TestRemoveUnpermissionedEidsEmptyValidations(t *testing.T) { testCases := []struct { description string - request *openrtb.BidRequest + request *openrtb2.BidRequest requestExt *openrtb_ext.ExtRequest }{ { description: "Nil User", - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ User: nil, }, requestExt: &openrtb_ext.ExtRequest{ @@ -1679,8 +1679,8 @@ func TestRemoveUnpermissionedEidsEmptyValidations(t *testing.T) { }, { description: "Empty User", - request: &openrtb.BidRequest{ - User: &openrtb.User{}, + request: &openrtb2.BidRequest{ + User: &openrtb2.User{}, }, requestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ @@ -1694,15 +1694,15 @@ func TestRemoveUnpermissionedEidsEmptyValidations(t *testing.T) { }, { description: "Nil Ext", - request: &openrtb.BidRequest{ - User: &openrtb.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, + request: &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, }, requestExt: nil, }, { description: "Nil Prebid Data", - request: &openrtb.BidRequest{ - User: &openrtb.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, + request: &openrtb2.BidRequest{ + User: &openrtb2.User{Ext: json.RawMessage(`{"eids":[{"source":"source1","id":"anyID"}]}`)}, }, requestExt: &openrtb_ext.ExtRequest{ Prebid: openrtb_ext.ExtRequestPrebid{ diff --git a/go.mod b/go.mod index 92396ff96d3..a4a29d6bf98 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/NYTimes/gziphandler v1.1.1 github.com/OneOfOne/xxhash v1.2.5 // indirect github.com/PubMatic-OpenWrap/etree v1.0.1 - github.com/PubMatic-OpenWrap/openrtb v11.0.1-0.20200228131822-5216ebe65c0c+incompatible github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/blang/semver v3.5.1+incompatible @@ -30,8 +29,7 @@ require ( github.com/mattn/go-colorable v0.1.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/mapstructure v1.0.0 // indirect - github.com/onsi/ginkgo v1.10.1 // indirect - github.com/onsi/gomega v1.7.0 // indirect + github.com/mxmCherry/openrtb/v15 v15.0.0 github.com/pelletier/go-toml v1.2.0 // indirect github.com/prebid/go-gdpr v0.8.3 github.com/prometheus/client_golang v0.0.0-20180623155954-77e8f2ddcfed @@ -56,9 +54,9 @@ require ( github.com/yudai/gojsondiff v0.0.0-20170107030110-7b1b7adf999d github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/yudai/pp v2.0.1+incompatible // indirect - golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 - golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect - golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect - golang.org/x/text v0.3.0 - gopkg.in/yaml.v2 v2.2.2 + golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb + golang.org/x/text v0.3.3 + gopkg.in/yaml.v2 v2.4.0 ) + +replace github.com/mxmCherry/openrtb/v15 v15.0.0 => github.com/PubMatic-OpenWrap/openrtb/v15 v15.0.0-20210425111602-5284bed23afa diff --git a/go.sum b/go.sum index 9bc40d960c8..fcc0121f872 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/PubMatic-OpenWrap/etree v1.0.1 h1:Q8sZ99MuXKmAx2v4XThKjwlstgadZffiRbN github.com/PubMatic-OpenWrap/etree v1.0.1/go.mod h1:5Y8qgcuDoy3XXG907UXkGnVTwihF16rXyJa4zRT7hOE= github.com/PubMatic-OpenWrap/openrtb v11.0.1-0.20200228131822-5216ebe65c0c+incompatible h1:BGwndVLu0ncwweHnofXzLo+SnRMe04Bq3KFfELLzif4= github.com/PubMatic-OpenWrap/openrtb v11.0.1-0.20200228131822-5216ebe65c0c+incompatible/go.mod h1:Ply/+GFe6FLkPMLV8Yh8xW0MpqclQyVf7m4PRsnaLDY= +github.com/PubMatic-OpenWrap/openrtb/v15 v15.0.0-20210425111602-5284bed23afa h1:ntX2w5IBWLesPVt6WDWxVEdrSQdG2LG70xZdWqkyrVk= +github.com/PubMatic-OpenWrap/openrtb/v15 v15.0.0-20210425111602-5284bed23afa/go.mod h1:m8XMbFYa0xEIGqfEBOXEM6sK0zM9qgI1QlPqV7TUAeA= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= @@ -36,12 +38,26 @@ github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd h1:biTJQdqouE5b github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -64,11 +80,20 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I= github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mxmCherry/openrtb/v15 v15.0.0 h1:inLuQ3Bsima9HLB2v6WjbtEFF69SWOT5Dux4QZtYdrw= +github.com/mxmCherry/openrtb/v15 v15.0.0/go.mod h1:TVgncsz6MOzbL7lhun1lNuUBzVBlVDbxf9Fyy1TyhZA= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.1/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -87,6 +112,8 @@ github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFE github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rs/cors v1.5.0 h1:dgSHE6+ia18arGOTIYQKKGWLvEbGvmbNE6NfxhoNHUY= github.com/rs/cors v1.5.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/sachin-pubmatic/openrtb/v15 v15.0.1-0.20210425111117-0bf205d1aea9 h1:YLF9qrF42h2NHtlAiPZ0EetnsQksCpXisRq8ItVWMjw= +github.com/sachin-pubmatic/openrtb/v15 v15.0.1-0.20210425111117-0bf205d1aea9/go.mod h1:2syoF27YsNOppkRtLeXoH8aHfj28VNdZhq4ftH0d91g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -122,23 +149,59 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3Ifn github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= @@ -149,3 +212,7 @@ gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/openrtb_ext/bid_request_video.go b/openrtb_ext/bid_request_video.go index 13ec8eb4538..a3817064bfa 100644 --- a/openrtb_ext/bid_request_video.go +++ b/openrtb_ext/bid_request_video.go @@ -1,7 +1,7 @@ package openrtb_ext import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) type BidRequestVideo struct { @@ -27,7 +27,7 @@ type BidRequestVideo struct { // object; App or Site required // Description: // Application where the impression will be shown - App *openrtb.App `json:"app"` + App *openrtb2.App `json:"app"` // Attribute: // site @@ -35,7 +35,7 @@ type BidRequestVideo struct { // object; App or Site required // Description: // Site where the impression will be shown - Site *openrtb.Site `json:"site"` + Site *openrtb2.Site `json:"site"` // Attribute: // user @@ -43,7 +43,7 @@ type BidRequestVideo struct { // object; optional // Description: // Container object for the user of of the actual device - User *openrtb.User `json:"user,omitempty"` + User *openrtb2.User `json:"user,omitempty"` // Attribute: // device @@ -51,7 +51,7 @@ type BidRequestVideo struct { // object; optional // Description: // Device specific data - Device openrtb.Device `json:"device,omitempty"` + Device openrtb2.Device `json:"device,omitempty"` // Attribute: // includebrandcategory @@ -67,7 +67,7 @@ type BidRequestVideo struct { // object; required // Description: // Player container object - Video *openrtb.Video `json:"video,omitempty"` + Video *openrtb2.Video `json:"video,omitempty"` // Attribute: // content @@ -75,7 +75,7 @@ type BidRequestVideo struct { // object; optional // Description: // Misc content meta data that can be used for targeting the adPod(s) - Content openrtb.Content `json:"content,omitempty"` + Content openrtb2.Content `json:"content,omitempty"` // Attribute: // cacheconfig @@ -135,7 +135,7 @@ type BidRequestVideo struct { // object; optional // Description: // Contains the OpenRTB Regs object to be passed to OpenRTB request - Regs *openrtb.Regs `json:"regs,omitempty"` + Regs *openrtb2.Regs `json:"regs,omitempty"` // Attribute: // supportdeals diff --git a/openrtb_ext/deal_tier.go b/openrtb_ext/deal_tier.go index e882235d01e..8aeedb81a5e 100644 --- a/openrtb_ext/deal_tier.go +++ b/openrtb_ext/deal_tier.go @@ -3,7 +3,7 @@ package openrtb_ext import ( "encoding/json" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // DealTier defines the configuration of a deal tier. @@ -20,7 +20,7 @@ type DealTier struct { type DealTierBidderMap map[BidderName]DealTier // ReadDealTiersFromImp returns a map of bidder deal tiers read from the impression of an original request (not split / cleaned). -func ReadDealTiersFromImp(imp openrtb.Imp) (DealTierBidderMap, error) { +func ReadDealTiersFromImp(imp openrtb2.Imp) (DealTierBidderMap, error) { dealTiers := make(DealTierBidderMap) if len(imp.Ext) == 0 { diff --git a/openrtb_ext/deal_tier_test.go b/openrtb_ext/deal_tier_test.go index 717e0703466..29d58d6c071 100644 --- a/openrtb_ext/deal_tier_test.go +++ b/openrtb_ext/deal_tier_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -83,7 +83,7 @@ func TestReadDealTiersFromImp(t *testing.T) { } for _, test := range testCases { - imp := openrtb.Imp{Ext: test.impExt} + imp := openrtb2.Imp{Ext: test.impExt} result, err := ReadDealTiersFromImp(imp) diff --git a/openrtb_ext/response.go b/openrtb_ext/response.go index f2119f2c871..a8599df84a5 100644 --- a/openrtb_ext/response.go +++ b/openrtb_ext/response.go @@ -1,7 +1,7 @@ package openrtb_ext import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // ExtBidResponse defines the contract for bidresponse.ext @@ -26,7 +26,7 @@ type ExtResponseDebug struct { // HttpCalls defines the contract for bidresponse.ext.debug.httpcalls HttpCalls map[BidderName][]*ExtHttpCall `json:"httpcalls,omitempty"` // Request after resolution of stored requests and debug overrides - ResolvedRequest *openrtb.BidRequest `json:"resolvedrequest,omitempty"` + ResolvedRequest *openrtb2.BidRequest `json:"resolvedrequest,omitempty"` } // ExtResponseSyncData defines the contract for bidresponse.ext.usersync.{bidder} diff --git a/pbs/pbsrequest.go b/pbs/pbsrequest.go index bd07a6c558b..40315d751a1 100644 --- a/pbs/pbsrequest.go +++ b/pbs/pbsrequest.go @@ -17,10 +17,10 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/util/httputil" "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/blang/semver" "github.com/buger/jsonparser" "github.com/golang/glog" + "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/publicsuffix" ) @@ -86,7 +86,7 @@ type PBSVideo struct { type AdUnit struct { Code string `json:"code"` TopFrame int8 `json:"is_top_frame"` - Sizes []openrtb.Format `json:"sizes"` + Sizes []openrtb2.Format `json:"sizes"` Bids []Bids `json:"bids"` ConfigID string `json:"config_id"` MediaTypes []string `json:"media_types"` @@ -95,7 +95,7 @@ type AdUnit struct { } type PBSAdUnit struct { - Sizes []openrtb.Format + Sizes []openrtb2.Format TopFrame int8 Code string BidID string @@ -162,18 +162,18 @@ type PBSRequest struct { TimeoutMillis int64 `json:"timeout_millis"` AdUnits []AdUnit `json:"ad_units"` IsDebug bool `json:"is_debug"` - App *openrtb.App `json:"app"` - Device *openrtb.Device `json:"device"` + App *openrtb2.App `json:"app"` + Device *openrtb2.Device `json:"device"` PBSUser json.RawMessage `json:"user"` SDK *SDK `json:"sdk"` // internal Bidders []*PBSBidder `json:"-"` - User *openrtb.User `json:"-"` + User *openrtb2.User `json:"-"` Cookie *usersync.PBSCookie `json:"-"` Url string `json:"-"` Domain string `json:"-"` - Regs *openrtb.Regs `json:"regs"` + Regs *openrtb2.Regs `json:"regs"` Start time.Time } @@ -236,7 +236,7 @@ func ParsePBSRequest(r *http.Request, cfg *config.AuctionTimeouts, cache cache.C pbsReq.TimeoutMillis = int64(cfg.LimitAuctionTimeout(time.Duration(pbsReq.TimeoutMillis)*time.Millisecond) / time.Millisecond) if pbsReq.Device == nil { - pbsReq.Device = &openrtb.Device{} + pbsReq.Device = &openrtb2.Device{} } if ip, _ := httputil.FindIP(r, ipv4Validator); ip != nil { pbsReq.Device.IP = ip.String() @@ -259,7 +259,7 @@ func ParsePBSRequest(r *http.Request, cfg *config.AuctionTimeouts, cache cache.C } if pbsReq.User == nil { - pbsReq.User = &openrtb.User{} + pbsReq.User = &openrtb2.User{} } // use client-side data for web requests diff --git a/pbs/pbsresponse.go b/pbs/pbsresponse.go index 7c6cea31261..b8cf2c19ff7 100644 --- a/pbs/pbsresponse.go +++ b/pbs/pbsresponse.go @@ -32,9 +32,9 @@ type PBSBid struct { // If NURL and Adm are both defined, then Adm takes precedence. Adm string `json:"adm,omitempty"` // Width is the intended width which Adm should be shown, in pixels. - Width uint64 `json:"width,omitempty"` + Width int64 `json:"width,omitempty"` // Height is the intended width which Adm should be shown, in pixels. - Height uint64 `json:"height,omitempty"` + Height int64 `json:"height,omitempty"` // DealId is not used by prebid-server, but may be used by buyers and sellers who make special // deals with each other. We simply pass this information along with the bid. DealId string `json:"deal_id,omitempty"` diff --git a/prebid_cache_client/client.go b/prebid_cache_client/client.go index 8d363e147bd..8fbabe01cc5 100644 --- a/prebid_cache_client/client.go +++ b/prebid_cache_client/client.go @@ -22,7 +22,7 @@ import ( // Client stores values in Prebid Cache. For more info, see https://github.com/prebid/prebid-cache type Client interface { - // PutJson stores JSON values for the given openrtb.Bids in the cache. Null values will be + // PutJson stores JSON values for the given openrtb2.Bids in the cache. Null values will be // // The returned string slice will always have the same number of elements as the values argument. If a // value could not be saved, the element will be an empty string. Implementations are responsible for diff --git a/prebid_cache_client/prebid_cache.go b/prebid_cache_client/prebid_cache.go index d19e8f1c9a6..842eb5b19d4 100644 --- a/prebid_cache_client/prebid_cache.go +++ b/prebid_cache_client/prebid_cache.go @@ -22,8 +22,8 @@ type CacheObject struct { type BidCache struct { Adm string `json:"adm,omitempty"` NURL string `json:"nurl,omitempty"` - Width uint64 `json:"width,omitempty"` - Height uint64 `json:"height,omitempty"` + Width int64 `json:"width,omitempty"` + Height int64 `json:"height,omitempty"` } // internal protocol objects diff --git a/privacy/ccpa/consentwriter.go b/privacy/ccpa/consentwriter.go index 4ef412fd3ef..1adb439840f 100644 --- a/privacy/ccpa/consentwriter.go +++ b/privacy/ccpa/consentwriter.go @@ -1,7 +1,7 @@ package ccpa import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // ConsentWriter implements the PolicyWriter interface for CCPA. @@ -10,7 +10,7 @@ type ConsentWriter struct { } // Write mutates an OpenRTB bid request with the CCPA consent string. -func (c ConsentWriter) Write(req *openrtb.BidRequest) error { +func (c ConsentWriter) Write(req *openrtb2.BidRequest) error { if req == nil { return nil } diff --git a/privacy/ccpa/consentwriter_test.go b/privacy/ccpa/consentwriter_test.go index 1e491d9d167..d59428626b8 100644 --- a/privacy/ccpa/consentwriter_test.go +++ b/privacy/ccpa/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -12,8 +12,8 @@ func TestConsentWriter(t *testing.T) { consent := "anyConsent" testCases := []struct { description string - request *openrtb.BidRequest - expected *openrtb.BidRequest + request *openrtb2.BidRequest + expected *openrtb2.BidRequest expectedError bool }{ { @@ -23,19 +23,19 @@ func TestConsentWriter(t *testing.T) { }, { description: "Success", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, }, { description: "Error With Regs.Ext - Does Not Mutate", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, expectedError: true, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, }, } diff --git a/privacy/ccpa/parsedpolicy_test.go b/privacy/ccpa/parsedpolicy_test.go index 4fa9f92684d..33563b50567 100644 --- a/privacy/ccpa/parsedpolicy_test.go +++ b/privacy/ccpa/parsedpolicy_test.go @@ -3,7 +3,7 @@ package ccpa import ( "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -385,7 +385,7 @@ type mockPolicWriter struct { mock.Mock } -func (m *mockPolicWriter) Write(req *openrtb.BidRequest) error { +func (m *mockPolicWriter) Write(req *openrtb2.BidRequest) error { args := m.Called(req) return args.Error(0) } diff --git a/privacy/ccpa/policy.go b/privacy/ccpa/policy.go index 3f5dd25c6bc..349abaed8e4 100644 --- a/privacy/ccpa/policy.go +++ b/privacy/ccpa/policy.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" - "github.com/PubMatic-OpenWrap/openrtb" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Policy represents the CCPA regulatory information from an OpenRTB bid request. @@ -16,7 +16,7 @@ type Policy struct { } // ReadFromRequest extracts the CCPA regulatory information from an OpenRTB bid request. -func ReadFromRequest(req *openrtb.BidRequest) (Policy, error) { +func ReadFromRequest(req *openrtb2.BidRequest) (Policy, error) { var consent string var noSaleBidders []string @@ -46,7 +46,7 @@ func ReadFromRequest(req *openrtb.BidRequest) (Policy, error) { } // Write mutates an OpenRTB bid request with the CCPA regulatory information. -func (p Policy) Write(req *openrtb.BidRequest) error { +func (p Policy) Write(req *openrtb2.BidRequest) error { if req == nil { return nil } @@ -65,14 +65,14 @@ func (p Policy) Write(req *openrtb.BidRequest) error { return nil } -func buildRegs(consent string, regs *openrtb.Regs) (*openrtb.Regs, error) { +func buildRegs(consent string, regs *openrtb2.Regs) (*openrtb2.Regs, error) { if consent == "" { return buildRegsClear(regs) } return buildRegsWrite(consent, regs) } -func buildRegsClear(regs *openrtb.Regs) (*openrtb.Regs, error) { +func buildRegsClear(regs *openrtb2.Regs) (*openrtb2.Regs, error) { if regs == nil || len(regs.Ext) == 0 { return regs, nil } @@ -92,7 +92,7 @@ func buildRegsClear(regs *openrtb.Regs) (*openrtb.Regs, error) { } // Marshal ext if there are still other fields - var regsResult openrtb.Regs + var regsResult openrtb2.Regs ext, err := json.Marshal(extMap) if err == nil { regsResult = *regs @@ -101,9 +101,9 @@ func buildRegsClear(regs *openrtb.Regs) (*openrtb.Regs, error) { return ®sResult, err } -func buildRegsWrite(consent string, regs *openrtb.Regs) (*openrtb.Regs, error) { +func buildRegsWrite(consent string, regs *openrtb2.Regs) (*openrtb2.Regs, error) { if regs == nil { - return marshalRegsExt(openrtb.Regs{}, openrtb_ext.ExtRegs{USPrivacy: consent}) + return marshalRegsExt(openrtb2.Regs{}, openrtb_ext.ExtRegs{USPrivacy: consent}) } if regs.Ext == nil { @@ -119,7 +119,7 @@ func buildRegsWrite(consent string, regs *openrtb.Regs) (*openrtb.Regs, error) { return marshalRegsExt(*regs, extMap) } -func marshalRegsExt(regs openrtb.Regs, ext interface{}) (*openrtb.Regs, error) { +func marshalRegsExt(regs openrtb2.Regs, ext interface{}) (*openrtb2.Regs, error) { extJSON, err := json.Marshal(ext) if err == nil { regs.Ext = extJSON diff --git a/privacy/ccpa/policy_test.go b/privacy/ccpa/policy_test.go index c1fdd9cd903..416ebffa31a 100644 --- a/privacy/ccpa/policy_test.go +++ b/privacy/ccpa/policy_test.go @@ -4,21 +4,21 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) func TestReadFromRequest(t *testing.T) { testCases := []struct { description string - request *openrtb.BidRequest + request *openrtb2.BidRequest expectedPolicy Policy expectedError bool }{ { description: "Success", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -36,7 +36,7 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Regs", - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ Regs: nil, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, @@ -47,8 +47,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Regs.Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -58,8 +58,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Empty Regs.Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -69,8 +69,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Missing Regs.Ext USPrivacy Value", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"anythingElse":"42"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"anythingElse":"42"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedPolicy: Policy{ @@ -80,24 +80,24 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Malformed Regs.Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedError: true, }, { description: "Invalid Regs.Ext Type", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":123`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":123`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a", "b"]}}`), }, expectedError: true, }, { description: "Nil Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: nil, }, expectedPolicy: Policy{ @@ -107,8 +107,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Empty Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{}`), }, expectedPolicy: Policy{ @@ -118,8 +118,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Missing Ext.Prebid No Sale Value", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{"anythingElse":"42"}`), }, expectedPolicy: Policy{ @@ -129,24 +129,24 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Malformed Ext", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`malformed`), }, expectedError: true, }, { description: "Invalid Ext.Prebid.NoSale Type", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":"wrongtype"}}`), }, expectedError: true, }, { description: "Injection Attack", - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"1YYY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"1YYY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`)}, }, expectedPolicy: Policy{ Consent: "1YYY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", @@ -165,8 +165,8 @@ func TestWrite(t *testing.T) { testCases := []struct { description string policy Policy - request *openrtb.BidRequest - expected *openrtb.BidRequest + request *openrtb2.BidRequest + expected *openrtb2.BidRequest expectedError bool }{ { @@ -178,31 +178,31 @@ func TestWrite(t *testing.T) { { description: "Success", policy: Policy{Consent: "anyConsent", NoSaleBidders: []string{"a", "b"}}, - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, Ext: json.RawMessage(`{"prebid":{"nosale":["a","b"]}}`), }, }, { description: "Error Regs.Ext - No Partial Update To Request", policy: Policy{Consent: "anyConsent", NoSaleBidders: []string{"a", "b"}}, - request: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + request: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, expectedError: true, - expected: &openrtb.BidRequest{ - Regs: &openrtb.Regs{Ext: json.RawMessage(`malformed}`)}, + expected: &openrtb2.BidRequest{ + Regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed}`)}, }, }, { description: "Error Ext - No Partial Update To Request", policy: Policy{Consent: "anyConsent", NoSaleBidders: []string{"a", "b"}}, - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ Ext: json.RawMessage(`malformed}`), }, expectedError: true, - expected: &openrtb.BidRequest{ + expected: &openrtb2.BidRequest{ Ext: json.RawMessage(`malformed}`), }, }, @@ -219,22 +219,22 @@ func TestBuildRegs(t *testing.T) { testCases := []struct { description string consent string - regs *openrtb.Regs - expected *openrtb.Regs + regs *openrtb2.Regs + expected *openrtb2.Regs expectedError bool }{ { description: "Clear", consent: "", - regs: &openrtb.Regs{ + regs: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy":"ABC"}`), }, - expected: &openrtb.Regs{}, + expected: &openrtb2.Regs{}, }, { description: "Clear - Error", consent: "", - regs: &openrtb.Regs{ + regs: &openrtb2.Regs{ Ext: json.RawMessage(`malformed`), }, expectedError: true, @@ -243,14 +243,14 @@ func TestBuildRegs(t *testing.T) { description: "Write", consent: "anyConsent", regs: nil, - expected: &openrtb.Regs{ + expected: &openrtb2.Regs{ Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`), }, }, { description: "Write - Error", consent: "anyConsent", - regs: &openrtb.Regs{ + regs: &openrtb2.Regs{ Ext: json.RawMessage(`malformed`), }, expectedError: true, @@ -267,8 +267,8 @@ func TestBuildRegs(t *testing.T) { func TestBuildRegsClear(t *testing.T) { testCases := []struct { description string - regs *openrtb.Regs - expected *openrtb.Regs + regs *openrtb2.Regs + expected *openrtb2.Regs expectedError bool }{ { @@ -278,32 +278,32 @@ func TestBuildRegsClear(t *testing.T) { }, { description: "Nil Regs.Ext", - regs: &openrtb.Regs{Ext: nil}, - expected: &openrtb.Regs{Ext: nil}, + regs: &openrtb2.Regs{Ext: nil}, + expected: &openrtb2.Regs{Ext: nil}, }, { description: "Empty Regs.Ext", - regs: &openrtb.Regs{Ext: json.RawMessage(`{}`)}, - expected: &openrtb.Regs{}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{}`)}, + expected: &openrtb2.Regs{}, }, { description: "Removes Regs.Ext Entirely", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, - expected: &openrtb.Regs{}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + expected: &openrtb2.Regs{}, }, { description: "Leaves Other Regs.Ext Values", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC", "other":"any"}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC", "other":"any"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, }, { description: "Invalid Regs.Ext Type - Still Cleared", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, - expected: &openrtb.Regs{}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, + expected: &openrtb2.Regs{}, }, { description: "Malformed Regs.Ext", - regs: &openrtb.Regs{Ext: json.RawMessage(`malformed`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed`)}, expectedError: true, }, } @@ -319,50 +319,50 @@ func TestBuildRegsWrite(t *testing.T) { testCases := []struct { description string consent string - regs *openrtb.Regs - expected *openrtb.Regs + regs *openrtb2.Regs + expected *openrtb2.Regs expectedError bool }{ { description: "Nil Regs", consent: "anyConsent", regs: nil, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Nil Regs.Ext", consent: "anyConsent", - regs: &openrtb.Regs{Ext: nil}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: nil}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Empty Regs.Ext", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Overwrites Existing", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"ABC"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Leaves Other Ext Values", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"other":"any","us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"other":"any"}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"other":"any","us_privacy":"anyConsent"}`)}, }, { description: "Invalid Regs.Ext Type - Still Overwrites", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, - expected: &openrtb.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":123}`)}, + expected: &openrtb2.Regs{Ext: json.RawMessage(`{"us_privacy":"anyConsent"}`)}, }, { description: "Malformed Regs.Ext", consent: "anyConsent", - regs: &openrtb.Regs{Ext: json.RawMessage(`malformed`)}, + regs: &openrtb2.Regs{Ext: json.RawMessage(`malformed`)}, expectedError: true, }, } diff --git a/privacy/enforcement.go b/privacy/enforcement.go index 47c1f0d03dd..5f4b7d5efef 100644 --- a/privacy/enforcement.go +++ b/privacy/enforcement.go @@ -1,7 +1,7 @@ package privacy import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // Enforcement represents the privacy policies to enforce for an OpenRTB bid request. @@ -19,11 +19,11 @@ func (e Enforcement) Any() bool { } // Apply cleans personally identifiable information from an OpenRTB bid request. -func (e Enforcement) Apply(bidRequest *openrtb.BidRequest) { +func (e Enforcement) Apply(bidRequest *openrtb2.BidRequest) { e.apply(bidRequest, NewScrubber()) } -func (e Enforcement) apply(bidRequest *openrtb.BidRequest, scrubber Scrubber) { +func (e Enforcement) apply(bidRequest *openrtb2.BidRequest, scrubber Scrubber) { if bidRequest != nil && e.Any() { bidRequest.Device = scrubber.ScrubDevice(bidRequest.Device, e.getDeviceIDScrubStrategy(), e.getIPv4ScrubStrategy(), e.getIPv6ScrubStrategy(), e.getGeoScrubStrategy()) bidRequest.User = scrubber.ScrubUser(bidRequest.User, e.getUserScrubStrategy(), e.getGeoScrubStrategy()) diff --git a/privacy/enforcement_test.go b/privacy/enforcement_test.go index a5e41c83198..61899e4d60e 100644 --- a/privacy/enforcement_test.go +++ b/privacy/enforcement_test.go @@ -3,7 +3,7 @@ package privacy import ( "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -197,12 +197,12 @@ func TestApply(t *testing.T) { } for _, test := range testCases { - req := &openrtb.BidRequest{ - Device: &openrtb.Device{}, - User: &openrtb.User{}, + req := &openrtb2.BidRequest{ + Device: &openrtb2.Device{}, + User: &openrtb2.User{}, } - replacedDevice := &openrtb.Device{} - replacedUser := &openrtb.User{} + replacedDevice := &openrtb2.Device{} + replacedUser := &openrtb2.User{} m := &mockScrubber{} m.On("ScrubDevice", req.Device, test.expectedDeviceID, test.expectedDeviceIPv4, test.expectedDeviceIPv6, test.expectedDeviceGeo).Return(replacedDevice).Once() @@ -217,7 +217,7 @@ func TestApply(t *testing.T) { } func TestApplyNoneApplicable(t *testing.T) { - req := &openrtb.BidRequest{} + req := &openrtb2.BidRequest{} m := &mockScrubber{} @@ -248,12 +248,12 @@ type mockScrubber struct { mock.Mock } -func (m *mockScrubber) ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb.Device { +func (m *mockScrubber) ScrubDevice(device *openrtb2.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb2.Device { args := m.Called(device, id, ipv4, ipv6, geo) - return args.Get(0).(*openrtb.Device) + return args.Get(0).(*openrtb2.Device) } -func (m *mockScrubber) ScrubUser(user *openrtb.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb.User { +func (m *mockScrubber) ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb2.User { args := m.Called(user, strategy, geo) - return args.Get(0).(*openrtb.User) + return args.Get(0).(*openrtb2.User) } diff --git a/privacy/gdpr/consentwriter.go b/privacy/gdpr/consentwriter.go index f1cc2ce12f7..e8873ee0c90 100644 --- a/privacy/gdpr/consentwriter.go +++ b/privacy/gdpr/consentwriter.go @@ -5,7 +5,7 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // ConsentWriter implements the PolicyWriter interface for GDPR TCF. @@ -14,13 +14,13 @@ type ConsentWriter struct { } // Write mutates an OpenRTB bid request with the GDPR TCF consent. -func (c ConsentWriter) Write(req *openrtb.BidRequest) error { +func (c ConsentWriter) Write(req *openrtb2.BidRequest) error { if c.Consent == "" { return nil } if req.User == nil { - req.User = &openrtb.User{} + req.User = &openrtb2.User{} } if req.User.Ext == nil { diff --git a/privacy/gdpr/consentwriter_test.go b/privacy/gdpr/consentwriter_test.go index 65df8051d02..5753442fa01 100644 --- a/privacy/gdpr/consentwriter_test.go +++ b/privacy/gdpr/consentwriter_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -12,76 +12,76 @@ func TestConsentWriter(t *testing.T) { testCases := []struct { description string consent string - request *openrtb.BidRequest - expected *openrtb.BidRequest + request *openrtb2.BidRequest + expected *openrtb2.BidRequest expectedError bool }{ { description: "Empty", consent: "", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{}, + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{}, }, { description: "Enabled With Nil Request User Object", consent: "anyConsent", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent"}`)}}, }, { description: "Enabled With Nil Request User Ext Object", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{}}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent"}`)}}, }, { description: "Enabled With Existing Request User Ext Object - Doesn't Overwrite", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"existing":"any"}`)}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent","existing":"any"}`)}}, }, { description: "Enabled With Existing Request User Ext Object - Overwrites", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"existing":"any","consent":"toBeOverwritten"}`)}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"anyConsent","existing":"any"}`)}}, }, { description: "Enabled With Existing Malformed Request User Ext Object", consent: "anyConsent", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`malformed`)}}, expectedError: true, }, { description: "Injection Attack With Nil Request User Object", consent: "BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", - request: &openrtb.BidRequest{}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`), }}, }, { description: "Injection Attack With Nil Request User Ext Object", consent: "BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", - request: &openrtb.BidRequest{User: &openrtb.User{}}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{}}, + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\""}`), }}, }, { description: "Injection Attack With Existing Request User Ext Object", consent: "BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"", - request: &openrtb.BidRequest{User: &openrtb.User{ + request: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"existing":"any"}`), }}, - expected: &openrtb.BidRequest{User: &openrtb.User{ + expected: &openrtb2.BidRequest{User: &openrtb2.User{ Ext: json.RawMessage(`{"consent":"BONV8oqONXwgmADACHENAO7pqzAAppY\"},\"oops\":\"malicious\",\"p\":{\"p\":\"","existing":"any"}`), }}, }, diff --git a/privacy/lmt/policy.go b/privacy/lmt/policy.go index 5f23b9a3eef..6a3621446a4 100644 --- a/privacy/lmt/policy.go +++ b/privacy/lmt/policy.go @@ -1,7 +1,7 @@ package lmt import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) const ( @@ -16,7 +16,7 @@ type Policy struct { } // ReadFromRequest extracts the LMT (Limit Ad Tracking) policy from an OpenRTB bid request. -func ReadFromRequest(req *openrtb.BidRequest) (policy Policy) { +func ReadFromRequest(req *openrtb2.BidRequest) (policy Policy) { if req != nil && req.Device != nil && req.Device.Lmt != nil { policy.Signal = int(*req.Device.Lmt) policy.SignalProvided = true diff --git a/privacy/lmt/policy_test.go b/privacy/lmt/policy_test.go index 9d0e3b6aa9a..f475d2fb702 100644 --- a/privacy/lmt/policy_test.go +++ b/privacy/lmt/policy_test.go @@ -3,7 +3,7 @@ package lmt import ( "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) @@ -12,7 +12,7 @@ func TestReadFromRequest(t *testing.T) { testCases := []struct { description string - request *openrtb.BidRequest + request *openrtb2.BidRequest expectedPolicy Policy }{ { @@ -25,7 +25,7 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Device", - request: &openrtb.BidRequest{ + request: &openrtb2.BidRequest{ Device: nil, }, expectedPolicy: Policy{ @@ -35,8 +35,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Nil Device.Lmt", - request: &openrtb.BidRequest{ - Device: &openrtb.Device{ + request: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ Lmt: nil, }, }, @@ -47,8 +47,8 @@ func TestReadFromRequest(t *testing.T) { }, { description: "Enabled", - request: &openrtb.BidRequest{ - Device: &openrtb.Device{ + request: &openrtb2.BidRequest{ + Device: &openrtb2.Device{ Lmt: &one, }, }, diff --git a/privacy/scrubber.go b/privacy/scrubber.go index aea5c9008f4..edaa5bb07c6 100644 --- a/privacy/scrubber.go +++ b/privacy/scrubber.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strings" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // ScrubStrategyIPV4 defines the approach to scrub PII from an IPV4 address. @@ -73,8 +73,8 @@ const ( // Scrubber removes PII from parts of an OpenRTB request. type Scrubber interface { - ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb.Device - ScrubUser(user *openrtb.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb.User + ScrubDevice(device *openrtb2.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb2.Device + ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb2.User } type scrubber struct{} @@ -84,7 +84,7 @@ func NewScrubber() Scrubber { return scrubber{} } -func (scrubber) ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb.Device { +func (scrubber) ScrubDevice(device *openrtb2.Device, id ScrubStrategyDeviceID, ipv4 ScrubStrategyIPV4, ipv6 ScrubStrategyIPV6, geo ScrubStrategyGeo) *openrtb2.Device { if device == nil { return nil } @@ -124,7 +124,7 @@ func (scrubber) ScrubDevice(device *openrtb.Device, id ScrubStrategyDeviceID, ip return &deviceCopy } -func (scrubber) ScrubUser(user *openrtb.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb.User { +func (scrubber) ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo ScrubStrategyGeo) *openrtb2.User { if user == nil { return nil } @@ -194,15 +194,15 @@ func removeLowestIPV6Segment(ip string) string { return ip[0:i] } -func scrubGeoFull(geo *openrtb.Geo) *openrtb.Geo { +func scrubGeoFull(geo *openrtb2.Geo) *openrtb2.Geo { if geo == nil { return nil } - return &openrtb.Geo{} + return &openrtb2.Geo{} } -func scrubGeoPrecision(geo *openrtb.Geo) *openrtb.Geo { +func scrubGeoPrecision(geo *openrtb2.Geo) *openrtb2.Geo { if geo == nil { return nil } diff --git a/privacy/scrubber_test.go b/privacy/scrubber_test.go index 4d989e1c5a1..9207315f593 100644 --- a/privacy/scrubber_test.go +++ b/privacy/scrubber_test.go @@ -4,12 +4,12 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) func TestScrubDevice(t *testing.T) { - device := &openrtb.Device{ + device := &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -19,7 +19,7 @@ func TestScrubDevice(t *testing.T) { IFA: "anyIFA", IP: "1.2.3.4", IPv6: "2001:0db8:0000:0000:0000:ff00:0042:8329", - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -30,7 +30,7 @@ func TestScrubDevice(t *testing.T) { testCases := []struct { description string - expected *openrtb.Device + expected *openrtb2.Device id ScrubStrategyDeviceID ipv4 ScrubStrategyIPV4 ipv6 ScrubStrategyIPV6 @@ -46,7 +46,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "All Strageties - Strictest", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "", DIDSHA1: "", DPIDMD5: "", @@ -56,7 +56,7 @@ func TestScrubDevice(t *testing.T) { IFA: "", IP: "1.2.3.0", IPv6: "2001:0db8:0000:0000:0000:ff00:0:0", - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, id: ScrubStrategyDeviceIDAll, ipv4: ScrubStrategyIPV4Lowest8, @@ -65,7 +65,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - ID - All", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "", DIDSHA1: "", DPIDMD5: "", @@ -84,7 +84,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - IPv4 - Lowest 8", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -103,7 +103,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - IPv6 - Lowest 16", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -122,7 +122,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - IPv6 - Lowest 32", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -141,7 +141,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - Geo - Reduced Precision", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -151,7 +151,7 @@ func TestScrubDevice(t *testing.T) { IFA: "anyIFA", IP: "1.2.3.4", IPv6: "2001:0db8:0000:0000:0000:ff00:0042:8329", - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -166,7 +166,7 @@ func TestScrubDevice(t *testing.T) { }, { description: "Isolated - Geo - Full", - expected: &openrtb.Device{ + expected: &openrtb2.Device{ DIDMD5: "anyDIDMD5", DIDSHA1: "anyDIDSHA1", DPIDMD5: "anyDPIDMD5", @@ -176,7 +176,7 @@ func TestScrubDevice(t *testing.T) { IFA: "anyIFA", IP: "1.2.3.4", IPv6: "2001:0db8:0000:0000:0000:ff00:0042:8329", - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, id: ScrubStrategyDeviceIDNone, ipv4: ScrubStrategyIPV4None, @@ -197,13 +197,13 @@ func TestScrubDeviceNil(t *testing.T) { } func TestScrubUser(t *testing.T) { - user := &openrtb.User{ + user := &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -214,32 +214,32 @@ func TestScrubUser(t *testing.T) { testCases := []struct { description string - expected *openrtb.User + expected *openrtb2.User scrubUser ScrubStrategyUser scrubGeo ScrubStrategyGeo }{ { description: "User ID And Demographic & Geo Full", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 0, Gender: "", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, scrubUser: ScrubStrategyUserIDAndDemographic, scrubGeo: ScrubStrategyGeoFull, }, { description: "User ID And Demographic & Geo Reduced", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 0, Gender: "", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -252,13 +252,13 @@ func TestScrubUser(t *testing.T) { }, { description: "User ID And Demographic & Geo None", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 0, Gender: "", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -271,26 +271,26 @@ func TestScrubUser(t *testing.T) { }, { description: "User ID & Geo Full", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, scrubUser: ScrubStrategyUserID, scrubGeo: ScrubStrategyGeoFull, }, { description: "User ID & Geo Reduced", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -303,13 +303,13 @@ func TestScrubUser(t *testing.T) { }, { description: "User ID & Geo None", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "", BuyerUID: "", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -322,26 +322,26 @@ func TestScrubUser(t *testing.T) { }, { description: "User None & Geo Full", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{}, + Geo: &openrtb2.Geo{}, }, scrubUser: ScrubStrategyUserNone, scrubGeo: ScrubStrategyGeoFull, }, { description: "User None & Geo Reduced", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", @@ -354,13 +354,13 @@ func TestScrubUser(t *testing.T) { }, { description: "User None & Geo None", - expected: &openrtb.User{ + expected: &openrtb2.User{ ID: "anyID", BuyerUID: "anyBuyerUID", Yob: 42, Gender: "anyGender", Ext: json.RawMessage(`{"digitrust":{"id":"anyId","keyv":4,"pref":8}}`), - Geo: &openrtb.Geo{ + Geo: &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", @@ -503,14 +503,14 @@ func TestScrubIPV6Lowest32Bits(t *testing.T) { } func TestScrubGeoFull(t *testing.T) { - geo := &openrtb.Geo{ + geo := &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", City: "some city", ZIP: "some zip", } - geoExpected := &openrtb.Geo{ + geoExpected := &openrtb2.Geo{ Lat: 0, Lon: 0, Metro: "", @@ -529,14 +529,14 @@ func TestScrubGeoFullWhenNil(t *testing.T) { } func TestScrubGeoPrecision(t *testing.T) { - geo := &openrtb.Geo{ + geo := &openrtb2.Geo{ Lat: 123.456, Lon: 678.89, Metro: "some metro", City: "some city", ZIP: "some zip", } - geoExpected := &openrtb.Geo{ + geoExpected := &openrtb2.Geo{ Lat: 123.46, Lon: 678.89, Metro: "some metro", diff --git a/privacy/writer.go b/privacy/writer.go index a68a158ced8..7798af9b9fe 100644 --- a/privacy/writer.go +++ b/privacy/writer.go @@ -1,18 +1,18 @@ package privacy import ( - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" ) // PolicyWriter mutates an OpenRTB bid request with a policy's regulatory information. type PolicyWriter interface { - Write(req *openrtb.BidRequest) error + Write(req *openrtb2.BidRequest) error } // NilPolicyWriter implements the PolicyWriter interface but performs no action. type NilPolicyWriter struct{} // Write is hardcoded to perform no action with the OpenRTB bid request. -func (NilPolicyWriter) Write(req *openrtb.BidRequest) error { +func (NilPolicyWriter) Write(req *openrtb2.BidRequest) error { return nil } diff --git a/privacy/writer_test.go b/privacy/writer_test.go index 754e6ffe2c9..f5b02387124 100644 --- a/privacy/writer_test.go +++ b/privacy/writer_test.go @@ -4,16 +4,16 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/openrtb" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) func TestNilWriter(t *testing.T) { - request := &openrtb.BidRequest{ + request := &openrtb2.BidRequest{ ID: "anyID", Ext: json.RawMessage(`{"anyJson":"anyValue"}`), } - expectedRequest := &openrtb.BidRequest{ + expectedRequest := &openrtb2.BidRequest{ ID: "anyID", Ext: json.RawMessage(`{"anyJson":"anyValue"}`), } From b40c4a4818f320dfebaeea4e5d669c8db5714575 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Mon, 26 Apr 2021 11:55:14 +0530 Subject: [PATCH 72/91] Rename package github.com/PubMatic-OpenWrap/prebid-server to github.com/prebid/prebid-server --- account/account.go | 8 +- account/account_test.go | 8 +- adapters/33across/33across.go | 8 +- adapters/33across/33across_test.go | 6 +- adapters/33across/params_test.go | 2 +- adapters/33across/usersync.go | 4 +- adapters/33across/usersync_test.go | 6 +- adapters/acuityads/acuityads.go | 10 +- adapters/acuityads/acuityads_test.go | 6 +- adapters/acuityads/params_test.go | 2 +- adapters/acuityads/usersync.go | 4 +- adapters/acuityads/usersync_test.go | 6 +- adapters/adapterstest/test_json.go | 2 +- adapters/adform/adform.go | 10 +- adapters/adform/adform_test.go | 14 +- adapters/adform/params_test.go | 2 +- adapters/adform/usersync.go | 4 +- adapters/adform/usersync_test.go | 4 +- adapters/adgeneration/adgeneration.go | 8 +- adapters/adgeneration/adgeneration_test.go | 8 +- adapters/adgeneration/params_test.go | 2 +- adapters/adhese/adhese.go | 10 +- adapters/adhese/adhese_test.go | 6 +- adapters/adhese/params_test.go | 2 +- adapters/adkernel/adkernel.go | 10 +- adapters/adkernel/adkernel_test.go | 6 +- adapters/adkernel/usersync.go | 4 +- adapters/adkernel/usersync_test.go | 6 +- adapters/adkernelAdn/adkernelAdn.go | 10 +- adapters/adkernelAdn/adkernelAdn_test.go | 6 +- adapters/adkernelAdn/usersync.go | 4 +- adapters/adkernelAdn/usersync_test.go | 6 +- adapters/adman/adman.go | 8 +- adapters/adman/adman_test.go | 6 +- adapters/adman/params_test.go | 2 +- adapters/adman/usersync.go | 4 +- adapters/adman/usersync_test.go | 6 +- adapters/admixer/admixer.go | 8 +- adapters/admixer/admixer_test.go | 6 +- adapters/admixer/params_test.go | 2 +- adapters/admixer/usersync.go | 4 +- adapters/admixer/usersync_test.go | 6 +- adapters/adocean/adocean.go | 10 +- adapters/adocean/adocean_test.go | 6 +- adapters/adocean/params_test.go | 2 +- adapters/adocean/usersync.go | 4 +- adapters/adocean/usersync_test.go | 4 +- adapters/adoppler/adoppler.go | 10 +- adapters/adoppler/adoppler_test.go | 6 +- adapters/adot/adot.go | 8 +- adapters/adot/adot_test.go | 8 +- adapters/adot/params_test.go | 2 +- adapters/adpone/adpone.go | 8 +- adapters/adpone/adpone_test.go | 6 +- adapters/adpone/usersync.go | 4 +- adapters/adpone/usersync_test.go | 2 +- adapters/adprime/adprime.go | 8 +- adapters/adprime/adprime_test.go | 6 +- adapters/adprime/params_test.go | 2 +- adapters/adtarget/adtarget.go | 8 +- adapters/adtarget/adtarget_test.go | 6 +- adapters/adtarget/params_test.go | 2 +- adapters/adtarget/usersync.go | 4 +- adapters/adtarget/usersync_test.go | 6 +- adapters/adtelligent/adtelligent.go | 8 +- adapters/adtelligent/adtelligent_test.go | 6 +- adapters/adtelligent/params_test.go | 2 +- adapters/adtelligent/usersync.go | 4 +- adapters/adtelligent/usersync_test.go | 4 +- adapters/advangelists/advangelists.go | 10 +- adapters/advangelists/advangelists_test.go | 6 +- adapters/advangelists/params_test.go | 2 +- adapters/advangelists/usersync.go | 4 +- adapters/advangelists/usersync_test.go | 4 +- adapters/aja/aja.go | 8 +- adapters/aja/aja_test.go | 6 +- adapters/aja/usersync.go | 4 +- adapters/aja/usersync_test.go | 6 +- adapters/amx/amx.go | 8 +- adapters/amx/amx_test.go | 8 +- adapters/amx/params_test.go | 2 +- adapters/amx/usersync.go | 4 +- adapters/amx/usersync_test.go | 2 +- adapters/applogy/applogy.go | 8 +- adapters/applogy/applogy_test.go | 6 +- adapters/appnexus/appnexus.go | 12 +- adapters/appnexus/appnexus_test.go | 14 +- adapters/appnexus/params_test.go | 2 +- adapters/appnexus/usersync.go | 4 +- adapters/appnexus/usersync_test.go | 2 +- adapters/audienceNetwork/facebook.go | 10 +- adapters/audienceNetwork/facebook_test.go | 8 +- adapters/audienceNetwork/usersync.go | 4 +- adapters/audienceNetwork/usersync_test.go | 2 +- adapters/avocet/avocet.go | 8 +- adapters/avocet/avocet_test.go | 10 +- adapters/avocet/usersync.go | 4 +- adapters/avocet/usersync_test.go | 6 +- adapters/beachfront/beachfront.go | 8 +- adapters/beachfront/beachfront_test.go | 6 +- adapters/beachfront/params_test.go | 2 +- adapters/beachfront/usersync.go | 4 +- adapters/beachfront/usersync_test.go | 6 +- adapters/beintoo/beintoo.go | 8 +- adapters/beintoo/beintoo_test.go | 6 +- adapters/beintoo/params_test.go | 2 +- adapters/beintoo/usersync.go | 4 +- adapters/beintoo/usersync_test.go | 6 +- adapters/between/between.go | 10 +- adapters/between/between_test.go | 6 +- adapters/between/params_test.go | 2 +- adapters/between/usersync.go | 4 +- adapters/between/usersync_test.go | 2 +- adapters/bidder.go | 6 +- adapters/brightroll/brightroll.go | 8 +- adapters/brightroll/brightroll_test.go | 6 +- adapters/brightroll/params_test.go | 2 +- adapters/brightroll/usersync.go | 4 +- adapters/brightroll/usersync_test.go | 2 +- adapters/colossus/colossus.go | 8 +- adapters/colossus/colossus_test.go | 6 +- adapters/colossus/params_test.go | 2 +- adapters/colossus/usersync.go | 4 +- adapters/colossus/usersync_test.go | 6 +- adapters/connectad/connectad.go | 8 +- adapters/connectad/connectad_test.go | 6 +- adapters/connectad/params_test.go | 2 +- adapters/connectad/usersync.go | 4 +- adapters/connectad/usersync_test.go | 6 +- adapters/consumable/consumable.go | 10 +- adapters/consumable/consumable_test.go | 8 +- adapters/consumable/params_test.go | 2 +- adapters/consumable/usersync.go | 4 +- adapters/consumable/usersync_test.go | 6 +- adapters/conversant/cnvr_legacy.go | 6 +- adapters/conversant/cnvr_legacy_test.go | 10 +- adapters/conversant/conversant.go | 8 +- adapters/conversant/conversant_test.go | 6 +- adapters/conversant/usersync.go | 4 +- adapters/conversant/usersync_test.go | 4 +- adapters/cpmstar/cpmstar.go | 8 +- adapters/cpmstar/cpmstar_test.go | 6 +- adapters/cpmstar/params_test.go | 2 +- adapters/cpmstar/usersync.go | 4 +- adapters/cpmstar/usersync_test.go | 2 +- adapters/datablocks/datablocks.go | 10 +- adapters/datablocks/datablocks_test.go | 6 +- adapters/datablocks/usersync.go | 4 +- adapters/datablocks/usersync_test.go | 6 +- adapters/decenterads/decenterads.go | 8 +- adapters/decenterads/decenterads_test.go | 6 +- adapters/decenterads/params_test.go | 2 +- adapters/deepintent/deepintent.go | 8 +- adapters/deepintent/deepintent_test.go | 6 +- adapters/deepintent/params_test.go | 2 +- adapters/deepintent/usersync.go | 4 +- adapters/deepintent/usersync_test.go | 6 +- adapters/dmx/dmx.go | 8 +- adapters/dmx/dmx_test.go | 8 +- adapters/dmx/params_test.go | 2 +- adapters/dmx/usersync.go | 4 +- adapters/dmx/usersync_test.go | 2 +- adapters/emx_digital/emx_digital.go | 8 +- adapters/emx_digital/emx_digital_test.go | 8 +- adapters/emx_digital/params_test.go | 2 +- adapters/emx_digital/usersync.go | 4 +- adapters/emx_digital/usersync_test.go | 6 +- adapters/engagebdr/engagebdr.go | 8 +- adapters/engagebdr/engagebdr_test.go | 6 +- adapters/engagebdr/params_test.go | 2 +- adapters/engagebdr/usersync.go | 4 +- adapters/engagebdr/usersync_test.go | 6 +- adapters/eplanning/eplanning.go | 8 +- adapters/eplanning/eplanning_test.go | 8 +- adapters/eplanning/usersync.go | 4 +- adapters/eplanning/usersync_test.go | 2 +- adapters/gamma/gamma.go | 8 +- adapters/gamma/gamma_test.go | 6 +- adapters/gamma/params_test.go | 2 +- adapters/gamma/usersync.go | 4 +- adapters/gamma/usersync_test.go | 4 +- adapters/gamoshi/gamoshi.go | 8 +- adapters/gamoshi/gamoshi_test.go | 6 +- adapters/gamoshi/params_test.go | 2 +- adapters/gamoshi/usersync.go | 4 +- adapters/gamoshi/usersync_test.go | 4 +- adapters/grid/grid.go | 8 +- adapters/grid/grid_test.go | 6 +- adapters/grid/usersync.go | 4 +- adapters/grid/usersync_test.go | 4 +- adapters/gumgum/gumgum.go | 8 +- adapters/gumgum/gumgum_test.go | 6 +- adapters/gumgum/params_test.go | 2 +- adapters/gumgum/usersync.go | 4 +- adapters/gumgum/usersync_test.go | 6 +- adapters/improvedigital/improvedigital.go | 8 +- .../improvedigital/improvedigital_test.go | 6 +- adapters/improvedigital/params_test.go | 2 +- adapters/improvedigital/usersync.go | 4 +- adapters/improvedigital/usersync_test.go | 6 +- adapters/info.go | 6 +- adapters/info_test.go | 8 +- adapters/inmobi/inmobi.go | 8 +- adapters/inmobi/inmobi_test.go | 6 +- adapters/invibes/invibes.go | 12 +- adapters/invibes/invibes_test.go | 6 +- adapters/invibes/params_test.go | 2 +- adapters/invibes/usersync.go | 4 +- adapters/invibes/usersync_test.go | 4 +- adapters/ix/ix.go | 10 +- adapters/ix/ix_test.go | 10 +- adapters/ix/usersync.go | 4 +- adapters/ix/usersync_test.go | 2 +- adapters/kidoz/kidoz.go | 8 +- adapters/kidoz/kidoz_test.go | 8 +- adapters/kidoz/params_test.go | 2 +- adapters/krushmedia/krushmedia.go | 10 +- adapters/krushmedia/krushmedia_test.go | 6 +- adapters/krushmedia/params_test.go | 2 +- adapters/krushmedia/usersync.go | 4 +- adapters/krushmedia/usersync_test.go | 6 +- adapters/kubient/kubient.go | 8 +- adapters/kubient/kubient_test.go | 6 +- adapters/legacy.go | 4 +- adapters/lifestreet/lifestreet.go | 8 +- adapters/lifestreet/lifestreet_test.go | 10 +- adapters/lifestreet/usersync.go | 4 +- adapters/lifestreet/usersync_test.go | 4 +- adapters/lockerdome/lockerdome.go | 8 +- adapters/lockerdome/lockerdome_test.go | 6 +- adapters/lockerdome/params_test.go | 2 +- adapters/lockerdome/usersync.go | 4 +- adapters/lockerdome/usersync_test.go | 2 +- adapters/logicad/logicad.go | 8 +- adapters/logicad/logicad_test.go | 6 +- adapters/logicad/params_test.go | 2 +- adapters/logicad/usersync.go | 4 +- adapters/logicad/usersync_test.go | 4 +- adapters/lunamedia/lunamedia.go | 10 +- adapters/lunamedia/lunamedia_test.go | 6 +- adapters/lunamedia/params_test.go | 2 +- adapters/lunamedia/usersync.go | 4 +- adapters/lunamedia/usersync_test.go | 4 +- adapters/marsmedia/marsmedia.go | 8 +- adapters/marsmedia/marsmedia_test.go | 6 +- adapters/marsmedia/params_test.go | 2 +- adapters/marsmedia/usersync.go | 4 +- adapters/marsmedia/usersync_test.go | 6 +- adapters/mediafuse/usersync.go | 4 +- adapters/mediafuse/usersync_test.go | 4 +- adapters/mgid/mgid.go | 8 +- adapters/mgid/mgid_test.go | 6 +- adapters/mgid/usersync.go | 4 +- adapters/mgid/usersync_test.go | 4 +- adapters/mobfoxpb/mobfoxpb.go | 8 +- adapters/mobfoxpb/mobfoxpb_test.go | 6 +- adapters/mobfoxpb/params_test.go | 2 +- adapters/mobilefuse/mobilefuse.go | 10 +- adapters/mobilefuse/mobilefuse_test.go | 6 +- adapters/mobilefuse/params_test.go | 2 +- adapters/nanointeractive/nanointeractive.go | 8 +- .../nanointeractive/nanointeractive_test.go | 6 +- adapters/nanointeractive/params_test.go | 2 +- adapters/nanointeractive/usersync.go | 4 +- adapters/nanointeractive/usersync_test.go | 6 +- adapters/ninthdecimal/ninthdecimal.go | 10 +- adapters/ninthdecimal/ninthdecimal_test.go | 6 +- adapters/ninthdecimal/params_test.go | 2 +- adapters/ninthdecimal/usersync.go | 4 +- adapters/ninthdecimal/usersync_test.go | 4 +- adapters/nobid/nobid.go | 8 +- adapters/nobid/nobid_test.go | 6 +- adapters/nobid/params_test.go | 2 +- adapters/nobid/usersync.go | 4 +- adapters/nobid/usersync_test.go | 6 +- adapters/openrtb_util.go | 4 +- adapters/openrtb_util_test.go | 4 +- adapters/openx/openx.go | 8 +- adapters/openx/openx_test.go | 8 +- adapters/openx/params_test.go | 2 +- adapters/openx/usersync.go | 4 +- adapters/openx/usersync_test.go | 2 +- adapters/orbidder/orbidder.go | 8 +- adapters/orbidder/orbidder_test.go | 6 +- adapters/orbidder/params_test.go | 2 +- adapters/pubmatic/params_test.go | 2 +- adapters/pubmatic/pubmatic.go | 10 +- adapters/pubmatic/pubmatic_test.go | 14 +- adapters/pubmatic/usersync.go | 4 +- adapters/pubmatic/usersync_test.go | 6 +- adapters/pubnative/pubnative.go | 8 +- adapters/pubnative/pubnative_test.go | 6 +- adapters/pulsepoint/params_test.go | 2 +- adapters/pulsepoint/pulsepoint.go | 10 +- adapters/pulsepoint/pulsepoint_test.go | 14 +- adapters/pulsepoint/usersync.go | 4 +- adapters/pulsepoint/usersync_test.go | 2 +- adapters/revcontent/revcontent.go | 8 +- adapters/revcontent/revcontent_test.go | 6 +- adapters/rhythmone/params_test.go | 2 +- adapters/rhythmone/rhythmone.go | 8 +- adapters/rhythmone/rhythmone_test.go | 6 +- adapters/rhythmone/usersync.go | 4 +- adapters/rhythmone/usersync_test.go | 6 +- adapters/rtbhouse/rtbhouse.go | 8 +- adapters/rtbhouse/rtbhouse_test.go | 6 +- adapters/rtbhouse/usersync.go | 4 +- adapters/rtbhouse/usersync_test.go | 4 +- adapters/rubicon/rubicon.go | 10 +- adapters/rubicon/rubicon_test.go | 16 +- adapters/rubicon/usersync.go | 4 +- adapters/rubicon/usersync_test.go | 4 +- adapters/sharethrough/butler.go | 8 +- adapters/sharethrough/butler_test.go | 6 +- adapters/sharethrough/params_test.go | 2 +- adapters/sharethrough/sharethrough.go | 8 +- adapters/sharethrough/sharethrough_test.go | 8 +- adapters/sharethrough/usersync.go | 4 +- adapters/sharethrough/usersync_test.go | 4 +- adapters/sharethrough/utils.go | 2 +- adapters/sharethrough/utils_test.go | 2 +- adapters/silvermob/params_test.go | 2 +- adapters/silvermob/silvermob.go | 10 +- adapters/silvermob/silvermob_test.go | 6 +- adapters/smaato/params_test.go | 2 +- adapters/smaato/smaato.go | 8 +- adapters/smaato/smaato_test.go | 6 +- adapters/smartadserver/params_test.go | 2 +- adapters/smartadserver/smartadserver.go | 8 +- adapters/smartadserver/smartadserver_test.go | 6 +- adapters/smartadserver/usersync.go | 4 +- adapters/smartadserver/usersync_test.go | 6 +- adapters/smartrtb/smartrtb.go | 10 +- adapters/smartrtb/smartrtb_test.go | 6 +- adapters/smartrtb/usersync.go | 4 +- adapters/smartrtb/usersync_test.go | 2 +- adapters/smartyads/params_test.go | 2 +- adapters/smartyads/smartyads.go | 10 +- adapters/smartyads/smartyads_test.go | 6 +- adapters/smartyads/usersync.go | 4 +- adapters/smartyads/usersync_test.go | 6 +- adapters/somoaudience/params_test.go | 2 +- adapters/somoaudience/somoaudience.go | 8 +- adapters/somoaudience/somoaudience_test.go | 6 +- adapters/somoaudience/usersync.go | 4 +- adapters/somoaudience/usersync_test.go | 2 +- adapters/sonobi/params_test.go | 2 +- adapters/sonobi/sonobi.go | 8 +- adapters/sonobi/sonobi_test.go | 6 +- adapters/sonobi/usersync.go | 4 +- adapters/sonobi/usersync_test.go | 4 +- adapters/sovrn/sovrn.go | 10 +- adapters/sovrn/sovrn_test.go | 14 +- adapters/sovrn/usersync.go | 4 +- adapters/sovrn/usersync_test.go | 4 +- adapters/spotx/params_test.go | 2 +- adapters/spotx/spotx.go | 8 +- adapters/spotx/spotx_test.go | 2 +- adapters/synacormedia/params_test.go | 2 +- adapters/synacormedia/synacormedia.go | 10 +- adapters/synacormedia/synacormedia_test.go | 6 +- adapters/synacormedia/usersync.go | 4 +- adapters/synacormedia/usersync_test.go | 2 +- adapters/syncer.go | 8 +- adapters/syncer_test.go | 6 +- adapters/tappx/params_test.go | 2 +- adapters/tappx/tappx.go | 10 +- adapters/tappx/tappx_test.go | 6 +- adapters/telaria/params_test.go | 2 +- adapters/telaria/telaria.go | 8 +- adapters/telaria/telaria_test.go | 6 +- adapters/telaria/usersync.go | 4 +- adapters/telaria/usersync_test.go | 4 +- adapters/triplelift/triplelift.go | 8 +- adapters/triplelift/triplelift_test.go | 6 +- adapters/triplelift/usersync.go | 4 +- adapters/triplelift/usersync_test.go | 2 +- .../triplelift_native/triplelift_native.go | 8 +- .../triplelift_native_test.go | 6 +- adapters/triplelift_native/usersync.go | 4 +- adapters/triplelift_native/usersync_test.go | 2 +- adapters/ucfunnel/params_test.go | 2 +- adapters/ucfunnel/ucfunnel.go | 8 +- adapters/ucfunnel/ucfunnel_test.go | 6 +- adapters/ucfunnel/usersync.go | 4 +- adapters/ucfunnel/usersync_test.go | 4 +- adapters/unruly/params_test.go | 2 +- adapters/unruly/unruly.go | 8 +- adapters/unruly/unruly_test.go | 10 +- adapters/unruly/usersync.go | 4 +- adapters/unruly/usersync_test.go | 6 +- adapters/valueimpression/params_test.go | 2 +- adapters/valueimpression/usersync.go | 4 +- adapters/valueimpression/usersync_test.go | 6 +- adapters/valueimpression/valueimpression.go | 8 +- .../valueimpression/valueimpression_test.go | 6 +- adapters/verizonmedia/params_test.go | 2 +- adapters/verizonmedia/usersync.go | 4 +- adapters/verizonmedia/usersync_test.go | 2 +- adapters/verizonmedia/verizonmedia.go | 8 +- adapters/verizonmedia/verizonmedia_test.go | 6 +- adapters/visx/params_test.go | 2 +- adapters/visx/usersync.go | 4 +- adapters/visx/usersync_test.go | 6 +- adapters/visx/visx.go | 8 +- adapters/visx/visx_test.go | 6 +- adapters/vrtcal/params_test.go | 2 +- adapters/vrtcal/usersync.go | 4 +- adapters/vrtcal/usersync_test.go | 4 +- adapters/vrtcal/vrtcal.go | 8 +- adapters/vrtcal/vrtcal_test.go | 6 +- adapters/yeahmobi/params_test.go | 2 +- adapters/yeahmobi/yeahmobi.go | 10 +- adapters/yeahmobi/yeahmobi_test.go | 6 +- adapters/yieldlab/params_test.go | 2 +- adapters/yieldlab/usersync.go | 4 +- adapters/yieldlab/usersync_test.go | 4 +- adapters/yieldlab/yieldlab.go | 8 +- adapters/yieldlab/yieldlab_test.go | 6 +- adapters/yieldmo/params_test.go | 2 +- adapters/yieldmo/usersync.go | 4 +- adapters/yieldmo/usersync_test.go | 4 +- adapters/yieldmo/yieldmo.go | 8 +- adapters/yieldmo/yieldmo_test.go | 6 +- adapters/yieldone/params_test.go | 2 +- adapters/yieldone/usersync.go | 4 +- adapters/yieldone/usersync_test.go | 4 +- adapters/yieldone/yieldone.go | 8 +- adapters/yieldone/yieldone_test.go | 6 +- adapters/zeroclickfraud/usersync.go | 4 +- adapters/zeroclickfraud/usersync_test.go | 6 +- adapters/zeroclickfraud/zeroclickfraud.go | 10 +- .../zeroclickfraud/zeroclickfraud_test.go | 6 +- analytics/config/config.go | 10 +- analytics/config/config_test.go | 4 +- analytics/core.go | 6 +- analytics/filesystem/file_module.go | 2 +- analytics/filesystem/file_module_test.go | 6 +- analytics/pubstack/helpers/json.go | 2 +- analytics/pubstack/helpers/json_test.go | 4 +- analytics/pubstack/pubstack_module.go | 6 +- analytics/pubstack/pubstack_module_test.go | 2 +- cache/dummycache/dummycache.go | 2 +- cache/filecache/filecache.go | 2 +- cache/postgrescache/postgrescache.go | 4 +- config/adapter.go | 2 +- config/config.go | 4 +- config/config_test.go | 2 +- currency/rate_converter.go | 4 +- currency/rate_converter_test.go | 2 +- endpoints/auction.go | 26 +-- endpoints/auction_test.go | 20 +- endpoints/cookie_sync.go | 18 +- endpoints/cookie_sync_test.go | 20 +- endpoints/currency_rates.go | 2 +- endpoints/currency_rates_test.go | 2 +- endpoints/events/account_test.go | 6 +- endpoints/events/event.go | 10 +- endpoints/events/event_test.go | 6 +- endpoints/events/vtrack.go | 14 +- endpoints/events/vtrack_test.go | 8 +- endpoints/getuids.go | 4 +- endpoints/getuids_test.go | 2 +- endpoints/info/bidders.go | 4 +- endpoints/info/bidders_test.go | 8 +- endpoints/openrtb2/amp_auction.go | 30 +-- endpoints/openrtb2/amp_auction_test.go | 16 +- endpoints/openrtb2/auction.go | 28 +-- endpoints/openrtb2/auction_benchmark_test.go | 16 +- endpoints/openrtb2/auction_test.go | 22 +- .../adslot_combination_generator.go | 2 +- .../adslot_combination_generator_test.go | 4 +- .../openrtb2/ctv/combination/combination.go | 4 +- .../ctv/combination/combination_test.go | 4 +- endpoints/openrtb2/ctv/impressions/helper.go | 4 +- .../ctv/impressions/impression_generator.go | 2 +- .../openrtb2/ctv/impressions/impressions.go | 4 +- .../ctv/impressions/maximize_for_duration.go | 4 +- .../impressions/maximize_for_duration_test.go | 4 +- .../ctv/impressions/min_max_algorithm.go | 4 +- .../ctv/impressions/min_max_algorithm_test.go | 2 +- .../ctv/response/adpod_generator copy.go.bak | 2 +- .../openrtb2/ctv/response/adpod_generator.go | 12 +- .../ctv/response/adpod_generator_test.go | 2 +- endpoints/openrtb2/ctv/types/adpod_types.go | 4 +- endpoints/openrtb2/ctv/util/util.go | 6 +- endpoints/openrtb2/ctv/util/util_test.go | 4 +- endpoints/openrtb2/ctv_auction.go | 32 +-- endpoints/openrtb2/ctv_auction_test.go | 2 +- endpoints/openrtb2/interstitial.go | 6 +- endpoints/openrtb2/video_auction.go | 22 +- endpoints/openrtb2/video_auction_test.go | 16 +- endpoints/setuid.go | 12 +- endpoints/setuid_test.go | 16 +- exchange/adapter_builders.go | 194 +++++++++--------- exchange/adapter_util.go | 10 +- exchange/adapter_util_test.go | 16 +- exchange/auction.go | 6 +- exchange/auction_test.go | 6 +- exchange/bidder.go | 14 +- exchange/bidder_test.go | 12 +- exchange/bidder_validate_bids.go | 6 +- exchange/bidder_validate_bids_test.go | 6 +- exchange/events.go | 12 +- exchange/events_test.go | 2 +- exchange/exchange.go | 20 +- exchange/exchange_test.go | 22 +- exchange/gdpr.go | 2 +- exchange/gdpr_test.go | 2 +- exchange/legacy.go | 10 +- exchange/legacy_test.go | 10 +- exchange/price_granularity.go | 2 +- exchange/price_granularity_test.go | 2 +- exchange/targeting.go | 2 +- exchange/targeting_test.go | 14 +- exchange/utils.go | 14 +- exchange/utils_test.go | 10 +- gdpr/gdpr.go | 6 +- gdpr/gdpr_test.go | 4 +- gdpr/impl.go | 4 +- gdpr/impl_test.go | 4 +- gdpr/vendorlist-fetching.go | 2 +- gdpr/vendorlist-fetching_test.go | 2 +- go.mod | 4 +- main.go | 14 +- main_test.go | 2 +- metrics/config/metrics.go | 8 +- metrics/config/metrics_test.go | 6 +- metrics/go_metrics.go | 4 +- metrics/go_metrics_test.go | 4 +- metrics/metrics.go | 2 +- metrics/metrics_mock.go | 2 +- metrics/prometheus/preload.go | 2 +- metrics/prometheus/prometheus.go | 6 +- metrics/prometheus/prometheus_test.go | 6 +- metrics/prometheus/type_conversion.go | 4 +- openrtb_ext/device.go | 2 +- openrtb_ext/device_test.go | 2 +- openrtb_ext/site_test.go | 2 +- pbs/pbsrequest.go | 12 +- pbs/pbsrequest_test.go | 4 +- pbs/usersync.go | 10 +- prebid_cache_client/client.go | 4 +- prebid_cache_client/client_test.go | 6 +- privacy/ccpa/parsedpolicy.go | 2 +- privacy/ccpa/policy.go | 2 +- privacy/gdpr/consentwriter.go | 2 +- privacy/policies.go | 6 +- router/admin.go | 4 +- router/aspects/request_timeout_handler.go | 4 +- .../aspects/request_timeout_handler_test.go | 4 +- router/router.go | 66 +++--- router/router_test.go | 4 +- server/listener.go | 2 +- server/listener_test.go | 4 +- server/prometheus.go | 6 +- server/server.go | 6 +- server/server_test.go | 2 +- .../backends/db_fetcher/fetcher.go | 2 +- .../backends/empty_fetcher/fetcher.go | 2 +- .../backends/file_fetcher/fetcher.go | 2 +- .../backends/file_fetcher/fetcher_test.go | 2 +- .../backends/http_fetcher/fetcher.go | 2 +- stored_requests/caches/cachestest/reliable.go | 2 +- stored_requests/caches/memory/cache.go | 2 +- stored_requests/caches/memory/cache_test.go | 4 +- stored_requests/config/config.go | 30 +-- stored_requests/config/config_test.go | 14 +- stored_requests/events/api/api.go | 2 +- stored_requests/events/api/api_test.go | 6 +- stored_requests/events/events.go | 2 +- stored_requests/events/events_test.go | 4 +- stored_requests/events/http/http.go | 2 +- stored_requests/events/postgres/database.go | 8 +- .../events/postgres/database_test.go | 6 +- stored_requests/fetcher.go | 2 +- stored_requests/fetcher_test.go | 4 +- usersync/cookie.go | 4 +- usersync/cookie_test.go | 4 +- usersync/usersync.go | 2 +- usersync/usersyncers/syncer.go | 160 +++++++-------- usersync/usersyncers/syncer_test.go | 4 +- util/httputil/httputil.go | 2 +- util/httputil/httputil_test.go | 2 +- util/task/ticker_task_test.go | 2 +- 585 files changed, 1893 insertions(+), 1893 deletions(-) diff --git a/account/account.go b/account/account.go index d5d22f4a894..0ed9de94c55 100644 --- a/account/account.go +++ b/account/account.go @@ -5,10 +5,10 @@ import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/stored_requests" jsonpatch "github.com/evanphx/json-patch" ) diff --git a/account/account_test.go b/account/account_test.go index 0783ee0e134..75c48a02d89 100644 --- a/account/account_test.go +++ b/account/account_test.go @@ -6,10 +6,10 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/stored_requests" "github.com/stretchr/testify/assert" ) diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index 9d2a5310943..b193f739791 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -6,10 +6,10 @@ import ( "net/http" "github.com/mxmCherry/openrtb/v15/openrtb2" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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 TtxAdapter struct { diff --git a/adapters/33across/33across_test.go b/adapters/33across/33across_test.go index 08c2ff614e9..97703735d9c 100644 --- a/adapters/33across/33across_test.go +++ b/adapters/33across/33across_test.go @@ -3,9 +3,9 @@ package ttx import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/33across/params_test.go b/adapters/33across/params_test.go index 19dfb22198c..0c7cde18216 100644 --- a/adapters/33across/params_test.go +++ b/adapters/33across/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/33across.json diff --git a/adapters/33across/usersync.go b/adapters/33across/usersync.go index 0bed70ee60d..7bc9ae458ae 100644 --- a/adapters/33across/usersync.go +++ b/adapters/33across/usersync.go @@ -3,8 +3,8 @@ package ttx import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func New33AcrossSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/33across/usersync_test.go b/adapters/33across/usersync_test.go index 89cae0f3f19..a9eb4e57908 100644 --- a/adapters/33across/usersync_test.go +++ b/adapters/33across/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/acuityads/acuityads.go b/adapters/acuityads/acuityads.go index 7f92231e89c..da1cda3da77 100644 --- a/adapters/acuityads/acuityads.go +++ b/adapters/acuityads/acuityads.go @@ -7,11 +7,11 @@ import ( "text/template" "github.com/mxmCherry/openrtb/v15/openrtb2" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" ) type AcuityAdsAdapter struct { diff --git a/adapters/acuityads/acuityads_test.go b/adapters/acuityads/acuityads_test.go index be12780a778..8cc50637374 100644 --- a/adapters/acuityads/acuityads_test.go +++ b/adapters/acuityads/acuityads_test.go @@ -3,9 +3,9 @@ package acuityads import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/acuityads/params_test.go b/adapters/acuityads/params_test.go index e1a47669796..892fe9a646d 100644 --- a/adapters/acuityads/params_test.go +++ b/adapters/acuityads/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) var validParams = []string{ diff --git a/adapters/acuityads/usersync.go b/adapters/acuityads/usersync.go index 90b610bb3cd..7eedf78d229 100644 --- a/adapters/acuityads/usersync.go +++ b/adapters/acuityads/usersync.go @@ -3,8 +3,8 @@ package acuityads import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAcuityAdsSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/acuityads/usersync_test.go b/adapters/acuityads/usersync_test.go index 5c6f6a43677..1f57cea3b66 100644 --- a/adapters/acuityads/usersync_test.go +++ b/adapters/acuityads/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adapterstest/test_json.go b/adapters/adapterstest/test_json.go index e6edf495d7d..72551d55ccd 100644 --- a/adapters/adapterstest/test_json.go +++ b/adapters/adapterstest/test_json.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/yudai/gojsondiff" "github.com/yudai/gojsondiff/formatter" diff --git a/adapters/adform/adform.go b/adapters/adform/adform.go index ea93bb4da84..23c13aa6eb5 100644 --- a/adapters/adform/adform.go +++ b/adapters/adform/adform.go @@ -13,11 +13,11 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "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" + "github.com/prebid/prebid-server/pbs" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index c903eb24c10..9de1675e5c5 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -10,16 +10,16 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" diff --git a/adapters/adform/params_test.go b/adapters/adform/params_test.go index c4ffb79399e..b392463f426 100644 --- a/adapters/adform/params_test.go +++ b/adapters/adform/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/adform.json diff --git a/adapters/adform/usersync.go b/adapters/adform/usersync.go index b98c1b6c0fc..32b4e3a91c1 100644 --- a/adapters/adform/usersync.go +++ b/adapters/adform/usersync.go @@ -3,8 +3,8 @@ package adform import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAdformSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/adform/usersync_test.go b/adapters/adform/usersync_test.go index 3a507331e85..855506da2ed 100644 --- a/adapters/adform/usersync_test.go +++ b/adapters/adform/usersync_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" ) func TestAdformSyncer(t *testing.T) { diff --git a/adapters/adgeneration/adgeneration.go b/adapters/adgeneration/adgeneration.go index c6a960ac1be..d86d19979be 100644 --- a/adapters/adgeneration/adgeneration.go +++ b/adapters/adgeneration/adgeneration.go @@ -10,10 +10,10 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adgeneration/adgeneration_test.go b/adapters/adgeneration/adgeneration_test.go index 60fd4041d3b..fc7f73b74b5 100644 --- a/adapters/adgeneration/adgeneration_test.go +++ b/adapters/adgeneration/adgeneration_test.go @@ -4,10 +4,10 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adgeneration/params_test.go b/adapters/adgeneration/params_test.go index 11a0dfe97c5..062d122ac08 100644 --- a/adapters/adgeneration/params_test.go +++ b/adapters/adgeneration/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index 292c5b04af8..32ec5e9c704 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -10,11 +10,11 @@ import ( "strings" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adhese/adhese_test.go b/adapters/adhese/adhese_test.go index 40b28887c20..3a9d28ee5e9 100644 --- a/adapters/adhese/adhese_test.go +++ b/adapters/adhese/adhese_test.go @@ -3,9 +3,9 @@ package adhese import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adhese/params_test.go b/adapters/adhese/params_test.go index f9c3de6212e..45024749b2d 100644 --- a/adapters/adhese/params_test.go +++ b/adapters/adhese/params_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/adkernel/adkernel.go b/adapters/adkernel/adkernel.go index 622fa8d95ae..f5049f9ae5b 100644 --- a/adapters/adkernel/adkernel.go +++ b/adapters/adkernel/adkernel.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adkernel/adkernel_test.go b/adapters/adkernel/adkernel_test.go index a85769f5565..e9fcaef1b0e 100644 --- a/adapters/adkernel/adkernel_test.go +++ b/adapters/adkernel/adkernel_test.go @@ -3,9 +3,9 @@ package adkernel import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adkernel/usersync.go b/adapters/adkernel/usersync.go index 7622e1da3b7..2e2ebdb9fe3 100644 --- a/adapters/adkernel/usersync.go +++ b/adapters/adkernel/usersync.go @@ -3,8 +3,8 @@ package adkernel import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) const adkernelGDPRVendorID = uint16(14) diff --git a/adapters/adkernel/usersync_test.go b/adapters/adkernel/usersync_test.go index 7230fcbab9c..aeacf00b7f0 100644 --- a/adapters/adkernel/usersync_test.go +++ b/adapters/adkernel/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adkernelAdn/adkernelAdn.go b/adapters/adkernelAdn/adkernelAdn.go index 3e62c17df31..e917855e485 100644 --- a/adapters/adkernelAdn/adkernelAdn.go +++ b/adapters/adkernelAdn/adkernelAdn.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adkernelAdn/adkernelAdn_test.go b/adapters/adkernelAdn/adkernelAdn_test.go index a4311d3e550..687f5a946c0 100644 --- a/adapters/adkernelAdn/adkernelAdn_test.go +++ b/adapters/adkernelAdn/adkernelAdn_test.go @@ -3,9 +3,9 @@ package adkernelAdn import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adkernelAdn/usersync.go b/adapters/adkernelAdn/usersync.go index ab60edf2dc7..0bedac38e46 100644 --- a/adapters/adkernelAdn/usersync.go +++ b/adapters/adkernelAdn/usersync.go @@ -3,8 +3,8 @@ package adkernelAdn import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) const adkernelGDPRVendorID = uint16(14) diff --git a/adapters/adkernelAdn/usersync_test.go b/adapters/adkernelAdn/usersync_test.go index 9528579aa3d..92d688e6117 100644 --- a/adapters/adkernelAdn/usersync_test.go +++ b/adapters/adkernelAdn/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adman/adman.go b/adapters/adman/adman.go index 6b0ab3040c6..0c977c999b6 100644 --- a/adapters/adman/adman.go +++ b/adapters/adman/adman.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adman/adman_test.go b/adapters/adman/adman_test.go index 5dc10df8dad..ceee5f21bd6 100644 --- a/adapters/adman/adman_test.go +++ b/adapters/adman/adman_test.go @@ -3,9 +3,9 @@ package adman import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/adman/params_test.go b/adapters/adman/params_test.go index 4cea67cc098..a80c2a44b8b 100644 --- a/adapters/adman/params_test.go +++ b/adapters/adman/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the adman schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/adman/usersync.go b/adapters/adman/usersync.go index f7edd8c5b70..aae6afcdfcd 100644 --- a/adapters/adman/usersync.go +++ b/adapters/adman/usersync.go @@ -3,8 +3,8 @@ package adman import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) // NewAdmanSyncer returns adman syncer diff --git a/adapters/adman/usersync_test.go b/adapters/adman/usersync_test.go index db67499e91d..25da77db7ed 100644 --- a/adapters/adman/usersync_test.go +++ b/adapters/adman/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index 219f32b1a51..28ba4e8c4f4 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/admixer/admixer_test.go b/adapters/admixer/admixer_test.go index 629d4df83cd..d994847c1ed 100644 --- a/adapters/admixer/admixer_test.go +++ b/adapters/admixer/admixer_test.go @@ -3,9 +3,9 @@ package admixer import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/admixer/params_test.go b/adapters/admixer/params_test.go index d25bdcecd68..71cccb6a3da 100644 --- a/adapters/admixer/params_test.go +++ b/adapters/admixer/params_test.go @@ -2,7 +2,7 @@ package admixer import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/admixer/usersync.go b/adapters/admixer/usersync.go index 1df22cc276d..0a7f50ab79a 100644 --- a/adapters/admixer/usersync.go +++ b/adapters/admixer/usersync.go @@ -1,8 +1,8 @@ package admixer import ( - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" "text/template" ) diff --git a/adapters/admixer/usersync_test.go b/adapters/admixer/usersync_test.go index 8a43b866804..79f023a236c 100644 --- a/adapters/admixer/usersync_test.go +++ b/adapters/admixer/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adocean/adocean.go b/adapters/adocean/adocean.go index 34f815c20a7..abfe9601bf5 100644 --- a/adapters/adocean/adocean.go +++ b/adapters/adocean/adocean.go @@ -13,11 +13,11 @@ import ( "strings" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adocean/adocean_test.go b/adapters/adocean/adocean_test.go index b75de2a9235..531204cdec3 100644 --- a/adapters/adocean/adocean_test.go +++ b/adapters/adocean/adocean_test.go @@ -3,9 +3,9 @@ package adocean import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adocean/params_test.go b/adapters/adocean/params_test.go index 91e2fbdcb67..1a88c4716e0 100644 --- a/adapters/adocean/params_test.go +++ b/adapters/adocean/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/adocean/usersync.go b/adapters/adocean/usersync.go index 4bfe39e11e5..650e517a578 100644 --- a/adapters/adocean/usersync.go +++ b/adapters/adocean/usersync.go @@ -3,8 +3,8 @@ package adocean import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAdOceanSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/adocean/usersync_test.go b/adapters/adocean/usersync_test.go index aa0bcb77e21..9ca81b98cb4 100644 --- a/adapters/adocean/usersync_test.go +++ b/adapters/adocean/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index a1fc0581c66..8407a2a4ba4 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -8,11 +8,11 @@ import ( "net/url" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adoppler/adoppler_test.go b/adapters/adoppler/adoppler_test.go index eab0ac5708d..fb5cb22bab5 100644 --- a/adapters/adoppler/adoppler_test.go +++ b/adapters/adoppler/adoppler_test.go @@ -3,9 +3,9 @@ package adoppler import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/adot/adot.go b/adapters/adot/adot.go index 83517429d52..a90d9e9fa07 100644 --- a/adapters/adot/adot.go +++ b/adapters/adot/adot.go @@ -3,10 +3,10 @@ package adot import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" "net/http" ) diff --git a/adapters/adot/adot_test.go b/adapters/adot/adot_test.go index 57aacc5a595..c60f98fe4cd 100644 --- a/adapters/adot/adot_test.go +++ b/adapters/adot/adot_test.go @@ -2,10 +2,10 @@ package adot import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "testing" diff --git a/adapters/adot/params_test.go b/adapters/adot/params_test.go index 2a6dc17d916..2f7b4b9af4e 100644 --- a/adapters/adot/params_test.go +++ b/adapters/adot/params_test.go @@ -2,7 +2,7 @@ package adot import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/adpone/adpone.go b/adapters/adpone/adpone.go index cdbc632efef..bd3b361d6e0 100644 --- a/adapters/adpone/adpone.go +++ b/adapters/adpone/adpone.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adpone/adpone_test.go b/adapters/adpone/adpone_test.go index 69726e31d50..78ad51ba095 100644 --- a/adapters/adpone/adpone_test.go +++ b/adapters/adpone/adpone_test.go @@ -3,9 +3,9 @@ package adpone import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) const testsDir = "adponetest" diff --git a/adapters/adpone/usersync.go b/adapters/adpone/usersync.go index 63f616091e2..67d4c998275 100644 --- a/adapters/adpone/usersync.go +++ b/adapters/adpone/usersync.go @@ -3,8 +3,8 @@ package adpone import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) const adponeGDPRVendorID = uint16(799) diff --git a/adapters/adpone/usersync_test.go b/adapters/adpone/usersync_test.go index 7bc528b8f36..87b4e9ae440 100644 --- a/adapters/adpone/usersync_test.go +++ b/adapters/adpone/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adprime/adprime.go b/adapters/adprime/adprime.go index 3b8f7a69b0f..a52820a1e42 100644 --- a/adapters/adprime/adprime.go +++ b/adapters/adprime/adprime.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adprime/adprime_test.go b/adapters/adprime/adprime_test.go index cfcf255a5cc..ff12381d053 100644 --- a/adapters/adprime/adprime_test.go +++ b/adapters/adprime/adprime_test.go @@ -3,9 +3,9 @@ package adprime import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/adprime/params_test.go b/adapters/adprime/params_test.go index bea13e32c13..05adad5c4ff 100644 --- a/adapters/adprime/params_test.go +++ b/adapters/adprime/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the adprime schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index 04aea18e515..20e7135d657 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adtarget/adtarget_test.go b/adapters/adtarget/adtarget_test.go index bb20b40c286..ed21aef0828 100644 --- a/adapters/adtarget/adtarget_test.go +++ b/adapters/adtarget/adtarget_test.go @@ -3,9 +3,9 @@ package adtarget import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/adtarget/params_test.go b/adapters/adtarget/params_test.go index 61ed4885512..b128d11c9cf 100644 --- a/adapters/adtarget/params_test.go +++ b/adapters/adtarget/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/adtarget.json diff --git a/adapters/adtarget/usersync.go b/adapters/adtarget/usersync.go index 93e57b173f6..20bced25c72 100644 --- a/adapters/adtarget/usersync.go +++ b/adapters/adtarget/usersync.go @@ -3,8 +3,8 @@ package adtarget import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAdtargetSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/adtarget/usersync_test.go b/adapters/adtarget/usersync_test.go index 419a6cb037e..ddba9e7a720 100644 --- a/adapters/adtarget/usersync_test.go +++ b/adapters/adtarget/usersync_test.go @@ -5,10 +5,10 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index 852280565d1..d37fb471a62 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/adtelligent/adtelligent_test.go b/adapters/adtelligent/adtelligent_test.go index 6a104aa7463..503b30b576a 100644 --- a/adapters/adtelligent/adtelligent_test.go +++ b/adapters/adtelligent/adtelligent_test.go @@ -3,9 +3,9 @@ package adtelligent import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/adtelligent/params_test.go b/adapters/adtelligent/params_test.go index 8d8eb6d13b3..eb2aab0d437 100644 --- a/adapters/adtelligent/params_test.go +++ b/adapters/adtelligent/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/adtelligent.json diff --git a/adapters/adtelligent/usersync.go b/adapters/adtelligent/usersync.go index 387c65bb46d..087b5bdd22d 100644 --- a/adapters/adtelligent/usersync.go +++ b/adapters/adtelligent/usersync.go @@ -3,8 +3,8 @@ package adtelligent import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAdtelligentSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/adtelligent/usersync_test.go b/adapters/adtelligent/usersync_test.go index 7cc92eb4011..fa157d226c5 100644 --- a/adapters/adtelligent/usersync_test.go +++ b/adapters/adtelligent/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/advangelists/advangelists.go b/adapters/advangelists/advangelists.go index d6b4b53a2e5..f0afff8329d 100644 --- a/adapters/advangelists/advangelists.go +++ b/adapters/advangelists/advangelists.go @@ -6,11 +6,11 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/advangelists/advangelists_test.go b/adapters/advangelists/advangelists_test.go index 49cca96a78a..4219c1a0237 100644 --- a/adapters/advangelists/advangelists_test.go +++ b/adapters/advangelists/advangelists_test.go @@ -3,9 +3,9 @@ package advangelists import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/advangelists/params_test.go b/adapters/advangelists/params_test.go index 2a94c782092..a58217a0ffd 100644 --- a/adapters/advangelists/params_test.go +++ b/adapters/advangelists/params_test.go @@ -2,7 +2,7 @@ package advangelists import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/advangelists/usersync.go b/adapters/advangelists/usersync.go index b1539d0093d..10c46d18a22 100644 --- a/adapters/advangelists/usersync.go +++ b/adapters/advangelists/usersync.go @@ -3,8 +3,8 @@ package advangelists import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAdvangelistsSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/advangelists/usersync_test.go b/adapters/advangelists/usersync_test.go index 5dae85b11a9..2167d49fb05 100644 --- a/adapters/advangelists/usersync_test.go +++ b/adapters/advangelists/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/aja/aja.go b/adapters/aja/aja.go index fb9d37e0359..73267ce0953 100644 --- a/adapters/aja/aja.go +++ b/adapters/aja/aja.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/aja/aja_test.go b/adapters/aja/aja_test.go index d2d9d7fa7c1..bab5419d889 100644 --- a/adapters/aja/aja_test.go +++ b/adapters/aja/aja_test.go @@ -3,9 +3,9 @@ package aja import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) const testsBidderEndpoint = "https://localhost/bid/4" diff --git a/adapters/aja/usersync.go b/adapters/aja/usersync.go index deddbabb1d9..c54405dbbd1 100644 --- a/adapters/aja/usersync.go +++ b/adapters/aja/usersync.go @@ -3,8 +3,8 @@ package aja import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAJASyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/aja/usersync_test.go b/adapters/aja/usersync_test.go index bf03f47af19..4b6c90ef141 100644 --- a/adapters/aja/usersync_test.go +++ b/adapters/aja/usersync_test.go @@ -4,10 +4,10 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index 15a9e4d806e..6c47da6931a 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -7,10 +7,10 @@ import ( "net/url" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index 8404520fefc..3eea8b094a8 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -6,13 +6,13 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/adapters/adapterstest" ) const ( diff --git a/adapters/amx/params_test.go b/adapters/amx/params_test.go index ef177644b21..89e9a3adeb4 100644 --- a/adapters/amx/params_test.go +++ b/adapters/amx/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/amx/usersync.go b/adapters/amx/usersync.go index d9ff10df562..28e6ac0ed79 100644 --- a/adapters/amx/usersync.go +++ b/adapters/amx/usersync.go @@ -3,8 +3,8 @@ package amx import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) // NewAMXSyncer produces an AMX RTB usersyncer diff --git a/adapters/amx/usersync_test.go b/adapters/amx/usersync_test.go index e6020b27570..20a47c33b69 100644 --- a/adapters/amx/usersync_test.go +++ b/adapters/amx/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go index 0d07f4b583a..d2247f8fff2 100644 --- a/adapters/applogy/applogy.go +++ b/adapters/applogy/applogy.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/applogy/applogy_test.go b/adapters/applogy/applogy_test.go index 63e99ed5895..d86c5cacd68 100644 --- a/adapters/applogy/applogy_test.go +++ b/adapters/applogy/applogy_test.go @@ -3,9 +3,9 @@ package applogy import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index a56f124d6d4..09ccac4d768 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -11,16 +11,16 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/pbs" "github.com/buger/jsonparser" "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/appnexus/appnexus_test.go b/adapters/appnexus/appnexus_test.go index 19aca43897a..d32fe3493c1 100644 --- a/adapters/appnexus/appnexus_test.go +++ b/adapters/appnexus/appnexus_test.go @@ -10,16 +10,16 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/appnexus/params_test.go b/adapters/appnexus/params_test.go index c30f5cf3e2a..f84cccc9a4c 100644 --- a/adapters/appnexus/params_test.go +++ b/adapters/appnexus/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/appnexus.json diff --git a/adapters/appnexus/usersync.go b/adapters/appnexus/usersync.go index 16ffdfa3338..22f46f1e723 100644 --- a/adapters/appnexus/usersync.go +++ b/adapters/appnexus/usersync.go @@ -3,8 +3,8 @@ package appnexus import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAppnexusSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/appnexus/usersync_test.go b/adapters/appnexus/usersync_test.go index 6796ce13b96..24b9eede9d6 100644 --- a/adapters/appnexus/usersync_test.go +++ b/adapters/appnexus/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index 2966bbc8d3a..e685e0393d1 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -10,11 +10,11 @@ import ( "net/http" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/util/maputil" + "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" + "github.com/prebid/prebid-server/util/maputil" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" diff --git a/adapters/audienceNetwork/facebook_test.go b/adapters/audienceNetwork/facebook_test.go index 596529dbb9a..a2e17b71ca8 100644 --- a/adapters/audienceNetwork/facebook_test.go +++ b/adapters/audienceNetwork/facebook_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/audienceNetwork/usersync.go b/adapters/audienceNetwork/usersync.go index 6b8ba3ba7a3..45c1281d0ae 100644 --- a/adapters/audienceNetwork/usersync.go +++ b/adapters/audienceNetwork/usersync.go @@ -3,8 +3,8 @@ package audienceNetwork import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewFacebookSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/audienceNetwork/usersync_test.go b/adapters/audienceNetwork/usersync_test.go index e11fb194dec..c3836e4f154 100644 --- a/adapters/audienceNetwork/usersync_test.go +++ b/adapters/audienceNetwork/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/avocet/avocet.go b/adapters/avocet/avocet.go index d4daa076162..8a0a0559197 100644 --- a/adapters/avocet/avocet.go +++ b/adapters/avocet/avocet.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/avocet/avocet_test.go b/adapters/avocet/avocet_test.go index 82d2e16eac5..7e41b4b00e3 100644 --- a/adapters/avocet/avocet_test.go +++ b/adapters/avocet/avocet_test.go @@ -6,11 +6,11 @@ import ( "reflect" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/avocet/usersync.go b/adapters/avocet/usersync.go index ec4f25dd952..f1075ab3c52 100644 --- a/adapters/avocet/usersync.go +++ b/adapters/avocet/usersync.go @@ -3,8 +3,8 @@ package avocet import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewAvocetSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/avocet/usersync_test.go b/adapters/avocet/usersync_test.go index 12b7901cc90..3df39b77fce 100644 --- a/adapters/avocet/usersync_test.go +++ b/adapters/avocet/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 8f069eba9b3..ebeb147d454 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -9,10 +9,10 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/beachfront/beachfront_test.go b/adapters/beachfront/beachfront_test.go index aace3224534..1c1c4ff4469 100644 --- a/adapters/beachfront/beachfront_test.go +++ b/adapters/beachfront/beachfront_test.go @@ -3,9 +3,9 @@ package beachfront import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/beachfront/params_test.go b/adapters/beachfront/params_test.go index 982bd96c609..ebc0a768900 100644 --- a/adapters/beachfront/params_test.go +++ b/adapters/beachfront/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/beachfront/usersync.go b/adapters/beachfront/usersync.go index f355697f4e0..a6502331bee 100644 --- a/adapters/beachfront/usersync.go +++ b/adapters/beachfront/usersync.go @@ -3,8 +3,8 @@ package beachfront import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) var VENDOR_ID uint16 = 335 diff --git a/adapters/beachfront/usersync_test.go b/adapters/beachfront/usersync_test.go index 58a072d01b3..db4d825eb5a 100644 --- a/adapters/beachfront/usersync_test.go +++ b/adapters/beachfront/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/beintoo/beintoo.go b/adapters/beintoo/beintoo.go index 4dfc05731d6..ffbc9c7b560 100644 --- a/adapters/beintoo/beintoo.go +++ b/adapters/beintoo/beintoo.go @@ -7,10 +7,10 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/beintoo/beintoo_test.go b/adapters/beintoo/beintoo_test.go index 477d4a5483a..181b9562577 100644 --- a/adapters/beintoo/beintoo_test.go +++ b/adapters/beintoo/beintoo_test.go @@ -3,9 +3,9 @@ package beintoo import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/beintoo/params_test.go b/adapters/beintoo/params_test.go index dca0111f9a5..b92b2a108dd 100644 --- a/adapters/beintoo/params_test.go +++ b/adapters/beintoo/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/beintoo/usersync.go b/adapters/beintoo/usersync.go index 1693c082b7f..a225a2b15da 100644 --- a/adapters/beintoo/usersync.go +++ b/adapters/beintoo/usersync.go @@ -3,8 +3,8 @@ package beintoo import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewBeintooSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/beintoo/usersync_test.go b/adapters/beintoo/usersync_test.go index f0597d8f574..880d6a84cee 100644 --- a/adapters/beintoo/usersync_test.go +++ b/adapters/beintoo/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/between/between.go b/adapters/between/between.go index 95c8a684edd..9fddb9e41f3 100644 --- a/adapters/between/between.go +++ b/adapters/between/between.go @@ -8,11 +8,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/between/between_test.go b/adapters/between/between_test.go index ee89d663260..6471b37b187 100644 --- a/adapters/between/between_test.go +++ b/adapters/between/between_test.go @@ -3,9 +3,9 @@ package between import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/between/params_test.go b/adapters/between/params_test.go index 599fb95bfdf..857718690d3 100644 --- a/adapters/between/params_test.go +++ b/adapters/between/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/between.json diff --git a/adapters/between/usersync.go b/adapters/between/usersync.go index bf6a1d32c18..a34521fe438 100644 --- a/adapters/between/usersync.go +++ b/adapters/between/usersync.go @@ -3,8 +3,8 @@ package between import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) // NewBetweenSyncer returns "between" syncer diff --git a/adapters/between/usersync_test.go b/adapters/between/usersync_test.go index 17a51e70c95..6470a9c441c 100644 --- a/adapters/between/usersync_test.go +++ b/adapters/between/usersync_test.go @@ -1,7 +1,7 @@ package between import ( - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" "testing" "text/template" diff --git a/adapters/bidder.go b/adapters/bidder.go index 451839d9ced..faa054aec61 100644 --- a/adapters/bidder.go +++ b/adapters/bidder.go @@ -5,9 +5,9 @@ import ( "encoding/json" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/brightroll/brightroll.go b/adapters/brightroll/brightroll.go index bd1c87bc6f0..9b78a4f8bf8 100644 --- a/adapters/brightroll/brightroll.go +++ b/adapters/brightroll/brightroll.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/brightroll/brightroll_test.go b/adapters/brightroll/brightroll_test.go index c25c57eddf0..a41a9e792c5 100644 --- a/adapters/brightroll/brightroll_test.go +++ b/adapters/brightroll/brightroll_test.go @@ -5,9 +5,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestEmptyConfig(t *testing.T) { diff --git a/adapters/brightroll/params_test.go b/adapters/brightroll/params_test.go index 6c65b8ce3ef..beac822f8f0 100644 --- a/adapters/brightroll/params_test.go +++ b/adapters/brightroll/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/brightroll.json diff --git a/adapters/brightroll/usersync.go b/adapters/brightroll/usersync.go index 74729f70025..b33cc5a2943 100644 --- a/adapters/brightroll/usersync.go +++ b/adapters/brightroll/usersync.go @@ -3,8 +3,8 @@ package brightroll import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewBrightrollSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/brightroll/usersync_test.go b/adapters/brightroll/usersync_test.go index 1ca0325495e..a5d47e35e56 100644 --- a/adapters/brightroll/usersync_test.go +++ b/adapters/brightroll/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/colossus/colossus.go b/adapters/colossus/colossus.go index d70b4f755dc..aa5136bfaaf 100644 --- a/adapters/colossus/colossus.go +++ b/adapters/colossus/colossus.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/colossus/colossus_test.go b/adapters/colossus/colossus_test.go index 25d107a544b..7baa423af70 100644 --- a/adapters/colossus/colossus_test.go +++ b/adapters/colossus/colossus_test.go @@ -3,9 +3,9 @@ package colossus import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/colossus/params_test.go b/adapters/colossus/params_test.go index c223209e5a1..2883de2f53e 100644 --- a/adapters/colossus/params_test.go +++ b/adapters/colossus/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the colossus schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/colossus/usersync.go b/adapters/colossus/usersync.go index 519dcaba86e..a4e82ee3bde 100644 --- a/adapters/colossus/usersync.go +++ b/adapters/colossus/usersync.go @@ -3,8 +3,8 @@ package colossus import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) // NewColossusSyncer returns colossus syncer diff --git a/adapters/colossus/usersync_test.go b/adapters/colossus/usersync_test.go index 5bbbdc089fc..52eb6389b1c 100644 --- a/adapters/colossus/usersync_test.go +++ b/adapters/colossus/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/connectad/connectad.go b/adapters/connectad/connectad.go index aaf68ced127..fa57975018d 100644 --- a/adapters/connectad/connectad.go +++ b/adapters/connectad/connectad.go @@ -7,10 +7,10 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/connectad/connectad_test.go b/adapters/connectad/connectad_test.go index 58984e909c4..36005219ce8 100644 --- a/adapters/connectad/connectad_test.go +++ b/adapters/connectad/connectad_test.go @@ -3,9 +3,9 @@ package connectad import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/connectad/params_test.go b/adapters/connectad/params_test.go index c8c407f8404..6d55b1ce7d9 100644 --- a/adapters/connectad/params_test.go +++ b/adapters/connectad/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/connectad/usersync.go b/adapters/connectad/usersync.go index ccd2d52cf40..5661cb5d9d8 100644 --- a/adapters/connectad/usersync.go +++ b/adapters/connectad/usersync.go @@ -3,8 +3,8 @@ package connectad import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewConnectAdSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/connectad/usersync_test.go b/adapters/connectad/usersync_test.go index c7b5c7c3fd2..c4b4962b9f6 100644 --- a/adapters/connectad/usersync_test.go +++ b/adapters/connectad/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index a0878b22531..dd4afd840f3 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -8,11 +8,11 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "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" + "github.com/prebid/prebid-server/privacy/ccpa" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/consumable/consumable_test.go b/adapters/consumable/consumable_test.go index 63f5d92972e..56e1d626c7b 100644 --- a/adapters/consumable/consumable_test.go +++ b/adapters/consumable/consumable_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/consumable/params_test.go b/adapters/consumable/params_test.go index 9f922796bc2..42de5cb9ca8 100644 --- a/adapters/consumable/params_test.go +++ b/adapters/consumable/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/consumable.json diff --git a/adapters/consumable/usersync.go b/adapters/consumable/usersync.go index 720b0bea78b..0e0938c7b39 100644 --- a/adapters/consumable/usersync.go +++ b/adapters/consumable/usersync.go @@ -3,8 +3,8 @@ package consumable import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) var VENDOR_ID uint16 = 591 diff --git a/adapters/consumable/usersync_test.go b/adapters/consumable/usersync_test.go index 1aeb2eb8c8d..ef71c0b18c7 100644 --- a/adapters/consumable/usersync_test.go +++ b/adapters/consumable/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/conversant/cnvr_legacy.go b/adapters/conversant/cnvr_legacy.go index 4f50d2d68f5..e3ba432870c 100644 --- a/adapters/conversant/cnvr_legacy.go +++ b/adapters/conversant/cnvr_legacy.go @@ -8,9 +8,9 @@ import ( "io/ioutil" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) diff --git a/adapters/conversant/cnvr_legacy_test.go b/adapters/conversant/cnvr_legacy_test.go index b7dc72edd75..fedc435ec56 100644 --- a/adapters/conversant/cnvr_legacy_test.go +++ b/adapters/conversant/cnvr_legacy_test.go @@ -11,11 +11,11 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index bee365128b7..d6827a97b84 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/conversant/conversant_test.go b/adapters/conversant/conversant_test.go index 2de1facf8a2..55b316b473f 100644 --- a/adapters/conversant/conversant_test.go +++ b/adapters/conversant/conversant_test.go @@ -3,9 +3,9 @@ package conversant import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/conversant/usersync.go b/adapters/conversant/usersync.go index 3fe0a45cef7..c2676df6620 100644 --- a/adapters/conversant/usersync.go +++ b/adapters/conversant/usersync.go @@ -3,8 +3,8 @@ package conversant import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewConversantSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/conversant/usersync_test.go b/adapters/conversant/usersync_test.go index ef05454b036..16affbd1d32 100644 --- a/adapters/conversant/usersync_test.go +++ b/adapters/conversant/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/cpmstar/cpmstar.go b/adapters/cpmstar/cpmstar.go index 68d5dd6958f..6c28700f14f 100644 --- a/adapters/cpmstar/cpmstar.go +++ b/adapters/cpmstar/cpmstar.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/cpmstar/cpmstar_test.go b/adapters/cpmstar/cpmstar_test.go index 8d214e4ee4a..c10dfbe1a59 100644 --- a/adapters/cpmstar/cpmstar_test.go +++ b/adapters/cpmstar/cpmstar_test.go @@ -3,9 +3,9 @@ package cpmstar import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/cpmstar/params_test.go b/adapters/cpmstar/params_test.go index dec3f342a9d..cee471a8322 100644 --- a/adapters/cpmstar/params_test.go +++ b/adapters/cpmstar/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/cpmstar.json diff --git a/adapters/cpmstar/usersync.go b/adapters/cpmstar/usersync.go index 91d3c89c4ab..9c864e24ce3 100644 --- a/adapters/cpmstar/usersync.go +++ b/adapters/cpmstar/usersync.go @@ -3,8 +3,8 @@ package cpmstar import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) //NewCpmstarSyncer : diff --git a/adapters/cpmstar/usersync_test.go b/adapters/cpmstar/usersync_test.go index cd04838a859..dae55e6302e 100644 --- a/adapters/cpmstar/usersync_test.go +++ b/adapters/cpmstar/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/datablocks/datablocks.go b/adapters/datablocks/datablocks.go index c2fcf71d7b8..42ea951472f 100644 --- a/adapters/datablocks/datablocks.go +++ b/adapters/datablocks/datablocks.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/datablocks/datablocks_test.go b/adapters/datablocks/datablocks_test.go index 1ee06b9349e..553c8edf8da 100644 --- a/adapters/datablocks/datablocks_test.go +++ b/adapters/datablocks/datablocks_test.go @@ -3,9 +3,9 @@ package datablocks import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/datablocks/usersync.go b/adapters/datablocks/usersync.go index 3993215bcad..2b47b259e39 100644 --- a/adapters/datablocks/usersync.go +++ b/adapters/datablocks/usersync.go @@ -3,8 +3,8 @@ package datablocks import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) const datablocksGDPRVendorID = uint16(0) diff --git a/adapters/datablocks/usersync_test.go b/adapters/datablocks/usersync_test.go index 3ab7ae1b477..a7518e9b226 100644 --- a/adapters/datablocks/usersync_test.go +++ b/adapters/datablocks/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/decenterads/decenterads.go b/adapters/decenterads/decenterads.go index 715e44ce147..c45322b51dc 100644 --- a/adapters/decenterads/decenterads.go +++ b/adapters/decenterads/decenterads.go @@ -7,10 +7,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/decenterads/decenterads_test.go b/adapters/decenterads/decenterads_test.go index eed77d7a9a3..ca86e89187c 100644 --- a/adapters/decenterads/decenterads_test.go +++ b/adapters/decenterads/decenterads_test.go @@ -3,9 +3,9 @@ package decenterads import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/decenterads/params_test.go b/adapters/decenterads/params_test.go index fcf5e94f3c2..3d3708be789 100644 --- a/adapters/decenterads/params_test.go +++ b/adapters/decenterads/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the decenterads schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/deepintent/deepintent.go b/adapters/deepintent/deepintent.go index 4ee6aec2098..9222d13a4a7 100644 --- a/adapters/deepintent/deepintent.go +++ b/adapters/deepintent/deepintent.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/deepintent/deepintent_test.go b/adapters/deepintent/deepintent_test.go index a0dbf836400..cdf158e6d28 100644 --- a/adapters/deepintent/deepintent_test.go +++ b/adapters/deepintent/deepintent_test.go @@ -3,10 +3,10 @@ package deepintent import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/adapters/adapterstest" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/deepintent/params_test.go b/adapters/deepintent/params_test.go index 87f80dfde74..8f37e5a9bd6 100644 --- a/adapters/deepintent/params_test.go +++ b/adapters/deepintent/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the deepintent schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/deepintent/usersync.go b/adapters/deepintent/usersync.go index 8ab615e3222..9e803df6d9d 100644 --- a/adapters/deepintent/usersync.go +++ b/adapters/deepintent/usersync.go @@ -3,8 +3,8 @@ package deepintent import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) // NewDeepintentSyncer returns deepintent syncer diff --git a/adapters/deepintent/usersync_test.go b/adapters/deepintent/usersync_test.go index 1e0174ab60b..06a221ca2fd 100644 --- a/adapters/deepintent/usersync_test.go +++ b/adapters/deepintent/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/dmx/dmx.go b/adapters/dmx/dmx.go index 92b69c5e996..dec0ef3ce7e 100644 --- a/adapters/dmx/dmx.go +++ b/adapters/dmx/dmx.go @@ -8,10 +8,10 @@ import ( "net/url" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/dmx/dmx_test.go b/adapters/dmx/dmx_test.go index 0d0c4f7c5cb..cb1a3ca4832 100644 --- a/adapters/dmx/dmx_test.go +++ b/adapters/dmx/dmx_test.go @@ -5,12 +5,12 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/adapters/adapterstest" ) var ( diff --git a/adapters/dmx/params_test.go b/adapters/dmx/params_test.go index 4d9da7863e1..0e5250b173e 100644 --- a/adapters/dmx/params_test.go +++ b/adapters/dmx/params_test.go @@ -2,7 +2,7 @@ package dmx import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/dmx/usersync.go b/adapters/dmx/usersync.go index 07c70ff9155..98e56234fa6 100644 --- a/adapters/dmx/usersync.go +++ b/adapters/dmx/usersync.go @@ -3,8 +3,8 @@ package dmx import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewDmxSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/dmx/usersync_test.go b/adapters/dmx/usersync_test.go index 2aa66575f8a..e4e3c7d8e55 100644 --- a/adapters/dmx/usersync_test.go +++ b/adapters/dmx/usersync_test.go @@ -1,7 +1,7 @@ package dmx import ( - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "testing" "text/template" diff --git a/adapters/emx_digital/emx_digital.go b/adapters/emx_digital/emx_digital.go index 76f0af9b4c1..37cee8d3898 100644 --- a/adapters/emx_digital/emx_digital.go +++ b/adapters/emx_digital/emx_digital.go @@ -9,10 +9,10 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/emx_digital/emx_digital_test.go b/adapters/emx_digital/emx_digital_test.go index 3e0e52e2845..bb7567e8b17 100644 --- a/adapters/emx_digital/emx_digital_test.go +++ b/adapters/emx_digital/emx_digital_test.go @@ -3,10 +3,10 @@ package emx_digital import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "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) { diff --git a/adapters/emx_digital/params_test.go b/adapters/emx_digital/params_test.go index 9a6ff5cf73f..49ad9eb1a9c 100644 --- a/adapters/emx_digital/params_test.go +++ b/adapters/emx_digital/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/emx_digital/usersync.go b/adapters/emx_digital/usersync.go index 38b6377f317..a453955b22e 100644 --- a/adapters/emx_digital/usersync.go +++ b/adapters/emx_digital/usersync.go @@ -3,8 +3,8 @@ package emx_digital import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewEMXDigitalSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/emx_digital/usersync_test.go b/adapters/emx_digital/usersync_test.go index 15bdd738fdb..59d66d87808 100644 --- a/adapters/emx_digital/usersync_test.go +++ b/adapters/emx_digital/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index cac85eda919..47869a2a587 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -4,13 +4,13 @@ import ( "encoding/json" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/engagebdr/engagebdr_test.go b/adapters/engagebdr/engagebdr_test.go index 699ef446e39..97e6a8e974f 100644 --- a/adapters/engagebdr/engagebdr_test.go +++ b/adapters/engagebdr/engagebdr_test.go @@ -3,9 +3,9 @@ package engagebdr import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/engagebdr/params_test.go b/adapters/engagebdr/params_test.go index b6c887eac66..c797d04ecc8 100644 --- a/adapters/engagebdr/params_test.go +++ b/adapters/engagebdr/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/engagebdr/usersync.go b/adapters/engagebdr/usersync.go index 99b6a1224c0..ae4047aa89c 100644 --- a/adapters/engagebdr/usersync.go +++ b/adapters/engagebdr/usersync.go @@ -1,8 +1,8 @@ package engagebdr import ( - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" "text/template" ) diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go index 588f1f97a79..3a6c179addf 100644 --- a/adapters/engagebdr/usersync_test.go +++ b/adapters/engagebdr/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/eplanning/eplanning.go b/adapters/eplanning/eplanning.go index ca10381936b..0c78051948a 100644 --- a/adapters/eplanning/eplanning.go +++ b/adapters/eplanning/eplanning.go @@ -11,10 +11,10 @@ import ( "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" "strconv" diff --git a/adapters/eplanning/eplanning_test.go b/adapters/eplanning/eplanning_test.go index bf43278845e..70e108d5e0a 100644 --- a/adapters/eplanning/eplanning_test.go +++ b/adapters/eplanning/eplanning_test.go @@ -3,10 +3,10 @@ package eplanning import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "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) { diff --git a/adapters/eplanning/usersync.go b/adapters/eplanning/usersync.go index 4f9f30aec3a..faa7fa82a19 100644 --- a/adapters/eplanning/usersync.go +++ b/adapters/eplanning/usersync.go @@ -3,8 +3,8 @@ package eplanning import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewEPlanningSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/eplanning/usersync_test.go b/adapters/eplanning/usersync_test.go index dd0bf15239a..85770689024 100644 --- a/adapters/eplanning/usersync_test.go +++ b/adapters/eplanning/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/gamma/gamma.go b/adapters/gamma/gamma.go index 320265b7016..793159c9f83 100644 --- a/adapters/gamma/gamma.go +++ b/adapters/gamma/gamma.go @@ -7,10 +7,10 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/gamma/gamma_test.go b/adapters/gamma/gamma_test.go index fb648cd4154..2741e425fae 100644 --- a/adapters/gamma/gamma_test.go +++ b/adapters/gamma/gamma_test.go @@ -3,9 +3,9 @@ package gamma import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/gamma/params_test.go b/adapters/gamma/params_test.go index 5e096cbf849..3329545a264 100644 --- a/adapters/gamma/params_test.go +++ b/adapters/gamma/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/gamma.json diff --git a/adapters/gamma/usersync.go b/adapters/gamma/usersync.go index 884468fe8ae..f19c522cebc 100644 --- a/adapters/gamma/usersync.go +++ b/adapters/gamma/usersync.go @@ -3,8 +3,8 @@ package gamma import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewGammaSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/gamma/usersync_test.go b/adapters/gamma/usersync_test.go index 04a88e5ede8..4278f9abd36 100644 --- a/adapters/gamma/usersync_test.go +++ b/adapters/gamma/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/gamoshi/gamoshi.go b/adapters/gamoshi/gamoshi.go index 987b8df3083..2e1fc0c100c 100644 --- a/adapters/gamoshi/gamoshi.go +++ b/adapters/gamoshi/gamoshi.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/gamoshi/gamoshi_test.go b/adapters/gamoshi/gamoshi_test.go index dc8c6091e51..d8834c45123 100644 --- a/adapters/gamoshi/gamoshi_test.go +++ b/adapters/gamoshi/gamoshi_test.go @@ -3,9 +3,9 @@ package gamoshi import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestJsonSamplesWithConfiguredURI(t *testing.T) { diff --git a/adapters/gamoshi/params_test.go b/adapters/gamoshi/params_test.go index d33740ee515..29a1864b9ae 100644 --- a/adapters/gamoshi/params_test.go +++ b/adapters/gamoshi/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/gamoshi.json diff --git a/adapters/gamoshi/usersync.go b/adapters/gamoshi/usersync.go index 73101ada257..6b7c43dd6a2 100644 --- a/adapters/gamoshi/usersync.go +++ b/adapters/gamoshi/usersync.go @@ -3,8 +3,8 @@ package gamoshi import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewGamoshiSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/gamoshi/usersync_test.go b/adapters/gamoshi/usersync_test.go index 08ddd5341c1..43dc88a4953 100644 --- a/adapters/gamoshi/usersync_test.go +++ b/adapters/gamoshi/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" "github.com/stretchr/testify/assert" ) diff --git a/adapters/grid/grid.go b/adapters/grid/grid.go index 7dff52daf6f..9e870468fca 100644 --- a/adapters/grid/grid.go +++ b/adapters/grid/grid.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/grid/grid_test.go b/adapters/grid/grid_test.go index 8438bd28908..1f9baaba640 100644 --- a/adapters/grid/grid_test.go +++ b/adapters/grid/grid_test.go @@ -3,9 +3,9 @@ package grid import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/grid/usersync.go b/adapters/grid/usersync.go index 52d25405b44..afdc5db763c 100644 --- a/adapters/grid/usersync.go +++ b/adapters/grid/usersync.go @@ -3,8 +3,8 @@ package grid import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewGridSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/grid/usersync_test.go b/adapters/grid/usersync_test.go index 40cb443fe97..99730b5deb4 100644 --- a/adapters/grid/usersync_test.go +++ b/adapters/grid/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index c85517c6d21..e733b7160c1 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -7,10 +7,10 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/gumgum/gumgum_test.go b/adapters/gumgum/gumgum_test.go index fc2d1059ac8..b097042b6d3 100644 --- a/adapters/gumgum/gumgum_test.go +++ b/adapters/gumgum/gumgum_test.go @@ -3,9 +3,9 @@ package gumgum import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/gumgum/params_test.go b/adapters/gumgum/params_test.go index 087c9136031..4cb6f019197 100644 --- a/adapters/gumgum/params_test.go +++ b/adapters/gumgum/params_test.go @@ -2,7 +2,7 @@ package gumgum import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/gumgum/usersync.go b/adapters/gumgum/usersync.go index b56b9d73c3c..5d29c7dceb2 100644 --- a/adapters/gumgum/usersync.go +++ b/adapters/gumgum/usersync.go @@ -3,8 +3,8 @@ package gumgum import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewGumGumSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/gumgum/usersync_test.go b/adapters/gumgum/usersync_test.go index 47301f9cef0..9c6dc420600 100644 --- a/adapters/gumgum/usersync_test.go +++ b/adapters/gumgum/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/improvedigital/improvedigital.go b/adapters/improvedigital/improvedigital.go index e54b1f36a91..32b8363dc24 100644 --- a/adapters/improvedigital/improvedigital.go +++ b/adapters/improvedigital/improvedigital.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/improvedigital/improvedigital_test.go b/adapters/improvedigital/improvedigital_test.go index b4530882cc2..7a45faacff4 100644 --- a/adapters/improvedigital/improvedigital_test.go +++ b/adapters/improvedigital/improvedigital_test.go @@ -3,9 +3,9 @@ package improvedigital import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/improvedigital/params_test.go b/adapters/improvedigital/params_test.go index f603479793f..13bdd807560 100644 --- a/adapters/improvedigital/params_test.go +++ b/adapters/improvedigital/params_test.go @@ -2,7 +2,7 @@ package improvedigital import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/improvedigital/usersync.go b/adapters/improvedigital/usersync.go index 9b5f7e89872..72c3ddafd49 100644 --- a/adapters/improvedigital/usersync.go +++ b/adapters/improvedigital/usersync.go @@ -3,8 +3,8 @@ package improvedigital import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewImprovedigitalSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/improvedigital/usersync_test.go b/adapters/improvedigital/usersync_test.go index 91c6cd91865..35ea89cf894 100644 --- a/adapters/improvedigital/usersync_test.go +++ b/adapters/improvedigital/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/info.go b/adapters/info.go index 49d7ed96d2a..21c67efb847 100644 --- a/adapters/info.go +++ b/adapters/info.go @@ -5,9 +5,9 @@ import ( "io/ioutil" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" yaml "gopkg.in/yaml.v2" diff --git a/adapters/info_test.go b/adapters/info_test.go index c21c92a0c4a..3f6b7cf6a23 100644 --- a/adapters/info_test.go +++ b/adapters/info_test.go @@ -5,10 +5,10 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go index 585257b89d7..03f339a2ced 100644 --- a/adapters/inmobi/inmobi.go +++ b/adapters/inmobi/inmobi.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/inmobi/inmobi_test.go b/adapters/inmobi/inmobi_test.go index bfe5d10bcef..0b662684f72 100644 --- a/adapters/inmobi/inmobi_test.go +++ b/adapters/inmobi/inmobi_test.go @@ -3,9 +3,9 @@ package inmobi import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/invibes/invibes.go b/adapters/invibes/invibes.go index 33fc5cdb6f0..ec26bced8db 100644 --- a/adapters/invibes/invibes.go +++ b/adapters/invibes/invibes.go @@ -9,12 +9,12 @@ import ( "strings" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/invibes/invibes_test.go b/adapters/invibes/invibes_test.go index 47071d4768f..73d6ec0bec5 100644 --- a/adapters/invibes/invibes_test.go +++ b/adapters/invibes/invibes_test.go @@ -3,9 +3,9 @@ package invibes import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/invibes/params_test.go b/adapters/invibes/params_test.go index 84d1d0493a4..8c3a26b4eac 100644 --- a/adapters/invibes/params_test.go +++ b/adapters/invibes/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/invibes/usersync.go b/adapters/invibes/usersync.go index c334f8ffa0b..468e604c1a6 100644 --- a/adapters/invibes/usersync.go +++ b/adapters/invibes/usersync.go @@ -3,8 +3,8 @@ package invibes import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewInvibesSyncer(urlTemplate *template.Template) usersync.Usersyncer { diff --git a/adapters/invibes/usersync_test.go b/adapters/invibes/usersync_test.go index e575daf241b..3f715f6bdfe 100644 --- a/adapters/invibes/usersync_test.go +++ b/adapters/invibes/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 76a86c8c6a8..e99603ed03b 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -10,11 +10,11 @@ import ( "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "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" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 91d8c043afe..ae2b02cf27f 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -11,11 +11,11 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/ix/usersync.go b/adapters/ix/usersync.go index dcb4d646489..6f3558949e0 100644 --- a/adapters/ix/usersync.go +++ b/adapters/ix/usersync.go @@ -3,8 +3,8 @@ package ix import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewIxSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/ix/usersync_test.go b/adapters/ix/usersync_test.go index 142ee6ac027..10f91da1abe 100644 --- a/adapters/ix/usersync_test.go +++ b/adapters/ix/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/kidoz/kidoz.go b/adapters/kidoz/kidoz.go index 2f29b865b2e..6e79907e81e 100644 --- a/adapters/kidoz/kidoz.go +++ b/adapters/kidoz/kidoz.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/kidoz/kidoz_test.go b/adapters/kidoz/kidoz_test.go index 6e2e5eee99d..42ddf8bd157 100644 --- a/adapters/kidoz/kidoz_test.go +++ b/adapters/kidoz/kidoz_test.go @@ -5,10 +5,10 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/kidoz/params_test.go b/adapters/kidoz/params_test.go index 43c5a68d69d..073d7382d68 100644 --- a/adapters/kidoz/params_test.go +++ b/adapters/kidoz/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index b5aa209ce4b..3f496aa144f 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/krushmedia/krushmedia_test.go b/adapters/krushmedia/krushmedia_test.go index 0fc5c93fed2..7bdea503569 100644 --- a/adapters/krushmedia/krushmedia_test.go +++ b/adapters/krushmedia/krushmedia_test.go @@ -3,9 +3,9 @@ package krushmedia import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/krushmedia/params_test.go b/adapters/krushmedia/params_test.go index 0f912513b2c..26daa56e10b 100644 --- a/adapters/krushmedia/params_test.go +++ b/adapters/krushmedia/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) var validParams = []string{ diff --git a/adapters/krushmedia/usersync.go b/adapters/krushmedia/usersync.go index 0a4f664e56f..5dc1471fb9f 100644 --- a/adapters/krushmedia/usersync.go +++ b/adapters/krushmedia/usersync.go @@ -3,8 +3,8 @@ package krushmedia import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewKrushmediaSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/krushmedia/usersync_test.go b/adapters/krushmedia/usersync_test.go index a5908b8061d..b58f2f1bc4e 100644 --- a/adapters/krushmedia/usersync_test.go +++ b/adapters/krushmedia/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/kubient/kubient.go b/adapters/kubient/kubient.go index c8617dbe0b0..ab0106a15c7 100644 --- a/adapters/kubient/kubient.go +++ b/adapters/kubient/kubient.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/kubient/kubient_test.go b/adapters/kubient/kubient_test.go index e7f8a9ee2fc..19eb3e8ff13 100644 --- a/adapters/kubient/kubient_test.go +++ b/adapters/kubient/kubient_test.go @@ -3,9 +3,9 @@ package kubient import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/legacy.go b/adapters/legacy.go index c3fde16d764..8b2221fe0ca 100644 --- a/adapters/legacy.go +++ b/adapters/legacy.go @@ -6,8 +6,8 @@ import ( "net/http" "time" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/server/ssl" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/server/ssl" ) // This file contains some deprecated, legacy types. diff --git a/adapters/lifestreet/lifestreet.go b/adapters/lifestreet/lifestreet.go index 7cd525c2e43..070a484fd9d 100644 --- a/adapters/lifestreet/lifestreet.go +++ b/adapters/lifestreet/lifestreet.go @@ -9,11 +9,11 @@ import ( "net/http" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) diff --git a/adapters/lifestreet/lifestreet_test.go b/adapters/lifestreet/lifestreet_test.go index f2d2cee190d..fe8d5b25355 100644 --- a/adapters/lifestreet/lifestreet_test.go +++ b/adapters/lifestreet/lifestreet_test.go @@ -10,14 +10,14 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/lifestreet/usersync.go b/adapters/lifestreet/usersync.go index 4f18854e54a..15ffde4db74 100644 --- a/adapters/lifestreet/usersync.go +++ b/adapters/lifestreet/usersync.go @@ -3,8 +3,8 @@ package lifestreet import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewLifestreetSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/lifestreet/usersync_test.go b/adapters/lifestreet/usersync_test.go index 134af2f5b88..8fee09358e8 100644 --- a/adapters/lifestreet/usersync_test.go +++ b/adapters/lifestreet/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/lockerdome/lockerdome.go b/adapters/lockerdome/lockerdome.go index 7a2b3ce58fb..29774985ecb 100644 --- a/adapters/lockerdome/lockerdome.go +++ b/adapters/lockerdome/lockerdome.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/lockerdome/lockerdome_test.go b/adapters/lockerdome/lockerdome_test.go index ca3da099eaa..6ac495d5d7c 100644 --- a/adapters/lockerdome/lockerdome_test.go +++ b/adapters/lockerdome/lockerdome_test.go @@ -3,9 +3,9 @@ package lockerdome import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/lockerdome/params_test.go b/adapters/lockerdome/params_test.go index 61ee259a437..815246571e3 100644 --- a/adapters/lockerdome/params_test.go +++ b/adapters/lockerdome/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file tests static/bidder-params/lockerdome.json diff --git a/adapters/lockerdome/usersync.go b/adapters/lockerdome/usersync.go index 67c4e15dd2d..fb01f8e2d99 100644 --- a/adapters/lockerdome/usersync.go +++ b/adapters/lockerdome/usersync.go @@ -3,8 +3,8 @@ package lockerdome import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewLockerDomeSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/lockerdome/usersync_test.go b/adapters/lockerdome/usersync_test.go index acfa788e5f7..b5dea2261b6 100644 --- a/adapters/lockerdome/usersync_test.go +++ b/adapters/lockerdome/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/logicad/logicad.go b/adapters/logicad/logicad.go index a38c99bce20..7abdacbeafb 100644 --- a/adapters/logicad/logicad.go +++ b/adapters/logicad/logicad.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/logicad/logicad_test.go b/adapters/logicad/logicad_test.go index 5da8e56e6c2..820aad9751d 100644 --- a/adapters/logicad/logicad_test.go +++ b/adapters/logicad/logicad_test.go @@ -3,9 +3,9 @@ package logicad import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/logicad/params_test.go b/adapters/logicad/params_test.go index 8b5d296bd1f..eb34452811b 100644 --- a/adapters/logicad/params_test.go +++ b/adapters/logicad/params_test.go @@ -2,7 +2,7 @@ package logicad import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/logicad/usersync.go b/adapters/logicad/usersync.go index 34d29a25543..d26a197b0a1 100644 --- a/adapters/logicad/usersync.go +++ b/adapters/logicad/usersync.go @@ -3,8 +3,8 @@ package logicad import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewLogicadSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/logicad/usersync_test.go b/adapters/logicad/usersync_test.go index aeb029d3380..89d6207d348 100644 --- a/adapters/logicad/usersync_test.go +++ b/adapters/logicad/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/lunamedia/lunamedia.go b/adapters/lunamedia/lunamedia.go index daf38ea207e..1492ccc7787 100644 --- a/adapters/lunamedia/lunamedia.go +++ b/adapters/lunamedia/lunamedia.go @@ -6,11 +6,11 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/lunamedia/lunamedia_test.go b/adapters/lunamedia/lunamedia_test.go index 6d0952cdd9c..4149060c809 100644 --- a/adapters/lunamedia/lunamedia_test.go +++ b/adapters/lunamedia/lunamedia_test.go @@ -3,9 +3,9 @@ package lunamedia import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/lunamedia/params_test.go b/adapters/lunamedia/params_test.go index 2f21ea45510..b4faeea1f77 100644 --- a/adapters/lunamedia/params_test.go +++ b/adapters/lunamedia/params_test.go @@ -2,7 +2,7 @@ package lunamedia import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/lunamedia/usersync.go b/adapters/lunamedia/usersync.go index 194c4b77dbe..7ad54e384a1 100644 --- a/adapters/lunamedia/usersync.go +++ b/adapters/lunamedia/usersync.go @@ -3,8 +3,8 @@ package lunamedia import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewLunaMediaSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/lunamedia/usersync_test.go b/adapters/lunamedia/usersync_test.go index 3a549aec5f7..c9fe2032d2c 100644 --- a/adapters/lunamedia/usersync_test.go +++ b/adapters/lunamedia/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/marsmedia/marsmedia.go b/adapters/marsmedia/marsmedia.go index df9e4302c06..47b99579573 100644 --- a/adapters/marsmedia/marsmedia.go +++ b/adapters/marsmedia/marsmedia.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/marsmedia/marsmedia_test.go b/adapters/marsmedia/marsmedia_test.go index 03e46312ca2..ab87bf773a4 100644 --- a/adapters/marsmedia/marsmedia_test.go +++ b/adapters/marsmedia/marsmedia_test.go @@ -3,9 +3,9 @@ package marsmedia import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/marsmedia/params_test.go b/adapters/marsmedia/params_test.go index 2e3b483824d..43cd49c2ed3 100644 --- a/adapters/marsmedia/params_test.go +++ b/adapters/marsmedia/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/marsmedia.json diff --git a/adapters/marsmedia/usersync.go b/adapters/marsmedia/usersync.go index 63d06d9dcc5..50996f325ac 100644 --- a/adapters/marsmedia/usersync.go +++ b/adapters/marsmedia/usersync.go @@ -3,8 +3,8 @@ package marsmedia import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewMarsmediaSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/marsmedia/usersync_test.go b/adapters/marsmedia/usersync_test.go index cc4f0b819f9..f019c014516 100644 --- a/adapters/marsmedia/usersync_test.go +++ b/adapters/marsmedia/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/mediafuse/usersync.go b/adapters/mediafuse/usersync.go index ca299c724f6..5381bf3606d 100644 --- a/adapters/mediafuse/usersync.go +++ b/adapters/mediafuse/usersync.go @@ -3,8 +3,8 @@ package mediafuse import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewMediafuseSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/mediafuse/usersync_test.go b/adapters/mediafuse/usersync_test.go index 95e6a7cf93f..30b5b535b12 100644 --- a/adapters/mediafuse/usersync_test.go +++ b/adapters/mediafuse/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/mgid/mgid.go b/adapters/mgid/mgid.go index 922cfd6bb37..7b83248c7c4 100644 --- a/adapters/mgid/mgid.go +++ b/adapters/mgid/mgid.go @@ -6,10 +6,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/mgid/mgid_test.go b/adapters/mgid/mgid_test.go index 11f5596ed9a..7d30045168d 100644 --- a/adapters/mgid/mgid_test.go +++ b/adapters/mgid/mgid_test.go @@ -3,9 +3,9 @@ package mgid import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/mgid/usersync.go b/adapters/mgid/usersync.go index 3eb77025d4d..fbdb95f01fc 100644 --- a/adapters/mgid/usersync.go +++ b/adapters/mgid/usersync.go @@ -3,8 +3,8 @@ package mgid import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewMgidSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/mgid/usersync_test.go b/adapters/mgid/usersync_test.go index b918dabfe0b..2ce634eeac2 100644 --- a/adapters/mgid/usersync_test.go +++ b/adapters/mgid/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/mobfoxpb/mobfoxpb.go b/adapters/mobfoxpb/mobfoxpb.go index a40a5e2f55a..1fc9ee01972 100644 --- a/adapters/mobfoxpb/mobfoxpb.go +++ b/adapters/mobfoxpb/mobfoxpb.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/mobfoxpb/mobfoxpb_test.go b/adapters/mobfoxpb/mobfoxpb_test.go index 23bdb28118c..271d30a97af 100644 --- a/adapters/mobfoxpb/mobfoxpb_test.go +++ b/adapters/mobfoxpb/mobfoxpb_test.go @@ -3,9 +3,9 @@ package mobfoxpb import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/mobfoxpb/params_test.go b/adapters/mobfoxpb/params_test.go index ddd738ece2b..59b9ec383c8 100644 --- a/adapters/mobfoxpb/params_test.go +++ b/adapters/mobfoxpb/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the mobfoxpb schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/mobilefuse/mobilefuse.go b/adapters/mobilefuse/mobilefuse.go index ec271d2a0eb..69b07cbcdc5 100644 --- a/adapters/mobilefuse/mobilefuse.go +++ b/adapters/mobilefuse/mobilefuse.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/mobilefuse/mobilefuse_test.go b/adapters/mobilefuse/mobilefuse_test.go index 52d2ab20768..3abe627fab0 100644 --- a/adapters/mobilefuse/mobilefuse_test.go +++ b/adapters/mobilefuse/mobilefuse_test.go @@ -3,9 +3,9 @@ package mobilefuse import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/mobilefuse/params_test.go b/adapters/mobilefuse/params_test.go index 6d98f656983..dbfd8894e70 100644 --- a/adapters/mobilefuse/params_test.go +++ b/adapters/mobilefuse/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(test *testing.T) { diff --git a/adapters/nanointeractive/nanointeractive.go b/adapters/nanointeractive/nanointeractive.go index 4eb817e6036..1925a28ee7e 100644 --- a/adapters/nanointeractive/nanointeractive.go +++ b/adapters/nanointeractive/nanointeractive.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/nanointeractive/nanointeractive_test.go b/adapters/nanointeractive/nanointeractive_test.go index 79caf9cf417..d0955511f8b 100644 --- a/adapters/nanointeractive/nanointeractive_test.go +++ b/adapters/nanointeractive/nanointeractive_test.go @@ -3,9 +3,9 @@ package nanointeractive import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/nanointeractive/params_test.go b/adapters/nanointeractive/params_test.go index 309d19b5128..b290f3d94b1 100644 --- a/adapters/nanointeractive/params_test.go +++ b/adapters/nanointeractive/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/nanointeractive.json diff --git a/adapters/nanointeractive/usersync.go b/adapters/nanointeractive/usersync.go index 180e2c53520..e6227436fb2 100644 --- a/adapters/nanointeractive/usersync.go +++ b/adapters/nanointeractive/usersync.go @@ -3,8 +3,8 @@ package nanointeractive import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewNanoInteractiveSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/nanointeractive/usersync_test.go b/adapters/nanointeractive/usersync_test.go index 44040756316..fa78664928f 100644 --- a/adapters/nanointeractive/usersync_test.go +++ b/adapters/nanointeractive/usersync_test.go @@ -4,10 +4,10 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/ninthdecimal/ninthdecimal.go b/adapters/ninthdecimal/ninthdecimal.go index 251f56e13fa..c77e3ca506c 100755 --- a/adapters/ninthdecimal/ninthdecimal.go +++ b/adapters/ninthdecimal/ninthdecimal.go @@ -6,11 +6,11 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/ninthdecimal/ninthdecimal_test.go b/adapters/ninthdecimal/ninthdecimal_test.go index 9d82f38783b..ccb8114f8a9 100755 --- a/adapters/ninthdecimal/ninthdecimal_test.go +++ b/adapters/ninthdecimal/ninthdecimal_test.go @@ -3,9 +3,9 @@ package ninthdecimal import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/ninthdecimal/params_test.go b/adapters/ninthdecimal/params_test.go index cc06088caff..8d3ef3d706f 100755 --- a/adapters/ninthdecimal/params_test.go +++ b/adapters/ninthdecimal/params_test.go @@ -2,7 +2,7 @@ package ninthdecimal import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/ninthdecimal/usersync.go b/adapters/ninthdecimal/usersync.go index 4ea91d031cb..7a8d029cfa9 100755 --- a/adapters/ninthdecimal/usersync.go +++ b/adapters/ninthdecimal/usersync.go @@ -3,8 +3,8 @@ package ninthdecimal import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewNinthDecimalSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/ninthdecimal/usersync_test.go b/adapters/ninthdecimal/usersync_test.go index ded5bf0dbf4..ee121434f29 100755 --- a/adapters/ninthdecimal/usersync_test.go +++ b/adapters/ninthdecimal/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/nobid/nobid.go b/adapters/nobid/nobid.go index f7814d0e972..5429bf09eb2 100644 --- a/adapters/nobid/nobid.go +++ b/adapters/nobid/nobid.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/nobid/nobid_test.go b/adapters/nobid/nobid_test.go index 420c57f36bc..674d189d661 100644 --- a/adapters/nobid/nobid_test.go +++ b/adapters/nobid/nobid_test.go @@ -3,9 +3,9 @@ package nobid import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/nobid/params_test.go b/adapters/nobid/params_test.go index f8c0533c300..75d69943d35 100644 --- a/adapters/nobid/params_test.go +++ b/adapters/nobid/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/nobid/usersync.go b/adapters/nobid/usersync.go index 3b36e59fa3d..c21413f59e7 100644 --- a/adapters/nobid/usersync.go +++ b/adapters/nobid/usersync.go @@ -3,8 +3,8 @@ package nobid import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewNoBidSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/nobid/usersync_test.go b/adapters/nobid/usersync_test.go index a59d70a4f91..bc55d130509 100644 --- a/adapters/nobid/usersync_test.go +++ b/adapters/nobid/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/openrtb_util.go b/adapters/openrtb_util.go index 3f70b48ffbc..a7e9adf8986 100644 --- a/adapters/openrtb_util.go +++ b/adapters/openrtb_util.go @@ -3,8 +3,8 @@ package adapters import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/openrtb_util_test.go b/adapters/openrtb_util_test.go index 887abe1f45b..7e70f8bae86 100644 --- a/adapters/openrtb_util_test.go +++ b/adapters/openrtb_util_test.go @@ -5,8 +5,8 @@ import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/openx/openx.go b/adapters/openx/openx.go index d76f44a3a39..a481f388fa9 100644 --- a/adapters/openx/openx.go +++ b/adapters/openx/openx.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/openx/openx_test.go b/adapters/openx/openx_test.go index 6cd9d0ff34c..6bb4ce60495 100644 --- a/adapters/openx/openx_test.go +++ b/adapters/openx/openx_test.go @@ -4,10 +4,10 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/openx/params_test.go b/adapters/openx/params_test.go index 87ce08fc733..b7ea970ab1f 100644 --- a/adapters/openx/params_test.go +++ b/adapters/openx/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/openx.json diff --git a/adapters/openx/usersync.go b/adapters/openx/usersync.go index f557e5e4095..bb4b328ce62 100644 --- a/adapters/openx/usersync.go +++ b/adapters/openx/usersync.go @@ -3,8 +3,8 @@ package openx import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewOpenxSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/openx/usersync_test.go b/adapters/openx/usersync_test.go index 7bb30399069..cdbb7da8b95 100644 --- a/adapters/openx/usersync_test.go +++ b/adapters/openx/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/orbidder/orbidder.go b/adapters/orbidder/orbidder.go index 73890360cd4..4fe2701c4be 100644 --- a/adapters/orbidder/orbidder.go +++ b/adapters/orbidder/orbidder.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/orbidder/orbidder_test.go b/adapters/orbidder/orbidder_test.go index 4e9fc2f8bb7..0eaed23a971 100644 --- a/adapters/orbidder/orbidder_test.go +++ b/adapters/orbidder/orbidder_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/orbidder/params_test.go b/adapters/orbidder/params_test.go index 98fcf0217db..19c4ed8d9d4 100644 --- a/adapters/orbidder/params_test.go +++ b/adapters/orbidder/params_test.go @@ -2,7 +2,7 @@ package orbidder import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/pubmatic/params_test.go b/adapters/pubmatic/params_test.go index 9615fb978e6..c8a300b9910 100644 --- a/adapters/pubmatic/params_test.go +++ b/adapters/pubmatic/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/pubmatic.json diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index 0b48ece335c..c9e3660b4c8 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -11,13 +11,13 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" "golang.org/x/net/context/ctxhttp" ) diff --git a/adapters/pubmatic/pubmatic_test.go b/adapters/pubmatic/pubmatic_test.go index 06262bdbe1c..a7c6b844c95 100644 --- a/adapters/pubmatic/pubmatic_test.go +++ b/adapters/pubmatic/pubmatic_test.go @@ -12,13 +12,13 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/pubmatic/usersync.go b/adapters/pubmatic/usersync.go index f35470c0ad9..7b4d8e86b50 100644 --- a/adapters/pubmatic/usersync.go +++ b/adapters/pubmatic/usersync.go @@ -3,8 +3,8 @@ package pubmatic import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewPubmaticSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/pubmatic/usersync_test.go b/adapters/pubmatic/usersync_test.go index e32650ac543..d6cd9f78af7 100644 --- a/adapters/pubmatic/usersync_test.go +++ b/adapters/pubmatic/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/pubnative/pubnative.go b/adapters/pubnative/pubnative.go index 7009ad96730..5e5d01545d9 100644 --- a/adapters/pubnative/pubnative.go +++ b/adapters/pubnative/pubnative.go @@ -7,11 +7,11 @@ import ( "net/url" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" ) type PubnativeAdapter struct { diff --git a/adapters/pubnative/pubnative_test.go b/adapters/pubnative/pubnative_test.go index 484315cac5e..6955b85f5de 100644 --- a/adapters/pubnative/pubnative_test.go +++ b/adapters/pubnative/pubnative_test.go @@ -3,9 +3,9 @@ package pubnative import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/pulsepoint/params_test.go b/adapters/pulsepoint/params_test.go index f6d6baf9f06..ac2b314b96f 100644 --- a/adapters/pulsepoint/params_test.go +++ b/adapters/pulsepoint/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/pulsepoint/pulsepoint.go b/adapters/pulsepoint/pulsepoint.go index dd0a8379d2d..4287be94247 100644 --- a/adapters/pulsepoint/pulsepoint.go +++ b/adapters/pulsepoint/pulsepoint.go @@ -11,11 +11,11 @@ import ( "io/ioutil" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "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" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) diff --git a/adapters/pulsepoint/pulsepoint_test.go b/adapters/pulsepoint/pulsepoint_test.go index 36e540b5853..834ebaa7313 100644 --- a/adapters/pulsepoint/pulsepoint_test.go +++ b/adapters/pulsepoint/pulsepoint_test.go @@ -5,8 +5,8 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "bytes" @@ -16,11 +16,11 @@ import ( "net/http/httptest" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/pulsepoint/usersync.go b/adapters/pulsepoint/usersync.go index 4c7d5ca63c8..58de835be28 100644 --- a/adapters/pulsepoint/usersync.go +++ b/adapters/pulsepoint/usersync.go @@ -3,8 +3,8 @@ package pulsepoint import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewPulsepointSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/pulsepoint/usersync_test.go b/adapters/pulsepoint/usersync_test.go index 8dd32564930..e1680fd22ba 100644 --- a/adapters/pulsepoint/usersync_test.go +++ b/adapters/pulsepoint/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/revcontent/revcontent.go b/adapters/revcontent/revcontent.go index e4bd1a31bc1..866e0c148b7 100644 --- a/adapters/revcontent/revcontent.go +++ b/adapters/revcontent/revcontent.go @@ -3,10 +3,10 @@ package revcontent import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" "net/http" ) diff --git a/adapters/revcontent/revcontent_test.go b/adapters/revcontent/revcontent_test.go index d7f83cdb2aa..836ef138eb7 100644 --- a/adapters/revcontent/revcontent_test.go +++ b/adapters/revcontent/revcontent_test.go @@ -3,9 +3,9 @@ package revcontent import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/rhythmone/params_test.go b/adapters/rhythmone/params_test.go index 00eacf15082..7d8cad47d53 100644 --- a/adapters/rhythmone/params_test.go +++ b/adapters/rhythmone/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/rhythmone/rhythmone.go b/adapters/rhythmone/rhythmone.go index 32c581a3f8d..de390c55e93 100644 --- a/adapters/rhythmone/rhythmone.go +++ b/adapters/rhythmone/rhythmone.go @@ -6,10 +6,10 @@ import ( "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/rhythmone/rhythmone_test.go b/adapters/rhythmone/rhythmone_test.go index e2419f33568..c0c0a891ef4 100644 --- a/adapters/rhythmone/rhythmone_test.go +++ b/adapters/rhythmone/rhythmone_test.go @@ -3,9 +3,9 @@ package rhythmone import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/rhythmone/usersync.go b/adapters/rhythmone/usersync.go index 534c60dd4bc..0f7db388e5c 100644 --- a/adapters/rhythmone/usersync.go +++ b/adapters/rhythmone/usersync.go @@ -3,8 +3,8 @@ package rhythmone import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewRhythmoneSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/rhythmone/usersync_test.go b/adapters/rhythmone/usersync_test.go index 1c725626a46..85ecba2a8ab 100644 --- a/adapters/rhythmone/usersync_test.go +++ b/adapters/rhythmone/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index 43aec56d5db..de83503506d 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/rtbhouse/rtbhouse_test.go b/adapters/rtbhouse/rtbhouse_test.go index 15dfd1fc9b2..bae9a636038 100644 --- a/adapters/rtbhouse/rtbhouse_test.go +++ b/adapters/rtbhouse/rtbhouse_test.go @@ -3,9 +3,9 @@ package rtbhouse import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) const testsDir = "rtbhousetest" diff --git a/adapters/rtbhouse/usersync.go b/adapters/rtbhouse/usersync.go index 97e673124aa..3e38d67e593 100644 --- a/adapters/rtbhouse/usersync.go +++ b/adapters/rtbhouse/usersync.go @@ -3,8 +3,8 @@ package rtbhouse import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) const rtbHouseGDPRVendorID = uint16(16) diff --git a/adapters/rtbhouse/usersync_test.go b/adapters/rtbhouse/usersync_test.go index 7b1d198b74d..bb139f7a2e5 100644 --- a/adapters/rtbhouse/usersync_test.go +++ b/adapters/rtbhouse/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index b8aa3ff72ec..89d4b16070d 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -10,15 +10,15 @@ import ( "net/url" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/pbs" "github.com/golang/glog" "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index d19d38b3f56..eb600bb0f5d 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -4,7 +4,7 @@ import ( "bytes" "context" "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/prebid/prebid-server/errortypes" "io/ioutil" "net/http" "net/http/httptest" @@ -12,18 +12,18 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "fmt" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" diff --git a/adapters/rubicon/usersync.go b/adapters/rubicon/usersync.go index 9c86024771e..08d98825a1e 100644 --- a/adapters/rubicon/usersync.go +++ b/adapters/rubicon/usersync.go @@ -3,8 +3,8 @@ package rubicon import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewRubiconSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/rubicon/usersync_test.go b/adapters/rubicon/usersync_test.go index 2fd53d6b62b..646ebff2dc4 100644 --- a/adapters/rubicon/usersync_test.go +++ b/adapters/rubicon/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/sharethrough/butler.go b/adapters/sharethrough/butler.go index b1a498d7139..6d2dadbf81e 100644 --- a/adapters/sharethrough/butler.go +++ b/adapters/sharethrough/butler.go @@ -9,10 +9,10 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/privacy/ccpa" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/sharethrough/butler_test.go b/adapters/sharethrough/butler_test.go index 16f5367b9ed..3c5003ed2dd 100644 --- a/adapters/sharethrough/butler_test.go +++ b/adapters/sharethrough/butler_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/sharethrough/params_test.go b/adapters/sharethrough/params_test.go index e4e659f4420..416f459341d 100644 --- a/adapters/sharethrough/params_test.go +++ b/adapters/sharethrough/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/sharethrough/sharethrough.go b/adapters/sharethrough/sharethrough.go index 1e835da1b8f..39ee796d2c4 100644 --- a/adapters/sharethrough/sharethrough.go +++ b/adapters/sharethrough/sharethrough.go @@ -5,10 +5,10 @@ import ( "net/http" "regexp" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/sharethrough/sharethrough_test.go b/adapters/sharethrough/sharethrough_test.go index c0a8be4b5fa..01e9a78190c 100644 --- a/adapters/sharethrough/sharethrough_test.go +++ b/adapters/sharethrough/sharethrough_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/sharethrough/usersync.go b/adapters/sharethrough/usersync.go index 7d5d6f135a8..a951fcd6a0a 100644 --- a/adapters/sharethrough/usersync.go +++ b/adapters/sharethrough/usersync.go @@ -1,8 +1,8 @@ package sharethrough import ( - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" "text/template" ) diff --git a/adapters/sharethrough/usersync_test.go b/adapters/sharethrough/usersync_test.go index c48a6d51f8e..4802329554e 100644 --- a/adapters/sharethrough/usersync_test.go +++ b/adapters/sharethrough/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/sharethrough/utils.go b/adapters/sharethrough/utils.go index 21e0ae856ad..7b6c2b67360 100644 --- a/adapters/sharethrough/utils.go +++ b/adapters/sharethrough/utils.go @@ -5,7 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" "html/template" diff --git a/adapters/sharethrough/utils_test.go b/adapters/sharethrough/utils_test.go index 0e3289dbe98..c48d625ce04 100644 --- a/adapters/sharethrough/utils_test.go +++ b/adapters/sharethrough/utils_test.go @@ -4,7 +4,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" "regexp" diff --git a/adapters/silvermob/params_test.go b/adapters/silvermob/params_test.go index fbfb5f3d097..13009f6a08b 100644 --- a/adapters/silvermob/params_test.go +++ b/adapters/silvermob/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // TestValidParams makes sure that the silvermob schema accepts all imp.ext fields which we intend to support. diff --git a/adapters/silvermob/silvermob.go b/adapters/silvermob/silvermob.go index 96a9e466563..1c358a6b7f7 100644 --- a/adapters/silvermob/silvermob.go +++ b/adapters/silvermob/silvermob.go @@ -6,11 +6,11 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/silvermob/silvermob_test.go b/adapters/silvermob/silvermob_test.go index 8045542c7c5..795d58fd834 100644 --- a/adapters/silvermob/silvermob_test.go +++ b/adapters/silvermob/silvermob_test.go @@ -3,9 +3,9 @@ package silvermob import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/smaato/params_test.go b/adapters/smaato/params_test.go index 80993dc5739..6c71cbe75c6 100644 --- a/adapters/smaato/params_test.go +++ b/adapters/smaato/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file intends to test static/bidder-params/smaato.json diff --git a/adapters/smaato/smaato.go b/adapters/smaato/smaato.go index 7119aa9431d..5ea61742e7c 100644 --- a/adapters/smaato/smaato.go +++ b/adapters/smaato/smaato.go @@ -6,10 +6,10 @@ import ( "net/http" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/smaato/smaato_test.go b/adapters/smaato/smaato_test.go index 5fdea31693f..c7c4a65017f 100644 --- a/adapters/smaato/smaato_test.go +++ b/adapters/smaato/smaato_test.go @@ -3,9 +3,9 @@ package smaato import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/smartadserver/params_test.go b/adapters/smartadserver/params_test.go index 363886d96b1..b424cbe0a1d 100644 --- a/adapters/smartadserver/params_test.go +++ b/adapters/smartadserver/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/smartadserver.json diff --git a/adapters/smartadserver/smartadserver.go b/adapters/smartadserver/smartadserver.go index b3030b3a90a..fdfcafae73e 100644 --- a/adapters/smartadserver/smartadserver.go +++ b/adapters/smartadserver/smartadserver.go @@ -8,10 +8,10 @@ import ( "path" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/smartadserver/smartadserver_test.go b/adapters/smartadserver/smartadserver_test.go index e6cf5e12b55..978be336471 100644 --- a/adapters/smartadserver/smartadserver_test.go +++ b/adapters/smartadserver/smartadserver_test.go @@ -3,9 +3,9 @@ package smartadserver import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/smartadserver/usersync.go b/adapters/smartadserver/usersync.go index cc155966c12..95b305ff227 100644 --- a/adapters/smartadserver/usersync.go +++ b/adapters/smartadserver/usersync.go @@ -3,8 +3,8 @@ package smartadserver import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewSmartadserverSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/smartadserver/usersync_test.go b/adapters/smartadserver/usersync_test.go index aeb34dd69f9..c4e6660693f 100644 --- a/adapters/smartadserver/usersync_test.go +++ b/adapters/smartadserver/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/smartrtb/smartrtb.go b/adapters/smartrtb/smartrtb.go index 56ab502eda1..365214175ca 100644 --- a/adapters/smartrtb/smartrtb.go +++ b/adapters/smartrtb/smartrtb.go @@ -6,11 +6,11 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/smartrtb/smartrtb_test.go b/adapters/smartrtb/smartrtb_test.go index 1d592dfc6d8..ef5fce668f4 100644 --- a/adapters/smartrtb/smartrtb_test.go +++ b/adapters/smartrtb/smartrtb_test.go @@ -3,9 +3,9 @@ package smartrtb import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/smartrtb/usersync.go b/adapters/smartrtb/usersync.go index 1148dcc1584..2f7b1dc3339 100644 --- a/adapters/smartrtb/usersync.go +++ b/adapters/smartrtb/usersync.go @@ -3,8 +3,8 @@ package smartrtb import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewSmartRTBSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/smartrtb/usersync_test.go b/adapters/smartrtb/usersync_test.go index 6fa5c837296..ae3ae5dc007 100644 --- a/adapters/smartrtb/usersync_test.go +++ b/adapters/smartrtb/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/smartyads/params_test.go b/adapters/smartyads/params_test.go index 048989a2c40..3aa5c0e837d 100644 --- a/adapters/smartyads/params_test.go +++ b/adapters/smartyads/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) var validParams = []string{ diff --git a/adapters/smartyads/smartyads.go b/adapters/smartyads/smartyads.go index b50a7909979..f909162ef2d 100644 --- a/adapters/smartyads/smartyads.go +++ b/adapters/smartyads/smartyads.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/smartyads/smartyads_test.go b/adapters/smartyads/smartyads_test.go index dae8e2a0726..4ea20e98c74 100644 --- a/adapters/smartyads/smartyads_test.go +++ b/adapters/smartyads/smartyads_test.go @@ -3,9 +3,9 @@ package smartyads import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/smartyads/usersync.go b/adapters/smartyads/usersync.go index d394fb730b0..839621e9927 100644 --- a/adapters/smartyads/usersync.go +++ b/adapters/smartyads/usersync.go @@ -3,8 +3,8 @@ package smartyads import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewSmartyAdsSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/smartyads/usersync_test.go b/adapters/smartyads/usersync_test.go index 6ea8aa81846..ed7fc07b594 100644 --- a/adapters/smartyads/usersync_test.go +++ b/adapters/smartyads/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/somoaudience/params_test.go b/adapters/somoaudience/params_test.go index b74725aac21..2cbb2b1f51a 100644 --- a/adapters/somoaudience/params_test.go +++ b/adapters/somoaudience/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/somoaudience.json diff --git a/adapters/somoaudience/somoaudience.go b/adapters/somoaudience/somoaudience.go index 7c88eccacf8..07760009823 100644 --- a/adapters/somoaudience/somoaudience.go +++ b/adapters/somoaudience/somoaudience.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/somoaudience/somoaudience_test.go b/adapters/somoaudience/somoaudience_test.go index 3f3ce8c6ca9..07a1d2b3b65 100644 --- a/adapters/somoaudience/somoaudience_test.go +++ b/adapters/somoaudience/somoaudience_test.go @@ -3,9 +3,9 @@ package somoaudience import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/somoaudience/usersync.go b/adapters/somoaudience/usersync.go index 2d0b715d669..e1e7e2ef21d 100644 --- a/adapters/somoaudience/usersync.go +++ b/adapters/somoaudience/usersync.go @@ -3,8 +3,8 @@ package somoaudience import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewSomoaudienceSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/somoaudience/usersync_test.go b/adapters/somoaudience/usersync_test.go index 9abcc65e748..86460506d68 100644 --- a/adapters/somoaudience/usersync_test.go +++ b/adapters/somoaudience/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/sonobi/params_test.go b/adapters/sonobi/params_test.go index 00fe63c6b6e..3e9d63e8101 100644 --- a/adapters/sonobi/params_test.go +++ b/adapters/sonobi/params_test.go @@ -2,7 +2,7 @@ package sonobi import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/sonobi/sonobi.go b/adapters/sonobi/sonobi.go index 7b156a945d8..b982d9c3ee6 100644 --- a/adapters/sonobi/sonobi.go +++ b/adapters/sonobi/sonobi.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/sonobi/sonobi_test.go b/adapters/sonobi/sonobi_test.go index 7a5d94bd5ac..7e8f2dc2916 100644 --- a/adapters/sonobi/sonobi_test.go +++ b/adapters/sonobi/sonobi_test.go @@ -3,9 +3,9 @@ package sonobi import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/sonobi/usersync.go b/adapters/sonobi/usersync.go index 6ac950563bc..6986d0fd8a1 100644 --- a/adapters/sonobi/usersync.go +++ b/adapters/sonobi/usersync.go @@ -1,8 +1,8 @@ package sonobi import ( - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" "text/template" ) diff --git a/adapters/sonobi/usersync_test.go b/adapters/sonobi/usersync_test.go index 8eadaef8f9c..bfe5859e5d1 100644 --- a/adapters/sonobi/usersync_test.go +++ b/adapters/sonobi/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/sovrn/sovrn.go b/adapters/sovrn/sovrn.go index f4d59e3f693..53c2b97ed28 100644 --- a/adapters/sovrn/sovrn.go +++ b/adapters/sovrn/sovrn.go @@ -12,11 +12,11 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" + "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" + "github.com/prebid/prebid-server/pbs" "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/net/context/ctxhttp" ) diff --git a/adapters/sovrn/sovrn_test.go b/adapters/sovrn/sovrn_test.go index 85cf4672218..56dabd8837e 100644 --- a/adapters/sovrn/sovrn_test.go +++ b/adapters/sovrn/sovrn_test.go @@ -8,9 +8,9 @@ import ( "net/http/httptest" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" "context" @@ -19,10 +19,10 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/config" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/sovrn/usersync.go b/adapters/sovrn/usersync.go index 3f4e81439c6..b4de623718a 100644 --- a/adapters/sovrn/usersync.go +++ b/adapters/sovrn/usersync.go @@ -3,8 +3,8 @@ package sovrn import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewSovrnSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/sovrn/usersync_test.go b/adapters/sovrn/usersync_test.go index e91c73245bb..4a4dfd9d1b9 100644 --- a/adapters/sovrn/usersync_test.go +++ b/adapters/sovrn/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/spotx/params_test.go b/adapters/spotx/params_test.go index 6212fef3bec..de96ebe7953 100644 --- a/adapters/spotx/params_test.go +++ b/adapters/spotx/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestSpotxParams(t *testing.T) { diff --git a/adapters/spotx/spotx.go b/adapters/spotx/spotx.go index 8f57dc9e42a..e7cf9014103 100644 --- a/adapters/spotx/spotx.go +++ b/adapters/spotx/spotx.go @@ -6,10 +6,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/spotx/spotx_test.go b/adapters/spotx/spotx_test.go index 3c806400174..3c7aa85e24b 100644 --- a/adapters/spotx/spotx_test.go +++ b/adapters/spotx/spotx_test.go @@ -2,7 +2,7 @@ package spotx import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters" "github.com/magiconair/properties/assert" "github.com/mxmCherry/openrtb/v15/openrtb2" "testing" diff --git a/adapters/synacormedia/params_test.go b/adapters/synacormedia/params_test.go index d7585c9d58c..a216818e382 100644 --- a/adapters/synacormedia/params_test.go +++ b/adapters/synacormedia/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/synacormedia.json diff --git a/adapters/synacormedia/synacormedia.go b/adapters/synacormedia/synacormedia.go index 86194ac2254..50306d83667 100644 --- a/adapters/synacormedia/synacormedia.go +++ b/adapters/synacormedia/synacormedia.go @@ -6,11 +6,11 @@ import ( "net/http" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/synacormedia/synacormedia_test.go b/adapters/synacormedia/synacormedia_test.go index ce696a67ee1..6a018dc3287 100644 --- a/adapters/synacormedia/synacormedia_test.go +++ b/adapters/synacormedia/synacormedia_test.go @@ -3,9 +3,9 @@ package synacormedia import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/synacormedia/usersync.go b/adapters/synacormedia/usersync.go index d7de9150744..988c1b9ef6a 100644 --- a/adapters/synacormedia/usersync.go +++ b/adapters/synacormedia/usersync.go @@ -3,8 +3,8 @@ package synacormedia import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewSynacorMediaSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/synacormedia/usersync_test.go b/adapters/synacormedia/usersync_test.go index 7ee7b1aa19b..538efb30c73 100644 --- a/adapters/synacormedia/usersync_test.go +++ b/adapters/synacormedia/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/syncer.go b/adapters/syncer.go index 13985db6275..122bcc7ed38 100644 --- a/adapters/syncer.go +++ b/adapters/syncer.go @@ -3,10 +3,10 @@ package adapters import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/usersync" ) func GDPRAwareSyncerIDs(syncers map[openrtb_ext.BidderName]usersync.Usersyncer) map[openrtb_ext.BidderName]uint16 { diff --git a/adapters/syncer_test.go b/adapters/syncer_test.go index 7961608c29d..ca33a9a130d 100644 --- a/adapters/syncer_test.go +++ b/adapters/syncer_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/tappx/params_test.go b/adapters/tappx/params_test.go index d6fcbb9cff6..3a73d4dab53 100644 --- a/adapters/tappx/params_test.go +++ b/adapters/tappx/params_test.go @@ -2,7 +2,7 @@ package tappx import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/tappx/tappx.go b/adapters/tappx/tappx.go index 57720cb8217..e9cf9b76edd 100644 --- a/adapters/tappx/tappx.go +++ b/adapters/tappx/tappx.go @@ -9,11 +9,11 @@ import ( "text/template" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/tappx/tappx_test.go b/adapters/tappx/tappx_test.go index 465828b0bdf..5346b82b694 100644 --- a/adapters/tappx/tappx_test.go +++ b/adapters/tappx/tappx_test.go @@ -4,9 +4,9 @@ import ( "regexp" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/telaria/params_test.go b/adapters/telaria/params_test.go index 76f936cecfc..efa3fba1be9 100644 --- a/adapters/telaria/params_test.go +++ b/adapters/telaria/params_test.go @@ -2,7 +2,7 @@ package telaria import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/telaria/telaria.go b/adapters/telaria/telaria.go index f6285c07c51..84345425c9b 100644 --- a/adapters/telaria/telaria.go +++ b/adapters/telaria/telaria.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/telaria/telaria_test.go b/adapters/telaria/telaria_test.go index b7eddbad523..be29ed40f03 100644 --- a/adapters/telaria/telaria_test.go +++ b/adapters/telaria/telaria_test.go @@ -3,9 +3,9 @@ package telaria import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/telaria/usersync.go b/adapters/telaria/usersync.go index 71cf85b6110..e3f76f6e9b4 100644 --- a/adapters/telaria/usersync.go +++ b/adapters/telaria/usersync.go @@ -3,8 +3,8 @@ package telaria import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewTelariaSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/telaria/usersync_test.go b/adapters/telaria/usersync_test.go index dc3accbbafa..4896b253d2f 100644 --- a/adapters/telaria/usersync_test.go +++ b/adapters/telaria/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 5f126f48e10..3b34659b350 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/triplelift/triplelift_test.go b/adapters/triplelift/triplelift_test.go index 3f23e0dcdc6..5107d7cc997 100644 --- a/adapters/triplelift/triplelift_test.go +++ b/adapters/triplelift/triplelift_test.go @@ -3,9 +3,9 @@ package triplelift import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/triplelift/usersync.go b/adapters/triplelift/usersync.go index 0bd678b0e14..5cb524bea11 100644 --- a/adapters/triplelift/usersync.go +++ b/adapters/triplelift/usersync.go @@ -3,8 +3,8 @@ package triplelift import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/triplelift/usersync_test.go b/adapters/triplelift/usersync_test.go index 30b1a33b3e9..1731b22dffb 100644 --- a/adapters/triplelift/usersync_test.go +++ b/adapters/triplelift/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index c292788fdb7..f02aa560af1 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/triplelift_native/triplelift_native_test.go b/adapters/triplelift_native/triplelift_native_test.go index 19b40232155..fef24949e79 100644 --- a/adapters/triplelift_native/triplelift_native_test.go +++ b/adapters/triplelift_native/triplelift_native_test.go @@ -3,9 +3,9 @@ package triplelift_native import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/triplelift_native/usersync.go b/adapters/triplelift_native/usersync.go index a8d246f07cd..b7587b77950 100644 --- a/adapters/triplelift_native/usersync.go +++ b/adapters/triplelift_native/usersync.go @@ -3,8 +3,8 @@ package triplelift_native import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/triplelift_native/usersync_test.go b/adapters/triplelift_native/usersync_test.go index ec229e2e68c..df0757edc9f 100644 --- a/adapters/triplelift_native/usersync_test.go +++ b/adapters/triplelift_native/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/ucfunnel/params_test.go b/adapters/ucfunnel/params_test.go index c33bc89a6b6..4faec8739da 100644 --- a/adapters/ucfunnel/params_test.go +++ b/adapters/ucfunnel/params_test.go @@ -2,7 +2,7 @@ package ucfunnel import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/ucfunnel/ucfunnel.go b/adapters/ucfunnel/ucfunnel.go index d2d8682b77a..cdf49cc6e36 100644 --- a/adapters/ucfunnel/ucfunnel.go +++ b/adapters/ucfunnel/ucfunnel.go @@ -6,10 +6,10 @@ import ( "net/http" "net/url" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/ucfunnel/ucfunnel_test.go b/adapters/ucfunnel/ucfunnel_test.go index b58dfecce5c..be7797e8b63 100644 --- a/adapters/ucfunnel/ucfunnel_test.go +++ b/adapters/ucfunnel/ucfunnel_test.go @@ -5,9 +5,9 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/ucfunnel/usersync.go b/adapters/ucfunnel/usersync.go index 8220fe6e1fa..92eba0d73e0 100644 --- a/adapters/ucfunnel/usersync.go +++ b/adapters/ucfunnel/usersync.go @@ -3,8 +3,8 @@ package ucfunnel import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewUcfunnelSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/ucfunnel/usersync_test.go b/adapters/ucfunnel/usersync_test.go index 25d879d808a..45320b8cac1 100644 --- a/adapters/ucfunnel/usersync_test.go +++ b/adapters/ucfunnel/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/unruly/params_test.go b/adapters/unruly/params_test.go index af1f2f2bce8..9b8f3110912 100644 --- a/adapters/unruly/params_test.go +++ b/adapters/unruly/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestValidParams(t *testing.T) { diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index 977316a5636..17a793ae190 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/unruly/unruly_test.go b/adapters/unruly/unruly_test.go index 7f37cba85db..09b79e60fc2 100644 --- a/adapters/unruly/unruly_test.go +++ b/adapters/unruly/unruly_test.go @@ -7,11 +7,11 @@ import ( "reflect" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/adapters/unruly/usersync.go b/adapters/unruly/usersync.go index 248b4923875..c90052a475f 100644 --- a/adapters/unruly/usersync.go +++ b/adapters/unruly/usersync.go @@ -3,8 +3,8 @@ package unruly import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewUnrulySyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/unruly/usersync_test.go b/adapters/unruly/usersync_test.go index e85a066dddc..2f0e07d813a 100644 --- a/adapters/unruly/usersync_test.go +++ b/adapters/unruly/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/valueimpression/params_test.go b/adapters/valueimpression/params_test.go index b80962ff4dd..46471de24bb 100644 --- a/adapters/valueimpression/params_test.go +++ b/adapters/valueimpression/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/valueimpression.json diff --git a/adapters/valueimpression/usersync.go b/adapters/valueimpression/usersync.go index 4cc1539103b..34addbc0e75 100644 --- a/adapters/valueimpression/usersync.go +++ b/adapters/valueimpression/usersync.go @@ -3,8 +3,8 @@ package valueimpression import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewValueImpressionSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/valueimpression/usersync_test.go b/adapters/valueimpression/usersync_test.go index ed75969ac0d..ffb3f372bd7 100644 --- a/adapters/valueimpression/usersync_test.go +++ b/adapters/valueimpression/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/valueimpression/valueimpression.go b/adapters/valueimpression/valueimpression.go index eacfc8e2feb..a7a81339679 100644 --- a/adapters/valueimpression/valueimpression.go +++ b/adapters/valueimpression/valueimpression.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/valueimpression/valueimpression_test.go b/adapters/valueimpression/valueimpression_test.go index b2c6500389f..f4d33864978 100644 --- a/adapters/valueimpression/valueimpression_test.go +++ b/adapters/valueimpression/valueimpression_test.go @@ -3,9 +3,9 @@ package valueimpression import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/verizonmedia/params_test.go b/adapters/verizonmedia/params_test.go index 9250c265526..febda6058e6 100644 --- a/adapters/verizonmedia/params_test.go +++ b/adapters/verizonmedia/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/verizonmedia.json diff --git a/adapters/verizonmedia/usersync.go b/adapters/verizonmedia/usersync.go index 612aab3b1f0..31fb12a2064 100644 --- a/adapters/verizonmedia/usersync.go +++ b/adapters/verizonmedia/usersync.go @@ -1,8 +1,8 @@ package verizonmedia import ( - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" "text/template" ) diff --git a/adapters/verizonmedia/usersync_test.go b/adapters/verizonmedia/usersync_test.go index 6455078a6f5..ad77ef0e6cb 100644 --- a/adapters/verizonmedia/usersync_test.go +++ b/adapters/verizonmedia/usersync_test.go @@ -4,7 +4,7 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy" "github.com/stretchr/testify/assert" ) diff --git a/adapters/verizonmedia/verizonmedia.go b/adapters/verizonmedia/verizonmedia.go index 715eb949e13..72caa3f1b2d 100644 --- a/adapters/verizonmedia/verizonmedia.go +++ b/adapters/verizonmedia/verizonmedia.go @@ -6,10 +6,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/verizonmedia/verizonmedia_test.go b/adapters/verizonmedia/verizonmedia_test.go index e0e46c462c1..0cc4cd53edd 100644 --- a/adapters/verizonmedia/verizonmedia_test.go +++ b/adapters/verizonmedia/verizonmedia_test.go @@ -3,9 +3,9 @@ package verizonmedia import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/influxdata/influxdb/pkg/testing/assert" ) diff --git a/adapters/visx/params_test.go b/adapters/visx/params_test.go index f59ce49a46d..e857e8d2639 100644 --- a/adapters/visx/params_test.go +++ b/adapters/visx/params_test.go @@ -2,7 +2,7 @@ package visx import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/visx/usersync.go b/adapters/visx/usersync.go index e8223083033..fe1f5a42a10 100644 --- a/adapters/visx/usersync.go +++ b/adapters/visx/usersync.go @@ -3,8 +3,8 @@ package visx import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewVisxSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/visx/usersync_test.go b/adapters/visx/usersync_test.go index e71ee35f5d8..b410cda6061 100644 --- a/adapters/visx/usersync_test.go +++ b/adapters/visx/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/visx/visx.go b/adapters/visx/visx.go index 28a03acd8d9..87675dd9cef 100644 --- a/adapters/visx/visx.go +++ b/adapters/visx/visx.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/visx/visx_test.go b/adapters/visx/visx_test.go index d637e908913..2f51af76597 100644 --- a/adapters/visx/visx_test.go +++ b/adapters/visx/visx_test.go @@ -3,9 +3,9 @@ package visx import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/vrtcal/params_test.go b/adapters/vrtcal/params_test.go index 5f80812f26f..ba57b6d82f8 100644 --- a/adapters/vrtcal/params_test.go +++ b/adapters/vrtcal/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) //Vrtcal doesn't currently require any custom fields. This file is included for conformity only diff --git a/adapters/vrtcal/usersync.go b/adapters/vrtcal/usersync.go index 0fd97875a0e..04e52955033 100644 --- a/adapters/vrtcal/usersync.go +++ b/adapters/vrtcal/usersync.go @@ -3,8 +3,8 @@ package vrtcal import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewVrtcalSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/vrtcal/usersync_test.go b/adapters/vrtcal/usersync_test.go index faea653f795..26e5838dbe3 100644 --- a/adapters/vrtcal/usersync_test.go +++ b/adapters/vrtcal/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/vrtcal/vrtcal.go b/adapters/vrtcal/vrtcal.go index 5a545dc8c04..24b0ab66159 100644 --- a/adapters/vrtcal/vrtcal.go +++ b/adapters/vrtcal/vrtcal.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/vrtcal/vrtcal_test.go b/adapters/vrtcal/vrtcal_test.go index c1f3cfb0796..332217650f6 100644 --- a/adapters/vrtcal/vrtcal_test.go +++ b/adapters/vrtcal/vrtcal_test.go @@ -3,9 +3,9 @@ package vrtcal import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/yeahmobi/params_test.go b/adapters/yeahmobi/params_test.go index 79b8273a362..997bf93a53f 100644 --- a/adapters/yeahmobi/params_test.go +++ b/adapters/yeahmobi/params_test.go @@ -2,7 +2,7 @@ package yeahmobi import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/yeahmobi/yeahmobi.go b/adapters/yeahmobi/yeahmobi.go index d66b614cd64..c20412d4cca 100644 --- a/adapters/yeahmobi/yeahmobi.go +++ b/adapters/yeahmobi/yeahmobi.go @@ -7,11 +7,11 @@ import ( "net/url" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/yeahmobi/yeahmobi_test.go b/adapters/yeahmobi/yeahmobi_test.go index 9f983633452..a38480b0486 100644 --- a/adapters/yeahmobi/yeahmobi_test.go +++ b/adapters/yeahmobi/yeahmobi_test.go @@ -3,9 +3,9 @@ package yeahmobi import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/yieldlab/params_test.go b/adapters/yieldlab/params_test.go index f66121e35e8..8c230c15b15 100644 --- a/adapters/yieldlab/params_test.go +++ b/adapters/yieldlab/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/yieldlab.json diff --git a/adapters/yieldlab/usersync.go b/adapters/yieldlab/usersync.go index a0462e19e6e..3ee9a3fdfb5 100644 --- a/adapters/yieldlab/usersync.go +++ b/adapters/yieldlab/usersync.go @@ -3,8 +3,8 @@ package yieldlab import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewYieldlabSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/yieldlab/usersync_test.go b/adapters/yieldlab/usersync_test.go index cdca7f9f417..3892c16bf05 100644 --- a/adapters/yieldlab/usersync_test.go +++ b/adapters/yieldlab/usersync_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" ) func TestYieldlabSyncer(t *testing.T) { diff --git a/adapters/yieldlab/yieldlab.go b/adapters/yieldlab/yieldlab.go index a3eb297fff9..05d612f98b1 100644 --- a/adapters/yieldlab/yieldlab.go +++ b/adapters/yieldlab/yieldlab.go @@ -12,10 +12,10 @@ import ( "github.com/mxmCherry/openrtb/v15/openrtb2" "golang.org/x/text/currency" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" ) // YieldlabAdapter connects the Yieldlab API to prebid server diff --git a/adapters/yieldlab/yieldlab_test.go b/adapters/yieldlab/yieldlab_test.go index 83f7d1e813f..273117e3bdf 100644 --- a/adapters/yieldlab/yieldlab_test.go +++ b/adapters/yieldlab/yieldlab_test.go @@ -5,9 +5,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) const testURL = "https://ad.yieldlab.net/testing/" diff --git a/adapters/yieldmo/params_test.go b/adapters/yieldmo/params_test.go index 87044a2dd57..0a8fe2d10f1 100644 --- a/adapters/yieldmo/params_test.go +++ b/adapters/yieldmo/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/yieldmo.json diff --git a/adapters/yieldmo/usersync.go b/adapters/yieldmo/usersync.go index 25d65f229a2..041e7e8f073 100644 --- a/adapters/yieldmo/usersync.go +++ b/adapters/yieldmo/usersync.go @@ -3,8 +3,8 @@ package yieldmo import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewYieldmoSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/yieldmo/usersync_test.go b/adapters/yieldmo/usersync_test.go index 1212efdb878..598710ec742 100644 --- a/adapters/yieldmo/usersync_test.go +++ b/adapters/yieldmo/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/yieldmo/yieldmo.go b/adapters/yieldmo/yieldmo.go index 7fc8ad5b1ca..175dee6117e 100644 --- a/adapters/yieldmo/yieldmo.go +++ b/adapters/yieldmo/yieldmo.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/yieldmo/yieldmo_test.go b/adapters/yieldmo/yieldmo_test.go index faee55c3890..cb0a8d60aa5 100644 --- a/adapters/yieldmo/yieldmo_test.go +++ b/adapters/yieldmo/yieldmo_test.go @@ -3,9 +3,9 @@ package yieldmo import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/yieldone/params_test.go b/adapters/yieldone/params_test.go index e0142334d6e..6048ea5d7dc 100644 --- a/adapters/yieldone/params_test.go +++ b/adapters/yieldone/params_test.go @@ -2,7 +2,7 @@ package yieldone import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "testing" ) diff --git a/adapters/yieldone/usersync.go b/adapters/yieldone/usersync.go index 333550aa775..bc9d1b3235b 100644 --- a/adapters/yieldone/usersync.go +++ b/adapters/yieldone/usersync.go @@ -3,8 +3,8 @@ package yieldone import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewYieldoneSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/yieldone/usersync_test.go b/adapters/yieldone/usersync_test.go index 730f9103017..902f3b66b34 100644 --- a/adapters/yieldone/usersync_test.go +++ b/adapters/yieldone/usersync_test.go @@ -4,8 +4,8 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/yieldone/yieldone.go b/adapters/yieldone/yieldone.go index 90c8cf06e78..f72efeb0f3b 100644 --- a/adapters/yieldone/yieldone.go +++ b/adapters/yieldone/yieldone.go @@ -5,10 +5,10 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/yieldone/yieldone_test.go b/adapters/yieldone/yieldone_test.go index ca2c3851ad4..8544c21f4e7 100644 --- a/adapters/yieldone/yieldone_test.go +++ b/adapters/yieldone/yieldone_test.go @@ -3,9 +3,9 @@ package yieldone import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "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) { diff --git a/adapters/zeroclickfraud/usersync.go b/adapters/zeroclickfraud/usersync.go index a5435335ab8..833524e4b3e 100644 --- a/adapters/zeroclickfraud/usersync.go +++ b/adapters/zeroclickfraud/usersync.go @@ -3,8 +3,8 @@ package zeroclickfraud import ( "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" ) func NewZeroClickFraudSyncer(temp *template.Template) usersync.Usersyncer { diff --git a/adapters/zeroclickfraud/usersync_test.go b/adapters/zeroclickfraud/usersync_test.go index 445b07ab8eb..5e8f8fdf111 100644 --- a/adapters/zeroclickfraud/usersync_test.go +++ b/adapters/zeroclickfraud/usersync_test.go @@ -4,9 +4,9 @@ import ( "testing" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" "github.com/stretchr/testify/assert" ) diff --git a/adapters/zeroclickfraud/zeroclickfraud.go b/adapters/zeroclickfraud/zeroclickfraud.go index 206981101f6..9d3b95bae73 100644 --- a/adapters/zeroclickfraud/zeroclickfraud.go +++ b/adapters/zeroclickfraud/zeroclickfraud.go @@ -7,11 +7,11 @@ import ( "strconv" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/macros" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/adapters/zeroclickfraud/zeroclickfraud_test.go b/adapters/zeroclickfraud/zeroclickfraud_test.go index 2942c25a4f3..654d9450da0 100644 --- a/adapters/zeroclickfraud/zeroclickfraud_test.go +++ b/adapters/zeroclickfraud/zeroclickfraud_test.go @@ -3,9 +3,9 @@ package zeroclickfraud import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/analytics/config/config.go b/analytics/config/config.go index ac145ee363e..326dc50775d 100644 --- a/analytics/config/config.go +++ b/analytics/config/config.go @@ -1,11 +1,11 @@ package config import ( - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/analytics/clients" - "github.com/PubMatic-OpenWrap/prebid-server/analytics/filesystem" - "github.com/PubMatic-OpenWrap/prebid-server/analytics/pubstack" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/analytics/clients" + "github.com/prebid/prebid-server/analytics/filesystem" + "github.com/prebid/prebid-server/analytics/pubstack" + "github.com/prebid/prebid-server/config" "github.com/golang/glog" ) diff --git a/analytics/config/config_test.go b/analytics/config/config_test.go index ec7fca7d73e..02bbde65445 100644 --- a/analytics/config/config_test.go +++ b/analytics/config/config_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/analytics/core.go b/analytics/core.go index 647a0d9f5dd..b55298ae173 100644 --- a/analytics/core.go +++ b/analytics/core.go @@ -3,9 +3,9 @@ package analytics import ( "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/analytics/filesystem/file_module.go b/analytics/filesystem/file_module.go index bb94fa783a5..dd38dc3d58e 100644 --- a/analytics/filesystem/file_module.go +++ b/analytics/filesystem/file_module.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" + "github.com/prebid/prebid-server/analytics" "github.com/chasex/glog" ) diff --git a/analytics/filesystem/file_module_test.go b/analytics/filesystem/file_module_test.go index 4c46d538cb0..f0f5e9a3ea8 100644 --- a/analytics/filesystem/file_module_test.go +++ b/analytics/filesystem/file_module_test.go @@ -1,14 +1,14 @@ package filesystem import ( - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/config" "net/http" "os" "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/analytics/pubstack/helpers/json.go b/analytics/pubstack/helpers/json.go index 11c5bf8ec05..f02f1120626 100644 --- a/analytics/pubstack/helpers/json.go +++ b/analytics/pubstack/helpers/json.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" + "github.com/prebid/prebid-server/analytics" ) func JsonifyAuctionObject(ao *analytics.AuctionObject, scope string) ([]byte, error) { diff --git a/analytics/pubstack/helpers/json_test.go b/analytics/pubstack/helpers/json_test.go index addc182204e..7b87b699fd9 100644 --- a/analytics/pubstack/helpers/json_test.go +++ b/analytics/pubstack/helpers/json_test.go @@ -1,8 +1,8 @@ package helpers import ( - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/usersync" "github.com/mxmCherry/openrtb/v15/openrtb2" "net/http" "testing" diff --git a/analytics/pubstack/pubstack_module.go b/analytics/pubstack/pubstack_module.go index ae32dc52638..8c548404d1f 100644 --- a/analytics/pubstack/pubstack_module.go +++ b/analytics/pubstack/pubstack_module.go @@ -2,7 +2,7 @@ package pubstack import ( "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/analytics/pubstack/eventchannel" + "github.com/prebid/prebid-server/analytics/pubstack/eventchannel" "net/http" "net/url" "os" @@ -11,10 +11,10 @@ import ( "syscall" "time" - "github.com/PubMatic-OpenWrap/prebid-server/analytics/pubstack/helpers" + "github.com/prebid/prebid-server/analytics/pubstack/helpers" "github.com/golang/glog" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" + "github.com/prebid/prebid-server/analytics" ) type Configuration struct { diff --git a/analytics/pubstack/pubstack_module_test.go b/analytics/pubstack/pubstack_module_test.go index ab317fd6202..1f7b5f7dbcd 100644 --- a/analytics/pubstack/pubstack_module_test.go +++ b/analytics/pubstack/pubstack_module_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" + "github.com/prebid/prebid-server/analytics" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/cache/dummycache/dummycache.go b/cache/dummycache/dummycache.go index 245b36325aa..8cf9f2c4dff 100644 --- a/cache/dummycache/dummycache.go +++ b/cache/dummycache/dummycache.go @@ -3,7 +3,7 @@ package dummycache import ( "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/cache" + "github.com/prebid/prebid-server/cache" ) // Cache dummy config that will echo back results diff --git a/cache/filecache/filecache.go b/cache/filecache/filecache.go index d49f755edb4..0c1ba435388 100644 --- a/cache/filecache/filecache.go +++ b/cache/filecache/filecache.go @@ -4,8 +4,8 @@ import ( "fmt" "io/ioutil" - "github.com/PubMatic-OpenWrap/prebid-server/cache" "github.com/golang/glog" + "github.com/prebid/prebid-server/cache" "gopkg.in/yaml.v2" ) diff --git a/cache/postgrescache/postgrescache.go b/cache/postgrescache/postgrescache.go index aa0d3c3ea8b..c76eda9bd3f 100644 --- a/cache/postgrescache/postgrescache.go +++ b/cache/postgrescache/postgrescache.go @@ -7,9 +7,9 @@ import ( "encoding/gob" "time" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/cache" + "github.com/prebid/prebid-server/cache" "github.com/coocood/freecache" "github.com/lib/pq" ) diff --git a/config/adapter.go b/config/adapter.go index 5f188ac4a62..13690a2c99b 100644 --- a/config/adapter.go +++ b/config/adapter.go @@ -4,7 +4,7 @@ import ( "fmt" "text/template" - "github.com/PubMatic-OpenWrap/prebid-server/macros" + "github.com/prebid/prebid-server/macros" validator "github.com/asaskevich/govalidator" ) diff --git a/config/config.go b/config/config.go index c1ad4426e28..e0b0f0f7e4b 100755 --- a/config/config.go +++ b/config/config.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" "github.com/spf13/viper" ) diff --git a/config/config_test.go b/config/config_test.go index f6792cb7648..7ff5f0fafa1 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -11,7 +11,7 @@ import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/currency/rate_converter.go b/currency/rate_converter.go index 269cf7551ea..2af949849c5 100644 --- a/currency/rate_converter.go +++ b/currency/rate_converter.go @@ -8,8 +8,8 @@ import ( "sync/atomic" "time" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/util/timeutil" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/util/timeutil" "github.com/golang/glog" ) diff --git a/currency/rate_converter_test.go b/currency/rate_converter_test.go index b3e26c86a47..e1d6741dff2 100644 --- a/currency/rate_converter_test.go +++ b/currency/rate_converter_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/util/task" + "github.com/prebid/prebid-server/util/task" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/auction.go b/endpoints/auction.go index 737e7b7fae8..0a719d8b532 100644 --- a/endpoints/auction.go +++ b/endpoints/auction.go @@ -10,19 +10,19 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/cache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - pbc "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - gdprPrivacy "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/cache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + pbc "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/privacy" + gdprPrivacy "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/usersync" "github.com/golang/glog" "github.com/julienschmidt/httprouter" ) diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index 83beb2fa40e..acc28778f3b 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -10,16 +10,16 @@ import ( "net/http/httptest" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - gdprPolicy "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/usersync/usersyncers" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + metricsConf "github.com/prebid/prebid-server/metrics/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/prebid_cache_client" + gdprPolicy "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/usersync/usersyncers" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/spf13/viper" diff --git a/endpoints/cookie_sync.go b/endpoints/cookie_sync.go index f32d823fe1d..6c349c0be46 100644 --- a/endpoints/cookie_sync.go +++ b/endpoints/cookie_sync.go @@ -5,15 +5,15 @@ import ( "encoding/json" "errors" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - gdprPrivacy "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + gdprPrivacy "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/usersync" "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" diff --git a/endpoints/cookie_sync_test.go b/endpoints/cookie_sync_test.go index 14a699177bc..75c8943dd6d 100644 --- a/endpoints/cookie_sync_test.go +++ b/endpoints/cookie_sync_test.go @@ -9,16 +9,16 @@ import ( "text/template" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/audienceNetwork" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubmatic" - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters/appnexus" + "github.com/prebid/prebid-server/adapters/audienceNetwork" + "github.com/prebid/prebid-server/adapters/lifestreet" + "github.com/prebid/prebid-server/adapters/pubmatic" + analyticsConf "github.com/prebid/prebid-server/analytics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/gdpr" + metricsConf "github.com/prebid/prebid-server/metrics/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/usersync" "github.com/buger/jsonparser" "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/assert" diff --git a/endpoints/currency_rates.go b/endpoints/currency_rates.go index de5a47e19b9..4f24d8dd9f0 100644 --- a/endpoints/currency_rates.go +++ b/endpoints/currency_rates.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "github.com/PubMatic-OpenWrap/prebid-server/currency" + "github.com/prebid/prebid-server/currency" "github.com/golang/glog" ) diff --git a/endpoints/currency_rates_test.go b/endpoints/currency_rates_test.go index e73893aa837..7fc513e7dbe 100644 --- a/endpoints/currency_rates_test.go +++ b/endpoints/currency_rates_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/currency" + "github.com/prebid/prebid-server/currency" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/events/account_test.go b/endpoints/events/account_test.go index 559b39d096c..a4b868b19d9 100644 --- a/endpoints/events/account_test.go +++ b/endpoints/events/account_test.go @@ -3,9 +3,9 @@ package events import ( "errors" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/stored_requests" "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/assert" "io/ioutil" diff --git a/endpoints/events/event.go b/endpoints/events/event.go index da18b16bd53..3fbc6f6230c 100644 --- a/endpoints/events/event.go +++ b/endpoints/events/event.go @@ -4,11 +4,11 @@ import ( "context" "errors" "fmt" - accountService "github.com/PubMatic-OpenWrap/prebid-server/account" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + accountService "github.com/prebid/prebid-server/account" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/stored_requests" "github.com/julienschmidt/httprouter" "net/http" "net/url" diff --git a/endpoints/events/event_test.go b/endpoints/events/event_test.go index d32d01ad562..ba8071843f4 100644 --- a/endpoints/events/event_test.go +++ b/endpoints/events/event_test.go @@ -4,9 +4,9 @@ import ( "context" "encoding/base64" "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/stored_requests" "github.com/stretchr/testify/assert" "io/ioutil" "net/http" diff --git a/endpoints/events/vtrack.go b/endpoints/events/vtrack.go index 90e597ab7fc..6de03cf547c 100644 --- a/endpoints/events/vtrack.go +++ b/endpoints/events/vtrack.go @@ -10,13 +10,13 @@ import ( "strings" "time" - accountService "github.com/PubMatic-OpenWrap/prebid-server/account" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + accountService "github.com/prebid/prebid-server/account" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/stored_requests" "github.com/golang/glog" "github.com/julienschmidt/httprouter" ) diff --git a/endpoints/events/vtrack_test.go b/endpoints/events/vtrack_test.go index 52665e7736d..0ec04663d01 100644 --- a/endpoints/events/vtrack_test.go +++ b/endpoints/events/vtrack_test.go @@ -5,10 +5,10 @@ import ( "context" "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/stored_requests" "github.com/stretchr/testify/assert" "io/ioutil" "net/http/httptest" diff --git a/endpoints/getuids.go b/endpoints/getuids.go index e02efe15b3a..42f59ce482d 100644 --- a/endpoints/getuids.go +++ b/endpoints/getuids.go @@ -3,8 +3,8 @@ package endpoints import ( "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/usersync" "github.com/julienschmidt/httprouter" "encoding/json" diff --git a/endpoints/getuids_test.go b/endpoints/getuids_test.go index fb984e15c35..7988acbaffe 100644 --- a/endpoints/getuids_test.go +++ b/endpoints/getuids_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/config" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/info/bidders.go b/endpoints/info/bidders.go index 7c44c7ec6fa..de9825b8399 100644 --- a/endpoints/info/bidders.go +++ b/endpoints/info/bidders.go @@ -4,8 +4,8 @@ import ( "encoding/json" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" diff --git a/endpoints/info/bidders_test.go b/endpoints/info/bidders_test.go index 15e5f77de23..8229472b84f 100644 --- a/endpoints/info/bidders_test.go +++ b/endpoints/info/bidders_test.go @@ -14,10 +14,10 @@ import ( "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/info" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/endpoints/info" + "github.com/prebid/prebid-server/openrtb_ext" yaml "gopkg.in/yaml.v2" ) diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index 4cd1764ee4b..d025a06d85f 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -11,21 +11,21 @@ import ( "strings" "time" - accountService "github.com/PubMatic-OpenWrap/prebid-server/account" - "github.com/PubMatic-OpenWrap/prebid-server/amp" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + accountService "github.com/prebid/prebid-server/account" + "github.com/prebid/prebid-server/amp" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/prebid/prebid-server/usersync" + "github.com/prebid/prebid-server/util/iputil" "github.com/buger/jsonparser" "github.com/golang/glog" "github.com/julienschmidt/httprouter" diff --git a/endpoints/openrtb2/amp_auction_test.go b/endpoints/openrtb2/amp_auction_test.go index 6826858f965..7af6b179e5e 100644 --- a/endpoints/openrtb2/amp_auction_test.go +++ b/endpoints/openrtb2/amp_auction_test.go @@ -11,14 +11,14 @@ import ( "strconv" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" + + analyticsConf "github.com/prebid/prebid-server/analytics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" gometrics "github.com/rcrowley/go-metrics" "github.com/stretchr/testify/assert" diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index 32a2d934776..e8bbd9b4ef6 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -13,20 +13,20 @@ import ( "strconv" "time" - accountService "github.com/PubMatic-OpenWrap/prebid-server/account" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/PubMatic-OpenWrap/prebid-server/util/httputil" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + accountService "github.com/prebid/prebid-server/account" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/prebid/prebid-server/usersync" + "github.com/prebid/prebid-server/util/httputil" + "github.com/prebid/prebid-server/util/iputil" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" "github.com/gofrs/uuid" diff --git a/endpoints/openrtb2/auction_benchmark_test.go b/endpoints/openrtb2/auction_benchmark_test.go index 89965db0430..b42e45b68d9 100644 --- a/endpoints/openrtb2/auction_benchmark_test.go +++ b/endpoints/openrtb2/auction_benchmark_test.go @@ -7,15 +7,15 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/currency" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/currency" - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" + analyticsConf "github.com/prebid/prebid-server/analytics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" ) // dummyServer returns the header bidding test ad. This response was scraped from a real appnexus server response. diff --git a/endpoints/openrtb2/auction_test.go b/endpoints/openrtb2/auction_test.go index 1112e33241c..09c4e931fe2 100644 --- a/endpoints/openrtb2/auction_test.go +++ b/endpoints/openrtb2/auction_test.go @@ -17,17 +17,17 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/stored_requests" + + analyticsConf "github.com/prebid/prebid-server/analytics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/prebid/prebid-server/util/iputil" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" "github.com/mxmCherry/openrtb/v15/openrtb2" diff --git a/endpoints/openrtb2/ctv/combination/adslot_combination_generator.go b/endpoints/openrtb2/ctv/combination/adslot_combination_generator.go index 8778cfe55e0..81a5a923eb6 100644 --- a/endpoints/openrtb2/ctv/combination/adslot_combination_generator.go +++ b/endpoints/openrtb2/ctv/combination/adslot_combination_generator.go @@ -3,7 +3,7 @@ package combination import ( "math/big" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) //generator holds all the combinations based diff --git a/endpoints/openrtb2/ctv/combination/adslot_combination_generator_test.go b/endpoints/openrtb2/ctv/combination/adslot_combination_generator_test.go index a9c72a8a5a8..b701a7f1c1f 100644 --- a/endpoints/openrtb2/ctv/combination/adslot_combination_generator_test.go +++ b/endpoints/openrtb2/ctv/combination/adslot_combination_generator_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/ctv/combination/combination.go b/endpoints/openrtb2/ctv/combination/combination.go index e5c5e0c4b79..4f4f1987354 100644 --- a/endpoints/openrtb2/ctv/combination/combination.go +++ b/endpoints/openrtb2/ctv/combination/combination.go @@ -8,8 +8,8 @@ package combination import ( - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/openrtb_ext" ) // ICombination ... diff --git a/endpoints/openrtb2/ctv/combination/combination_test.go b/endpoints/openrtb2/ctv/combination/combination_test.go index 029cad0819b..14f32eddcb6 100644 --- a/endpoints/openrtb2/ctv/combination/combination_test.go +++ b/endpoints/openrtb2/ctv/combination/combination_test.go @@ -3,8 +3,8 @@ package combination import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/ctv/impressions/helper.go b/endpoints/openrtb2/ctv/impressions/helper.go index 23e57a3b349..7fba95d704d 100644 --- a/endpoints/openrtb2/ctv/impressions/helper.go +++ b/endpoints/openrtb2/ctv/impressions/helper.go @@ -3,8 +3,8 @@ package impressions import ( "math" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/openrtb_ext" ) // newConfig initializes the generator instance diff --git a/endpoints/openrtb2/ctv/impressions/impression_generator.go b/endpoints/openrtb2/ctv/impressions/impression_generator.go index eb195b39f56..5488a8dd6a6 100644 --- a/endpoints/openrtb2/ctv/impressions/impression_generator.go +++ b/endpoints/openrtb2/ctv/impressions/impression_generator.go @@ -1,7 +1,7 @@ package impressions import ( - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" ) // generator contains Pod Minimum Duration, Pod Maximum Duration, Slot Minimum Duration and Slot Maximum Duration diff --git a/endpoints/openrtb2/ctv/impressions/impressions.go b/endpoints/openrtb2/ctv/impressions/impressions.go index ab8294afc81..f810d9fd2a8 100644 --- a/endpoints/openrtb2/ctv/impressions/impressions.go +++ b/endpoints/openrtb2/ctv/impressions/impressions.go @@ -4,8 +4,8 @@ package impressions import ( - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/openrtb_ext" ) // Algorithm indicates type of algorithms supported diff --git a/endpoints/openrtb2/ctv/impressions/maximize_for_duration.go b/endpoints/openrtb2/ctv/impressions/maximize_for_duration.go index 77cd5a334c7..b51116744b6 100644 --- a/endpoints/openrtb2/ctv/impressions/maximize_for_duration.go +++ b/endpoints/openrtb2/ctv/impressions/maximize_for_duration.go @@ -1,8 +1,8 @@ package impressions import ( - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/openrtb_ext" ) // newMaximizeForDuration Constucts the generator object from openrtb_ext.VideoAdPod diff --git a/endpoints/openrtb2/ctv/impressions/maximize_for_duration_test.go b/endpoints/openrtb2/ctv/impressions/maximize_for_duration_test.go index 84f3304fb6d..2bb7323b0c1 100644 --- a/endpoints/openrtb2/ctv/impressions/maximize_for_duration_test.go +++ b/endpoints/openrtb2/ctv/impressions/maximize_for_duration_test.go @@ -3,8 +3,8 @@ package impressions import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/impressions/testdata" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/impressions/testdata" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/ctv/impressions/min_max_algorithm.go b/endpoints/openrtb2/ctv/impressions/min_max_algorithm.go index b25d0783230..0d2f43301f2 100644 --- a/endpoints/openrtb2/ctv/impressions/min_max_algorithm.go +++ b/endpoints/openrtb2/ctv/impressions/min_max_algorithm.go @@ -7,8 +7,8 @@ import ( "strings" "sync" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/openrtb_ext" ) // keyDelim used as separator in forming key of maxExpectedDurationMap diff --git a/endpoints/openrtb2/ctv/impressions/min_max_algorithm_test.go b/endpoints/openrtb2/ctv/impressions/min_max_algorithm_test.go index 5928b430924..332e5d78e4c 100644 --- a/endpoints/openrtb2/ctv/impressions/min_max_algorithm_test.go +++ b/endpoints/openrtb2/ctv/impressions/min_max_algorithm_test.go @@ -4,7 +4,7 @@ import ( "sort" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/impressions/testdata" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/impressions/testdata" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/ctv/response/adpod_generator copy.go.bak b/endpoints/openrtb2/ctv/response/adpod_generator copy.go.bak index 0c3fc4b1a69..df5b7e36be0 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator copy.go.bak +++ b/endpoints/openrtb2/ctv/response/adpod_generator copy.go.bak @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) /********************* AdPodGenerator Functions *********************/ diff --git a/endpoints/openrtb2/ctv/response/adpod_generator.go b/endpoints/openrtb2/ctv/response/adpod_generator.go index 760bd3943c3..6b24c3719aa 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator.go +++ b/endpoints/openrtb2/ctv/response/adpod_generator.go @@ -5,12 +5,12 @@ import ( "sync" "time" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/combination" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/combination" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/endpoints/openrtb2/ctv/response/adpod_generator_test.go b/endpoints/openrtb2/ctv/response/adpod_generator_test.go index d5f31237cb4..6e73f98269d 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator_test.go +++ b/endpoints/openrtb2/ctv/response/adpod_generator_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/endpoints/openrtb2/ctv/types/adpod_types.go b/endpoints/openrtb2/ctv/types/adpod_types.go index 7af21cfc5ef..5c6f89c11a7 100644 --- a/endpoints/openrtb2/ctv/types/adpod_types.go +++ b/endpoints/openrtb2/ctv/types/adpod_types.go @@ -1,8 +1,8 @@ package types import ( - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/endpoints/openrtb2/ctv/util/util.go b/endpoints/openrtb2/ctv/util/util.go index f9b0ca1bcaf..805f06cc3f9 100644 --- a/endpoints/openrtb2/ctv/util/util.go +++ b/endpoints/openrtb2/ctv/util/util.go @@ -11,9 +11,9 @@ import ( "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" ) diff --git a/endpoints/openrtb2/ctv/util/util_test.go b/endpoints/openrtb2/ctv/util/util_test.go index f18cabb6144..8a351caad86 100644 --- a/endpoints/openrtb2/ctv/util/util_test.go +++ b/endpoints/openrtb2/ctv/util/util_test.go @@ -4,11 +4,11 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/ctv_auction.go b/endpoints/openrtb2/ctv_auction.go index d958701969d..064edd3a606 100644 --- a/endpoints/openrtb2/ctv_auction.go +++ b/endpoints/openrtb2/ctv_auction.go @@ -13,22 +13,22 @@ import ( "time" "github.com/PubMatic-OpenWrap/etree" - accountService "github.com/PubMatic-OpenWrap/prebid-server/account" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/combination" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/constant" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/impressions" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/response" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/types" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2/ctv/util" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + accountService "github.com/prebid/prebid-server/account" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/combination" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/impressions" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/response" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/usersync" + "github.com/prebid/prebid-server/util/iputil" "github.com/buger/jsonparser" uuid "github.com/gofrs/uuid" "github.com/golang/glog" diff --git a/endpoints/openrtb2/ctv_auction_test.go b/endpoints/openrtb2/ctv_auction_test.go index 9c75316d3b8..a1de7dd9b30 100644 --- a/endpoints/openrtb2/ctv_auction_test.go +++ b/endpoints/openrtb2/ctv_auction_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/openrtb2/interstitial.go b/endpoints/openrtb2/interstitial.go index 7c2af1b9de0..727412251d3 100644 --- a/endpoints/openrtb2/interstitial.go +++ b/endpoints/openrtb2/interstitial.go @@ -4,9 +4,9 @@ import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index 0b7a64ee7cf..4867d1ec911 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -14,21 +14,21 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/util/iputil" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" "github.com/gofrs/uuid" - accountService "github.com/PubMatic-OpenWrap/prebid-server/account" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + accountService "github.com/prebid/prebid-server/account" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/usersync" "github.com/golang/glog" "github.com/julienschmidt/httprouter" "github.com/mxmCherry/openrtb/v15/openrtb2" diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index 855e7055afb..8bcf914fdd5 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -12,14 +12,14 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/prebid/prebid-server/analytics" + analyticsConf "github.com/prebid/prebid-server/analytics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/setuid.go b/endpoints/setuid.go index b6832951625..0cb277fbb44 100644 --- a/endpoints/setuid.go +++ b/endpoints/setuid.go @@ -9,12 +9,12 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/usersync" "github.com/julienschmidt/httprouter" ) diff --git a/endpoints/setuid_test.go b/endpoints/setuid_test.go index 2b46fddecd0..fc98608ef9f 100644 --- a/endpoints/setuid_test.go +++ b/endpoints/setuid_test.go @@ -10,17 +10,17 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/usersync" "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" + analyticsConf "github.com/prebid/prebid-server/analytics/config" + metricsConf "github.com/prebid/prebid-server/metrics/config" ) func TestSetUIDEndpoint(t *testing.T) { diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index ca6f1fb0868..ccd0e0a0e7f 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -1,103 +1,103 @@ package exchange import ( - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - ttx "github.com/PubMatic-OpenWrap/prebid-server/adapters/33across" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/acuityads" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adform" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adgeneration" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adhese" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adkernel" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adkernelAdn" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adman" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/admixer" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adocean" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adoppler" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adot" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adpone" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adprime" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adtarget" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adtelligent" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/advangelists" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/aja" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/amx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/applogy" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/audienceNetwork" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/avocet" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/beachfront" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/beintoo" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/between" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/brightroll" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/colossus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/connectad" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/consumable" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/conversant" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/cpmstar" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/datablocks" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/decenterads" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/deepintent" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/dmx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/emx_digital" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/engagebdr" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/eplanning" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/gamma" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/gamoshi" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/grid" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/gumgum" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/improvedigital" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/inmobi" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/invibes" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ix" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/kidoz" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/krushmedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/kubient" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lockerdome" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/logicad" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lunamedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/marsmedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/mgid" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/mobfoxpb" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/mobilefuse" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/nanointeractive" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ninthdecimal" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/nobid" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/openx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/orbidder" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubmatic" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubnative" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pulsepoint" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/revcontent" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rhythmone" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rtbhouse" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rubicon" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sharethrough" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/silvermob" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smaato" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smartadserver" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smartrtb" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smartyads" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/somoaudience" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sonobi" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sovrn" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/spotx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/synacormedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/tappx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/telaria" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/triplelift" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/triplelift_native" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ucfunnel" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/unruly" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/valueimpression" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/verizonmedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/visx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/vrtcal" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yeahmobi" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yieldlab" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yieldmo" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yieldone" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/zeroclickfraud" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + ttx "github.com/prebid/prebid-server/adapters/33across" + "github.com/prebid/prebid-server/adapters/acuityads" + "github.com/prebid/prebid-server/adapters/adform" + "github.com/prebid/prebid-server/adapters/adgeneration" + "github.com/prebid/prebid-server/adapters/adhese" + "github.com/prebid/prebid-server/adapters/adkernel" + "github.com/prebid/prebid-server/adapters/adkernelAdn" + "github.com/prebid/prebid-server/adapters/adman" + "github.com/prebid/prebid-server/adapters/admixer" + "github.com/prebid/prebid-server/adapters/adocean" + "github.com/prebid/prebid-server/adapters/adoppler" + "github.com/prebid/prebid-server/adapters/adot" + "github.com/prebid/prebid-server/adapters/adpone" + "github.com/prebid/prebid-server/adapters/adprime" + "github.com/prebid/prebid-server/adapters/adtarget" + "github.com/prebid/prebid-server/adapters/adtelligent" + "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/aja" + "github.com/prebid/prebid-server/adapters/amx" + "github.com/prebid/prebid-server/adapters/applogy" + "github.com/prebid/prebid-server/adapters/appnexus" + "github.com/prebid/prebid-server/adapters/audienceNetwork" + "github.com/prebid/prebid-server/adapters/avocet" + "github.com/prebid/prebid-server/adapters/beachfront" + "github.com/prebid/prebid-server/adapters/beintoo" + "github.com/prebid/prebid-server/adapters/between" + "github.com/prebid/prebid-server/adapters/brightroll" + "github.com/prebid/prebid-server/adapters/colossus" + "github.com/prebid/prebid-server/adapters/connectad" + "github.com/prebid/prebid-server/adapters/consumable" + "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/cpmstar" + "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/dmx" + "github.com/prebid/prebid-server/adapters/emx_digital" + "github.com/prebid/prebid-server/adapters/engagebdr" + "github.com/prebid/prebid-server/adapters/eplanning" + "github.com/prebid/prebid-server/adapters/gamma" + "github.com/prebid/prebid-server/adapters/gamoshi" + "github.com/prebid/prebid-server/adapters/grid" + "github.com/prebid/prebid-server/adapters/gumgum" + "github.com/prebid/prebid-server/adapters/improvedigital" + "github.com/prebid/prebid-server/adapters/inmobi" + "github.com/prebid/prebid-server/adapters/invibes" + "github.com/prebid/prebid-server/adapters/ix" + "github.com/prebid/prebid-server/adapters/kidoz" + "github.com/prebid/prebid-server/adapters/krushmedia" + "github.com/prebid/prebid-server/adapters/kubient" + "github.com/prebid/prebid-server/adapters/lockerdome" + "github.com/prebid/prebid-server/adapters/logicad" + "github.com/prebid/prebid-server/adapters/lunamedia" + "github.com/prebid/prebid-server/adapters/marsmedia" + "github.com/prebid/prebid-server/adapters/mgid" + "github.com/prebid/prebid-server/adapters/mobfoxpb" + "github.com/prebid/prebid-server/adapters/mobilefuse" + "github.com/prebid/prebid-server/adapters/nanointeractive" + "github.com/prebid/prebid-server/adapters/ninthdecimal" + "github.com/prebid/prebid-server/adapters/nobid" + "github.com/prebid/prebid-server/adapters/openx" + "github.com/prebid/prebid-server/adapters/orbidder" + "github.com/prebid/prebid-server/adapters/pubmatic" + "github.com/prebid/prebid-server/adapters/pubnative" + "github.com/prebid/prebid-server/adapters/pulsepoint" + "github.com/prebid/prebid-server/adapters/revcontent" + "github.com/prebid/prebid-server/adapters/rhythmone" + "github.com/prebid/prebid-server/adapters/rtbhouse" + "github.com/prebid/prebid-server/adapters/rubicon" + "github.com/prebid/prebid-server/adapters/sharethrough" + "github.com/prebid/prebid-server/adapters/silvermob" + "github.com/prebid/prebid-server/adapters/smaato" + "github.com/prebid/prebid-server/adapters/smartadserver" + "github.com/prebid/prebid-server/adapters/smartrtb" + "github.com/prebid/prebid-server/adapters/smartyads" + "github.com/prebid/prebid-server/adapters/somoaudience" + "github.com/prebid/prebid-server/adapters/sonobi" + "github.com/prebid/prebid-server/adapters/sovrn" + "github.com/prebid/prebid-server/adapters/spotx" + "github.com/prebid/prebid-server/adapters/synacormedia" + "github.com/prebid/prebid-server/adapters/tappx" + "github.com/prebid/prebid-server/adapters/telaria" + "github.com/prebid/prebid-server/adapters/triplelift" + "github.com/prebid/prebid-server/adapters/triplelift_native" + "github.com/prebid/prebid-server/adapters/ucfunnel" + "github.com/prebid/prebid-server/adapters/unruly" + "github.com/prebid/prebid-server/adapters/valueimpression" + "github.com/prebid/prebid-server/adapters/verizonmedia" + "github.com/prebid/prebid-server/adapters/visx" + "github.com/prebid/prebid-server/adapters/vrtcal" + "github.com/prebid/prebid-server/adapters/yeahmobi" + "github.com/prebid/prebid-server/adapters/yieldlab" + "github.com/prebid/prebid-server/adapters/yieldmo" + "github.com/prebid/prebid-server/adapters/yieldone" + "github.com/prebid/prebid-server/adapters/zeroclickfraud" + "github.com/prebid/prebid-server/openrtb_ext" ) // Adapter registration is kept in this separate file for ease of use and to aid diff --git a/exchange/adapter_util.go b/exchange/adapter_util.go index 4cd9c6ddafd..7e271376868 100644 --- a/exchange/adapter_util.go +++ b/exchange/adapter_util.go @@ -4,12 +4,12 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/lifestreet" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) func BuildAdapters(client *http.Client, cfg *config.Configuration, infos adapters.BidderInfos, me metrics.MetricsEngine) (map[openrtb_ext.BidderName]adaptedBidder, []error) { diff --git a/exchange/adapter_util_test.go b/exchange/adapter_util_test.go index 58904a750a9..1a6c42f4a41 100644 --- a/exchange/adapter_util_test.go +++ b/exchange/adapter_util_test.go @@ -6,14 +6,14 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rubicon" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - metrics "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/appnexus" + "github.com/prebid/prebid-server/adapters/lifestreet" + "github.com/prebid/prebid-server/adapters/rubicon" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/currency" + metrics "github.com/prebid/prebid-server/metrics/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/exchange/auction.go b/exchange/auction.go index 965712490d6..e0602072104 100644 --- a/exchange/auction.go +++ b/exchange/auction.go @@ -10,9 +10,9 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/prebid_cache_client" uuid "github.com/gofrs/uuid" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/exchange/auction_test.go b/exchange/auction_test.go index ddf89d6a336..b5c7e2e8679 100644 --- a/exchange/auction_test.go +++ b/exchange/auction_test.go @@ -11,9 +11,9 @@ import ( "strconv" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/prebid_cache_client" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" diff --git a/exchange/bidder.go b/exchange/bidder.go index da5a59b6cb3..538faa22bff 100644 --- a/exchange/bidder.go +++ b/exchange/bidder.go @@ -12,15 +12,15 @@ import ( "net/http/httptrace" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config/util" - "github.com/PubMatic-OpenWrap/prebid-server/currency" + "github.com/prebid/prebid-server/config/util" + "github.com/prebid/prebid-server/currency" "github.com/golang/glog" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" nativeRequests "github.com/mxmCherry/openrtb/v15/native1/request" nativeResponse "github.com/mxmCherry/openrtb/v15/native1/response" "github.com/mxmCherry/openrtb/v15/openrtb2" diff --git a/exchange/bidder_test.go b/exchange/bidder_test.go index bdec701c380..8fc5f423b08 100644 --- a/exchange/bidder_test.go +++ b/exchange/bidder_test.go @@ -15,12 +15,12 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - metricsConfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/metrics" + metricsConfig "github.com/prebid/prebid-server/metrics/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" diff --git a/exchange/bidder_validate_bids.go b/exchange/bidder_validate_bids.go index 4346adafdaa..a1504f0fd60 100644 --- a/exchange/bidder_validate_bids.go +++ b/exchange/bidder_validate_bids.go @@ -6,9 +6,9 @@ import ( "fmt" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" goCurrency "golang.org/x/text/currency" ) diff --git a/exchange/bidder_validate_bids_test.go b/exchange/bidder_validate_bids_test.go index 948168e58c0..1a4e8d122c5 100644 --- a/exchange/bidder_validate_bids_test.go +++ b/exchange/bidder_validate_bids_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/exchange/events.go b/exchange/events.go index 99b494839df..0b88624cf29 100644 --- a/exchange/events.go +++ b/exchange/events.go @@ -4,12 +4,12 @@ import ( "encoding/json" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/events" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/endpoints/events" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" jsonpatch "github.com/evanphx/json-patch" ) diff --git a/exchange/events_test.go b/exchange/events_test.go index 5cdb7d6f430..813211dccc2 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -3,7 +3,7 @@ package exchange import ( "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/exchange/exchange.go b/exchange/exchange.go index 18b9451cc0b..7a97d459d8e 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -14,16 +14,16 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/stored_requests" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/prebid_cache_client" "github.com/golang/glog" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index d697bc6cd78..69954ada691 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -15,17 +15,17 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - metricsConfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - pbc "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/file_fetcher" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + metricsConf "github.com/prebid/prebid-server/metrics/config" + metricsConfig "github.com/prebid/prebid-server/metrics/config" + "github.com/prebid/prebid-server/openrtb_ext" + pbc "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/backends/file_fetcher" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/buger/jsonparser" diff --git a/exchange/gdpr.go b/exchange/gdpr.go index 03952ea8209..97487081bdf 100644 --- a/exchange/gdpr.go +++ b/exchange/gdpr.go @@ -3,7 +3,7 @@ package exchange import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" + "github.com/prebid/prebid-server/gdpr" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/exchange/gdpr_test.go b/exchange/gdpr_test.go index e11b6782aa7..0d3f7a8a8ef 100644 --- a/exchange/gdpr_test.go +++ b/exchange/gdpr_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" + "github.com/prebid/prebid-server/gdpr" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/exchange/legacy.go b/exchange/legacy.go index b3b9e32e6e0..5466e9b21a0 100644 --- a/exchange/legacy.go +++ b/exchange/legacy.go @@ -6,11 +6,11 @@ import ( "errors" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/exchange/legacy_test.go b/exchange/legacy_test.go index a3f282acc72..f4662647a30 100644 --- a/exchange/legacy_test.go +++ b/exchange/legacy_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/pbs" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/pbs" + "github.com/prebid/prebid-server/usersync" "github.com/buger/jsonparser" jsonpatch "github.com/evanphx/json-patch" "github.com/mxmCherry/openrtb/v15/openrtb2" diff --git a/exchange/price_granularity.go b/exchange/price_granularity.go index ffcce061465..242d420f1fc 100644 --- a/exchange/price_granularity.go +++ b/exchange/price_granularity.go @@ -4,7 +4,7 @@ import ( "math" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // GetPriceBucket is the externally facing function for computing CPM buckets diff --git a/exchange/price_granularity_test.go b/exchange/price_granularity_test.go index 6dccc677b7b..13840838ba7 100644 --- a/exchange/price_granularity_test.go +++ b/exchange/price_granularity_test.go @@ -4,7 +4,7 @@ import ( "math" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/exchange/targeting.go b/exchange/targeting.go index 33f72b675b3..66bedfc46eb 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -3,7 +3,7 @@ package exchange import ( "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index 4a2b27e4619..d98b9da7329 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -8,16 +8,16 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/currency" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" + "github.com/prebid/prebid-server/gdpr" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - metricsConfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" + metricsConf "github.com/prebid/prebid-server/metrics/config" + metricsConfig "github.com/prebid/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/exchange/utils.go b/exchange/utils.go index 17041295fd8..5be334d1179 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -8,13 +8,13 @@ import ( "github.com/prebid/go-gdpr/vendorconsent" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/privacy" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/lmt" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/lmt" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 1b0684a819c..a05192d3e84 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -7,11 +7,11 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/gdpr" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/stretchr/testify/assert" ) diff --git a/gdpr/gdpr.go b/gdpr/gdpr.go index 272bc1f21f0..a74e34f2bcd 100644 --- a/gdpr/gdpr.go +++ b/gdpr/gdpr.go @@ -5,9 +5,9 @@ import ( "net/http" "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/go-gdpr/vendorlist" ) diff --git a/gdpr/gdpr_test.go b/gdpr/gdpr_test.go index 81d3c6156f7..5048cf118f5 100644 --- a/gdpr/gdpr_test.go +++ b/gdpr/gdpr_test.go @@ -5,8 +5,8 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/gdpr/impl.go b/gdpr/impl.go index 8d9a357393d..0918825a738 100644 --- a/gdpr/impl.go +++ b/gdpr/impl.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/go-gdpr/api" tcf1constants "github.com/prebid/go-gdpr/consentconstants" consentconstants "github.com/prebid/go-gdpr/consentconstants/tcf2" diff --git a/gdpr/impl_test.go b/gdpr/impl_test.go index 1977c4cf62e..45d2ba43ce3 100644 --- a/gdpr/impl_test.go +++ b/gdpr/impl_test.go @@ -6,8 +6,8 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/go-gdpr/vendorlist" "github.com/prebid/go-gdpr/vendorlist2" diff --git a/gdpr/vendorlist-fetching.go b/gdpr/vendorlist-fetching.go index 61fa166d212..157d8d9a527 100644 --- a/gdpr/vendorlist-fetching.go +++ b/gdpr/vendorlist-fetching.go @@ -10,7 +10,7 @@ import ( "sync/atomic" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/config" "github.com/golang/glog" "github.com/prebid/go-gdpr/api" "github.com/prebid/go-gdpr/vendorlist" diff --git a/gdpr/vendorlist-fetching_test.go b/gdpr/vendorlist-fetching_test.go index cd97b300883..47c13e32e20 100644 --- a/gdpr/vendorlist-fetching_test.go +++ b/gdpr/vendorlist-fetching_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/config" "github.com/prebid/go-gdpr/consentconstants" ) diff --git a/go.mod b/go.mod index a4a29d6bf98..7de0d924a48 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/PubMatic-OpenWrap/prebid-server +module github.com/prebid/prebid-server go 1.14 @@ -59,4 +59,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -replace github.com/mxmCherry/openrtb/v15 v15.0.0 => github.com/PubMatic-OpenWrap/openrtb/v15 v15.0.0-20210425111602-5284bed23afa +replace github.com/mxmCherry/openrtb/v15 v15.0.0 => github.com/PubMatic-OpenWrap/openrtb/v15 adbedb6f42c618555bee13551e99e6f57de448c7 diff --git a/main.go b/main.go index 376fe31f254..702af6cd2be 100644 --- a/main.go +++ b/main.go @@ -5,13 +5,13 @@ import ( "net/http" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - pbc "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/router" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/PubMatic-OpenWrap/prebid-server/util/task" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/openrtb_ext" + pbc "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/router" + "github.com/prebid/prebid-server/usersync" + "github.com/prebid/prebid-server/util/task" "github.com/golang/glog" "github.com/spf13/viper" diff --git a/main_test.go b/main_test.go index f3b6748ba48..1d2ec332164 100644 --- a/main_test.go +++ b/main_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/config" "github.com/stretchr/testify/assert" "github.com/spf13/viper" diff --git a/metrics/config/metrics.go b/metrics/config/metrics.go index 513fbd0ff53..70738f2fd1a 100644 --- a/metrics/config/metrics.go +++ b/metrics/config/metrics.go @@ -3,10 +3,10 @@ package config import ( "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - prometheusmetrics "github.com/PubMatic-OpenWrap/prebid-server/metrics/prometheus" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + prometheusmetrics "github.com/prebid/prebid-server/metrics/prometheus" + "github.com/prebid/prebid-server/openrtb_ext" gometrics "github.com/rcrowley/go-metrics" influxdb "github.com/vrischmann/go-metrics-influxdb" ) diff --git a/metrics/config/metrics_test.go b/metrics/config/metrics_test.go index 5465061d5a0..5b70b53bb1a 100644 --- a/metrics/config/metrics_test.go +++ b/metrics/config/metrics_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - mainConfig "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + mainConfig "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" gometrics "github.com/rcrowley/go-metrics" ) diff --git a/metrics/go_metrics.go b/metrics/go_metrics.go index a84a3ea8b74..a3116f3fa4b 100644 --- a/metrics/go_metrics.go +++ b/metrics/go_metrics.go @@ -5,8 +5,8 @@ import ( "sync" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/golang/glog" metrics "github.com/rcrowley/go-metrics" ) diff --git a/metrics/go_metrics_test.go b/metrics/go_metrics_test.go index 712e8d5254c..2d0b9097b11 100644 --- a/metrics/go_metrics_test.go +++ b/metrics/go_metrics_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" metrics "github.com/rcrowley/go-metrics" "github.com/stretchr/testify/assert" ) diff --git a/metrics/metrics.go b/metrics/metrics.go index 1908bca497b..4e6a6ea7275 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -3,7 +3,7 @@ package metrics import ( "time" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" ) // Labels defines the labels that can be attached to the metrics. diff --git a/metrics/metrics_mock.go b/metrics/metrics_mock.go index 51fb2b902fc..54b448bbe19 100644 --- a/metrics/metrics_mock.go +++ b/metrics/metrics_mock.go @@ -3,7 +3,7 @@ package metrics import ( "time" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/mock" ) diff --git a/metrics/prometheus/preload.go b/metrics/prometheus/preload.go index 0f2ada29e3a..f4dfe43469d 100644 --- a/metrics/prometheus/preload.go +++ b/metrics/prometheus/preload.go @@ -1,7 +1,7 @@ package prometheusmetrics import ( - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/metrics" "github.com/prometheus/client_golang/prometheus" ) diff --git a/metrics/prometheus/prometheus.go b/metrics/prometheus/prometheus.go index 015ec033d81..889eeb67d73 100644 --- a/metrics/prometheus/prometheus.go +++ b/metrics/prometheus/prometheus.go @@ -4,9 +4,9 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prometheus/client_golang/prometheus" ) diff --git a/metrics/prometheus/prometheus_test.go b/metrics/prometheus/prometheus_test.go index c136b57c02b..9b4dc2aa09e 100644 --- a/metrics/prometheus/prometheus_test.go +++ b/metrics/prometheus/prometheus_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" diff --git a/metrics/prometheus/type_conversion.go b/metrics/prometheus/type_conversion.go index eff379e8b2c..0e5c80636db 100644 --- a/metrics/prometheus/type_conversion.go +++ b/metrics/prometheus/type_conversion.go @@ -3,8 +3,8 @@ package prometheusmetrics import ( "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/openrtb_ext" ) func actionsAsString() []string { diff --git a/openrtb_ext/device.go b/openrtb_ext/device.go index afbea276988..73aeb14de84 100644 --- a/openrtb_ext/device.go +++ b/openrtb_ext/device.go @@ -3,7 +3,7 @@ package openrtb_ext import ( "strconv" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/prebid/prebid-server/errortypes" "github.com/buger/jsonparser" ) diff --git a/openrtb_ext/device_test.go b/openrtb_ext/device_test.go index b4c85bcc0b0..e307374ef38 100644 --- a/openrtb_ext/device_test.go +++ b/openrtb_ext/device_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/openrtb_ext/site_test.go b/openrtb_ext/site_test.go index 0d41e0c02ce..67ec6cc4f99 100644 --- a/openrtb_ext/site_test.go +++ b/openrtb_ext/site_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/pbs/pbsrequest.go b/pbs/pbsrequest.go index 40315d751a1..1527568e658 100644 --- a/pbs/pbsrequest.go +++ b/pbs/pbsrequest.go @@ -10,12 +10,12 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/cache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" - "github.com/PubMatic-OpenWrap/prebid-server/util/httputil" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + "github.com/prebid/prebid-server/cache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/usersync" + "github.com/prebid/prebid-server/util/httputil" + "github.com/prebid/prebid-server/util/iputil" "github.com/blang/semver" "github.com/buger/jsonparser" diff --git a/pbs/pbsrequest_test.go b/pbs/pbsrequest_test.go index 566057473b8..09ca8d47324 100644 --- a/pbs/pbsrequest_test.go +++ b/pbs/pbsrequest_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/config" "github.com/magiconair/properties/assert" ) diff --git a/pbs/usersync.go b/pbs/usersync.go index f50933b2434..f64eaea4da1 100644 --- a/pbs/usersync.go +++ b/pbs/usersync.go @@ -9,11 +9,11 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/server/ssl" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/server/ssl" + "github.com/prebid/prebid-server/usersync" "github.com/golang/glog" "github.com/julienschmidt/httprouter" ) diff --git a/prebid_cache_client/client.go b/prebid_cache_client/client.go index 8fbabe01cc5..730d54b0acb 100644 --- a/prebid_cache_client/client.go +++ b/prebid_cache_client/client.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" "github.com/buger/jsonparser" "github.com/golang/glog" diff --git a/prebid_cache_client/client_test.go b/prebid_cache_client/client_test.go index c4eeca82b8f..1ba30a6faab 100644 --- a/prebid_cache_client/client_test.go +++ b/prebid_cache_client/client_test.go @@ -10,9 +10,9 @@ import ( "strconv" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + metricsConf "github.com/prebid/prebid-server/metrics/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/privacy/ccpa/parsedpolicy.go b/privacy/ccpa/parsedpolicy.go index 52977104716..3c934e67822 100644 --- a/privacy/ccpa/parsedpolicy.go +++ b/privacy/ccpa/parsedpolicy.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" + "github.com/prebid/prebid-server/errortypes" ) const ( diff --git a/privacy/ccpa/policy.go b/privacy/ccpa/policy.go index 349abaed8e4..c497f2877b4 100644 --- a/privacy/ccpa/policy.go +++ b/privacy/ccpa/policy.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/privacy/gdpr/consentwriter.go b/privacy/gdpr/consentwriter.go index e8873ee0c90..fbd1c9b8043 100644 --- a/privacy/gdpr/consentwriter.go +++ b/privacy/gdpr/consentwriter.go @@ -3,7 +3,7 @@ package gdpr import ( "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" ) diff --git a/privacy/policies.go b/privacy/policies.go index a1c3fca49be..bc844a4e463 100644 --- a/privacy/policies.go +++ b/privacy/policies.go @@ -1,9 +1,9 @@ package privacy import ( - "github.com/PubMatic-OpenWrap/prebid-server/privacy/ccpa" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/gdpr" - "github.com/PubMatic-OpenWrap/prebid-server/privacy/lmt" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/prebid/prebid-server/privacy/lmt" ) // Policies represents the privacy regulations for an OpenRTB bid request. diff --git a/router/admin.go b/router/admin.go index ba4f25f585b..b66bf55a5d6 100644 --- a/router/admin.go +++ b/router/admin.go @@ -5,8 +5,8 @@ import ( "net/http/pprof" "time" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/endpoints" ) func Admin(revision string, rateConverter *currency.RateConverter, rateConverterFetchingInterval time.Duration) *http.ServeMux { diff --git a/router/aspects/request_timeout_handler.go b/router/aspects/request_timeout_handler.go index 9c51b9b8570..d32d12c34d3 100644 --- a/router/aspects/request_timeout_handler.go +++ b/router/aspects/request_timeout_handler.go @@ -5,8 +5,8 @@ import ( "strconv" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" "github.com/julienschmidt/httprouter" ) diff --git a/router/aspects/request_timeout_handler_test.go b/router/aspects/request_timeout_handler_test.go index 3d6fa34e5bd..e5931c5da7d 100644 --- a/router/aspects/request_timeout_handler_test.go +++ b/router/aspects/request_timeout_handler_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/assert" diff --git a/router/router.go b/router/router.go index eb69f5fafd1..8771c1be58d 100644 --- a/router/router.go +++ b/router/router.go @@ -12,41 +12,41 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/analytics" - "github.com/PubMatic-OpenWrap/prebid-server/currency" - "github.com/PubMatic-OpenWrap/prebid-server/errortypes" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + "github.com/prebid/prebid-server/analytics" + "github.com/prebid/prebid-server/currency" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/usersync" "github.com/prometheus/client_golang/prometheus" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - - "github.com/PubMatic-OpenWrap/prebid-server/adapters" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adform" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/conversant" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ix" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubmatic" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pulsepoint" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rubicon" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sovrn" - analyticsConf "github.com/PubMatic-OpenWrap/prebid-server/analytics/config" - "github.com/PubMatic-OpenWrap/prebid-server/cache" - "github.com/PubMatic-OpenWrap/prebid-server/cache/dummycache" - "github.com/PubMatic-OpenWrap/prebid-server/cache/filecache" - "github.com/PubMatic-OpenWrap/prebid-server/cache/postgrescache" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints" - "github.com/PubMatic-OpenWrap/prebid-server/endpoints/openrtb2" - "github.com/PubMatic-OpenWrap/prebid-server/exchange" - "github.com/PubMatic-OpenWrap/prebid-server/gdpr" - metricsConf "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - pbc "github.com/PubMatic-OpenWrap/prebid-server/prebid_cache_client" - "github.com/PubMatic-OpenWrap/prebid-server/server/ssl" - storedRequestsConf "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/config" - "github.com/PubMatic-OpenWrap/prebid-server/usersync/usersyncers" + "github.com/prebid/prebid-server/metrics" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/adapters/adform" + "github.com/prebid/prebid-server/adapters/appnexus" + "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/ix" + "github.com/prebid/prebid-server/adapters/lifestreet" + "github.com/prebid/prebid-server/adapters/pubmatic" + "github.com/prebid/prebid-server/adapters/pulsepoint" + "github.com/prebid/prebid-server/adapters/rubicon" + "github.com/prebid/prebid-server/adapters/sovrn" + analyticsConf "github.com/prebid/prebid-server/analytics/config" + "github.com/prebid/prebid-server/cache" + "github.com/prebid/prebid-server/cache/dummycache" + "github.com/prebid/prebid-server/cache/filecache" + "github.com/prebid/prebid-server/cache/postgrescache" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/endpoints" + "github.com/prebid/prebid-server/endpoints/openrtb2" + "github.com/prebid/prebid-server/exchange" + "github.com/prebid/prebid-server/gdpr" + metricsConf "github.com/prebid/prebid-server/metrics/config" + "github.com/prebid/prebid-server/openrtb_ext" + pbc "github.com/prebid/prebid-server/prebid_cache_client" + "github.com/prebid/prebid-server/server/ssl" + storedRequestsConf "github.com/prebid/prebid-server/stored_requests/config" + "github.com/prebid/prebid-server/usersync/usersyncers" "github.com/golang/glog" "github.com/julienschmidt/httprouter" diff --git a/router/router_test.go b/router/router_test.go index 09b07a0a7ce..a86d0f72c49 100644 --- a/router/router_test.go +++ b/router/router_test.go @@ -8,8 +8,8 @@ import ( "os" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/server/listener.go b/server/listener.go index f172ad7d961..69401130323 100644 --- a/server/listener.go +++ b/server/listener.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/metrics" "github.com/golang/glog" ) diff --git a/server/listener_test.go b/server/listener_test.go index 58f3d42d95a..f91dbddbc54 100644 --- a/server/listener_test.go +++ b/server/listener_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" gometrics "github.com/rcrowley/go-metrics" ) diff --git a/server/prometheus.go b/server/prometheus.go index 8001234faa2..4b9f7037d0a 100644 --- a/server/prometheus.go +++ b/server/prometheus.go @@ -7,9 +7,9 @@ import ( "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/PubMatic-OpenWrap/prebid-server/config" - metricsconfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" - prometheusMetrics "github.com/PubMatic-OpenWrap/prebid-server/metrics/prometheus" + "github.com/prebid/prebid-server/config" + metricsconfig "github.com/prebid/prebid-server/metrics/config" + prometheusMetrics "github.com/prebid/prebid-server/metrics/prometheus" ) func newPrometheusServer(cfg *config.Configuration, metrics *metricsconfig.DetailedMetricsEngine) *http.Server { diff --git a/server/server.go b/server/server.go index 0b1aa76b63b..f8ec1b2a0d7 100644 --- a/server/server.go +++ b/server/server.go @@ -12,9 +12,9 @@ import ( "time" "github.com/NYTimes/gziphandler" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - metricsconfig "github.com/PubMatic-OpenWrap/prebid-server/metrics/config" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + metricsconfig "github.com/prebid/prebid-server/metrics/config" "github.com/golang/glog" ) diff --git a/server/server_test.go b/server/server_test.go index 3d6d5684e96..e7ef593a4b5 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" + "github.com/prebid/prebid-server/config" ) func TestNewAdminServer(t *testing.T) { diff --git a/stored_requests/backends/db_fetcher/fetcher.go b/stored_requests/backends/db_fetcher/fetcher.go index c3b71a3be67..e60edac83e5 100644 --- a/stored_requests/backends/db_fetcher/fetcher.go +++ b/stored_requests/backends/db_fetcher/fetcher.go @@ -7,7 +7,7 @@ import ( "github.com/lib/pq" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" "github.com/golang/glog" ) diff --git a/stored_requests/backends/empty_fetcher/fetcher.go b/stored_requests/backends/empty_fetcher/fetcher.go index 6edf3cc4d00..ee6b98b3b2e 100644 --- a/stored_requests/backends/empty_fetcher/fetcher.go +++ b/stored_requests/backends/empty_fetcher/fetcher.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" ) // EmptyFetcher is a nil-object which has no Stored Requests. diff --git a/stored_requests/backends/file_fetcher/fetcher.go b/stored_requests/backends/file_fetcher/fetcher.go index bff94b21e79..2d3b00657b9 100644 --- a/stored_requests/backends/file_fetcher/fetcher.go +++ b/stored_requests/backends/file_fetcher/fetcher.go @@ -7,7 +7,7 @@ import ( "io/ioutil" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" ) // NewFileFetcher _immediately_ loads stored request data from local files. diff --git a/stored_requests/backends/file_fetcher/fetcher_test.go b/stored_requests/backends/file_fetcher/fetcher_test.go index f0900002c8c..a145a3b43a2 100644 --- a/stored_requests/backends/file_fetcher/fetcher_test.go +++ b/stored_requests/backends/file_fetcher/fetcher_test.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" "github.com/stretchr/testify/assert" ) diff --git a/stored_requests/backends/http_fetcher/fetcher.go b/stored_requests/backends/http_fetcher/fetcher.go index 5a7d8fa2878..bc12caecb98 100644 --- a/stored_requests/backends/http_fetcher/fetcher.go +++ b/stored_requests/backends/http_fetcher/fetcher.go @@ -10,7 +10,7 @@ import ( "net/url" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" "github.com/golang/glog" "golang.org/x/net/context/ctxhttp" diff --git a/stored_requests/caches/cachestest/reliable.go b/stored_requests/caches/cachestest/reliable.go index a0ab07df431..7fbaf7238af 100644 --- a/stored_requests/caches/cachestest/reliable.go +++ b/stored_requests/caches/cachestest/reliable.go @@ -5,7 +5,7 @@ import ( "encoding/json" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" ) const ( diff --git a/stored_requests/caches/memory/cache.go b/stored_requests/caches/memory/cache.go index 288e6c26b71..5dacc91f027 100644 --- a/stored_requests/caches/memory/cache.go +++ b/stored_requests/caches/memory/cache.go @@ -5,7 +5,7 @@ import ( "encoding/json" "sync" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" "github.com/coocood/freecache" "github.com/golang/glog" ) diff --git a/stored_requests/caches/memory/cache_test.go b/stored_requests/caches/memory/cache_test.go index 20ec1239cd2..b89bd5af26f 100644 --- a/stored_requests/caches/memory/cache_test.go +++ b/stored_requests/caches/memory/cache_test.go @@ -7,8 +7,8 @@ import ( "strconv" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/caches/cachestest" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/caches/cachestest" ) func TestLRURobustness(t *testing.T) { diff --git a/stored_requests/config/config.go b/stored_requests/config/config.go index ed51ed6f5de..56eab4c2d15 100644 --- a/stored_requests/config/config.go +++ b/stored_requests/config/config.go @@ -6,21 +6,21 @@ import ( "net/http" "time" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/db_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/file_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/http_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/caches/memory" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/caches/nil_cache" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" - apiEvents "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events/api" - httpEvents "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events/http" - postgresEvents "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events/postgres" - "github.com/PubMatic-OpenWrap/prebid-server/util/task" + "github.com/prebid/prebid-server/metrics" + + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/backends/db_fetcher" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/prebid/prebid-server/stored_requests/backends/file_fetcher" + "github.com/prebid/prebid-server/stored_requests/backends/http_fetcher" + "github.com/prebid/prebid-server/stored_requests/caches/memory" + "github.com/prebid/prebid-server/stored_requests/caches/nil_cache" + "github.com/prebid/prebid-server/stored_requests/events" + apiEvents "github.com/prebid/prebid-server/stored_requests/events/api" + httpEvents "github.com/prebid/prebid-server/stored_requests/events/http" + postgresEvents "github.com/prebid/prebid-server/stored_requests/events/postgres" + "github.com/prebid/prebid-server/util/task" "github.com/golang/glog" "github.com/julienschmidt/httprouter" ) diff --git a/stored_requests/config/config_test.go b/stored_requests/config/config_test.go index fa1bbfd8764..464003908a2 100644 --- a/stored_requests/config/config_test.go +++ b/stored_requests/config/config_test.go @@ -12,13 +12,13 @@ import ( "github.com/stretchr/testify/assert" sqlmock "github.com/DATA-DOG/go-sqlmock" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/empty_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/backends/http_fetcher" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" - httpEvents "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events/http" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/backends/empty_fetcher" + "github.com/prebid/prebid-server/stored_requests/backends/http_fetcher" + "github.com/prebid/prebid-server/stored_requests/events" + httpEvents "github.com/prebid/prebid-server/stored_requests/events/http" "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/mock" ) diff --git a/stored_requests/events/api/api.go b/stored_requests/events/api/api.go index 8fb6f6be9eb..776c3d310fa 100644 --- a/stored_requests/events/api/api.go +++ b/stored_requests/events/api/api.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" + "github.com/prebid/prebid-server/stored_requests/events" "github.com/julienschmidt/httprouter" ) diff --git a/stored_requests/events/api/api_test.go b/stored_requests/events/api/api_test.go index 74e02e69e4d..cd3af77bd83 100644 --- a/stored_requests/events/api/api_test.go +++ b/stored_requests/events/api/api_test.go @@ -9,9 +9,9 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/caches/memory" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/caches/memory" + "github.com/prebid/prebid-server/stored_requests/events" ) func TestGoodRequests(t *testing.T) { diff --git a/stored_requests/events/events.go b/stored_requests/events/events.go index 60909a0d426..5b89943572f 100644 --- a/stored_requests/events/events.go +++ b/stored_requests/events/events.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests" ) // Save represents a bulk save diff --git a/stored_requests/events/events_test.go b/stored_requests/events/events_test.go index 0a48b4cc365..f3483705e86 100644 --- a/stored_requests/events/events_test.go +++ b/stored_requests/events/events_test.go @@ -7,8 +7,8 @@ import ( "reflect" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/caches/memory" + "github.com/prebid/prebid-server/stored_requests" + "github.com/prebid/prebid-server/stored_requests/caches/memory" ) func TestListen(t *testing.T) { diff --git a/stored_requests/events/http/http.go b/stored_requests/events/http/http.go index 790c247e368..860401e7592 100644 --- a/stored_requests/events/http/http.go +++ b/stored_requests/events/http/http.go @@ -11,7 +11,7 @@ import ( "golang.org/x/net/context/ctxhttp" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" + "github.com/prebid/prebid-server/stored_requests/events" "github.com/buger/jsonparser" "github.com/golang/glog" diff --git a/stored_requests/events/postgres/database.go b/stored_requests/events/postgres/database.go index 89fb30b88c8..e94d28d4c14 100644 --- a/stored_requests/events/postgres/database.go +++ b/stored_requests/events/postgres/database.go @@ -8,10 +8,10 @@ import ( "net" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" - "github.com/PubMatic-OpenWrap/prebid-server/util/timeutil" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/stored_requests/events" + "github.com/prebid/prebid-server/util/timeutil" "github.com/golang/glog" ) diff --git a/stored_requests/events/postgres/database_test.go b/stored_requests/events/postgres/database_test.go index 63625061dd3..15d0fbffbc3 100644 --- a/stored_requests/events/postgres/database_test.go +++ b/stored_requests/events/postgres/database_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/events" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/stored_requests/events" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/stored_requests/fetcher.go b/stored_requests/fetcher.go index 597b660cb61..865231ee757 100644 --- a/stored_requests/fetcher.go +++ b/stored_requests/fetcher.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" + "github.com/prebid/prebid-server/metrics" ) // Fetcher knows how to fetch Stored Request data by id. diff --git a/stored_requests/fetcher_test.go b/stored_requests/fetcher_test.go index 07631e79bbd..e77bc75c310 100644 --- a/stored_requests/fetcher_test.go +++ b/stored_requests/fetcher_test.go @@ -6,8 +6,8 @@ import ( "errors" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/metrics" - "github.com/PubMatic-OpenWrap/prebid-server/stored_requests/caches/nil_cache" + "github.com/prebid/prebid-server/metrics" + "github.com/prebid/prebid-server/stored_requests/caches/nil_cache" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/usersync/cookie.go b/usersync/cookie.go index c3a045aca77..2e6bb79515f 100644 --- a/usersync/cookie.go +++ b/usersync/cookie.go @@ -8,8 +8,8 @@ import ( "net/http" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) const ( diff --git a/usersync/cookie_test.go b/usersync/cookie_test.go index c05eadd4a98..ef2e9911e46 100644 --- a/usersync/cookie_test.go +++ b/usersync/cookie_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/usersync/usersync.go b/usersync/usersync.go index 7730febcd90..236acbe73a3 100644 --- a/usersync/usersync.go +++ b/usersync/usersync.go @@ -1,6 +1,6 @@ package usersync -import "github.com/PubMatic-OpenWrap/prebid-server/privacy" +import "github.com/prebid/prebid-server/privacy" type Usersyncer interface { // GetUsersyncInfo returns basic info the browser needs in order to run a user sync. diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 04ec05430e5..b648b356502 100755 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -4,86 +4,86 @@ import ( "strings" "text/template" - ttx "github.com/PubMatic-OpenWrap/prebid-server/adapters/33across" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/acuityads" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adform" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adkernel" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adkernelAdn" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adman" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/admixer" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adocean" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adpone" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adtarget" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/adtelligent" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/advangelists" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/aja" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/amx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/appnexus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/audienceNetwork" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/avocet" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/beachfront" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/beintoo" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/between" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/brightroll" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/colossus" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/connectad" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/consumable" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/conversant" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/cpmstar" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/datablocks" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/deepintent" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/dmx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/emx_digital" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/engagebdr" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/eplanning" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/gamma" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/gamoshi" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/grid" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/gumgum" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/improvedigital" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/invibes" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ix" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/krushmedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lifestreet" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lockerdome" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/logicad" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/lunamedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/marsmedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/mediafuse" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/mgid" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/nanointeractive" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ninthdecimal" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/nobid" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/openx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pubmatic" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/pulsepoint" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rhythmone" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rtbhouse" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/rubicon" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sharethrough" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smartadserver" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smartrtb" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/smartyads" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/somoaudience" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sonobi" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/sovrn" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/synacormedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/telaria" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/triplelift" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/triplelift_native" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/ucfunnel" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/unruly" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/valueimpression" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/verizonmedia" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/visx" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/vrtcal" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yieldlab" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yieldmo" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/yieldone" - "github.com/PubMatic-OpenWrap/prebid-server/adapters/zeroclickfraud" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "github.com/PubMatic-OpenWrap/prebid-server/usersync" + ttx "github.com/prebid/prebid-server/adapters/33across" + "github.com/prebid/prebid-server/adapters/acuityads" + "github.com/prebid/prebid-server/adapters/adform" + "github.com/prebid/prebid-server/adapters/adkernel" + "github.com/prebid/prebid-server/adapters/adkernelAdn" + "github.com/prebid/prebid-server/adapters/adman" + "github.com/prebid/prebid-server/adapters/admixer" + "github.com/prebid/prebid-server/adapters/adocean" + "github.com/prebid/prebid-server/adapters/adpone" + "github.com/prebid/prebid-server/adapters/adtarget" + "github.com/prebid/prebid-server/adapters/adtelligent" + "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/aja" + "github.com/prebid/prebid-server/adapters/amx" + "github.com/prebid/prebid-server/adapters/appnexus" + "github.com/prebid/prebid-server/adapters/audienceNetwork" + "github.com/prebid/prebid-server/adapters/avocet" + "github.com/prebid/prebid-server/adapters/beachfront" + "github.com/prebid/prebid-server/adapters/beintoo" + "github.com/prebid/prebid-server/adapters/between" + "github.com/prebid/prebid-server/adapters/brightroll" + "github.com/prebid/prebid-server/adapters/colossus" + "github.com/prebid/prebid-server/adapters/connectad" + "github.com/prebid/prebid-server/adapters/consumable" + "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/cpmstar" + "github.com/prebid/prebid-server/adapters/datablocks" + "github.com/prebid/prebid-server/adapters/deepintent" + "github.com/prebid/prebid-server/adapters/dmx" + "github.com/prebid/prebid-server/adapters/emx_digital" + "github.com/prebid/prebid-server/adapters/engagebdr" + "github.com/prebid/prebid-server/adapters/eplanning" + "github.com/prebid/prebid-server/adapters/gamma" + "github.com/prebid/prebid-server/adapters/gamoshi" + "github.com/prebid/prebid-server/adapters/grid" + "github.com/prebid/prebid-server/adapters/gumgum" + "github.com/prebid/prebid-server/adapters/improvedigital" + "github.com/prebid/prebid-server/adapters/invibes" + "github.com/prebid/prebid-server/adapters/ix" + "github.com/prebid/prebid-server/adapters/krushmedia" + "github.com/prebid/prebid-server/adapters/lifestreet" + "github.com/prebid/prebid-server/adapters/lockerdome" + "github.com/prebid/prebid-server/adapters/logicad" + "github.com/prebid/prebid-server/adapters/lunamedia" + "github.com/prebid/prebid-server/adapters/marsmedia" + "github.com/prebid/prebid-server/adapters/mediafuse" + "github.com/prebid/prebid-server/adapters/mgid" + "github.com/prebid/prebid-server/adapters/nanointeractive" + "github.com/prebid/prebid-server/adapters/ninthdecimal" + "github.com/prebid/prebid-server/adapters/nobid" + "github.com/prebid/prebid-server/adapters/openx" + "github.com/prebid/prebid-server/adapters/pubmatic" + "github.com/prebid/prebid-server/adapters/pulsepoint" + "github.com/prebid/prebid-server/adapters/rhythmone" + "github.com/prebid/prebid-server/adapters/rtbhouse" + "github.com/prebid/prebid-server/adapters/rubicon" + "github.com/prebid/prebid-server/adapters/sharethrough" + "github.com/prebid/prebid-server/adapters/smartadserver" + "github.com/prebid/prebid-server/adapters/smartrtb" + "github.com/prebid/prebid-server/adapters/smartyads" + "github.com/prebid/prebid-server/adapters/somoaudience" + "github.com/prebid/prebid-server/adapters/sonobi" + "github.com/prebid/prebid-server/adapters/sovrn" + "github.com/prebid/prebid-server/adapters/synacormedia" + "github.com/prebid/prebid-server/adapters/telaria" + "github.com/prebid/prebid-server/adapters/triplelift" + "github.com/prebid/prebid-server/adapters/triplelift_native" + "github.com/prebid/prebid-server/adapters/ucfunnel" + "github.com/prebid/prebid-server/adapters/unruly" + "github.com/prebid/prebid-server/adapters/valueimpression" + "github.com/prebid/prebid-server/adapters/verizonmedia" + "github.com/prebid/prebid-server/adapters/visx" + "github.com/prebid/prebid-server/adapters/vrtcal" + "github.com/prebid/prebid-server/adapters/yieldlab" + "github.com/prebid/prebid-server/adapters/yieldmo" + "github.com/prebid/prebid-server/adapters/yieldone" + "github.com/prebid/prebid-server/adapters/zeroclickfraud" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/usersync" "github.com/golang/glog" ) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 08a31322553..4633b564819 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -4,8 +4,8 @@ import ( "strings" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/config" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" ) func TestNewSyncerMap(t *testing.T) { diff --git a/util/httputil/httputil.go b/util/httputil/httputil.go index 93bcca2a8c5..461512771b3 100644 --- a/util/httputil/httputil.go +++ b/util/httputil/httputil.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + "github.com/prebid/prebid-server/util/iputil" ) var ( diff --git a/util/httputil/httputil_test.go b/util/httputil/httputil_test.go index 7b6a9a504f1..f7166740fe5 100644 --- a/util/httputil/httputil_test.go +++ b/util/httputil/httputil_test.go @@ -6,7 +6,7 @@ import ( "net/http" "testing" - "github.com/PubMatic-OpenWrap/prebid-server/util/iputil" + "github.com/prebid/prebid-server/util/iputil" "github.com/stretchr/testify/assert" ) diff --git a/util/task/ticker_task_test.go b/util/task/ticker_task_test.go index 92cf6835ea6..27551c9a2c2 100644 --- a/util/task/ticker_task_test.go +++ b/util/task/ticker_task_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/PubMatic-OpenWrap/prebid-server/util/task" + "github.com/prebid/prebid-server/util/task" "github.com/stretchr/testify/assert" ) From 28d9cfac7643d78c87fe3fd469286b3c14ca1bba Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 08:52:45 +0530 Subject: [PATCH 73/91] UOE-6196: OpenWrap S2S: Remove adpod_id from AppNexus adapter --- adapters/appnexus/appnexus.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index 046f5d312d7..4fcedf43117 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -362,12 +362,14 @@ func (a *AppNexusAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ad imps := request.Imp + // Commenting out the following piece of code to avoid populating adpod_id in the Appnexus request (ref: https://inside.pubmatic.com:9443/jira/browse/UOE-6196) + // For long form requests adpod_id must be sent downstream. // Adpod id is a unique identifier for pod // All impressions in the same pod must have the same pod id in request extension // For this all impressions in request should belong to the same pod // If impressions number per pod is more than maxImpsPerReq - divide those imps to several requests but keep pod id the same - if isVIDEO == 1 { + /*if isVIDEO == 1 { podImps := groupByPods(imps) requests := make([]*adapters.RequestData, 0, len(podImps)) @@ -379,7 +381,7 @@ func (a *AppNexusAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ad errs = append(errs, errors...) } return requests, errs - } + }*/ return splitRequests(imps, request, reqExt, thisURI, errs) } From 7d0afbc37f4e850018b050d4805d672283b908ea Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 10:29:13 +0530 Subject: [PATCH 74/91] Refactored code and fixed indentation --- .travis.yml | 0 Makefile | 2 +- .../acuityadstest/exemplary/native-app.json | 278 +++++++++--------- .../invalid-smartyads-ext-object.json | 29 -- adapters/adform/adform_test.go | 1 + adapters/avocet/avocet/exemplary/banner.json | 106 ------- adapters/avocet/avocet/exemplary/video.json | 104 ------- .../exemplary/banner-and-video-app.json | 270 ++++++++--------- .../exemplary/banner-and-video-site.json | 276 ++++++++--------- .../emx_digitaltest/exemplary/video-app.json | 230 +++++++-------- .../emx_digitaltest/exemplary/video-ctv.json | 273 ++++++++--------- .../emx_digitaltest/exemplary/video-site.json | 238 +++++++-------- adapters/spotx/spotx.go | 2 +- adapters/spotx/spotx_test.go | 2 +- analytics/config/config.go | 2 +- analytics/filesystem/file_module.go | 2 +- cache/postgrescache/postgrescache.go | 2 +- endpoints/getuids.go | 2 +- .../openrtb2/ctv/response/adpod_generator.go | 2 +- .../ctv/response/adpod_generator_test.go | 2 +- endpoints/openrtb2/ctv/types/adpod_types.go | 4 +- endpoints/openrtb2/ctv/util/util.go | 2 +- endpoints/openrtb2/ctv_auction.go | 10 +- endpoints/openrtb2/ctv_auction_test.go | 2 +- endpoints/setuid.go | 2 +- go.sum | 12 - metrics/config/metrics.go | 3 +- openrtb_ext/device.go | 2 +- pbs/pbsrequest_test.go | 2 +- pbs/usersync.go | 4 +- .../backends/db_fetcher/fetcher.go | 2 +- stored_requests/events/api/api.go | 2 +- stored_requests/events/http/http.go | 2 +- 33 files changed, 811 insertions(+), 1061 deletions(-) delete mode 100644 .travis.yml delete mode 100644 adapters/acuityads/acuityadstest/supplemental/invalid-smartyads-ext-object.json delete mode 100644 adapters/avocet/avocet/exemplary/banner.json delete mode 100644 adapters/avocet/avocet/exemplary/video.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Makefile b/Makefile index 8475ce8369b..8ffea91fe36 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ test: deps ifeq "$(adapter)" "" ./validate.sh else - go test github.com/PubMatic-OpenWrap/prebid-server/adapters/$(adapter) -bench=. + go test github.com/prebid/prebid-server/adapters/$(adapter) -bench=. endif # build will ensure all of our tests pass and then build the go binary diff --git a/adapters/acuityads/acuityadstest/exemplary/native-app.json b/adapters/acuityads/acuityadstest/exemplary/native-app.json index 75b596f6ab7..c0d5ad49be2 100644 --- a/adapters/acuityads/acuityadstest/exemplary/native-app.json +++ b/adapters/acuityads/acuityadstest/exemplary/native-app.json @@ -1,152 +1,152 @@ { - "mockBidRequest": { - "id": "some-request-id", - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "tmax": 1000, - "user": { - "buyeruid": "awesome-user" - }, - "app": { - "publisher": { - "id": "123456789" - }, - "cat": [ - "IAB22-1" - ], - "bundle": "com.app.awesome", - "name": "Awesome App", - "domain": "awesomeapp.com", + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { "id": "123456789" }, - "imp": [ - { - "id": "some-impression-id", - "tagid": "ogTAGID", - "native": { - "ver":"1.1", - "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" - }, - "ext": { - "bidder": { - "host": "ep1", - "accountid": "hash" - } - } - } - ] + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" }, - "httpCalls": [ + "imp": [ { - "expectedRequest": { - "headers": { - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Accept": [ - "application/json" - ], - "X-Openrtb-Version": [ - "2.5" - ], - "User-Agent": [ - "test-user-agent" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ] - }, - "uri": "http://ep1.example.com/bid?token=hash", - "body": { - "id": "some-request-id", - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "imp": [ - { - "id": "some-impression-id", - "native": { - "ver":"1.1", - "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" - }, - "tagid": "ogTAGID" - } - ], - "app": { - "id": "123456789", - "name": "Awesome App", - "bundle": "com.app.awesome", - "domain": "awesomeapp.com", - "cat": [ - "IAB22-1" - ], - "publisher": { - "id": "123456789" - } - }, - "user": { - "buyeruid": "awesome-user" - }, - "tmax": 1000 + "id": "some-impression-id", + "tagid": "ogTAGID", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "host": "ep1", + "accountid": "hash" } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] }, - "mockResponse": { - "status": 200, - "body": { - "id": "awesome-resp-id", - "seatbid": [ - { - "bid": [ - { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "some-impression-id", - "price": 3.5, - "adm": "awesome-markup", - "adomain": [ - "awesome.com" - ], - "crid": "20" - } - ], - "type": "native", - "seat": "acuityads" - } - ], - "cur": "USD", - "ext": { - "responsetimemillis": { - "acuityads": 154 + "uri": "http://ep1.example.com/bid?token=hash", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" }, - "tmaxrequest": 1000 + "tagid": "ogTAGID" } - } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 } - } - ], - "expectedBidResponses": [ - { - "bids":[ - { - "bid": { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "some-impression-id", - "price": 3.5, - "adm": "awesome-markup", - "crid": "20", - "adomain": [ - "awesome.com" - ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20" + } + ], + "type": "native", + "seat": "acuityads" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "acuityads": 154 }, - "type": "native" + "tmaxrequest": 1000 } - ] + } } - ] - } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ] + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/acuityads/acuityadstest/supplemental/invalid-smartyads-ext-object.json b/adapters/acuityads/acuityadstest/supplemental/invalid-smartyads-ext-object.json deleted file mode 100644 index 77752d01edf..00000000000 --- a/adapters/acuityads/acuityadstest/supplemental/invalid-smartyads-ext-object.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "expectedMakeRequestsErrors": [ - { - "value": "ext.bidder not provided", - "comparison": "literal" - } - ], - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "some-impression-id", - "tagid": "my-adcode", - "video": { - "mimes": ["video/mp4"], - "w": 640, - "h": 480, - "minduration": 120, - "maxduration": 150 - }, - "ext": "Awesome" - } - ], - "site": { - "page": "test.com" - } - }, - "httpCalls": [] -} diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index 05dd9637d85..70cd6883a4d 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -21,6 +21,7 @@ import ( "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" + "github.com/stretchr/testify/assert" ) diff --git a/adapters/avocet/avocet/exemplary/banner.json b/adapters/avocet/avocet/exemplary/banner.json deleted file mode 100644 index b5e308ea725..00000000000 --- a/adapters/avocet/avocet/exemplary/banner.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "placement": "5ea9601ac865f911007f1b6a" - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://bid.staging.avct.cloud/ortb/bid/5e722ee9bd6df11d063a8013", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "placement": "5ea9601ac865f911007f1b6a" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "bidid": "dd87f80c-16a0-43c8-a673-b94b3ea4d417", - "id": "test-request-id", - "seatbid": [ - { - "bid": [ - { - "adm": "", - "adomain": ["avocet.io"], - "cid": "5b51e2d689654741306813a4", - "crid": "5b51e49634f2021f127ff7c9", - "h": 250, - "id": "bc708396-9202-437b-b726-08b9864cb8b8", - "impid": "test-imp-id", - "iurl": "https://cdn.staging.avocet.io/snapshots/5b51dd1634f2021f127ff7c0/5b51e49634f2021f127ff7c9.jpeg", - "language": "en", - "price": 15.64434783, - "w": 300 - } - ], - "seat": "TEST_SEAT_ID" - } - ] - } - } - } - ], - - "expectedBids": [ - { - "bid": { - "adm": "", - "adomain": ["avocet.io"], - "cid": "5b51e2d689654741306813a4", - "crid": "5b51e49634f2021f127ff7c9", - "h": 250, - "id": "bc708396-9202-437b-b726-08b9864cb8b8", - "impid": "test-imp-id", - "iurl": "https://cdn.staging.avocet.io/snapshots/5b51dd1634f2021f127ff7c0/5b51e49634f2021f127ff7c9.jpeg", - "language": "en", - "price": 15.64434783, - "w": 300 - }, - "type": "banner" - } - ] -} diff --git a/adapters/avocet/avocet/exemplary/video.json b/adapters/avocet/avocet/exemplary/video.json deleted file mode 100644 index 2398256b0dd..00000000000 --- a/adapters/avocet/avocet/exemplary/video.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "protocols": [2, 5], - "w": 1920, - "h": 1080 - }, - "ext": { - "bidder": { - "placement": "5ea9601ac865f911007f1b6a" - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://bid.staging.avct.cloud/ortb/bid/5e722ee9bd6df11d063a8013", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "protocols": [2, 5], - "w": 1920, - "h": 1080 - }, - "ext": { - "bidder": { - "placement": "5ea9601ac865f911007f1b6a" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "bidid": "a0eec3aa-f9f6-42fb-9aa4-f1b5656d4f42", - "id": "749d36d7-c993-455f-aefd-ffd8a7e3ccf", - "seatbid": [ - { - "bid": [ - { - "adm": "Avocet", - "adomain": ["avocet.io"], - "cid": "5b51e2d689654741306813a4", - "crid": "5ec530e32d57fe1100f17d87", - "h": 396, - "id": "3d4c2d45-5a8c-43b8-9e15-4f48ac45204f", - "impid": "dfp-ad--top-above-nav", - "iurl": "https://cdn.staging.avocet.io/snapshots/5b51dd1634f2021f127ff7c0/5ec530e32d57fe1100f17d87.jpeg", - "language": "en", - "price": 15.64434783, - "w": 600, - "ext": { - "avocet": { - "duration": 30 - } - } - } - ], - "seat": "TEST_SEAT_ID" - } - ] - } - } - } - ], - - "expectedBids": [ - { - "bid": { - "adm": "Avocet", - "adomain": ["avocet.io"], - "cid": "5b51e2d689654741306813a4", - "crid": "5ec530e32d57fe1100f17d87", - "h": 396, - "id": "3d4c2d45-5a8c-43b8-9e15-4f48ac45204f", - "impid": "dfp-ad--top-above-nav", - "iurl": "https://cdn.staging.avocet.io/snapshots/5b51dd1634f2021f127ff7c0/5ec530e32d57fe1100f17d87.jpeg", - "language": "en", - "price": 15.64434783, - "w": 600, - "ext": { - "avocet": { - "duration": 30 - } - } - }, - "type": "video" - } - ] -} diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json index e67d1e8a06b..293ab34cc2d 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json @@ -1,37 +1,37 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ - "w": 300, - "h": 250 - }], + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ "w": 300, "h": 250 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - } + }], + "w": 300, + "h": 250 }, + "ext": { + "bidder": { + "tagid": "25251" + } + } + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { @@ -39,110 +39,110 @@ } } }], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - }, - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - } + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ - "w": 300, - "h": 250 - }], + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ "w": 300, "h": 250 - }, + }], + "w": 300, + "h": 250 + }, "ext": { "bidder": { "tagid": "25251" } }, - "tagid": "25251", - "secure": 0 - }, + "tagid": "25251", + "secure": 0 + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, "tagid": "25251", "secure": 0 }], - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - } + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" + }, + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [ - { - "seat": "12356", - "bid": [{ - "adm": "
", - "id": "some_test_ad_id_1", - "impid": "some_test_ad_id_1", - "ttl": 300, - "crid": "94395500", - "w": 300, - "price": 2.942808, - "adid": "94395500", - "h": 250 - }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [ + { + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] }, { "seat": "45678", @@ -157,14 +157,14 @@ "adid": "9999999", "h": 1000 } - ] - }], - "cur": "USD" - } + ] + }], + "cur": "USD" } - }], - - "expectedBidResponses": [ + } + }], + + "expectedBidResponses": [ { "bids": [{ "bid": { @@ -179,19 +179,19 @@ }, "type": "banner" }, - { - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id_2", - "impid": "some_test_ad_id_2", - "crid": "9999999", - "w": 1020, - "price": 1, - "adid": "9999999", - "h": 1000 - }, - "type": "video" - }] + { + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id_2", + "impid": "some_test_ad_id_2", + "crid": "9999999", + "w": 1020, + "price": 1, + "adid": "9999999", + "h": 1000 + }, + "type": "video" + }] } ] } diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json index 5e4cc7d1f4b..c28214f4892 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json @@ -1,37 +1,37 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ - "w": 300, - "h": 250 - }], + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ "w": 300, "h": 250 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - } + }], + "w": 300, + "h": 250 }, + "ext": { + "bidder": { + "tagid": "25251" + } + } + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { @@ -40,75 +40,75 @@ } } ], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - }, - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - } + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Referer": [ - "http://www.publisher.com/awesome/site?with=some¶meters=here" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ - "w": 300, - "h": 250 - }], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Referer": [ + "http://www.publisher.com/awesome/site?with=some¶meters=here" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ "w": 300, "h": 250 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 + }], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "tagid": "25251" + } }, + "tagid": "25251", + "secure": 0 + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { @@ -118,35 +118,35 @@ "tagid": "25251", "secure": 0 }], - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - } + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + }, + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ - "adm": "
", - "id": "some_test_ad_id_1", - "impid": "some_test_ad_id_1", - "ttl": 300, - "crid": "94395500", - "w": 300, - "price": 2.942808, - "adid": "94395500", - "h": 250 - }] - }, + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] + }, { "seat": "45678", "bid": [{ @@ -160,27 +160,27 @@ "adid": "9999999", "h": 1000 } - ] - }], - "cur": "USD" - } + ] + }], + "cur": "USD" } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "
", - "id": "some_test_ad_id_1", - "impid": "some_test_ad_id_1", - "crid": "94395500", - "w": 300, - "price": 2.942808, - "adid": "94395500", - "h": 250 - }, - "type": "banner" + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 }, + "type": "banner" + }, { "bid": { "adm": "00:00:15", @@ -192,8 +192,8 @@ "adid": "9999999", "h": 1000 }, - "type": "video" + "type": "video" }] - } + } ] } diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json index c700c76fc39..e8ff9156ac7 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json @@ -1,131 +1,131 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + } + }], + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + }, + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id", + "video":{ "mimes": [ "video/mp4", "application/javascript" ], "protocols":[ - 2, - 3, - 5, - 6 + 2, + 3, + 5, + 6 ], "w":640, "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + }], + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" }, - "ext": { - "bidder": { - "tagid": "25251" - } + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 } - }], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - }, - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" } }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "00:00:15", "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 - }], - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }] - }], - "cur": "USD" - } + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }] + }], + "cur": "USD" } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }, - "type": "video" - }] + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }, + "type": "video" }] - } + }] +} diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json index ff0b50a4969..80c415e093e 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json @@ -1,150 +1,151 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6, + 7 + ], + "w": 1920, + "h": 1080 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + } + }], + "device": { + "ua": "Roku\/DVP-9.0 (919.00E04142A)", + "ip": "123.123.123.123", + "dnt": 1, + "devicetype": 3, + "make": "Roku", + "model": "Digital Video player", + "language": "en", + "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" + }, + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", + "name": "Example TV", + "bundle": "com.example.tv" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Language": [ + "en" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Roku\/DVP-9.0 (919.00E04142A)" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id", + "video":{ "mimes": [ "video/mp4", "application/javascript" ], "protocols":[ - 2, - 3, - 5, - 6, - 7 + 2, + 3, + 5, + 6 ], - "w": 1920, - "h": 1080 + "w":1920, + "h":1080 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + }], + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", + "name": "Example TV", + "bundle": "com.example.tv" }, - "ext": { - "bidder": { - "tagid": "25251" - } + "device": { + "ua": "Roku\/DVP-9.0 (919.00E04142A)", + "ip": "123.123.123.123", + "dnt": 1, + "devicetype": 3, + "make": "Roku", + "model": "Digital Video player", + "language": "en", + "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" } - }], - "device": { - "ua": "Roku\/DVP-9.0 (919.00E04142A)", - "ip": "123.123.123.123", - "dnt": 1, - "devicetype": 3, - "make": "Roku", - "model": "Digital Video player", - "language": "en", - "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" - }, - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", - "name": "Example TV", - "bundle": "com.example.tv" } }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Accept-Language": [ - "en" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Roku\/DVP-9.0 (919.00E04142A)" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "00:00:15", "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":1920, - "h":1080 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 - }], - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", - "name": "Example TV", - "bundle": "com.example.tv" - }, - "device": { - "ua": "Roku\/DVP-9.0 (919.00E04142A)", - "ip": "123.123.123.123", - "dnt": 1, - "devicetype": 3, - "make": "Roku", - "model": "Digital Video player", - "language": "en", - "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "ttl": 300, - "crid": "148479785", - "w": 1920, - "price": 1.00, - "adid": "148479785", - "h": 1080 - }] - }], - "cur": "USD" - } + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 1920, + "price": 1.00, + "adid": "148479785", + "h": 1080 + }] + }], + "cur": "USD" } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 1920, - "price": 1.00, - "adid": "148479785", - "h": 1080 - }, - "type": "video" - }] + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 1920, + "price": 1.00, + "adid": "148479785", + "h": 1080 + }, + "type": "video" }] - } + }] +} + \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json index 65a34996829..0b4a7b1bc6b 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json @@ -1,135 +1,135 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id", + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + } + }], + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Referer": [ + "http://www.publisher.com/awesome/site?with=some¶meters=here" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id", + "video":{ "mimes": [ "video/mp4", "application/javascript" ], "protocols":[ - 2, - 3, - 5, - 6 + 2, + 3, + 5, + 6 ], "w":640, "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + }], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" }, - "ext": { - "bidder": { - "tagid": "25251" - } + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 } - }], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - }, - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" } }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Referer": [ - "http://www.publisher.com/awesome/site?with=some¶meters=here" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "00:00:15", "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 - }], - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "ttl": 300, - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }] - }], - "cur": "USD" - } + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }] + }], + "cur": "USD" } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }, - "type": "video" - }] + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }, + "type": "video" }] - } + }] +} diff --git a/adapters/spotx/spotx.go b/adapters/spotx/spotx.go index e7cf9014103..92d12c82d90 100644 --- a/adapters/spotx/spotx.go +++ b/adapters/spotx/spotx.go @@ -6,11 +6,11 @@ import ( "fmt" "net/http" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb/v15/openrtb2" ) type Adapter struct { diff --git a/adapters/spotx/spotx_test.go b/adapters/spotx/spotx_test.go index 3c7aa85e24b..d516f39b8a2 100644 --- a/adapters/spotx/spotx_test.go +++ b/adapters/spotx/spotx_test.go @@ -2,9 +2,9 @@ package spotx import ( "encoding/json" - "github.com/prebid/prebid-server/adapters" "github.com/magiconair/properties/assert" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/adapters" "testing" ) diff --git a/analytics/config/config.go b/analytics/config/config.go index 326dc50775d..fa63cb5a1e4 100644 --- a/analytics/config/config.go +++ b/analytics/config/config.go @@ -1,12 +1,12 @@ package config import ( + "github.com/golang/glog" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/analytics/clients" "github.com/prebid/prebid-server/analytics/filesystem" "github.com/prebid/prebid-server/analytics/pubstack" "github.com/prebid/prebid-server/config" - "github.com/golang/glog" ) //Modules that need to be logged to need to be initialized here diff --git a/analytics/filesystem/file_module.go b/analytics/filesystem/file_module.go index dd38dc3d58e..a0721d98a2a 100644 --- a/analytics/filesystem/file_module.go +++ b/analytics/filesystem/file_module.go @@ -5,8 +5,8 @@ import ( "encoding/json" "fmt" - "github.com/prebid/prebid-server/analytics" "github.com/chasex/glog" + "github.com/prebid/prebid-server/analytics" ) type RequestType string diff --git a/cache/postgrescache/postgrescache.go b/cache/postgrescache/postgrescache.go index c76eda9bd3f..df8b8fe49b2 100644 --- a/cache/postgrescache/postgrescache.go +++ b/cache/postgrescache/postgrescache.go @@ -9,9 +9,9 @@ import ( "github.com/prebid/prebid-server/stored_requests" - "github.com/prebid/prebid-server/cache" "github.com/coocood/freecache" "github.com/lib/pq" + "github.com/prebid/prebid-server/cache" ) type CacheConfig struct { diff --git a/endpoints/getuids.go b/endpoints/getuids.go index 42f59ce482d..859c0e7288c 100644 --- a/endpoints/getuids.go +++ b/endpoints/getuids.go @@ -3,9 +3,9 @@ package endpoints import ( "net/http" + "github.com/julienschmidt/httprouter" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/usersync" - "github.com/julienschmidt/httprouter" "encoding/json" ) diff --git a/endpoints/openrtb2/ctv/response/adpod_generator.go b/endpoints/openrtb2/ctv/response/adpod_generator.go index 6b24c3719aa..37758f7bbf6 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator.go +++ b/endpoints/openrtb2/ctv/response/adpod_generator.go @@ -5,13 +5,13 @@ import ( "sync" "time" + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/combination" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/util" "github.com/prebid/prebid-server/metrics" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb/v15/openrtb2" ) /********************* AdPodGenerator Functions *********************/ diff --git a/endpoints/openrtb2/ctv/response/adpod_generator_test.go b/endpoints/openrtb2/ctv/response/adpod_generator_test.go index 6e73f98269d..f387d5bbe24 100644 --- a/endpoints/openrtb2/ctv/response/adpod_generator_test.go +++ b/endpoints/openrtb2/ctv/response/adpod_generator_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" ) func Test_findUniqueCombinations(t *testing.T) { diff --git a/endpoints/openrtb2/ctv/types/adpod_types.go b/endpoints/openrtb2/ctv/types/adpod_types.go index 5c6f89c11a7..6e46929547d 100644 --- a/endpoints/openrtb2/ctv/types/adpod_types.go +++ b/endpoints/openrtb2/ctv/types/adpod_types.go @@ -1,9 +1,9 @@ package types import ( + "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/mxmCherry/openrtb/v15/openrtb2" ) //Bid openrtb bid object with extra parameters @@ -23,7 +23,7 @@ type ExtCTVBidResponse struct { //BidResponseAdPodExt object for ctv bidresponse adpod object type BidResponseAdPodExt struct { Response openrtb2.BidResponse `json:"bidresponse,omitempty"` - Config map[string]*ImpData `json:"config,omitempty"` + Config map[string]*ImpData `json:"config,omitempty"` } //AdPodBid combination contains ImpBid diff --git a/endpoints/openrtb2/ctv/util/util.go b/endpoints/openrtb2/ctv/util/util.go index 805f06cc3f9..523fcf7ed61 100644 --- a/endpoints/openrtb2/ctv/util/util.go +++ b/endpoints/openrtb2/ctv/util/util.go @@ -11,10 +11,10 @@ import ( "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/golang/glog" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/constant" "github.com/prebid/prebid-server/endpoints/openrtb2/ctv/types" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/golang/glog" ) func GetDurationWiseBidsBucket(bids []*types.Bid) types.BidsBuckets { diff --git a/endpoints/openrtb2/ctv_auction.go b/endpoints/openrtb2/ctv_auction.go index 064edd3a606..c28904591c7 100644 --- a/endpoints/openrtb2/ctv_auction.go +++ b/endpoints/openrtb2/ctv_auction.go @@ -13,6 +13,11 @@ import ( "time" "github.com/PubMatic-OpenWrap/etree" + "github.com/buger/jsonparser" + uuid "github.com/gofrs/uuid" + "github.com/golang/glog" + "github.com/julienschmidt/httprouter" + "github.com/mxmCherry/openrtb/v15/openrtb2" accountService "github.com/prebid/prebid-server/account" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" @@ -29,11 +34,6 @@ import ( "github.com/prebid/prebid-server/stored_requests" "github.com/prebid/prebid-server/usersync" "github.com/prebid/prebid-server/util/iputil" - "github.com/buger/jsonparser" - uuid "github.com/gofrs/uuid" - "github.com/golang/glog" - "github.com/julienschmidt/httprouter" - "github.com/mxmCherry/openrtb/v15/openrtb2" ) //CTV Specific Endpoint diff --git a/endpoints/openrtb2/ctv_auction_test.go b/endpoints/openrtb2/ctv_auction_test.go index a1de7dd9b30..7284f856ea3 100644 --- a/endpoints/openrtb2/ctv_auction_test.go +++ b/endpoints/openrtb2/ctv_auction_test.go @@ -4,8 +4,8 @@ import ( "encoding/json" "testing" - "github.com/prebid/prebid-server/openrtb_ext" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/endpoints/setuid.go b/endpoints/setuid.go index 0cb277fbb44..4bff02acf37 100644 --- a/endpoints/setuid.go +++ b/endpoints/setuid.go @@ -9,13 +9,13 @@ import ( "strings" "time" + "github.com/julienschmidt/httprouter" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/gdpr" "github.com/prebid/prebid-server/metrics" "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/usersync" - "github.com/julienschmidt/httprouter" ) const ( diff --git a/go.sum b/go.sum index 9ddee0ed3bc..510e0ee0648 100644 --- a/go.sum +++ b/go.sum @@ -34,7 +34,6 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DP github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd h1:biTJQdqouE5by89AAffXG8++TY+9Fsdrg5rinbt3tHk= github.com/evanphx/json-patch v0.0.0-20180720181644-f195058310bd/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -43,7 +42,6 @@ github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4 github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -59,7 +57,6 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/influxdata/influxdb v1.6.1 h1:OseoBlzI5ftNI/bczyxSWq6PKRCNEeiXvyWP/wS5fB0= github.com/influxdata/influxdb v1.6.1/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= @@ -79,8 +76,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I= github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mxmCherry/openrtb/v15 v15.0.0 h1:inLuQ3Bsima9HLB2v6WjbtEFF69SWOT5Dux4QZtYdrw= -github.com/mxmCherry/openrtb/v15 v15.0.0/go.mod h1:TVgncsz6MOzbL7lhun1lNuUBzVBlVDbxf9Fyy1TyhZA= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -127,7 +122,6 @@ github.com/spf13/viper v1.1.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7Sr github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -150,7 +144,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -161,10 +154,8 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -174,7 +165,6 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -195,11 +185,9 @@ google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyz google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/metrics/config/metrics.go b/metrics/config/metrics.go index b5c72da7242..70738f2fd1a 100644 --- a/metrics/config/metrics.go +++ b/metrics/config/metrics.go @@ -244,7 +244,6 @@ func (me *MultiMetricsEngine) RecordRequestPrivacy(privacy metrics.PrivacyLabels } } - // RecordAdapterDuplicateBidID across all engines func (me *MultiMetricsEngine) RecordAdapterDuplicateBidID(adaptor string, collisions int) { for _, thisME := range *me { @@ -416,4 +415,4 @@ func (me *DummyMetricsEngine) RecordPodCompititveExclusionTime(labels metrics.Po // RecordAdapterVideoBidDuration as a noop func (me *DummyMetricsEngine) RecordAdapterVideoBidDuration(labels metrics.AdapterLabels, videoBidDuration int) { -} \ No newline at end of file +} diff --git a/openrtb_ext/device.go b/openrtb_ext/device.go index fbb7e3c62e5..cc06f3806cf 100644 --- a/openrtb_ext/device.go +++ b/openrtb_ext/device.go @@ -5,8 +5,8 @@ import ( "errors" "strconv" - "github.com/prebid/prebid-server/errortypes" "github.com/buger/jsonparser" + "github.com/prebid/prebid-server/errortypes" ) // PrebidExtKey represents the prebid extension key used in requests diff --git a/pbs/pbsrequest_test.go b/pbs/pbsrequest_test.go index 09ca8d47324..52cd6153323 100644 --- a/pbs/pbsrequest_test.go +++ b/pbs/pbsrequest_test.go @@ -8,9 +8,9 @@ import ( "strings" "testing" + "github.com/magiconair/properties/assert" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/config" - "github.com/magiconair/properties/assert" ) const mimeVideoMp4 = "video/mp4" diff --git a/pbs/usersync.go b/pbs/usersync.go index f64eaea4da1..4cac3544804 100644 --- a/pbs/usersync.go +++ b/pbs/usersync.go @@ -9,13 +9,13 @@ import ( "strings" "time" + "github.com/golang/glog" + "github.com/julienschmidt/httprouter" "github.com/prebid/prebid-server/analytics" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/metrics" "github.com/prebid/prebid-server/server/ssl" "github.com/prebid/prebid-server/usersync" - "github.com/golang/glog" - "github.com/julienschmidt/httprouter" ) // Recaptcha code from https://github.com/haisum/recaptcha/blob/master/recaptcha.go diff --git a/stored_requests/backends/db_fetcher/fetcher.go b/stored_requests/backends/db_fetcher/fetcher.go index e60edac83e5..d8cf132d25b 100644 --- a/stored_requests/backends/db_fetcher/fetcher.go +++ b/stored_requests/backends/db_fetcher/fetcher.go @@ -7,8 +7,8 @@ import ( "github.com/lib/pq" - "github.com/prebid/prebid-server/stored_requests" "github.com/golang/glog" + "github.com/prebid/prebid-server/stored_requests" ) func NewFetcher(db *sql.DB, queryMaker func(int, int) string) stored_requests.AllFetcher { diff --git a/stored_requests/events/api/api.go b/stored_requests/events/api/api.go index 776c3d310fa..6dce4ebaad6 100644 --- a/stored_requests/events/api/api.go +++ b/stored_requests/events/api/api.go @@ -5,8 +5,8 @@ import ( "io/ioutil" "net/http" - "github.com/prebid/prebid-server/stored_requests/events" "github.com/julienschmidt/httprouter" + "github.com/prebid/prebid-server/stored_requests/events" ) type eventsAPI struct { diff --git a/stored_requests/events/http/http.go b/stored_requests/events/http/http.go index 860401e7592..4615183f693 100644 --- a/stored_requests/events/http/http.go +++ b/stored_requests/events/http/http.go @@ -11,8 +11,8 @@ import ( "golang.org/x/net/context/ctxhttp" - "github.com/prebid/prebid-server/stored_requests/events" "github.com/buger/jsonparser" + "github.com/prebid/prebid-server/stored_requests/events" "github.com/golang/glog" ) From bff555cb008ce0823ba1639232e84d3bd7b695e0 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 10:52:39 +0530 Subject: [PATCH 75/91] Fixed indentation for json files --- .../acuityadstest/exemplary/native-app.json | 13 +- .../exemplary/banner-and-video-app.json | 1 + .../emx_digitaltest/exemplary/video-app.json | 216 ++++++++-------- .../emx_digitaltest/exemplary/video-ctv.json | 241 +++++++++--------- .../emx_digitaltest/exemplary/video-site.json | 224 ++++++++-------- 5 files changed, 366 insertions(+), 329 deletions(-) diff --git a/adapters/acuityads/acuityadstest/exemplary/native-app.json b/adapters/acuityads/acuityadstest/exemplary/native-app.json index c0d5ad49be2..17cf509b12c 100644 --- a/adapters/acuityads/acuityadstest/exemplary/native-app.json +++ b/adapters/acuityads/acuityadstest/exemplary/native-app.json @@ -28,8 +28,8 @@ "id": "some-impression-id", "tagid": "ogTAGID", "native": { - "ver":"1.1", - "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + "ver": "1.1", + "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" }, "ext": { "bidder": { @@ -73,8 +73,8 @@ { "id": "some-impression-id", "native": { - "ver":"1.1", - "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + "ver": "1.1", + "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" }, "tagid": "ogTAGID" } @@ -132,9 +132,9 @@ ], "expectedBidResponses": [ { - "bids":[ + "bids": [ { - "bid": { + "bid": { "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, @@ -150,3 +150,4 @@ } ] } + diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json index 293ab34cc2d..8d6403ff5d4 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json @@ -195,3 +195,4 @@ } ] } + diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json index e8ff9156ac7..a8538f7a0bb 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json @@ -1,28 +1,30 @@ { "mockBidRequest": { "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } } } - }], + ], "device": { "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", "ip": "123.123.123.123", @@ -33,71 +35,97 @@ "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" } }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 } + ], + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" }, - "tagid": "25251", - "secure": 0 - }], - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [ + { + "seat": "12356", + "bid": [ + { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + } + ] + } + ], + "cur": "USD" } } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { "adm": "00:00:15", "id": "some_test_ad_id", "impid": "some_test_ad_id", @@ -106,26 +134,10 @@ "price": 0.05, "adid": "148479785", "h": 480 - }] - }], - "cur": "USD" - } + }, + "type": "video" + } + ] } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }, - "type": "video" - }] - }] + ] } diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json index 80c415e093e..b4102835c91 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json @@ -1,29 +1,31 @@ { "mockBidRequest": { "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6, - 7 - ], - "w": 1920, - "h": 1080 - }, - "ext": { - "bidder": { - "tagid": "25251" + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6, + 7 + ], + "w": 1920, + "h": 1080 + }, + "ext": { + "bidder": { + "tagid": "25251" + } } } - }], + ], "device": { "ua": "Roku\/DVP-9.0 (919.00E04142A)", "ip": "123.123.123.123", @@ -41,111 +43,120 @@ "bundle": "com.example.tv" } }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Accept-Language": [ - "en" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Roku\/DVP-9.0 (919.00E04142A)" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":1920, - "h":1080 - }, - "ext": { - "bidder": { - "tagid": "25251" + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Accept-Language": [ + "en" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Roku\/DVP-9.0 (919.00E04142A)" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 1920, + "h": 1080 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 } + ], + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", + "name": "Example TV", + "bundle": "com.example.tv" }, - "tagid": "25251", - "secure": 0 - }], - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", - "name": "Example TV", - "bundle": "com.example.tv" - }, - "device": { - "ua": "Roku\/DVP-9.0 (919.00E04142A)", - "ip": "123.123.123.123", - "dnt": 1, - "devicetype": 3, - "make": "Roku", - "model": "Digital Video player", - "language": "en", - "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" + "device": { + "ua": "Roku\/DVP-9.0 (919.00E04142A)", + "ip": "123.123.123.123", + "dnt": 1, + "devicetype": 3, + "make": "Roku", + "model": "Digital Video player", + "language": "en", + "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [ + { + "seat": "12356", + "bid": [ + { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 1920, + "price": 1.00, + "adid": "148479785", + "h": 1080 + } + ] + } + ], + "cur": "USD" } } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { "adm": "00:00:15", "id": "some_test_ad_id", "impid": "some_test_ad_id", - "ttl": 300, "crid": "148479785", "w": 1920, "price": 1.00, "adid": "148479785", "h": 1080 - }] - }], - "cur": "USD" - } + }, + "type": "video" + } + ] } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 1920, - "price": 1.00, - "adid": "148479785", - "h": 1080 - }, - "type": "video" - }] - }] + ] } - \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json index 0b4a7b1bc6b..8123a1aa239 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json @@ -1,28 +1,30 @@ { "mockBidRequest": { "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } } } - }], + ], "device": { "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", "ip": "123.123.123.123", @@ -33,103 +35,113 @@ "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" } }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Referer": [ - "http://www.publisher.com/awesome/site?with=some¶meters=here" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] - }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id", - "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Referer": [ + "http://www.publisher.com/awesome/site?with=some¶meters=here" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [ + { + "id": "some_test_ad_id", + "video": { + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols": [ + 2, + 3, + 5, + 6 + ], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 } + ], + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" }, - "tagid": "25251", - "secure": 0 - }], - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [ + { + "seat": "12356", + "bid": [ + { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + } + ] + } + ], + "cur": "USD" } } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { "adm": "00:00:15", "id": "some_test_ad_id", "impid": "some_test_ad_id", - "ttl": 300, "crid": "148479785", "w": 640, "price": 0.05, "adid": "148479785", "h": 480 - }] - }], - "cur": "USD" - } + }, + "type": "video" + } + ] } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }, - "type": "video" - }] - }] + ] } From ba43f62761bf9e8b3c2617d822a03d8ab349d4b9 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 10:59:27 +0530 Subject: [PATCH 76/91] Fixed indentation for json files --- .../acuityadstest/exemplary/native-app.json | 280 +++++++++--------- .../exemplary/banner-and-video-app.json | 272 ++++++++--------- .../exemplary/banner-and-video-site.json | 277 ++++++++--------- .../emx_digitaltest/exemplary/video-app.json | 167 +++++------ .../emx_digitaltest/exemplary/video-ctv.json | 185 ++++++------ .../emx_digitaltest/exemplary/video-site.json | 169 +++++------ 6 files changed, 659 insertions(+), 691 deletions(-) diff --git a/adapters/acuityads/acuityadstest/exemplary/native-app.json b/adapters/acuityads/acuityadstest/exemplary/native-app.json index 17cf509b12c..f10a0a9af4d 100644 --- a/adapters/acuityads/acuityadstest/exemplary/native-app.json +++ b/adapters/acuityads/acuityadstest/exemplary/native-app.json @@ -1,153 +1,153 @@ { - "mockBidRequest": { - "id": "some-request-id", - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "tmax": 1000, - "user": { - "buyeruid": "awesome-user" - }, - "app": { - "publisher": { + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", "id": "123456789" }, - "cat": [ - "IAB22-1" - ], - "bundle": "com.app.awesome", - "name": "Awesome App", - "domain": "awesomeapp.com", - "id": "123456789" + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "host": "ep1", + "accountid": "hash" + } + } + } + ] }, - "imp": [ + "httpCalls": [ { - "id": "some-impression-id", - "tagid": "ogTAGID", - "native": { - "ver": "1.1", - "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" - }, - "ext": { - "bidder": { - "host": "ep1", - "accountid": "hash" + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://ep1.example.com/bid?token=hash", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "tagid": "ogTAGID" + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "headers": { - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Accept": [ - "application/json" - ], - "X-Openrtb-Version": [ - "2.5" - ], - "User-Agent": [ - "test-user-agent" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ] }, - "uri": "http://ep1.example.com/bid?token=hash", - "body": { - "id": "some-request-id", - "device": { - "ua": "test-user-agent", - "ip": "123.123.123.123", - "language": "en", - "dnt": 0 - }, - "imp": [ - { - "id": "some-impression-id", - "native": { - "ver": "1.1", - "request": "{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" - }, - "tagid": "ogTAGID" - } - ], - "app": { - "id": "123456789", - "name": "Awesome App", - "bundle": "com.app.awesome", - "domain": "awesomeapp.com", - "cat": [ - "IAB22-1" + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20" + } + ], + "type": "native", + "seat": "acuityads" + } ], - "publisher": { - "id": "123456789" + "cur": "USD", + "ext": { + "responsetimemillis": { + "acuityads": 154 + }, + "tmaxrequest": 1000 } - }, - "user": { - "buyeruid": "awesome-user" - }, - "tmax": 1000 + } } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "awesome-resp-id", - "seatbid": [ - { - "bid": [ - { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "some-impression-id", - "price": 3.5, - "adm": "awesome-markup", - "adomain": [ - "awesome.com" - ], - "crid": "20" - } - ], - "type": "native", - "seat": "acuityads" - } - ], - "cur": "USD", - "ext": { - "responsetimemillis": { - "acuityads": 154 + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ] }, - "tmaxrequest": 1000 + "type": "native" } - } + ] } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "some-impression-id", - "price": 3.5, - "adm": "awesome-markup", - "crid": "20", - "adomain": [ - "awesome.com" - ] - }, - "type": "native" - } - ] - } - ] -} - + ] + } + \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json index 8d6403ff5d4..46c469b9d28 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-app.json @@ -1,37 +1,37 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }], "w": 300, "h": 250 - }], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "tagid": "25251" + }, + "ext": { + "bidder": { + "tagid": "25251" + } } - } - }, + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { @@ -39,110 +39,110 @@ } } }], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - }, - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - } - }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }], "w": 300, "h": 250 - }], - "w": 300, - "h": 250 - }, + }, "ext": { "bidder": { "tagid": "25251" } }, - "tagid": "25251", - "secure": 0 - }, + "tagid": "25251", + "secure": 0 + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 - }, - "ext": { - "bidder": { - "tagid": "25251" - } + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, "tagid": "25251", "secure": 0 }], - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" + }, + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + } } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [ - { - "seat": "12356", - "bid": [{ - "adm": "
", - "id": "some_test_ad_id_1", - "impid": "some_test_ad_id_1", - "ttl": 300, - "crid": "94395500", - "w": 300, - "price": 2.942808, - "adid": "94395500", - "h": 250 - }] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [ + { + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] }, { "seat": "45678", @@ -157,14 +157,14 @@ "adid": "9999999", "h": 1000 } - ] - }], - "cur": "USD" + ] + }], + "cur": "USD" } - } - }], - - "expectedBidResponses": [ + } + }], + + "expectedBidResponses": [ { "bids": [{ "bid": { @@ -179,20 +179,20 @@ }, "type": "banner" }, - { - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id_2", - "impid": "some_test_ad_id_2", - "crid": "9999999", - "w": 1020, - "price": 1, - "adid": "9999999", - "h": 1000 - }, - "type": "video" - }] + { + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id_2", + "impid": "some_test_ad_id_2", + "crid": "9999999", + "w": 1020, + "price": 1, + "adid": "9999999", + "h": 1000 + }, + "type": "video" + }] } ] } - + \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json index c28214f4892..f47fd66784e 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/banner-and-video-site.json @@ -1,37 +1,37 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }], "w": 300, "h": 250 - }], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "tagid": "25251" + }, + "ext": { + "bidder": { + "tagid": "25251" + } } - } - }, + }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { @@ -40,75 +40,75 @@ } } ], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 - }, - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - } - }, - - "httpCalls": [{ - "expectedRequest": { - "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", - "headers": { - "Accept": [ - "application/json" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "X-Forwarded-For": [ - "123.123.123.123" - ], - "Referer": [ - "http://www.publisher.com/awesome/site?with=some¶meters=here" - ], - "Dnt": [ - "1" - ], - "User-Agent": [ - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" - ] + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 }, - "body": { - "id": "some_test_auction", - "imp": [{ - "id": "some_test_ad_id_1", - "banner": { - "format": [{ + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + } + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Referer": [ + "http://www.publisher.com/awesome/site?with=some¶meters=here" + ], + "Dnt": [ + "1" + ], + "User-Agent": [ + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" + ] + }, + "body": { + "id": "some_test_auction", + "imp": [{ + "id": "some_test_ad_id_1", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }], "w": 300, "h": 250 - }], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "tagid": "25251" - } + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 }, - "tagid": "25251", - "secure": 0 - }, { "id": "some_test_ad_id_2", "video":{ - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols":[ - 2, - 3, - 5, - 6 - ], - "w":640, - "h":480 + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { @@ -118,35 +118,35 @@ "tagid": "25251", "secure": 0 }], - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - }, - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" + }, + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + } } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "some_test_auction", - "seatbid": [{ - "seat": "12356", - "bid": [{ - "adm": "
", - "id": "some_test_ad_id_1", - "impid": "some_test_ad_id_1", - "ttl": 300, - "crid": "94395500", - "w": 300, - "price": 2.942808, - "adid": "94395500", - "h": 250 - }] - }, + }, + "mockResponse": { + "status": 200, + "body": { + "id": "some_test_auction", + "seatbid": [{ + "seat": "12356", + "bid": [{ + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "ttl": 300, + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }] + }, { "seat": "45678", "bid": [{ @@ -160,27 +160,27 @@ "adid": "9999999", "h": 1000 } - ] - }], - "cur": "USD" + ] + }], + "cur": "USD" } - } - }], - - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "
", - "id": "some_test_ad_id_1", - "impid": "some_test_ad_id_1", - "crid": "94395500", - "w": 300, - "price": 2.942808, - "adid": "94395500", - "h": 250 + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "
", + "id": "some_test_ad_id_1", + "impid": "some_test_ad_id_1", + "crid": "94395500", + "w": 300, + "price": 2.942808, + "adid": "94395500", + "h": 250 + }, + "type": "banner" }, - "type": "banner" - }, { "bid": { "adm": "00:00:15", @@ -192,8 +192,9 @@ "adid": "9999999", "h": 1000 }, - "type": "video" + "type": "video" }] - } + } ] } + \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json index a8538f7a0bb..5bade072bdd 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-app.json @@ -1,42 +1,40 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [ - { + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ "id": "some_test_ad_id", - "video": { - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols": [ - 2, - 3, - 5, - 6 - ], - "w": 640, - "h": 480 + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { "tagid": "25251" } } + }], + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + }, + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" } - ], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 }, - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" - } - }, - "httpCalls": [ - { + + "httpCalls": [{ "expectedRequest": { "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", "headers": { @@ -58,32 +56,30 @@ }, "body": { "id": "some_test_auction", - "imp": [ - { - "id": "some_test_ad_id", - "video": { + "imp": [{ + "id": "some_test_ad_id", + "video":{ "mimes": [ "video/mp4", "application/javascript" ], - "protocols": [ - 2, - 3, - 5, - 6 + "protocols":[ + 2, + 3, + 5, + 6 ], - "w": 640, - "h": 480 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 - } - ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + }], "app": { "domain": "www.publisher.com", "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here" @@ -99,45 +95,38 @@ "status": 200, "body": { "id": "some_test_auction", - "seatbid": [ - { + "seatbid": [{ "seat": "12356", - "bid": [ - { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - } - ] - } - ], + "bid": [{ + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }] + }], "cur": "USD" - } } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }, - "type": "video" - } - ] - } - ] -} + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }, + "type": "video" + }] + }] + } + \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json index b4102835c91..7afbfbf088d 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-ctv.json @@ -1,50 +1,48 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [ - { + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ "id": "some_test_ad_id", - "video": { - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols": [ - 2, - 3, - 5, - 6, - 7 - ], - "w": 1920, - "h": 1080 + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6, + 7 + ], + "w": 1920, + "h": 1080 }, "ext": { "bidder": { "tagid": "25251" } } + }], + "device": { + "ua": "Roku\/DVP-9.0 (919.00E04142A)", + "ip": "123.123.123.123", + "dnt": 1, + "devicetype": 3, + "make": "Roku", + "model": "Digital Video player", + "language": "en", + "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" + }, + "app": { + "domain": "www.publisher.com", + "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", + "name": "Example TV", + "bundle": "com.example.tv" } - ], - "device": { - "ua": "Roku\/DVP-9.0 (919.00E04142A)", - "ip": "123.123.123.123", - "dnt": 1, - "devicetype": 3, - "make": "Roku", - "model": "Digital Video player", - "language": "en", - "ifa": "7a2016d7-17b0-572f-a7a6-13f89a81d905" }, - "app": { - "domain": "www.publisher.com", - "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", - "name": "Example TV", - "bundle": "com.example.tv" - } - }, - "httpCalls": [ - { + + "httpCalls": [{ "expectedRequest": { "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", "headers": { @@ -69,32 +67,30 @@ }, "body": { "id": "some_test_auction", - "imp": [ - { - "id": "some_test_ad_id", - "video": { + "imp": [{ + "id": "some_test_ad_id", + "video":{ "mimes": [ "video/mp4", "application/javascript" ], - "protocols": [ - 2, - 3, - 5, - 6 + "protocols":[ + 2, + 3, + 5, + 6 ], - "w": 1920, - "h": 1080 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 - } - ], + "w":1920, + "h":1080 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + }], "app": { "domain": "www.publisher.com", "storeurl": "http://www.publisher.com/awesome/site?with=some¶meters=here", @@ -117,46 +113,39 @@ "status": 200, "body": { "id": "some_test_auction", - "seatbid": [ - { + "seatbid": [{ "seat": "12356", - "bid": [ - { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "ttl": 300, - "crid": "148479785", - "w": 1920, - "price": 1.00, - "adid": "148479785", - "h": 1080 - } - ] - } - ], + "bid": [{ + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 1920, + "price": 1.00, + "adid": "148479785", + "h": 1080 + }] + }], "cur": "USD" - } } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 1920, - "price": 1.00, - "adid": "148479785", - "h": 1080 - }, - "type": "video" - } - ] - } - ] -} + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 1920, + "price": 1.00, + "adid": "148479785", + "h": 1080 + }, + "type": "video" + }] + }] + } + \ No newline at end of file diff --git a/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json b/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json index 8123a1aa239..9d209b91958 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/video-site.json @@ -1,42 +1,40 @@ { - "mockBidRequest": { - "id": "some_test_auction", - "imp": [ - { + "mockBidRequest": { + "id": "some_test_auction", + "imp": [{ "id": "some_test_ad_id", - "video": { - "mimes": [ - "video/mp4", - "application/javascript" - ], - "protocols": [ - 2, - 3, - 5, - 6 - ], - "w": 640, - "h": 480 + "video":{ + "mimes": [ + "video/mp4", + "application/javascript" + ], + "protocols":[ + 2, + 3, + 5, + 6 + ], + "w":640, + "h":480 }, "ext": { "bidder": { "tagid": "25251" } } + }], + "device": { + "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", + "ip": "123.123.123.123", + "dnt": 1 + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" } - ], - "device": { - "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36", - "ip": "123.123.123.123", - "dnt": 1 }, - "site": { - "domain": "www.publisher.com", - "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" - } - }, - "httpCalls": [ - { + + "httpCalls": [{ "expectedRequest": { "uri": "https://hb.emxdgt.com?t=1000&ts=2060541160", "headers": { @@ -61,32 +59,30 @@ }, "body": { "id": "some_test_auction", - "imp": [ - { - "id": "some_test_ad_id", - "video": { + "imp": [{ + "id": "some_test_ad_id", + "video":{ "mimes": [ "video/mp4", "application/javascript" ], - "protocols": [ - 2, - 3, - 5, - 6 + "protocols":[ + 2, + 3, + 5, + 6 ], - "w": 640, - "h": 480 - }, - "ext": { - "bidder": { - "tagid": "25251" - } - }, - "tagid": "25251", - "secure": 0 - } - ], + "w":640, + "h":480 + }, + "ext": { + "bidder": { + "tagid": "25251" + } + }, + "tagid": "25251", + "secure": 0 + }], "site": { "domain": "www.publisher.com", "page": "http://www.publisher.com/awesome/site?with=some¶meters=here" @@ -102,46 +98,39 @@ "status": 200, "body": { "id": "some_test_auction", - "seatbid": [ - { + "seatbid": [{ "seat": "12356", - "bid": [ - { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "ttl": 300, - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - } - ] - } - ], + "bid": [{ + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "ttl": 300, + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }] + }], "cur": "USD" - } } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "adm": "00:00:15", - "id": "some_test_ad_id", - "impid": "some_test_ad_id", - "crid": "148479785", - "w": 640, - "price": 0.05, - "adid": "148479785", - "h": 480 - }, - "type": "video" - } - ] - } - ] -} + } + }], + + "expectedBidResponses": [{ + "bids": [{ + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id", + "impid": "some_test_ad_id", + "crid": "148479785", + "w": 640, + "price": 0.05, + "adid": "148479785", + "h": 480 + }, + "type": "video" + }] + }] + } + \ No newline at end of file From f62cd277cdb59228af4f5ef83a8e577389df67b0 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 11:03:32 +0530 Subject: [PATCH 77/91] Fixed import in adapters/gumgum/gumgum.go --- adapters/gumgum/gumgum.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/gumgum/gumgum.go b/adapters/gumgum/gumgum.go index b1e38d555f4..00927b9bf80 100644 --- a/adapters/gumgum/gumgum.go +++ b/adapters/gumgum/gumgum.go @@ -3,13 +3,13 @@ package gumgum import ( "encoding/json" "fmt" - "github.com/prebid/prebid-server/config" "net/http" "strconv" "strings" "github.com/mxmCherry/openrtb/v15/openrtb2" "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" ) From af9a43a8d9364b5368536268f4cd2a26d3b1c436 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 11:39:22 +0530 Subject: [PATCH 78/91] Reverted unwanted changes in test json files --- .../krushmediatest/exemplary/native-app.json | 1 + .../mobfoxpbtest/params/race/banner.json | 3 - .../mobfoxpbtest/params/race/video.json | 3 - .../supplemental/trimPublisherID.json | 259 +++++++++--------- 4 files changed, 134 insertions(+), 132 deletions(-) delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/video.json diff --git a/adapters/krushmedia/krushmediatest/exemplary/native-app.json b/adapters/krushmedia/krushmediatest/exemplary/native-app.json index 20d9fcb6c1d..bd27d2dc69e 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/native-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/native-app.json @@ -154,3 +154,4 @@ } ] } + \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json deleted file mode 100644 index dbdac1ad995..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "TagID": "6" -} \ No newline at end of file diff --git a/adapters/mobfoxpb/mobfoxpbtest/params/race/video.json b/adapters/mobfoxpb/mobfoxpbtest/params/race/video.json deleted file mode 100644 index 6e2e0b3803b..00000000000 --- a/adapters/mobfoxpb/mobfoxpbtest/params/race/video.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "TagID": "7" -} \ No newline at end of file diff --git a/adapters/pubmatic/pubmatictest/supplemental/trimPublisherID.json b/adapters/pubmatic/pubmatictest/supplemental/trimPublisherID.json index 95dbed85501..6a344ee091a 100644 --- a/adapters/pubmatic/pubmatictest/supplemental/trimPublisherID.json +++ b/adapters/pubmatic/pubmatictest/supplemental/trimPublisherID.json @@ -1,152 +1,159 @@ { - "mockBidRequest": { - "id": "test-request-id", - "imp": [{ - "id": "test-imp-id", - "banner": { - "format": [{ - "w": 300, - "h": 250 - }] - }, - "ext": { - "bidder": { - "adSlot": "AdTag_Div1@300x250", - "publisherId": " 999 ", - "keywords": [{ - "key": "pmZoneID", - "value": ["Zone1", "Zone2"] - }, - { - "key": "preference", - "value": ["sports", "movies"] - } - ], - "wrapper": { - "version": 1, - "profile": 5123 - } - } + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 } - }], - "device":{ - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" + ] }, - "site": { - "id": "siteID", - "publisher": { - "id": "1234" - } - }, - "ext":{ - "prebid" :{ - "bidderparams": { - "wiid": "dwzafakjflan-tygannnvlla-mlljvj" + "ext": { + "bidder": { + "adSlot": "AdTag_Div1@300x250", + "publisherId": " 999 ", + "keywords": [ + { + "key": "pmZoneID", + "value": [ + "Zone1", + "Zone2" + ] + }, + { + "key": "preference", + "value": [ + "sports", + "movies" + ] + } + ], + "wrapper": { + "version": 1, + "profile": 5123 } } } - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://hbopenbid.pubmatic.com/translator?source=prebid-server", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "tagid":"AdTag_Div1", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } + } + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" + }, + "site": { + "id": "siteID", + "publisher": { + "id": "1234" + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hbopenbid.pubmatic.com/translator?source=prebid-server", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "AdTag_Div1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } ], "h": 250, "w": 300 - }, - "ext": { - "pmZoneID": "Zone1,Zone2", - "preference": "sports,movies" - } + }, + "ext": { + "pmZoneID": "Zone1,Zone2", + "preference": "sports,movies" } - ], - "device":{ - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" - }, - "site": { - "id": "siteID", - "publisher": { - "id": "999" - } - }, - "ext": { - "wrapper": { - "profile": 5123, - "version":1, - "wiid" : "dwzafakjflan-tygannnvlla-mlljvj" - } + } + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" + }, + "site": { + "id": "siteID", + "publisher": { + "id": "999" + } + }, + "ext": { + "wrapper": { + "profile": 5123, + "version": 1 } } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [{ + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { "id": "7706636740145184841", "impid": "test-imp-id", "price": 0.500000, "adid": "29681110", "adm": "some-test-ad", - "adomain": ["pubmatic.com"], + "adomain": [ + "pubmatic.com" + ], "crid": "29681110", "h": 250, "w": 300, - "dealid":"test deal", + "dealid": "test deal", "ext": { "dspid": 6, "deal_channel": 1 } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" } } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": ["pubmatic.com"], - "crid": "29681110", - "w": 300, - "h": 250, - "dealid":"test deal", - "ext": { - "dspid": 6, - "deal_channel": 1 - } - }, - "type": "banner" - } - ] - } - ] - } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "pubmatic.com" + ], + "crid": "29681110", + "w": 300, + "h": 250, + "dealid": "test deal", + "ext": { + "dspid": 6, + "deal_channel": 1 + } + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file From c2ed9d8081b05e4e534d838a70578743614706cf Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 12:15:07 +0530 Subject: [PATCH 79/91] Fixed unwanted git merge changes --- adapters/rubicon/rubicon_test.go | 4 +- .../silvermobtest/exemplary/native-app.json | 1 + .../smartyadstest/exemplary/banner-app.json | 1 + .../smartyadstest/exemplary/native-app.json | 1 + config/config.go | 1 - ...valid-context-allowed-with-ext-bidder.json | 50 ----------------- ...id-context-allowed-with-prebid-bidder.json | 54 ------------------- ...ata-imp-ext-multiple-prebid-bidders.json } | 0 static/bidder-params/nobid.json | 2 +- .../category-mapping/freewheel/freewheel.json | 2 +- usersync/cookie.go | 6 +-- usersync/usersyncers/syncer.go | 0 12 files changed, 9 insertions(+), 113 deletions(-) delete mode 100644 endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json delete mode 100644 endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json rename exchange/exchangetest/{firstpartydata-imp-ext-multiple-prebid-bidders.json => firstpartydata-imp-ext-multiple-prebid-bidders.json } (100%) mode change 100755 => 100644 usersync/usersyncers/syncer.go diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index 8c38696e57a..dc5b3a90423 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "github.com/prebid/prebid-server/errortypes" "io/ioutil" "net/http" "net/http/httptest" @@ -13,6 +12,8 @@ import ( "time" "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/adapters/adapterstest" "github.com/prebid/prebid-server/cache/dummycache" "github.com/prebid/prebid-server/pbs" @@ -25,6 +26,7 @@ import ( "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" + "github.com/stretchr/testify/assert" ) diff --git a/adapters/silvermob/silvermobtest/exemplary/native-app.json b/adapters/silvermob/silvermobtest/exemplary/native-app.json index 56384a10ccf..c1cb8cf3d49 100644 --- a/adapters/silvermob/silvermobtest/exemplary/native-app.json +++ b/adapters/silvermob/silvermobtest/exemplary/native-app.json @@ -156,3 +156,4 @@ } ] } + \ No newline at end of file diff --git a/adapters/smartyads/smartyadstest/exemplary/banner-app.json b/adapters/smartyads/smartyadstest/exemplary/banner-app.json index 289380a9da6..56052236310 100644 --- a/adapters/smartyads/smartyadstest/exemplary/banner-app.json +++ b/adapters/smartyads/smartyadstest/exemplary/banner-app.json @@ -159,3 +159,4 @@ } ] } + \ No newline at end of file diff --git a/adapters/smartyads/smartyadstest/exemplary/native-app.json b/adapters/smartyads/smartyadstest/exemplary/native-app.json index dcf65ccaaa9..c14beb550ee 100644 --- a/adapters/smartyads/smartyadstest/exemplary/native-app.json +++ b/adapters/smartyads/smartyadstest/exemplary/native-app.json @@ -157,3 +157,4 @@ } ] } + \ No newline at end of file diff --git a/config/config.go b/config/config.go index 4d166452ea0..a52113a7f29 100755 --- a/config/config.go +++ b/config/config.go @@ -636,7 +636,6 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSomoaudience, "https://publisher-east.mobileadtrading.com/usersync?ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsomoaudience%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSonobi, "https://sync.go.sonobi.com/us.gif?loc="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsonobi%26consent_string%3D{{.GDPR}}%26gdpr%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSovrn, "https://ap.lijit.com/pixel?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsovrn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderSynacormedia, "https://sync.technoratimedia.com/services?srv=cs&pid=70&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dsynacormedia%26uid%3D%5BUSER_ID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTappx, "https://ssp.api.tappx.com/cs/usersync.php?gdpr_optin={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&type=iframe&ruid="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtappx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7B%7BTPPXUID%7D%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTelaria, "https://pbs.publishers.tremorhub.com/pubsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dtelaria%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Btvid%5D") diff --git a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json b/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json deleted file mode 100644 index 74dede0857f..00000000000 --- a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-ext-bidder.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "description": "The imp.ext.context field is valid for First Party Data and should be exempted from bidder name validation.", - - "mockBidRequest": { - "id": "some-request-id", - "site": { - "page": "test.somepage.com" - }, - "imp": [{ - "id": "some-imp-id", - "banner": { - "format": [{ - "w": 600, - "h": 500 - }, { - "w": 300, - "h": 600 - }] - }, - "ext": { - "appnexus": { - "placementId": 12883451 - }, - "context": { - "data": { - "keywords": "prebid server example" - } - } - } - }] - }, - "expectedBidResponse": { - "id":"some-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "appnexus-bid", - "impid": "", - "price": 0 - } - ], - "seat": "appnexus-bids" - } - ], - "bidid":"test bid id", - "nbr":0 - }, - "expectedReturnCode": 200 -} diff --git a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json b/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json deleted file mode 100644 index 41461813c40..00000000000 --- a/endpoints/openrtb2/sample-requests/first-party-data/valid-context-allowed-with-prebid-bidder.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "description": "The imp.ext.context field is valid for First Party Data and should be exempted from bidder name validation.", - - "mockBidRequest": { - "id": "some-request-id", - "site": { - "page": "test.somepage.com" - }, - "imp": [{ - "id": "some-imp-id", - "banner": { - "format": [{ - "w": 600, - "h": 500 - }, { - "w": 300, - "h": 600 - }] - }, - "ext": { - "prebid": { - "bidder": { - "appnexus": { - "placementId": 12883451 - } - } - }, - "context": { - "data": { - "keywords": "prebid server example" - } - } - } - }] - }, - "expectedBidResponse": { - "id":"some-request-id", - "seatbid": [ - { - "bid": [ - { - "id": "appnexus-bid", - "impid": "", - "price": 0 - } - ], - "seat": "appnexus-bids" - } - ], - "bidid":"test bid id", - "nbr":0 - }, - "expectedReturnCode": 200 -} diff --git a/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json b/exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json similarity index 100% rename from exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json rename to exchange/exchangetest/firstpartydata-imp-ext-multiple-prebid-bidders.json diff --git a/static/bidder-params/nobid.json b/static/bidder-params/nobid.json index 4179e2a9428..6293c40c9fd 100644 --- a/static/bidder-params/nobid.json +++ b/static/bidder-params/nobid.json @@ -8,7 +8,7 @@ "siteId": { "type": "integer", "description": "A Required ID which identifies the NoBid site. The siteId parameter is provided by your NoBid account manager." - }, "placementId": { + }, "placementId": { "type": "integer", "description": "An optional ID which identifies an adunit in a site. The placementId parameter is provided by your NoBid account manager." } diff --git a/static/category-mapping/freewheel/freewheel.json b/static/category-mapping/freewheel/freewheel.json index fe8c038542f..11529206087 100644 --- a/static/category-mapping/freewheel/freewheel.json +++ b/static/category-mapping/freewheel/freewheel.json @@ -1178,7 +1178,7 @@ "IAB22-3": { "id": "410", "name": "Product" - }, + }, "IAB1": { "id": "392", "name": "Entertainment" diff --git a/usersync/cookie.go b/usersync/cookie.go index 2e6bb79515f..c4e329b65e0 100644 --- a/usersync/cookie.go +++ b/usersync/cookie.go @@ -177,8 +177,6 @@ func (cookie *PBSCookie) GetId(bidderName openrtb_ext.BidderName) (id string, ex // SetCookieOnResponse is a shortcut for "ToHTTPCookie(); cookie.setDomain(domain); setCookie(w, cookie)" func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, setSiteCookie bool, cfg *config.HostCookie, ttl time.Duration) { httpCookie := cookie.ToHTTPCookie(ttl) - httpCookie.Secure = true - var domain string = cfg.Domain if domain != "" { @@ -207,10 +205,9 @@ func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, setSiteCooki var uidsCookieStr string var sameSiteCookie *http.Cookie if setSiteCookie { - //httpCookie.Secure = true + httpCookie.Secure = true uidsCookieStr = httpCookie.String() uidsCookieStr += SameSiteAttribute - sameSiteCookie = &http.Cookie{ Name: SameSiteCookieName, Value: SameSiteCookieValue, @@ -218,7 +215,6 @@ func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, setSiteCooki Path: "/", Secure: true, } - sameSiteCookieStr := sameSiteCookie.String() sameSiteCookieStr += SameSiteAttribute w.Header().Add("Set-Cookie", sameSiteCookieStr) diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go old mode 100755 new mode 100644 From 1efc3bf39a838923764e0b0a18b9f8f89ca42d49 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 14:34:41 +0530 Subject: [PATCH 80/91] Added missing field SkipDedup in ExtIncludeBrandCategory --- openrtb_ext/request.go | 1 + 1 file changed, 1 insertion(+) diff --git a/openrtb_ext/request.go b/openrtb_ext/request.go index 8624fc35a45..87807075d8e 100644 --- a/openrtb_ext/request.go +++ b/openrtb_ext/request.go @@ -120,6 +120,7 @@ type ExtIncludeBrandCategory struct { Publisher string `json:"publisher"` WithCategory bool `json:"withcategory"` TranslateCategories *bool `json:"translatecategories,omitempty"` + SkipDedup bool `json:"skipdedup"` } // Make an unmarshaller that will set a default PriceGranularity From 2273d692a72366cf641c4bcae4baf724b6d6139d Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 14:47:02 +0530 Subject: [PATCH 81/91] Added missing Bidder field in ExtBid type --- openrtb_ext/bid.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openrtb_ext/bid.go b/openrtb_ext/bid.go index 535ac76be04..a568392beba 100644 --- a/openrtb_ext/bid.go +++ b/openrtb_ext/bid.go @@ -1,12 +1,14 @@ package openrtb_ext import ( + "encoding/json" "fmt" ) // ExtBid defines the contract for bidresponse.seatbid.bid[i].ext type ExtBid struct { - Prebid *ExtBidPrebid `json:"prebid,omitempty"` + Prebid *ExtBidPrebid `json:"prebid,omitempty"` + Bidder json.RawMessage `json:"bidder,omitempty"` } // ExtBidPrebid defines the contract for bidresponse.seatbid.bid[i].ext.prebid From b202980dc27367402498d7584d7166416934958d Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 15:14:51 +0530 Subject: [PATCH 82/91] Exposing CookieSyncRequest for header-bidding --- endpoints/cookie_sync.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/endpoints/cookie_sync.go b/endpoints/cookie_sync.go index ba057478b08..0396ee9f107 100644 --- a/endpoints/cookie_sync.go +++ b/endpoints/cookie_sync.go @@ -232,6 +232,9 @@ func cookieSyncStatus(syncCount int) string { return "ok" } +type CookieSyncReq cookieSyncRequest +type CookieSyncResp cookieSyncResponse + type cookieSyncRequest struct { Bidders []string `json:"bidders"` GDPR *int `json:"gdpr"` From bccd2fa9f7ff1910f0f3f9a1d48a5db8f770d369 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 17:14:11 +0530 Subject: [PATCH 83/91] Temporary path change for static folder --- main.go | 2 +- router/router.go | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 294cc141169..acb5c2b967b 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ import ( // See issue #559 var Rev string -const schemaDirectory = "/home/http/GO_SERVER/dmhbserver/static/" +const schemaDirectory = "/Users/sachin/go/src/header-bidding/resource/static/" /* func init() { diff --git a/router/router.go b/router/router.go index f3c63228013..eca4c11bde7 100644 --- a/router/router.go +++ b/router/router.go @@ -192,8 +192,11 @@ type Router struct { } func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *Router, err error) { - const schemaDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-params" - const infoDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-info" + //const schemaDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-params" + //const infoDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-info" + + const schemaDirectory = "/Users/sachin/go/src/header-bidding/resource/static/bidder-params" + const infoDirectory = "/Users/sachin/go/src/header-bidding/resource/static/bidder-info" r = &Router{ Router: httprouter.New(), From 4a85a111cc61060a7a138188bcbb6a86abe62a9e Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 17:39:11 +0530 Subject: [PATCH 84/91] Fixed static folder paths --- config/config.go | 6 +++--- main.go | 2 +- router/router.go | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/config/config.go b/config/config.go index a52113a7f29..9b8bc1219d5 100755 --- a/config/config.go +++ b/config/config.go @@ -729,7 +729,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("datacache.cache_size", 0) v.SetDefault("datacache.ttl_seconds", 0) v.SetDefault("category_mapping.filesystem.enabled", true) - v.SetDefault("category_mapping.filesystem.directorypath", "./static/category-mapping") + v.SetDefault("category_mapping.filesystem.directorypath", "/home/http/GO_SERVER/dmhbserver/static/category-mapping") v.SetDefault("category_mapping.http.endpoint", "") v.SetDefault("stored_requests.filesystem.enabled", false) v.SetDefault("stored_requests.filesystem.directorypath", "./stored_requests/data/by_id") @@ -792,7 +792,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("event.timeout_ms", 1000) v.SetDefault("accounts.filesystem.enabled", false) - v.SetDefault("accounts.filesystem.directorypath", "./stored_requests/data/by_id") + v.SetDefault("accounts.filesystem.directorypath", "/Users/sachin/go/src/header-bidding/resource/static/stored_requests/data/by_id") v.SetDefault("accounts.in_memory_cache.type", "none") for _, bidder := range openrtb_ext.CoreBidderNames() { @@ -936,7 +936,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("gdpr.timeouts_ms.active_vendorlist_fetch", 0) v.SetDefault("gdpr.non_standard_publishers", []string{""}) v.SetDefault("gdpr.tcf1.fetch_gvl", false) - v.SetDefault("gdpr.tcf1.fallback_gvl_path", "./static/tcf1/fallback_gvl.json") + v.SetDefault("gdpr.tcf1.fallback_gvl_path", "/home/http/GO_SERVER/dmhbserver/static/tcf1/fallback_gvl.json") v.SetDefault("gdpr.tcf2.enabled", true) v.SetDefault("gdpr.tcf2.purpose1.enabled", true) v.SetDefault("gdpr.tcf2.purpose2.enabled", true) diff --git a/main.go b/main.go index acb5c2b967b..294cc141169 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ import ( // See issue #559 var Rev string -const schemaDirectory = "/Users/sachin/go/src/header-bidding/resource/static/" +const schemaDirectory = "/home/http/GO_SERVER/dmhbserver/static/" /* func init() { diff --git a/router/router.go b/router/router.go index eca4c11bde7..f3c63228013 100644 --- a/router/router.go +++ b/router/router.go @@ -192,11 +192,8 @@ type Router struct { } func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *Router, err error) { - //const schemaDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-params" - //const infoDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-info" - - const schemaDirectory = "/Users/sachin/go/src/header-bidding/resource/static/bidder-params" - const infoDirectory = "/Users/sachin/go/src/header-bidding/resource/static/bidder-info" + const schemaDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-params" + const infoDirectory = "/home/http/GO_SERVER/dmhbserver/static/bidder-info" r = &Router{ Router: httprouter.New(), From 57db5c28aba1fceb908febf1d1f1d38080440f28 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 18:15:14 +0530 Subject: [PATCH 85/91] Fixed default value in config for usersync_if_ambiguous --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 9b8bc1219d5..982c395e5e1 100755 --- a/config/config.go +++ b/config/config.go @@ -931,7 +931,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("amp_timeout_adjustment_ms", 0) v.SetDefault("gdpr.enabled", true) v.SetDefault("gdpr.host_vendor_id", 0) - v.SetDefault("gdpr.usersync_if_ambiguous", false) + v.SetDefault("gdpr.usersync_if_ambiguous", true) v.SetDefault("gdpr.timeouts_ms.init_vendorlist_fetches", 0) v.SetDefault("gdpr.timeouts_ms.active_vendorlist_fetch", 0) v.SetDefault("gdpr.non_standard_publishers", []string{""}) From c1c7f1bc89871954ed7cd9db403d346811910012 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 18:46:22 +0530 Subject: [PATCH 86/91] Fixed config after upgrade --- config/config.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 982c395e5e1..42656598940 100755 --- a/config/config.go +++ b/config/config.go @@ -607,7 +607,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGrid, "https://x.bidswitch.net/check_uuid/"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BBSW_UUID%7D?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGumGum, "https://rtb.gumgum.com/usync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderImprovedigital, "https://ad.360yield.com/server_match?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dimprovedigital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BPUB_USER_ID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderIx, "https://ssum.casalemedia.com/usermatchredir?s=184674&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dix%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderIx, "https://ssum.casalemedia.com/usermatchredir?s=186523&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dix%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") // openrtb_ext.BidderInvibes doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderJixie, "https://id.jixie.io/api/sync?pid=&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Djixie%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25JXUID%25%25") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderKrushmedia, "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dkrushmedia%26uid%3D%5BUID%5D") @@ -857,7 +857,8 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.gumgum.endpoint", "https://g2.gumgum.com/providers/prbds2s/bid") v.SetDefault("adapters.improvedigital.endpoint", "http://ad.360yield.com/pbs") v.SetDefault("adapters.inmobi.endpoint", "https://api.w.inmobi.com/showad/openrtb/bidder/prebid") - v.SetDefault("adapters.ix.disabled", true) + v.SetDefault("adapters.ix.disabled", false) + v.SetDefault("adapters.ix.endpoint", "http://exchange.indexww.com/pbs?p=192919") v.SetDefault("adapters.jixie.endpoint", "https://hb.jixie.io/v2/hbsvrpost") v.SetDefault("adapters.krushmedia.endpoint", "http://ads4.krushmedia.com/?c=rtb&m=req&key={{.AccountID}}") v.SetDefault("adapters.invibes.endpoint", "https://{{.Host}}/bid/ServerBidAdContent") @@ -887,7 +888,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.revcontent.endpoint", "https://trends.revcontent.com/rtb") v.SetDefault("adapters.rhythmone.endpoint", "http://tag.1rx.io/rmp") v.SetDefault("adapters.rtbhouse.endpoint", "http://prebidserver-s2s-ams.creativecdn.com/bidder/prebidserver/bids") - v.SetDefault("adapters.rubicon.disabled", true) + v.SetDefault("adapters.rubicon.disabled", false) v.SetDefault("adapters.rubicon.endpoint", "http://exapi-us-east.rubiconproject.com/a/api/exchange.json") v.SetDefault("adapters.sharethrough.endpoint", "http://btlr.sharethrough.com/FGMrCMMc/v1") v.SetDefault("adapters.silvermob.endpoint", "http://{{.Host}}.silvermob.com/marketplace/api/dsp/bid/{{.ZoneID}}") @@ -912,7 +913,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.valueimpression.endpoint", "https://rtb.valueimpression.com/endpoint") v.SetDefault("adapters.verizonmedia.disabled", true) v.SetDefault("adapters.visx.endpoint", "https://t.visx.net/s2s_bid?wrapperType=s2s_prebid_standard") - v.SetDefault("adapters.vrtcal.endpoint", "http://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804") + v.SetDefault("adapters.vrtcal.endpoint", "http://rtb.vrtcal.com/bidder_prebid.vap?ssp=1812") v.SetDefault("adapters.yeahmobi.endpoint", "https://{{.Host}}/prebid/bid") v.SetDefault("adapters.yieldlab.endpoint", "https://ad.yieldlab.net/yp/") v.SetDefault("adapters.yieldmo.endpoint", "https://ads.yieldmo.com/exchange/prebid-server") From bdb4996c38ccfe4151b35a0dc73670b85da81e75 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 19:02:58 +0530 Subject: [PATCH 87/91] Updated router.go to uncomment defaultRequest validation --- router/router.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/router/router.go b/router/router.go index f3c63228013..e79e9782f89 100644 --- a/router/router.go +++ b/router/router.go @@ -259,11 +259,12 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R g_activeBidders = exchange.GetActiveBidders(bidderInfos) g_disabledBidders = exchange.GetDisabledBiddersErrorMessages(bidderInfos) - _, g_defReqJSON = readDefaultRequest(cfg.DefReqConfig) - /*defaultAliases, defReqJSON := readDefaultRequest(cfg.DefReqConfig) + defaultAliases, defReqJSON := readDefaultRequest(cfg.DefReqConfig) if err := validateDefaultAliases(defaultAliases); err != nil { glog.Fatal(err) - }*/ + } + + g_defReqJSON = defReqJSON g_syncers = usersyncers.NewSyncerMap(cfg) gvlVendorIDs := bidderInfos.ToGVLVendorIDMap() From 21f070df5f6db457be1aab62fab419d70fdbf696 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 20:44:23 +0530 Subject: [PATCH 88/91] Fixed path for accounts.filesystem.directorypath --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 42656598940..6da41e4123b 100755 --- a/config/config.go +++ b/config/config.go @@ -792,7 +792,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("event.timeout_ms", 1000) v.SetDefault("accounts.filesystem.enabled", false) - v.SetDefault("accounts.filesystem.directorypath", "/Users/sachin/go/src/header-bidding/resource/static/stored_requests/data/by_id") + v.SetDefault("accounts.filesystem.directorypath", "./stored_requests/data/by_id") v.SetDefault("accounts.in_memory_cache.type", "none") for _, bidder := range openrtb_ext.CoreBidderNames() { From 01597f2d695cf19b964244d24b5e8ca064cbdfa3 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Wed, 28 Apr 2021 23:21:39 +0530 Subject: [PATCH 89/91] Fixed diff with OW --- adapters/appnexus/appnexus.go | 6 +- adapters/conversant/conversant.go | 2 +- .../conversanttest/exemplary/banner.json | 2 +- .../conversanttest/exemplary/simple_app.json | 2 +- .../conversanttest/exemplary/video.json | 2 +- .../supplemental/server_badresponse.json | 2 +- .../supplemental/server_nocontent.json | 2 +- .../supplemental/server_unknownstatus.json | 2 +- exchange/legacy.go | 11 +- exchange/targeting.go | 10 +- exchange/utils.go | 46 +++++ metrics/prometheus/prometheus.go | 37 ++++ metrics/prometheus/prometheus_test.go | 182 ++++++++++++++++++ usersync/cookie.go | 3 +- 14 files changed, 298 insertions(+), 11 deletions(-) diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index 4fcedf43117..8993c7249dc 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -678,7 +678,11 @@ func resolvePlatformID(platformID string) int { func loadCategoryMapFromFileSystem() map[string]string { // Load custom options for our adapter (currently just a lookup table to convert appnexus => iab categories) - opts, err := ioutil.ReadFile("./static/adapter/appnexus/opts.json") + opts, err := ioutil.ReadFile("./home/http/GO_SERVER/dmhbserver/static/adapter/appnexus/opts.json") + //this is for tests + if err != nil { + opts, err = ioutil.ReadFile("./static/adapter/appnexus/opts.json") + } if err == nil { var adapterOptions appnexusAdapterOptions diff --git a/adapters/conversant/conversant.go b/adapters/conversant/conversant.go index cdcf75665f3..63df55abaea 100644 --- a/adapters/conversant/conversant.go +++ b/adapters/conversant/conversant.go @@ -72,7 +72,7 @@ func (c ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *a } func parseCnvrParams(imp *openrtb2.Imp, cnvrExt openrtb_ext.ExtImpConversant) { - imp.DisplayManager = "prebid-s2s" + imp.DisplayManager = "pubmatic-openwrap" imp.DisplayManagerVer = "2.0.0" imp.BidFloor = cnvrExt.BidFloor imp.TagID = cnvrExt.TagID diff --git a/adapters/conversant/conversanttest/exemplary/banner.json b/adapters/conversant/conversanttest/exemplary/banner.json index 472e18f712d..9c3569eb40d 100644 --- a/adapters/conversant/conversanttest/exemplary/banner.json +++ b/adapters/conversant/conversanttest/exemplary/banner.json @@ -41,7 +41,7 @@ "tagid": "mytag", "secure": 1, "bidfloor": 0.01, - "displaymanager": "prebid-s2s", + "displaymanager": "pubmatic-openwrap", "displaymanagerver": "2.0.0", "banner": { "format": [{"w": 300, "h": 250}] diff --git a/adapters/conversant/conversanttest/exemplary/simple_app.json b/adapters/conversant/conversanttest/exemplary/simple_app.json index 303c60f75a9..d094f1f2c7f 100644 --- a/adapters/conversant/conversanttest/exemplary/simple_app.json +++ b/adapters/conversant/conversanttest/exemplary/simple_app.json @@ -45,7 +45,7 @@ "tagid": "mytag", "secure": 1, "bidfloor": 0.01, - "displaymanager": "prebid-s2s", + "displaymanager": "pubmatic-openwrap", "displaymanagerver": "2.0.0", "banner": { "format": [{"w": 300, "h": 250}] diff --git a/adapters/conversant/conversanttest/exemplary/video.json b/adapters/conversant/conversanttest/exemplary/video.json index 475dd796262..56606aab461 100644 --- a/adapters/conversant/conversanttest/exemplary/video.json +++ b/adapters/conversant/conversanttest/exemplary/video.json @@ -49,7 +49,7 @@ "tagid": "mytag", "secure": 1, "bidfloor": 0.01, - "displaymanager": "prebid-s2s", + "displaymanager": "pubmatic-openwrap", "displaymanagerver": "2.0.0", "video": { "w": 300, diff --git a/adapters/conversant/conversanttest/supplemental/server_badresponse.json b/adapters/conversant/conversanttest/supplemental/server_badresponse.json index 96cb4b46452..0cab9523ba6 100644 --- a/adapters/conversant/conversanttest/supplemental/server_badresponse.json +++ b/adapters/conversant/conversanttest/supplemental/server_badresponse.json @@ -30,7 +30,7 @@ "imp": [ { "id": "1", - "displaymanager": "prebid-s2s", + "displaymanager": "pubmatic-openwrap", "displaymanagerver": "2.0.0", "banner": { "format": [{"w": 300, "h": 250}] diff --git a/adapters/conversant/conversanttest/supplemental/server_nocontent.json b/adapters/conversant/conversanttest/supplemental/server_nocontent.json index ad86d19d6b2..15707c757e3 100644 --- a/adapters/conversant/conversanttest/supplemental/server_nocontent.json +++ b/adapters/conversant/conversanttest/supplemental/server_nocontent.json @@ -30,7 +30,7 @@ "imp": [ { "id": "1", - "displaymanager": "prebid-s2s", + "displaymanager": "pubmatic-openwrap", "displaymanagerver": "2.0.0", "banner": { "format": [{"w": 300, "h": 250}] diff --git a/adapters/conversant/conversanttest/supplemental/server_unknownstatus.json b/adapters/conversant/conversanttest/supplemental/server_unknownstatus.json index 85586f066c6..cabfeaf321c 100644 --- a/adapters/conversant/conversanttest/supplemental/server_unknownstatus.json +++ b/adapters/conversant/conversanttest/supplemental/server_unknownstatus.json @@ -30,7 +30,7 @@ "imp": [ { "id": "1", - "displaymanager": "prebid-s2s", + "displaymanager": "pubmatic-openwrap", "displaymanagerver": "2.0.0", "banner": { "format": [{"w": 300, "h": 250}] diff --git a/exchange/legacy.go b/exchange/legacy.go index 3983ce132ed..0e7d1590686 100644 --- a/exchange/legacy.go +++ b/exchange/legacy.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "github.com/buger/jsonparser" "github.com/mxmCherry/openrtb/v15/openrtb2" @@ -89,7 +90,15 @@ func (bidder *adaptedAdapter) toLegacyRequest(req *openrtb2.BidRequest) (*pbs.PB } isDebug := false - if req.Test == 1 { + var requestExt openrtb_ext.ExtRequest + if req.Ext != nil { + err = json.Unmarshal(req.Ext, &requestExt) + if err != nil { + return nil, fmt.Errorf("Error decoding Request.ext : %s", err.Error()) + } + } + + if requestExt.Prebid.Debug { isDebug = true } diff --git a/exchange/targeting.go b/exchange/targeting.go index f00e43d200c..c4710f826f0 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -76,7 +76,7 @@ func (targData *targetData) setTargeting(auc *auction, isApp bool, categoryMappi if len(categoryMapping) > 0 { targData.addKeys(targets, openrtb_ext.HbCategoryDurationKey, categoryMapping[topBidPerBidder.bid.ID], bidderName, isOverallWinner) } - + targData.addBidderKeys(targets, topBidPerBidder.bidTargets) topBidPerBidder.bidTargets = targets } } @@ -97,3 +97,11 @@ func makeHbSize(bid *openrtb2.Bid) string { } return "" } + +func (targData *targetData) addBidderKeys(keys map[string]string, bidderKeys map[string]string) { + if targData.includeBidderKeys { + for index, element := range bidderKeys { + keys[index] = element + } + } +} \ No newline at end of file diff --git a/exchange/utils.go b/exchange/utils.go index 5bde1bd7889..38d21751f8f 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -189,6 +189,29 @@ func extractLMT(orig *openrtb2.BidRequest, privacyConfig config.Privacy) privacy } } +func getBidderExts(reqExt *openrtb_ext.ExtRequest) (map[string]map[string]interface{}, error) { + if reqExt == nil { + return nil, nil + } + + if reqExt.Prebid.BidderParams == nil { + return nil, nil + } + + pbytes, err := json.Marshal(reqExt.Prebid.BidderParams) + if err != nil { + return nil, err + } + + var bidderParams map[string]map[string]interface{} + err = json.Unmarshal(pbytes, &bidderParams) + if err != nil { + return nil, err + } + + return bidderParams, nil +} + func getAuctionBidderRequests(req AuctionRequest, requestExt *openrtb_ext.ExtRequest, impsByBidder map[string][]openrtb2.Imp, @@ -201,6 +224,14 @@ func getAuctionBidderRequests(req AuctionRequest, return nil, []error{err} } + var bidderExt map[string]map[string]interface{} + if requestExt != nil { + bidderExt, err = getBidderExts(requestExt) + if err != nil { + return nil, []error{err} + } + } + var sChainsByBidder map[string]*openrtb_ext.ExtRequestPrebidSChainSChain sChainsByBidder, err = BidderToPrebidSChains(requestExt) @@ -223,6 +254,21 @@ func getAuctionBidderRequests(req AuctionRequest, prepareSource(&reqCopy, bidder, sChainsByBidder) + if len(bidderExt) != 0 { + bidderName := openrtb_ext.BidderName(bidder) + if bidderParams, ok := bidderExt[string(bidderName)]; ok { + requestExt.Prebid.BidderParams = bidderParams + } else { + requestExt.Prebid.BidderParams = nil + } + + if reqCopy.Ext, err = getExtJson(req.BidRequest, requestExt); err != nil { + return nil, []error{err} + } + } else { + reqCopy.Ext = reqExt + } + if err := removeUnpermissionedEids(&reqCopy, bidder, requestExt); err != nil { errs = append(errs, fmt.Errorf("unable to enforce request.ext.prebid.data.eidpermissions because %v", err)) continue diff --git a/metrics/prometheus/prometheus.go b/metrics/prometheus/prometheus.go index 487dcb77356..33b36fbb61c 100644 --- a/metrics/prometheus/prometheus.go +++ b/metrics/prometheus/prometheus.go @@ -379,6 +379,43 @@ func NewMetrics(cfg config.PrometheusMetrics, disabledMetrics config.DisabledMet []string{requestTypeLabel, requestStatusLabel}, queuedRequestTimeBuckets) + metrics.adapterDuplicateBidIDCounter = newCounter(cfg, metrics.Registry, + "duplicate_bid_ids", + "Number of collisions observed for given adaptor", + []string{adapterLabel}) + + metrics.requestsDuplicateBidIDCounter = newCounterWithoutLabels(cfg, metrics.Registry, + "requests_having_duplicate_bid_ids", + "Count of number of request where bid collision is detected.") + + // adpod specific metrics + metrics.podImpGenTimer = newHistogramVec(cfg, metrics.Registry, + "impr_gen", + "Time taken by Ad Pod Impression Generator in seconds", []string{podAlgorithm, podNoOfImpressions}, + // 200 µS, 250 µS, 275 µS, 300 µS + //[]float64{0.000200000, 0.000250000, 0.000275000, 0.000300000}) + // 100 µS, 200 µS, 300 µS, 400 µS, 500 µS, 600 µS, + []float64{0.000100000, 0.000200000, 0.000300000, 0.000400000, 0.000500000, 0.000600000}) + + metrics.podCombGenTimer = newHistogramVec(cfg, metrics.Registry, + "comb_gen", + "Time taken by Ad Pod Combination Generator in seconds", []string{podAlgorithm, podTotalCombinations}, + // 200 µS, 250 µS, 275 µS, 300 µS + //[]float64{0.000200000, 0.000250000, 0.000275000, 0.000300000}) + []float64{0.000100000, 0.000200000, 0.000300000, 0.000400000, 0.000500000, 0.000600000}) + + metrics.podCompExclTimer = newHistogramVec(cfg, metrics.Registry, + "comp_excl", + "Time taken by Ad Pod Compititve Exclusion in seconds", []string{podAlgorithm, podNoOfResponseBids}, + // 200 µS, 250 µS, 275 µS, 300 µS + //[]float64{0.000200000, 0.000250000, 0.000275000, 0.000300000}) + []float64{0.000100000, 0.000200000, 0.000300000, 0.000400000, 0.000500000, 0.000600000}) + + metrics.adapterVideoBidDuration = newHistogramVec(cfg, metrics.Registry, + "adapter_vidbid_dur", + "Video Ad durations returned by the bidder", []string{adapterLabel}, + []float64{4, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 120}) + preloadLabelValues(&metrics) return &metrics diff --git a/metrics/prometheus/prometheus_test.go b/metrics/prometheus/prometheus_test.go index b2ffff34850..9b4dc2aa09e 100644 --- a/metrics/prometheus/prometheus_test.go +++ b/metrics/prometheus/prometheus_test.go @@ -2,6 +2,7 @@ package prometheusmetrics import ( "fmt" + "strconv" "testing" "time" @@ -1447,6 +1448,187 @@ func TestRecordRequestPrivacy(t *testing.T) { }) } +// TestRecordRequestDuplicateBidID checks RecordRequestDuplicateBidID +func TestRecordRequestDuplicateBidID(t *testing.T) { + m := createMetricsForTesting() + m.RecordRequestHavingDuplicateBidID() + // verify total no of requests which detected collision + assertCounterValue(t, "request cnt having duplicate bid.id", "request cnt having duplicate bid.id", m.requestsDuplicateBidIDCounter, float64(1)) +} + +// TestRecordAdapterDuplicateBidID checks RecordAdapterDuplicateBidID +func TestRecordAdapterDuplicateBidID(t *testing.T) { + type collisions struct { + simulate int // no of bids to be simulate with same bid.id + expect int // no of collisions expected to be recorded by metrics engine for given bidder + } + type bidderCollisions = map[string]collisions + testCases := []struct { + scenario string + bidderCollisions bidderCollisions // represents no of collisions detected for bid.id at bidder level for given request + expectCollisions int + }{ + {scenario: "invalid collision value", bidderCollisions: map[string]collisions{"bidder-1": {simulate: -1, expect: 0}}}, + {scenario: "no collision", bidderCollisions: map[string]collisions{"bidder-1": {simulate: 0, expect: 0}}}, + {scenario: "one collision", bidderCollisions: map[string]collisions{"bidder-1": {simulate: 1, expect: 1}}}, + {scenario: "multiple collisions", bidderCollisions: map[string]collisions{"bidder-1": {simulate: 2, expect: 2}}}, + {scenario: "multiple bidders", bidderCollisions: map[string]collisions{"bidder-1": {simulate: 2, expect: 2}, "bidder-2": {simulate: 4, expect: 4}}}, + {scenario: "multiple bidders with bidder-1 no collision", bidderCollisions: map[string]collisions{"bidder-1": {simulate: 0, expect: 0}, + "bidder-2": {simulate: 4, expect: 4}}}, + } + + for _, testcase := range testCases { + m := createMetricsForTesting() + for bidder, collisions := range testcase.bidderCollisions { + for collision := 1; collision <= collisions.simulate; collision++ { + m.RecordAdapterDuplicateBidID(bidder, 1) + } + assertCounterVecValue(t, testcase.scenario, testcase.scenario, m.adapterDuplicateBidIDCounter, float64(collisions.expect), prometheus.Labels{ + adapterLabel: bidder, + }) + } + } +} + +func TestRecordPodImpGenTime(t *testing.T) { + impressions := 4 + testAlgorithmMetrics(t, impressions, func(m *Metrics) dto.Histogram { + m.RecordPodImpGenTime(metrics.PodLabels{AlgorithmName: "sample_imp_algo", NoOfImpressions: &impressions}, time.Now()) + return getHistogramFromHistogramVec(m.podImpGenTimer, podNoOfImpressions, strconv.Itoa(impressions)) + }) +} + +func TestRecordPodCombGenTime(t *testing.T) { + combinations := 5 + testAlgorithmMetrics(t, combinations, func(m *Metrics) dto.Histogram { + m.RecordPodCombGenTime(metrics.PodLabels{AlgorithmName: "sample_comb_algo", NoOfCombinations: &combinations}, time.Since(time.Now())) + return getHistogramFromHistogramVec(m.podCombGenTimer, podTotalCombinations, strconv.Itoa(combinations)) + }) +} + +func TestRecordPodCompetitiveExclusionTime(t *testing.T) { + totalBids := 8 + testAlgorithmMetrics(t, totalBids, func(m *Metrics) dto.Histogram { + m.RecordPodCompititveExclusionTime(metrics.PodLabels{AlgorithmName: "sample_comt_excl_algo", NoOfResponseBids: &totalBids}, time.Since(time.Now())) + return getHistogramFromHistogramVec(m.podCompExclTimer, podNoOfResponseBids, strconv.Itoa(totalBids)) + }) +} + +func TestRecordAdapterVideoBidDuration(t *testing.T) { + + testCases := []struct { + description string + bidderAdDurations map[string][]int + expectedSum map[string]int + expectedCount map[string]int + expectedBuckets map[string]map[int]int // cumulative + }{ + { + description: "single bidder multiple ad durations", + bidderAdDurations: map[string][]int{ + "bidder_1": {5, 10, 11, 32}, + }, + expectedSum: map[string]int{"bidder_1": 58}, + expectedCount: map[string]int{"bidder_1": 4}, + expectedBuckets: map[string]map[int]int{ + "bidder_1": {5: 1, 10: 2, 15: 3, 35: 4}, // Upper bound : cumulative number + }, + }, + { + description: "multiple bidders multiple ad durations", + bidderAdDurations: map[string][]int{ + "bidder_1": {5, 10, 11, 32, 39}, + "bidder_2": {25, 30}, + }, + expectedSum: map[string]int{"bidder_1": 97, "bidder_2": 55}, + expectedCount: map[string]int{"bidder_1": 5, "bidder_2": 2}, + expectedBuckets: map[string]map[int]int{ + "bidder_1": {5: 1, 10: 2, 15: 3, 35: 4, 40: 5}, + "bidder_2": {25: 1, 30: 2}, + }, + }, + { + description: "bidder with 0 ad durations", + bidderAdDurations: map[string][]int{ + "bidder_1": {5, 0, 0, 27}, + }, + expectedSum: map[string]int{"bidder_1": 32}, + expectedCount: map[string]int{"bidder_1": 2}, // must exclude 2 observations having 0 durations + expectedBuckets: map[string]map[int]int{ + "bidder_1": {5: 1, 30: 2}, + }, + }, + { + description: "bidder with similar durations", + bidderAdDurations: map[string][]int{ + "bidder_1": {23, 23, 23}, + }, + expectedSum: map[string]int{"bidder_1": 69}, + expectedCount: map[string]int{"bidder_1": 3}, // + expectedBuckets: map[string]map[int]int{ + "bidder_1": {25: 3}, + }, + }, + { + description: "bidder with ad durations >= 60", + bidderAdDurations: map[string][]int{ + "bidder_1": {33, 60, 93, 90, 90, 120}, + }, + expectedSum: map[string]int{"bidder_1": 486}, + expectedCount: map[string]int{"bidder_1": 6}, // + expectedBuckets: map[string]map[int]int{ + "bidder_1": {35: 1, 60: 2, 120: 6}, + }, + }, + } + + for _, test := range testCases { + t.Run(test.description, func(t *testing.T) { + m := createMetricsForTesting() + for adapterName, adDurations := range test.bidderAdDurations { + for _, adDuration := range adDurations { + m.RecordAdapterVideoBidDuration(metrics.AdapterLabels{ + Adapter: openrtb_ext.BidderName(adapterName), + }, adDuration) + } + result := getHistogramFromHistogramVec(m.adapterVideoBidDuration, adapterLabel, adapterName) + for bucketDuration, durationCnt := range test.expectedBuckets[adapterName] { + validBucket := false + for _, bucket := range result.GetBucket() { + if int(bucket.GetUpperBound()) == bucketDuration { + validBucket = true + assert.Equal(t, uint64(durationCnt), bucket.GetCumulativeCount()) + break + } + } + if !validBucket { + assert.Fail(t, "Invalid expected bucket = "+strconv.Itoa(bucketDuration)) + } + } + expectedCount := test.expectedCount[adapterName] + expectedSum := test.expectedSum[adapterName] + assertHistogram(t, "adapter_vidbid_dur", result, uint64(expectedCount), float64(expectedSum)) + } + }) + } +} + +func testAlgorithmMetrics(t *testing.T, input int, f func(m *Metrics) dto.Histogram) { + // test input + adRequests := 2 + m := createMetricsForTesting() + var result dto.Histogram + for req := 1; req <= adRequests; req++ { + result = f(m) + } + + // assert observations + assert.Equal(t, uint64(adRequests), result.GetSampleCount(), "ad requests : count") + for _, bucket := range result.Bucket { + assert.Equal(t, uint64(adRequests), bucket.GetCumulativeCount(), "total observations") + } +} + func assertCounterValue(t *testing.T, description, name string, counter prometheus.Counter, expected float64) { m := dto.Metric{} counter.Write(&m) diff --git a/usersync/cookie.go b/usersync/cookie.go index c4e329b65e0..f5083a83bbe 100644 --- a/usersync/cookie.go +++ b/usersync/cookie.go @@ -178,6 +178,7 @@ func (cookie *PBSCookie) GetId(bidderName openrtb_ext.BidderName) (id string, ex func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, setSiteCookie bool, cfg *config.HostCookie, ttl time.Duration) { httpCookie := cookie.ToHTTPCookie(ttl) var domain string = cfg.Domain + httpCookie.Secure = true if domain != "" { httpCookie.Domain = domain @@ -205,7 +206,7 @@ func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, setSiteCooki var uidsCookieStr string var sameSiteCookie *http.Cookie if setSiteCookie { - httpCookie.Secure = true + //httpCookie.Secure = true uidsCookieStr = httpCookie.String() uidsCookieStr += SameSiteAttribute sameSiteCookie = &http.Cookie{ From 7d1e416601995cfd8eee0542c7bbc9fbad30bedf Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Thu, 29 Apr 2021 13:10:25 +0530 Subject: [PATCH 90/91] Added DMX default usersync URL --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 6da41e4123b..7a7deaa43ad 100755 --- a/config/config.go +++ b/config/config.go @@ -595,7 +595,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderCpmstar, "https://server.cpmstar.com/usersync.aspx?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dcpmstar%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDatablocks, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D") // openrtb_ext.BidderDecenterAds doesn't have a good default. - // openrtb_ext.BidderDMX doesn't have a good default. + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDmx, "https://dmx.districtm.io/s/v1/img/s/10007?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D%24%7Bgdpr%7D%26gdpr_consent%3D%24%7Bgdpr_consent%7D%26uid%3D%24%7Buid%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDeepintent, "https://match.deepintent.com/usersync/136?id=unk&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddeepintent%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEmxDigital, "https://cs.emxdgt.com/um?ssp=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") From d4bba5353d11050e127578cad3e914b9a8c4d864 Mon Sep 17 00:00:00 2001 From: Sachin Survase Date: Thu, 29 Apr 2021 16:14:43 +0530 Subject: [PATCH 91/91] Reverted Dmx default usersync url, Will add it in properties file --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 3ee661c05bc..66a11ca71bf 100755 --- a/config/config.go +++ b/config/config.go @@ -596,7 +596,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderCpmstar, "https://server.cpmstar.com/usersync.aspx?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dcpmstar%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDatablocks, "https://sync.v5prebid.datablocks.net/s2ssync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D") // openrtb_ext.BidderDecenterAds doesn't have a good default. - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDmx, "https://dmx.districtm.io/s/v1/img/s/10007?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddatablocks%26gdpr%3D%24%7Bgdpr%7D%26gdpr_consent%3D%24%7Bgdpr_consent%7D%26uid%3D%24%7Buid%7D") + // openrtb_ext.BidderDmx doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderDeepintent, "https://match.deepintent.com/usersync/136?id=unk&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Ddeepintent%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEmxDigital, "https://cs.emxdgt.com/um?ssp=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Demx_digital%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D")