From b1de2fe1f1d8c00c2798d3f0955e3aaaa69da5f6 Mon Sep 17 00:00:00 2001 From: PubMatic-OpenWrap Date: Wed, 17 Feb 2021 20:37:41 +0530 Subject: [PATCH] Revert "Prebid upgrade 0.146.0 ci1 (#117)" This reverts commit 984ee22ee5ee0c3b09f677fe5b4c0a08b1a70d45. --- .github/workflows/validate-merge.yml | 24 - .github/workflows/validate.yml | 23 +- .travis.yml | 2 +- Dockerfile | 2 +- README.md | 2 +- account/account.go | 4 +- account/account_test.go | 4 +- adapters/33across/33across.go | 129 ++-- adapters/33across/33across_test.go | 11 +- .../exemplary/bidresponse-defaults.json | 17 +- .../exemplary/instream-video-defaults.json | 17 +- .../33acrosstest/exemplary/multi-format.json | 17 +- .../exemplary/multi-imp-banner.json | 200 ------- .../exemplary/optional-params.json | 17 +- .../exemplary/outstream-video-defaults.json | 17 +- .../{site-banner.json => simple-banner.json} | 17 +- .../{site-video.json => simple-video.json} | 17 +- .../multi-imp-mixed-validation.json | 121 ---- .../supplemental/status-not-ok.json | 17 +- .../supplemental/video-validation-fail.json | 4 + adapters/acuityads/acuityads.go | 16 +- adapters/acuityads/acuityads_test.go | 19 +- .../acuityadstest/exemplary/banner-app.json | 280 +++++---- .../acuityadstest/exemplary/banner-web.json | 4 +- .../acuityadstest/exemplary/native-app.json | 6 +- .../acuityadstest/exemplary/native-web.json | 4 +- .../acuityadstest/exemplary/video-app.json | 4 +- .../acuityadstest/exemplary/video-web.json | 41 +- .../invalid-acuityads-ext-object.json | 29 - adapters/adform/adform.go | 81 ++- adapters/adform/adform_test.go | 40 +- .../exemplary/multiformat-impression.json | 2 +- .../exemplary/single-banner-impression.json | 2 +- .../exemplary/single-video-impression.json | 2 +- .../adformtest/supplemental/user-nil.json | 5 +- adapters/adgeneration/adgeneration.go | 9 +- adapters/adgeneration/adgeneration_test.go | 61 +- adapters/adhese/adhese.go | 15 +- adapters/adhese/adhese_test.go | 19 +- adapters/adkernel/adkernel.go | 17 +- adapters/adkernel/adkernel_test.go | 19 +- adapters/adkernelAdn/adkernelAdn.go | 17 +- adapters/adkernelAdn/adkernelAdn_test.go | 19 +- adapters/adman/adman.go | 10 +- adapters/adman/adman_test.go | 12 +- .../admantest/supplemental/status-204.json | 141 +++-- adapters/admixer/admixer.go | 12 +- adapters/admixer/admixer_test.go | 14 +- .../exemplary/optional-params.json | 3 +- adapters/admixer/usersync_test.go | 4 +- adapters/adocean/adocean.go | 17 +- adapters/adocean/adocean_test.go | 20 +- adapters/adoppler/adoppler.go | 15 +- adapters/adoppler/adoppler_test.go | 10 +- adapters/adot/adot.go | 117 ---- adapters/adot/adot_test.go | 76 --- .../adottest/exemplary/simple-banner.json | 94 --- .../exemplary/simple-interstitial.json | 101 ---- .../adottest/exemplary/simple-native.json | 88 --- .../adot/adottest/exemplary/simple-video.json | 120 ---- .../adot/adottest/params/race/banner.json | 3 - adapters/adot/adottest/params/race/video.json | 3 - .../adottest/supplemental/simple-audio.json | 66 -- .../supplemental/simple-parallax.json | 103 ---- .../adottest/supplemental/status_204.json | 39 -- .../adottest/supplemental/status_400.json | 62 -- .../adottest/supplemental/status_500.json | 62 -- .../supplemental/unmarshal_error.json | 62 -- adapters/adot/params_test.go | 53 -- adapters/adpone/adpone.go | 9 +- adapters/adpone/adpone_test.go | 11 +- adapters/adprime/adprime.go | 10 +- adapters/adprime/adprime_test.go | 12 +- .../adprimetest/supplemental/status-204.json | 3 +- adapters/adtarget/adtarget.go | 9 +- adapters/adtarget/adtarget_test.go | 11 +- .../adtargettest/exemplary/simple-banner.json | 5 +- .../adtargettest/exemplary/simple-video.json | 5 +- .../supplemental/explicit-dimensions.json | 3 +- adapters/adtelligent/adtelligent.go | 9 +- adapters/adtelligent/adtelligent_test.go | 11 +- .../exemplary/simple-banner.json | 3 +- .../exemplary/simple-video.json | 3 +- .../supplemental/explicit-dimensions.json | 3 +- adapters/advangelists/advangelists.go | 17 +- adapters/advangelists/advangelists_test.go | 22 +- adapters/aja/aja.go | 12 +- adapters/aja/aja_test.go | 11 +- adapters/amx/amx.go | 25 +- adapters/amx/amx_test.go | 45 +- .../amx/amxtest/exemplary/app-simple.json | 2 +- .../amxtest/exemplary/display-multiple.json | 292 --------- .../amx/amxtest/exemplary/video-simple.json | 4 +- .../amx/amxtest/exemplary/web-simple.json | 4 +- .../amxtest/supplemental/204-response.json | 2 +- .../amxtest/supplemental/400-response.json | 2 +- .../amxtest/supplemental/500-response.json | 2 +- adapters/applogy/applogy.go | 9 +- adapters/applogy/applogy_test.go | 11 +- .../applogytest/supplemental/status-204.json | 3 +- adapters/appnexus/appnexus.go | 73 +-- adapters/appnexus/appnexus_test.go | 27 +- .../exemplary/optional-params.json | 3 +- .../simple-banner-foreign-currency.json | 141 ----- .../supplemental/explicit-dimensions.json | 3 +- .../supplemental/no-bid-204.json | 3 +- adapters/audienceNetwork/facebook.go | 49 +- adapters/audienceNetwork/facebook_test.go | 65 +- adapters/avocet/avocet.go | 10 +- adapters/avocet/avocet_test.go | 10 +- .../avocet/avocettest/exemplary/banner.json | 112 ---- .../avocet/avocettest/exemplary/video.json | 104 ---- adapters/beachfront/beachfront.go | 50 +- adapters/beachfront/beachfront_test.go | 53 +- .../exemplary/adm-video-by-default.json | 123 ---- .../exemplary/adm-video-by-explicit-type.json | 124 ---- .../banner-and-adm-video-by-default.json | 187 ------ ...banner-and-adm-video-by-explicit-type.json | 188 ------ .../exemplary/banner-and-nurl-video.json | 189 ------ .../exemplary/minimal-banner.json | 95 +++ .../exemplary/simple-adm-video.json | 150 +++++ .../beachfronttest/exemplary/simple-mix.json | 214 +++++++ ...nurl-video.json => simple-nurl-video.json} | 44 +- ...on => minimal-banner-empty_array-200.json} | 17 +- .../supplemental/minimal-mobile-video.json | 119 ++++ .../minimal-site-banner.json} | 19 +- .../supplemental/mobile-banner.json | 128 ++++ .../supplemental/multi-banner.json | 138 +++++ .../supplemental/multi-video.json | 235 ++++++++ ...response-order--banner-adm-nurl--PASS.json | 465 -------------- .../supplemental/two-four-combo.json | 263 -------- .../supplemental/unmarshal-error-banner.json | 4 +- ...nmarshal-error-but-another-good-video.json | 172 ++++++ .../supplemental/unmarshal-error-video.json | 2 +- adapters/beintoo/beintoo.go | 9 +- adapters/beintoo/beintoo_test.go | 12 +- .../beintootest/exemplary/minimal-banner.json | 29 +- .../supplemental/add-bidfloor.json | 3 +- .../supplemental/build-banner-object.json | 3 +- .../invalid-response-no-bids.json | 3 +- .../supplemental/server-no-content.json | 5 +- .../site-domain-and-url-correctly-parsed.json | 3 +- adapters/between/between.go | 271 ++++----- adapters/between/between_test.go | 22 +- .../betweentest/exemplary/multi-request.json | 34 +- .../betweentest/exemplary/secure-detect.json | 106 ---- .../exemplary/simple-site-banner.json | 29 +- .../betweentest/params/race/banner.json | 3 +- .../supplemental/bad-bidder-ext.json | 32 +- .../supplemental/bad-dsp-request-example.json | 26 +- .../supplemental/bad-response-body.json | 145 ++--- .../dsp-server-internal-error-example.json | 26 +- .../supplemental/missing-format.json | 34 -- .../supplemental/missing-host.json | 34 +- .../betweentest/supplemental/missing-imp.json | 7 +- .../supplemental/missing-publisher.json | 38 -- .../betweentest/supplemental/no-bids.json | 27 +- .../unknown-status-code-example.json | 30 +- .../supplemental/zero-bid-request-error.json | 2 +- adapters/between/params_test.go | 61 -- adapters/between/usersync.go | 13 - adapters/between/usersync_test.go | 24 - adapters/bidder.go | 16 +- adapters/brightroll/brightroll.go | 37 +- adapters/brightroll/brightroll_test.go | 50 +- .../exemplary/banner-native-audio.json | 32 +- .../exemplary/banner-video-native.json | 32 +- .../exemplary/banner-video.json | 32 +- .../exemplary/simple-banner.json | 32 +- .../exemplary/simple-video.json | 26 +- .../exemplary/valid-extension.json | 24 +- .../exemplary/video-and-audio.json | 24 +- adapters/colossus/colossus.go | 10 +- adapters/colossus/colossus_test.go | 12 +- .../colossustest/supplemental/status-204.json | 3 +- adapters/connectad/connectad.go | 9 +- adapters/connectad/connectad_test.go | 11 +- adapters/consumable/consumable.go | 14 +- adapters/consumable/consumable_test.go | 27 +- adapters/conversant/cnvr_legacy.go | 2 +- adapters/conversant/cnvr_legacy_test.go | 30 +- adapters/conversant/conversant.go | 9 +- adapters/conversant/conversant_test.go | 13 +- .../supplemental/server_nocontent.json | 3 +- adapters/cpmstar/cpmstar.go | 9 +- adapters/cpmstar/cpmstar_test.go | 11 +- .../exemplary/banner-and-video.json | 50 +- .../cpmstar/cpmstartest/exemplary/video.json | 3 +- .../supplemental/explicit-dimensions.json | 5 +- .../invalid-response-no-bids.json | 5 +- .../supplemental/server-no-content.json | 52 +- adapters/datablocks/datablocks.go | 22 +- adapters/datablocks/datablocks_test.go | 19 +- adapters/decenterads/decenterads.go | 124 ---- adapters/decenterads/decenterads_test.go | 18 - .../exemplary/simple-banner.json | 128 ---- .../exemplary/simple-video.json | 116 ---- .../exemplary/simple-web-banner.json | 126 ---- .../decenteradstest/params/race/banner.json | 3 - .../decenteradstest/params/race/video.json | 3 - .../supplemental/bad-imp-ext.json | 41 -- .../supplemental/bad_response.json | 83 --- .../supplemental/bad_status_code.json | 77 --- .../supplemental/imp_ext_empty_object.json | 37 -- .../supplemental/imp_ext_string.json | 37 -- .../supplemental/status-204.json | 78 --- .../supplemental/status-404.json | 83 --- adapters/decenterads/params_test.go | 48 -- adapters/deepintent/deepintent.go | 191 ------ adapters/deepintent/deepintent_test.go | 21 - .../exemplary/simple-banner.json | 140 ----- .../exemplary/simple-web-banner.json | 139 ----- .../deepintenttest/params/banner.json | 3 - .../deepintenttest/params/race/banner.json | 3 - .../supplemental/bad_response.json | 91 --- .../supplemental/no_banner.json | 26 - .../deepintenttest/supplemental/no_ext-1.json | 30 - .../deepintenttest/supplemental/no_ext-2.json | 30 - .../deepintenttest/supplemental/no_ext.json | 29 - .../supplemental/no_format.json | 30 - .../supplemental/status-204.json | 85 --- .../supplemental/status-404.json | 91 --- .../deepintenttest/supplemental/wrongext.json | 42 -- .../deepintenttest/supplemental/wrongimp.json | 121 ---- adapters/deepintent/params_test.go | 46 -- adapters/deepintent/usersync.go | 13 - adapters/deepintent/usersync_test.go | 35 -- adapters/dmx/dmx.go | 53 +- adapters/dmx/dmx_test.go | 145 +---- .../exemplary/imp-populated-banner.json | 9 +- .../dmx/dmxtest/exemplary/simple-app.json | 9 +- adapters/dmx/params_test.go | 53 -- adapters/emx_digital/emx_digital.go | 15 +- adapters/emx_digital/emx_digital_test.go | 20 +- .../exemplary/banner-and-video-app.json | 54 +- .../exemplary/banner-and-video-site.json | 54 +- .../emx_digitaltest/exemplary/banner-app.json | 27 +- .../exemplary/minimal-banner.json | 27 +- .../emx_digitaltest/exemplary/video-app.json | 30 +- .../emx_digitaltest/exemplary/video-ctv.json | 29 +- .../emx_digitaltest/exemplary/video-site.json | 29 +- .../supplemental/add-bidfloor.json | 3 +- .../app-domain-and-url-correctly-parsed.json | 3 +- .../app-storeUrl-correctly-parsed.json | 3 +- .../supplemental/build-banner-object.json | 3 +- .../supplemental/build-video-object.json | 3 +- .../invalid-response-no-bids.json | 3 +- .../supplemental/server-no-content.json | 3 +- .../site-domain-and-url-correctly-parsed.json | 3 +- adapters/engagebdr/engagebdr.go | 17 +- adapters/engagebdr/engagebdr_test.go | 15 +- adapters/eplanning/eplanning.go | 54 +- adapters/eplanning/eplanning_test.go | 21 +- ...anner-2-sizes-in-priority-list-mobile.json | 81 --- ...nner-3-sizes-in-priority-list-desktop.json | 85 --- ...anner-3-sizes-in-priority-list-mobile.json | 85 --- ...er-3-sizes-inout-priority-list-mobile.json | 85 --- ...nner-4-sizes-in-priority-list-desktop.json | 89 --- .../invalid-response-no-bids.json | 81 ++- .../supplemental/server-no-content.json | 51 +- adapters/gamma/gamma.go | 9 +- adapters/gamma/gamma_test.go | 11 +- .../exemplary/banner-and-video-and-audio.json | 137 ++--- .../gammatest/exemplary/simple-banner.json | 66 +- .../gammatest/exemplary/valid-extension.json | 70 +-- .../exemplary/valid-full-params.json | 91 ++- adapters/gamoshi/gamoshi.go | 9 +- adapters/gamoshi/gamoshi_test.go | 24 +- .../exemplary/banner-and-audio.json | 30 +- .../exemplary/banner-and-video.json | 30 +- .../exemplary/banner-native-audio.json | 30 +- .../exemplary/banner-video-native.json | 30 +- .../gamoshitest/exemplary/simple-banner.json | 30 +- .../gamoshitest/exemplary/simple-video.json | 24 +- .../exemplary/valid-extension.json | 24 +- .../exemplary/valid-with-device.json | 24 +- .../exemplary/video-and-audio.json | 24 +- adapters/grid/grid.go | 10 +- adapters/grid/grid_test.go | 11 +- adapters/gumgum/gumgum.go | 17 +- adapters/gumgum/gumgum_test.go | 14 +- adapters/improvedigital/improvedigital.go | 10 +- .../improvedigital/improvedigital_test.go | 11 +- adapters/info.go | 13 +- adapters/inmobi/inmobi.go | 12 +- adapters/inmobi/inmobi_test.go | 14 +- .../inmobi/inmobitest/supplemental/204.json | 67 +-- adapters/invibes/invibes.go | 20 +- adapters/invibes/invibes_test.go | 19 +- adapters/invibes/invibestest/amp/amp-ad.json | 3 +- .../invibes/invibestest/exemplary/no-ad.json | 3 +- .../invibestest/exemplary/test-ad.json | 3 +- adapters/ix/ix.go | 272 ++------- adapters/ix/ix_test.go | 261 +++----- .../ixtest/exemplary/additional-consent.json | 124 ---- .../ix/ixtest/exemplary/banner-no-format.json | 108 ---- .../ix/ixtest/exemplary/max-requests.json | 255 -------- adapters/ix/ixtest/exemplary/no-pub-id.json | 121 ---- adapters/ix/ixtest/exemplary/no-pub.json | 117 ---- .../ix/ixtest/exemplary/simple-audio.json | 102 ---- .../exemplary/simple-banner-multi-size.json | 201 ------- .../ix/ixtest/exemplary/simple-native.json | 104 ---- .../ix/ixtest/exemplary/simple-video.json | 134 ----- adapters/ix/ixtest/params/race/audio.json | 4 - adapters/ix/ixtest/params/race/banner.json | 3 +- adapters/ix/ixtest/params/race/native.json | 4 - adapters/ix/ixtest/params/race/video.json | 3 +- .../ixtest/supplemental/bad-ext-bidder.json | 22 - .../ix/ixtest/supplemental/bad-ext-ix.json | 21 - .../ix/ixtest/supplemental/bad-imp-id.json | 118 ---- .../ix/ixtest/supplemental/bad-request.json | 63 -- .../supplemental/bad-response-body.json | 65 -- .../ix/ixtest/supplemental/no-content.json | 57 -- adapters/ix/ixtest/supplemental/no-imp.json | 6 - .../ix/ixtest/supplemental/not-found.json | 63 -- adapters/kidoz/kidoz.go | 9 +- adapters/kidoz/kidoz_test.go | 28 +- .../kidoztest/exemplary/simple-banner.json | 5 +- .../kidoztest/exemplary/simple-video.json | 3 +- .../kidoztest/supplemental/status-204.json | 5 +- adapters/krushmedia/krushmedia.go | 14 +- adapters/krushmedia/krushmedia_test.go | 19 +- .../krushmediatest/exemplary/banner-app.json | 285 +++++---- .../krushmediatest/exemplary/banner-web.json | 4 +- .../krushmediatest/exemplary/native-app.json | 6 +- .../krushmediatest/exemplary/native-web.json | 4 +- .../krushmediatest/exemplary/video-app.json | 4 +- .../krushmediatest/exemplary/video-web.json | 41 +- adapters/kubient/kubient.go | 12 +- adapters/kubient/kubient_test.go | 14 +- .../kubient/kubienttest/exemplary/banner.json | 30 +- .../kubient/kubienttest/exemplary/video.json | 30 +- adapters/legacy.go | 2 +- adapters/lifestreet/lifestreet.go | 5 +- adapters/lifestreet/lifestreet_test.go | 2 +- adapters/lockerdome/lockerdome.go | 9 +- adapters/lockerdome/lockerdome_test.go | 14 +- adapters/logicad/logicad.go | 9 +- adapters/logicad/logicad_test.go | 14 +- adapters/lunamedia/lunamedia.go | 15 +- adapters/lunamedia/lunamedia_test.go | 22 +- adapters/marsmedia/marsmedia.go | 9 +- adapters/marsmedia/marsmedia_test.go | 11 +- .../exemplary/simple-banner.json | 36 +- .../marsmediatest/exemplary/simple-video.json | 24 +- .../exemplary/valid-extension.json | 24 +- adapters/mediafuse/usersync.go | 12 - adapters/mediafuse/usersync_test.go | 30 - adapters/mgid/mgid.go | 12 +- adapters/mgid/mgid_test.go | 14 +- adapters/mobfoxpb/mobfoxpb.go | 131 ---- adapters/mobfoxpb/mobfoxpb_test.go | 18 - .../mobfoxpbtest/exemplary/simple-banner.json | 132 ---- .../mobfoxpbtest/exemplary/simple-video.json | 119 ---- .../exemplary/simple-web-banner.json | 130 ---- .../mobfoxpbtest/params/race/banner.json | 3 - .../mobfoxpbtest/params/race/video.json | 3 - .../supplemental/bad-imp-ext.json | 42 -- .../supplemental/bad_response.json | 87 --- .../supplemental/bad_status_code.json | 81 --- .../supplemental/imp_ext_empty_object.json | 38 -- .../supplemental/imp_ext_string.json | 38 -- .../mobfoxpbtest/supplemental/status-204.json | 82 --- .../mobfoxpbtest/supplemental/status-404.json | 87 --- adapters/mobfoxpb/params_test.go | 47 -- adapters/mobilefuse/mobilefuse.go | 23 +- adapters/mobilefuse/mobilefuse_test.go | 22 +- .../exemplary/multi-format.json | 2 +- .../mobilefusetest/exemplary/multi-imps.json | 2 +- .../mobilefusetest/exemplary/no-bid.json | 2 +- .../exemplary/optional-params.json | 2 +- .../exemplary/simple-banner.json | 2 +- .../exemplary/simple-video.json | 2 +- .../supplemental/bad-status-code.json | 2 +- .../supplemental/server-error-response.json | 2 +- adapters/nanointeractive/nanointeractive.go | 26 +- .../nanointeractive/nanointeractive_test.go | 14 +- .../exemplary/simple-banner.json | 34 +- .../supplemental/multi-param.json | 34 +- adapters/ninthdecimal/ninthdecimal.go | 15 +- adapters/ninthdecimal/ninthdecimal_test.go | 22 +- adapters/nobid/nobid.go | 10 +- adapters/nobid/nobid_test.go | 12 +- adapters/openx/openx.go | 9 +- adapters/openx/openx_test.go | 18 +- .../openxtest/exemplary/optional-params.json | 3 +- adapters/orbidder/orbidder.go | 12 +- adapters/orbidder/orbidder_test.go | 13 +- adapters/pubmatic/pubmatic.go | 15 +- adapters/pubmatic/pubmatic_test.go | 33 +- adapters/pubnative/pubnative.go | 9 +- adapters/pubnative/pubnative_test.go | 11 +- adapters/pulsepoint/params_test.go | 59 -- adapters/pulsepoint/pulsepoint.go | 185 +----- adapters/pulsepoint/pulsepoint_test.go | 50 +- .../pulsepointtest/exemplary/banner-app.json | 101 ---- .../pulsepointtest/exemplary/banner.json | 101 ---- .../exemplary/empty-pub-node-app.json | 96 --- .../exemplary/empty-pub-node-site.json | 96 --- .../pulsepointtest/exemplary/multi-imps.json | 151 ----- .../pulsepointtest/exemplary/native.json | 97 --- .../pulsepointtest/exemplary/video.json | 105 ---- .../pulsepointtest/params/race/banner.json | 1 + .../pulsepointtest/params/race/native.json | 4 - .../pulsepointtest/params/race/video.json | 4 - .../supplemental/bad-bid-data.json | 90 --- .../supplemental/bad-input.json | 70 --- .../supplemental/bad-prebid-params.json | 32 - .../supplemental/bad-prebid.ext.json | 27 - .../pulsepointtest/supplemental/error.json | 70 --- .../supplemental/impid-mismatch.json | 87 --- .../pulsepointtest/supplemental/passback.json | 68 --- adapters/revcontent/revcontent.go | 105 ---- adapters/revcontent/revcontent_test.go | 21 - .../revcontenttest/exemplary/no-bid.json | 45 -- .../exemplary/simple-banner.json | 85 --- .../exemplary/simple-native.json | 76 --- .../supplemental/bad_response.json | 49 -- .../supplemental/missing_app_name.json | 23 - .../supplemental/missing_domain.json | 23 - .../supplemental/status_400.json | 49 -- .../supplemental/status_500.json | 49 -- adapters/rhythmone/rhythmone.go | 12 +- adapters/rhythmone/rhythmone_test.go | 14 +- .../exemplary/banner-and-video-app.json | 311 +++++----- .../exemplary/banner-and-video-gdpr.json | 250 ++++---- .../exemplary/banner-and-video-site.json | 259 ++++---- .../exemplary/banner-and-video.json | 242 ++++---- .../exemplary/simple-banner.json | 157 +++-- .../rhythmonetest/exemplary/simple-video.json | 152 +++-- .../supplemental/missing-extension.json | 40 +- adapters/rtbhouse/rtbhouse.go | 12 +- adapters/rtbhouse/rtbhouse_test.go | 11 +- adapters/rubicon/rubicon.go | 67 +-- adapters/rubicon/rubicon_test.go | 68 +-- .../rubicontest/exemplary/simple-video.json | 159 ----- .../supplemental/required-video-size-id.json | 2 +- adapters/sharethrough/sharethrough.go | 15 +- adapters/sharethrough/sharethrough_test.go | 19 +- adapters/silvermob/silvermob.go | 16 +- adapters/silvermob/silvermob_test.go | 20 +- .../silvermobtest/exemplary/native-app.json | 6 +- .../silvermobtest/exemplary/video-app.json | 4 +- adapters/smaato/smaato.go | 10 +- adapters/smaato/smaato_test.go | 11 +- adapters/smartadserver/params_test.go | 4 +- adapters/smartadserver/smartadserver.go | 9 +- adapters/smartadserver/smartadserver_test.go | 11 +- .../supplemental/response-204.json | 3 +- adapters/smartrtb/smartrtb.go | 16 +- adapters/smartrtb/smartrtb_test.go | 19 +- .../smartrtbtest/supplemental/empty-imps.json | 6 +- .../smartrtbtest/supplemental/nobid.json | 3 +- adapters/smartyads/smartyads.go | 14 +- adapters/smartyads/smartyads_test.go | 19 +- .../smartyadstest/exemplary/banner-app.json | 31 +- .../smartyadstest/exemplary/banner-web.json | 4 +- .../smartyadstest/exemplary/native-app.json | 6 +- .../smartyadstest/exemplary/native-web.json | 4 +- .../smartyadstest/exemplary/video-app.json | 4 +- .../smartyadstest/exemplary/video-web.json | 41 +- adapters/somoaudience/somoaudience.go | 9 +- adapters/somoaudience/somoaudience_test.go | 11 +- adapters/sonobi/sonobi.go | 34 +- adapters/sonobi/sonobi_test.go | 16 +- adapters/sovrn/sovrn.go | 22 +- adapters/sovrn/sovrn_test.go | 27 +- adapters/spotx/spotx.go | 12 +- adapters/synacormedia/synacormedia.go | 16 +- adapters/synacormedia/synacormedia_test.go | 19 +- .../supplemental/status_204.json | 3 +- adapters/tappx/tappx.go | 36 +- adapters/tappx/tappx_test.go | 35 +- adapters/telaria/telaria.go | 24 +- adapters/telaria/telaria_test.go | 44 +- .../telariatest/exemplary/video-app.json | 39 +- .../telariatest/exemplary/video-web.json | 39 +- adapters/triplelift/triplelift.go | 10 +- adapters/triplelift/triplelift_test.go | 14 +- .../exemplary/optional-params.json | 3 +- .../triplelift_native/triplelift_native.go | 55 +- .../triplelift_native_test.go | 44 +- .../exemplary/optional-params.json | 3 +- adapters/ucfunnel/ucfunnel.go | 23 +- adapters/ucfunnel/ucfunnel_test.go | 34 +- adapters/unruly/params_test.go | 47 -- adapters/unruly/unruly.go | 34 +- adapters/unruly/unruly_test.go | 33 +- .../unruly/unrulytest/params/race/video.json | 4 +- adapters/valueimpression/valueimpression.go | 9 +- .../valueimpression/valueimpression_test.go | 11 +- .../exemplary/banner-and-video.json | 50 +- .../valueimpressiontest/exemplary/video.json | 3 +- .../supplemental/explicit-dimensions.json | 5 +- .../invalid-response-no-bids.json | 5 +- .../supplemental/server-no-content.json | 3 +- adapters/verizonmedia/verizonmedia.go | 48 +- adapters/verizonmedia/verizonmedia_test.go | 45 +- .../exemplary/simple-app-banner.json | 117 ---- adapters/visx/visx.go | 11 +- adapters/visx/visx_test.go | 11 +- adapters/vrtcal/vrtcal.go | 10 +- adapters/vrtcal/vrtcal_test.go | 11 +- adapters/yeahmobi/yeahmobi.go | 22 +- adapters/yeahmobi/yeahmobi_test.go | 22 +- adapters/yieldlab/yieldlab.go | 10 +- adapters/yieldlab/yieldlab_test.go | 28 +- adapters/yieldmo/yieldmo.go | 9 +- adapters/yieldmo/yieldmo_test.go | 11 +- adapters/yieldone/yieldone.go | 10 +- adapters/yieldone/yieldone_test.go | 11 +- adapters/zeroclickfraud/zeroclickfraud.go | 22 +- .../zeroclickfraud/zeroclickfraud_test.go | 19 +- amp/parse.go | 110 ---- amp/parse_test.go | 168 ------ analytics/core.go | 15 +- config/accounts.go | 1 - config/adapter.go | 136 ----- config/config.go | 216 +++++-- config/config_test.go | 59 +- config/interstitial.go | 510 ++++++++-------- config/stored_requests.go | 10 +- config/stored_requests_test.go | 4 +- {currency => currencies}/constant_rates.go | 2 +- .../constant_rates_test.go | 8 +- {currency => currencies}/converter_info.go | 2 +- {currency => currencies}/rate_converter.go | 2 +- .../rate_converter_test.go | 2 +- {currency => currencies}/rates.go | 2 +- {currency => currencies}/rates_test.go | 24 +- docs/developers/add-new-bidder.md | 0 docs/developers/cookie-syncs.md | 0 docs/developers/default-request.md | 0 endpoints/auction.go | 117 ++-- endpoints/auction_test.go | 92 +-- endpoints/cookie_sync.go | 37 +- endpoints/cookie_sync_test.go | 22 +- endpoints/currency_rates.go | 4 +- endpoints/currency_rates_test.go | 8 +- endpoints/events/vtrack.go | 48 +- endpoints/info/bidders.go | 7 +- endpoints/info/bidders_test.go | 38 +- endpoints/openrtb2/amp_auction.go | 194 +++--- endpoints/openrtb2/amp_auction_test.go | 94 +-- endpoints/openrtb2/auction.go | 149 ++--- endpoints/openrtb2/auction_benchmark_test.go | 34 +- endpoints/openrtb2/auction_test.go | 470 +++------------ .../openrtb2/ctv/response/adpod_generator.go | 10 +- endpoints/openrtb2/ctv_auction.go | 40 +- endpoints/openrtb2/interstitial.go | 2 +- endpoints/openrtb2/video_auction.go | 54 +- endpoints/openrtb2/video_auction_test.go | 62 +- endpoints/setuid.go | 81 ++- endpoints/setuid_test.go | 53 +- errortypes/aggregate.go | 48 -- errortypes/aggregate_test.go | 41 -- exchange/adapter_builders.go | 205 ------- exchange/adapter_map.go | 257 ++++++++ exchange/adapter_map_test.go | 71 +++ exchange/adapter_util.go | 140 ----- exchange/adapter_util_test.go | 423 ------------- exchange/auction.go | 12 +- exchange/auction_test.go | 128 ++-- exchange/bidder.go | 60 +- exchange/bidder_test.go | 300 ++++------ exchange/bidder_validate_bids.go | 14 +- exchange/bidder_validate_bids_test.go | 20 +- exchange/events.go | 115 ---- exchange/events_test.go | 138 ----- .../json-account-off-request-off.json | 49 -- .../json-account-off-request-on.json | 49 -- .../json-account-on-request-off.json | 49 -- .../json-account-on-request-on.json | 49 -- exchange/exchange.go | 238 +++----- exchange/exchange_test.go | 531 +++++----------- .../exchangetest/append-bidder-names.json | 5 +- exchange/exchangetest/debuglog_disabled.json | 3 + exchange/exchangetest/debuglog_enabled.json | 3 + .../eidpermissions-allowed-alias.json | 123 ---- .../exchangetest/eidpermissions-allowed.json | 117 ---- .../exchangetest/eidpermissions-denied.json | 111 ---- .../events-bid-account-off-request-off.json | 97 --- .../events-bid-account-off-request-on.json | 106 ---- .../events-bid-account-on-request-off.json | 104 ---- .../events-vast-account-off-request-off.json | 157 ----- .../events-vast-account-off-request-on.json | 160 ----- .../events-vast-account-on-request-off.json | 159 ----- .../request-multi-bidders-debug-info.json | 4 - exchange/gdpr.go | 20 +- exchange/gdpr_test.go | 123 +--- exchange/legacy.go | 4 +- exchange/legacy_test.go | 24 +- exchange/targeting_test.go | 13 +- exchange/utils.go | 248 +++----- exchange/utils_test.go | 565 ++++-------------- gdpr/gdpr.go | 44 +- gdpr/gdpr_test.go | 102 ---- gdpr/impl.go | 103 ++-- gdpr/impl_test.go | 246 ++------ gdpr/vendorlist-fetching.go | 27 +- gdpr/vendorlist-fetching_test.go | 349 ++++++++++- go.mod | 5 +- go.sum | 2 + hooks/pre-push | 6 + main.go | 4 +- openrtb_ext/bid.go | 36 +- openrtb_ext/bidders.go | 271 ++++----- openrtb_ext/bidders_test.go | 21 +- openrtb_ext/imp_adot.go | 6 - openrtb_ext/imp_between.go | 5 +- openrtb_ext/imp_decenterads.go | 5 - openrtb_ext/imp_deepintent.go | 5 - openrtb_ext/imp_ix.go | 7 - openrtb_ext/imp_pulsepoint.go | 9 - openrtb_ext/request.go | 17 +- openrtb_ext/response.go | 16 +- pbs/usersync.go | 6 +- {metrics => pbsmetrics}/config/metrics.go | 108 ++-- .../config/metrics_test.go | 127 ++-- {metrics => pbsmetrics}/go_metrics.go | 35 +- {metrics => pbsmetrics}/go_metrics_test.go | 31 +- {metrics => pbsmetrics}/metrics.go | 21 +- {metrics => pbsmetrics}/metrics_mock.go | 6 +- {metrics => pbsmetrics}/prometheus/preload.go | 4 +- .../prometheus/preload_test.go | 0 .../prometheus/prometheus.go | 85 ++- .../prometheus/prometheus_test.go | 329 +++++----- .../prometheus/type_conversion.go | 24 +- prebid_cache_client/client.go | 8 +- prebid_cache_client/client_test.go | 12 +- privacy/enforcement.go | 12 +- privacy/enforcement_test.go | 64 +- router/admin.go | 4 +- router/aspects/request_timeout_handler.go | 9 +- .../aspects/request_timeout_handler_test.go | 13 +- router/router.go | 86 ++- router/router_test.go | 8 +- server/listener.go | 6 +- server/listener_test.go | 8 +- server/prometheus.go | 4 +- server/server.go | 6 +- .../mockcertificates/mock-certs.pem | 0 {server/ssl => ssl}/ssl.go | 0 {server/ssl => ssl}/ssl_test.go | 0 static/bidder-info/33across.yaml | 4 + static/bidder-info/adot.yaml | 14 - static/bidder-info/adprime.yaml | 4 +- static/bidder-info/decenterads.yaml | 14 - static/bidder-info/deepintent.yaml | 9 - static/bidder-info/dmx.yaml | 2 +- static/bidder-info/ix.yaml | 9 - static/bidder-info/kubient.yaml | 2 +- static/bidder-info/mediafuse.yaml | 11 - static/bidder-info/mobfoxpb.yaml | 11 - static/bidder-info/openx.yaml | 1 - static/bidder-info/pulsepoint.yaml | 6 - static/bidder-info/revcontent.yaml | 11 - static/bidder-info/verizonmedia.yaml | 3 - static/bidder-params/adot.json | 17 - static/bidder-params/beachfront.json | 2 +- static/bidder-params/between.json | 19 +- static/bidder-params/decenterads.json | 18 - static/bidder-params/deepintent.json | 14 - static/bidder-params/dmx.json | 20 +- static/bidder-params/mediafuse.json | 26 - static/bidder-params/mobfoxpb.json | 14 - static/bidder-params/pulsepoint.json | 7 +- static/bidder-params/revcontent.json | 9 - static/bidder-params/unruly.json | 2 +- stored_requests/config/config.go | 8 +- stored_requests/config/config_test.go | 6 +- stored_requests/events/postgres/database.go | 44 +- .../events/postgres/database_test.go | 58 +- stored_requests/fetcher.go | 18 +- stored_requests/fetcher_test.go | 56 +- usersync/cookie.go | 6 +- usersync/usersync.go | 2 +- usersync/usersyncers/syncer.go | 10 +- usersync/usersyncers/syncer_test.go | 22 +- 679 files changed, 8353 insertions(+), 24839 deletions(-) delete mode 100644 .github/workflows/validate-merge.yml delete mode 100644 adapters/33across/33acrosstest/exemplary/multi-imp-banner.json rename adapters/33across/33acrosstest/exemplary/{site-banner.json => simple-banner.json} (85%) rename adapters/33across/33acrosstest/exemplary/{site-video.json => simple-video.json} (87%) delete mode 100644 adapters/33across/33acrosstest/supplemental/multi-imp-mixed-validation.json delete mode 100644 adapters/acuityads/acuityadstest/supplemental/invalid-acuityads-ext-object.json delete mode 100644 adapters/adot/adot.go delete mode 100644 adapters/adot/adot_test.go delete mode 100644 adapters/adot/adottest/exemplary/simple-banner.json delete mode 100644 adapters/adot/adottest/exemplary/simple-interstitial.json delete mode 100644 adapters/adot/adottest/exemplary/simple-native.json delete mode 100644 adapters/adot/adottest/exemplary/simple-video.json delete mode 100644 adapters/adot/adottest/params/race/banner.json delete mode 100644 adapters/adot/adottest/params/race/video.json delete mode 100644 adapters/adot/adottest/supplemental/simple-audio.json delete mode 100644 adapters/adot/adottest/supplemental/simple-parallax.json delete mode 100644 adapters/adot/adottest/supplemental/status_204.json delete mode 100644 adapters/adot/adottest/supplemental/status_400.json delete mode 100644 adapters/adot/adottest/supplemental/status_500.json delete mode 100644 adapters/adot/adottest/supplemental/unmarshal_error.json delete mode 100644 adapters/adot/params_test.go delete mode 100644 adapters/amx/amxtest/exemplary/display-multiple.json delete mode 100644 adapters/appnexus/appnexustest/exemplary/simple-banner-foreign-currency.json delete mode 100644 adapters/avocet/avocettest/exemplary/banner.json delete mode 100644 adapters/avocet/avocettest/exemplary/video.json delete mode 100644 adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json delete mode 100644 adapters/beachfront/beachfronttest/exemplary/adm-video-by-explicit-type.json delete mode 100644 adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-default.json delete mode 100644 adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-explicit-type.json delete mode 100644 adapters/beachfront/beachfronttest/exemplary/banner-and-nurl-video.json create mode 100644 adapters/beachfront/beachfronttest/exemplary/minimal-banner.json create mode 100644 adapters/beachfront/beachfronttest/exemplary/simple-adm-video.json create mode 100644 adapters/beachfront/beachfronttest/exemplary/simple-mix.json rename adapters/beachfront/beachfronttest/exemplary/{nurl-video.json => simple-nurl-video.json} (71%) rename adapters/beachfront/beachfronttest/supplemental/{banner-empty_array-200.json => minimal-banner-empty_array-200.json} (75%) create mode 100644 adapters/beachfront/beachfronttest/supplemental/minimal-mobile-video.json rename adapters/beachfront/beachfronttest/{exemplary/banner.json => supplemental/minimal-site-banner.json} (83%) create mode 100644 adapters/beachfront/beachfronttest/supplemental/mobile-banner.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/multi-banner.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/multi-video.json delete mode 100644 adapters/beachfront/beachfronttest/supplemental/six-nine-combo--response-order--banner-adm-nurl--PASS.json delete mode 100644 adapters/beachfront/beachfronttest/supplemental/two-four-combo.json create mode 100644 adapters/beachfront/beachfronttest/supplemental/unmarshal-error-but-another-good-video.json delete mode 100644 adapters/between/betweentest/exemplary/secure-detect.json delete mode 100644 adapters/between/betweentest/supplemental/missing-format.json delete mode 100644 adapters/between/betweentest/supplemental/missing-publisher.json delete mode 100644 adapters/between/params_test.go delete mode 100644 adapters/between/usersync.go delete mode 100644 adapters/between/usersync_test.go delete mode 100644 adapters/decenterads/decenterads.go delete mode 100644 adapters/decenterads/decenterads_test.go delete mode 100644 adapters/decenterads/decenteradstest/exemplary/simple-banner.json delete mode 100644 adapters/decenterads/decenteradstest/exemplary/simple-video.json delete mode 100644 adapters/decenterads/decenteradstest/exemplary/simple-web-banner.json delete mode 100644 adapters/decenterads/decenteradstest/params/race/banner.json delete mode 100644 adapters/decenterads/decenteradstest/params/race/video.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/bad-imp-ext.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/bad_response.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/bad_status_code.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/imp_ext_empty_object.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/imp_ext_string.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/status-204.json delete mode 100644 adapters/decenterads/decenteradstest/supplemental/status-404.json delete mode 100644 adapters/decenterads/params_test.go delete mode 100644 adapters/deepintent/deepintent.go delete mode 100644 adapters/deepintent/deepintent_test.go delete mode 100644 adapters/deepintent/deepintenttest/exemplary/simple-banner.json delete mode 100644 adapters/deepintent/deepintenttest/exemplary/simple-web-banner.json delete mode 100644 adapters/deepintent/deepintenttest/params/banner.json delete mode 100644 adapters/deepintent/deepintenttest/params/race/banner.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/bad_response.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/no_banner.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/no_ext-1.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/no_ext-2.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/no_ext.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/no_format.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/status-204.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/status-404.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/wrongext.json delete mode 100644 adapters/deepintent/deepintenttest/supplemental/wrongimp.json delete mode 100644 adapters/deepintent/params_test.go delete mode 100644 adapters/deepintent/usersync.go delete mode 100644 adapters/deepintent/usersync_test.go delete mode 100644 adapters/dmx/params_test.go delete mode 100644 adapters/eplanning/eplanningtest/supplemental/banner-2-sizes-in-priority-list-mobile.json delete mode 100644 adapters/eplanning/eplanningtest/supplemental/banner-3-sizes-in-priority-list-desktop.json delete mode 100644 adapters/eplanning/eplanningtest/supplemental/banner-3-sizes-in-priority-list-mobile.json delete mode 100644 adapters/eplanning/eplanningtest/supplemental/banner-3-sizes-inout-priority-list-mobile.json delete mode 100644 adapters/eplanning/eplanningtest/supplemental/banner-4-sizes-in-priority-list-desktop.json delete mode 100644 adapters/ix/ixtest/exemplary/additional-consent.json delete mode 100644 adapters/ix/ixtest/exemplary/banner-no-format.json delete mode 100644 adapters/ix/ixtest/exemplary/max-requests.json delete mode 100644 adapters/ix/ixtest/exemplary/no-pub-id.json delete mode 100644 adapters/ix/ixtest/exemplary/no-pub.json delete mode 100644 adapters/ix/ixtest/exemplary/simple-audio.json delete mode 100644 adapters/ix/ixtest/exemplary/simple-banner-multi-size.json delete mode 100644 adapters/ix/ixtest/exemplary/simple-native.json delete mode 100644 adapters/ix/ixtest/exemplary/simple-video.json delete mode 100644 adapters/ix/ixtest/params/race/audio.json delete mode 100644 adapters/ix/ixtest/params/race/native.json delete mode 100644 adapters/ix/ixtest/supplemental/bad-ext-bidder.json delete mode 100644 adapters/ix/ixtest/supplemental/bad-ext-ix.json delete mode 100644 adapters/ix/ixtest/supplemental/bad-imp-id.json delete mode 100644 adapters/ix/ixtest/supplemental/bad-request.json delete mode 100644 adapters/ix/ixtest/supplemental/bad-response-body.json delete mode 100644 adapters/ix/ixtest/supplemental/no-content.json delete mode 100644 adapters/ix/ixtest/supplemental/no-imp.json delete mode 100644 adapters/ix/ixtest/supplemental/not-found.json delete mode 100644 adapters/mediafuse/usersync.go delete mode 100644 adapters/mediafuse/usersync_test.go delete mode 100644 adapters/mobfoxpb/mobfoxpb.go delete mode 100644 adapters/mobfoxpb/mobfoxpb_test.go delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-banner.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-video.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/exemplary/simple-web-banner.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/banner.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/params/race/video.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/bad-imp-ext.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_response.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/bad_status_code.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_empty_object.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/imp_ext_string.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/status-204.json delete mode 100644 adapters/mobfoxpb/mobfoxpbtest/supplemental/status-404.json delete mode 100644 adapters/mobfoxpb/params_test.go delete mode 100644 adapters/pulsepoint/params_test.go delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/banner-app.json delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/banner.json delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/empty-pub-node-app.json delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/empty-pub-node-site.json delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/multi-imps.json delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/native.json delete mode 100644 adapters/pulsepoint/pulsepointtest/exemplary/video.json delete mode 100644 adapters/pulsepoint/pulsepointtest/params/race/native.json delete mode 100644 adapters/pulsepoint/pulsepointtest/params/race/video.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/bad-bid-data.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/bad-input.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid-params.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/bad-prebid.ext.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/error.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/impid-mismatch.json delete mode 100644 adapters/pulsepoint/pulsepointtest/supplemental/passback.json delete mode 100644 adapters/revcontent/revcontent.go delete mode 100644 adapters/revcontent/revcontent_test.go delete mode 100644 adapters/revcontent/revcontenttest/exemplary/no-bid.json delete mode 100644 adapters/revcontent/revcontenttest/exemplary/simple-banner.json delete mode 100644 adapters/revcontent/revcontenttest/exemplary/simple-native.json delete mode 100644 adapters/revcontent/revcontenttest/supplemental/bad_response.json delete mode 100644 adapters/revcontent/revcontenttest/supplemental/missing_app_name.json delete mode 100644 adapters/revcontent/revcontenttest/supplemental/missing_domain.json delete mode 100644 adapters/revcontent/revcontenttest/supplemental/status_400.json delete mode 100644 adapters/revcontent/revcontenttest/supplemental/status_500.json delete mode 100644 adapters/rubicon/rubicontest/exemplary/simple-video.json delete mode 100644 adapters/unruly/params_test.go delete mode 100644 adapters/verizonmedia/verizonmediatest/exemplary/simple-app-banner.json delete mode 100644 amp/parse.go delete mode 100644 amp/parse_test.go delete mode 100644 config/adapter.go rename {currency => currencies}/constant_rates.go (98%) rename {currency => currencies}/constant_rates_test.go (91%) rename {currency => currencies}/converter_info.go (97%) rename {currency => currencies}/rate_converter.go (99%) rename {currency => currencies}/rate_converter_test.go (99%) rename {currency => currencies}/rates.go (99%) rename {currency => currencies}/rates_test.go (90%) create mode 100644 docs/developers/add-new-bidder.md create mode 100644 docs/developers/cookie-syncs.md create mode 100644 docs/developers/default-request.md delete mode 100644 errortypes/aggregate.go delete mode 100644 errortypes/aggregate_test.go delete mode 100755 exchange/adapter_builders.go create mode 100755 exchange/adapter_map.go create mode 100644 exchange/adapter_map_test.go delete mode 100644 exchange/adapter_util.go delete mode 100644 exchange/adapter_util_test.go delete mode 100644 exchange/events.go delete mode 100644 exchange/events_test.go delete mode 100644 exchange/eventscachetest/json-account-off-request-off.json delete mode 100644 exchange/eventscachetest/json-account-off-request-on.json delete mode 100644 exchange/eventscachetest/json-account-on-request-off.json delete mode 100644 exchange/eventscachetest/json-account-on-request-on.json delete mode 100644 exchange/exchangetest/eidpermissions-allowed-alias.json delete mode 100644 exchange/exchangetest/eidpermissions-allowed.json delete mode 100644 exchange/exchangetest/eidpermissions-denied.json delete mode 100644 exchange/exchangetest/events-bid-account-off-request-off.json delete mode 100644 exchange/exchangetest/events-bid-account-off-request-on.json delete mode 100644 exchange/exchangetest/events-bid-account-on-request-off.json delete mode 100644 exchange/exchangetest/events-vast-account-off-request-off.json delete mode 100644 exchange/exchangetest/events-vast-account-off-request-on.json delete mode 100644 exchange/exchangetest/events-vast-account-on-request-off.json delete mode 100644 gdpr/gdpr_test.go create mode 100755 hooks/pre-push delete mode 100644 openrtb_ext/imp_adot.go delete mode 100644 openrtb_ext/imp_decenterads.go delete mode 100644 openrtb_ext/imp_deepintent.go delete mode 100644 openrtb_ext/imp_ix.go delete mode 100644 openrtb_ext/imp_pulsepoint.go rename {metrics => pbsmetrics}/config/metrics.go (71%) rename {metrics => pbsmetrics}/config/metrics_test.go (57%) rename {metrics => pbsmetrics}/go_metrics.go (97%) rename {metrics => pbsmetrics}/go_metrics_test.go (96%) rename {metrics => pbsmetrics}/metrics.go (97%) rename {metrics => pbsmetrics}/metrics_mock.go (97%) rename {metrics => pbsmetrics}/prometheus/preload.go (98%) rename {metrics => pbsmetrics}/prometheus/preload_test.go (100%) rename {metrics => pbsmetrics}/prometheus/prometheus.go (90%) rename {metrics => pbsmetrics}/prometheus/prometheus_test.go (83%) rename {metrics => pbsmetrics}/prometheus/type_conversion.go (81%) rename {server/ssl => ssl}/mockcertificates/mock-certs.pem (100%) rename {server/ssl => ssl}/ssl.go (100%) rename {server/ssl => ssl}/ssl_test.go (100%) delete mode 100644 static/bidder-info/adot.yaml delete mode 100644 static/bidder-info/decenterads.yaml delete mode 100644 static/bidder-info/deepintent.yaml delete mode 100644 static/bidder-info/mediafuse.yaml delete mode 100644 static/bidder-info/mobfoxpb.yaml delete mode 100644 static/bidder-info/revcontent.yaml delete mode 100644 static/bidder-params/adot.json delete mode 100644 static/bidder-params/decenterads.json delete mode 100644 static/bidder-params/deepintent.json delete mode 100644 static/bidder-params/mediafuse.json delete mode 100644 static/bidder-params/mobfoxpb.json delete mode 100644 static/bidder-params/revcontent.json diff --git a/.github/workflows/validate-merge.yml b/.github/workflows/validate-merge.yml deleted file mode 100644 index 30370178ca8..00000000000 --- a/.github/workflows/validate-merge.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Validate Merge - -on: - pull_request: - branches: [master] - -jobs: - validate-merge: - runs-on: ubuntu-18.04 - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.14.2 - - - name: Checkout Merged Branch - uses: actions/checkout@v2 - - - name: Validate - run: | - ./validate.sh --nofmt --cov --race 10 - env: - GO111MODULE: "on" diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 3efc51d287a..d7bb50fbabf 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,31 +1,26 @@ -name: Validate - on: push: - branches: [master] + branches: + - master pull_request: - branches: [master] - + release: + types: + - created +name: Validate jobs: - validate: + Go: strategy: matrix: - go-version: [1.14.x, 1.15.x] + go-version: [1.13.x, 1.14.x, 1.15.x] os: [ubuntu-18.04] runs-on: ${{ matrix.os }} - steps: - name: Install Go uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} - - - name: Checkout Branch + - name: Checkout code uses: actions/checkout@v2 - with: - # Resolves to empty string for push events and falls back to HEAD. - ref: ${{ github.event.pull_request.head.sha }} - - name: Validate run: | ./validate.sh --nofmt --cov --race 10 diff --git a/.travis.yml b/.travis.yml index 655ea837eae..60ee49faf68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: go go: + - '1.13' - '1.14.2' - - '1.15' go_import_path: github.com/PubMatic-OpenWrap/prebid-server diff --git a/Dockerfile b/Dockerfile index d76398dc6d3..2c60b9e39b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,6 @@ RUN apt-get update && \ apt-get install -y ca-certificates mtr && \ apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* EXPOSE 8000 -EXPOSE 6060 +EXPOSE 8080 ENTRYPOINT ["/usr/local/bin/prebid-server"] CMD ["-v", "1", "-logtostderr"] diff --git a/README.md b/README.md index 529629e0e2a..145883587fd 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ For more information, see: ## Installation -First install [Go](https://golang.org/doc/install) version 1.14 or newer. +First install [Go](https://golang.org/doc/install) version 1.13 or newer. Note that prebid-server is using [Go modules](https://blog.golang.org/using-go-modules). We officially support the most recent two major versions of the Go runtime. However, if you'd like to use a version <1.13 and are inside GOPATH `GO111MODULE` needs to be set to `GO111MODULE=on`. diff --git a/account/account.go b/account/account.go index d5d22f4a894..43ba806a6da 100644 --- a/account/account.go +++ b/account/account.go @@ -7,7 +7,7 @@ import ( "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/pbsmetrics" "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" jsonpatch "github.com/evanphx/json-patch" ) @@ -20,7 +20,7 @@ func GetAccount(ctx context.Context, cfg *config.Configuration, fetcher stored_r Message: fmt.Sprintf("Prebid-server has disabled Account ID: %s, please reach out to the prebid server host.", accountID), }} } - if cfg.AccountRequired && accountID == metrics.PublisherUnknown { + if cfg.AccountRequired && accountID == pbsmetrics.PublisherUnknown { return nil, []error{&errortypes.AcctRequired{ Message: fmt.Sprintf("Prebid-server has been configured to discard requests without a valid Account ID. Please reach out to the prebid server host."), }} diff --git a/account/account_test.go b/account/account_test.go index 0783ee0e134..e8acdfe0f5f 100644 --- a/account/account_test.go +++ b/account/account_test.go @@ -8,7 +8,7 @@ import ( "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/pbsmetrics" "github.com/PubMatic-OpenWrap/prebid-server/stored_requests" "github.com/stretchr/testify/assert" ) @@ -29,7 +29,7 @@ func (af mockAccountFetcher) FetchAccount(ctx context.Context, accountID string) } func TestGetAccount(t *testing.T) { - unknown := metrics.PublisherUnknown + unknown := pbsmetrics.PublisherUnknown testCases := []struct { accountID string // account_required diff --git a/adapters/33across/33across.go b/adapters/33across/33across.go index 7abd7ba72bd..9b622e4f94e 100644 --- a/adapters/33across/33across.go +++ b/adapters/33across/33across.go @@ -7,7 +7,6 @@ import ( "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" ) @@ -17,31 +16,14 @@ type TtxAdapter struct { } type Ext struct { - Ttx impTtxExt `json:"ttx"` + Ttx ext `json:"ttx"` } -type impTtxExt struct { +type ext struct { Prod string `json:"prod"` Zoneid string `json:"zoneid,omitempty"` } -type reqExt struct { - Ttx *reqTtxExt `json:"ttx,omitempty"` -} - -type reqTtxExt struct { - Caller []TtxCaller `json:"caller,omitempty"` -} - -type TtxCaller struct { - Name string `json:"name,omitempty"` - Version string `json:"version,omitempty"` -} - -// CALLER Info used to track Prebid Server -// as one of the hops in the request to exchange -var CALLER = TtxCaller{"Prebid-Server", "n/a"} - type bidExt struct { Ttx bidTtxExt `json:"ttx,omitempty"` } @@ -55,41 +37,39 @@ func (a *TtxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters var errs []error var adapterRequests []*adapters.RequestData - // Construct request extension common to all imps - // NOTE: not blocking adapter requests on errors - // since request extension is optional. - reqExt, err := makeReqExt(request) - if err != nil { - errs = append(errs, err) - } - request.Ext = reqExt - - // Break up multi-imp request into multiple external requests since we don't - // support SRA in our exchange server - for i := 0; i < len(request.Imp); i++ { - if adapterReq, err := a.makeRequest(*request, request.Imp[i]); err == nil { - adapterRequests = append(adapterRequests, adapterReq) - } else { - errs = append(errs, err) - } + adapterReq, errors := a.makeRequest(request) + if adapterReq != nil { + adapterRequests = append(adapterRequests, adapterReq) } + errs = append(errs, errors...) - return adapterRequests, errs + return adapterRequests, errors } -func (a *TtxAdapter) makeRequest(request openrtb.BidRequest, imp openrtb.Imp) (*adapters.RequestData, error) { - impCopy, err := makeImps(imp) +// Update the request object to include custom value +// site.id +func (a *TtxAdapter) makeRequest(request *openrtb.BidRequest) (*adapters.RequestData, []error) { + var errs []error - if err != nil { - return nil, err + // Make a copy as we don't want to change the original request + reqCopy := *request + if err := preprocess(&reqCopy); err != nil { + errs = append(errs, err) } - request.Imp = []openrtb.Imp{*impCopy} + if reqCopy.Imp[0].Banner == nil && reqCopy.Imp[0].Video == nil { + errs = append(errs, &errortypes.BadInput{ + Message: "At least one of [banner, video] formats must be defined in Imp. None found", + }) + + return nil, errs + } // Last Step - reqJSON, err := json.Marshal(request) + reqJSON, err := json.Marshal(reqCopy) if err != nil { - return nil, err + errs = append(errs, err) + return nil, errs } headers := http.Header{} @@ -100,26 +80,22 @@ func (a *TtxAdapter) makeRequest(request openrtb.BidRequest, imp openrtb.Imp) (* Uri: a.endpoint, Body: reqJSON, Headers: headers, - }, nil + }, errs } -func makeImps(imp openrtb.Imp) (*openrtb.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), - } - } - +// Mutate the request to get it ready to send to ttx. +func preprocess(request *openrtb.BidRequest) error { + var imp = &request.Imp[0] var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return nil, &errortypes.BadInput{ + return &errortypes.BadInput{ Message: err.Error(), } } var ttxExt openrtb_ext.ExtImp33across if err := json.Unmarshal(bidderExt.Bidder, &ttxExt); err != nil { - return nil, &errortypes.BadInput{ + return &errortypes.BadInput{ Message: err.Error(), } } @@ -127,20 +103,22 @@ func makeImps(imp openrtb.Imp) (*openrtb.Imp, error) { var impExt Ext impExt.Ttx.Prod = ttxExt.ProductId - impExt.Ttx.Zoneid = ttxExt.SiteId - + // Add zoneid if it's defined if len(ttxExt.ZoneId) > 0 { impExt.Ttx.Zoneid = ttxExt.ZoneId } impExtJSON, err := json.Marshal(impExt) if err != nil { - return nil, &errortypes.BadInput{ + return &errortypes.BadInput{ Message: err.Error(), } } imp.Ext = impExtJSON + siteCopy := *request.Site + siteCopy.ID = ttxExt.SiteId + request.Site = &siteCopy // Validate Video if it exists if imp.Video != nil { @@ -149,35 +127,13 @@ func makeImps(imp openrtb.Imp) (*openrtb.Imp, error) { imp.Video = videoCopy if err != nil { - return nil, &errortypes.BadInput{ + return &errortypes.BadInput{ Message: err.Error(), } } } - return &imp, nil -} - -func makeReqExt(request *openrtb.BidRequest) ([]byte, error) { - var reqExt reqExt - - if len(request.Ext) > 0 { - if err := json.Unmarshal(request.Ext, &reqExt); err != nil { - return nil, err - } - } - - if reqExt.Ttx == nil { - reqExt.Ttx = &reqTtxExt{} - } - - if reqExt.Ttx.Caller == nil { - reqExt.Ttx.Caller = make([]TtxCaller, 0) - } - - reqExt.Ttx.Caller = append(reqExt.Ttx.Caller, CALLER) - - return json.Marshal(reqExt) + return nil } // MakeBids make the bids for the bid response. @@ -263,10 +219,9 @@ func getBidType(ext bidExt) openrtb_ext.BidType { return openrtb_ext.BidTypeBanner } -// Builder builds a new instance of the 33Across adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &TtxAdapter{ - endpoint: config.Endpoint, +// New33AcrossBidder configures bidder endpoint +func New33AcrossBidder(endpoint string) *TtxAdapter { + return &TtxAdapter{ + endpoint: endpoint, } - return bidder, nil } diff --git a/adapters/33across/33across_test.go b/adapters/33across/33across_test.go index 08c2ff614e9..efb771c6385 100644 --- a/adapters/33across/33across_test.go +++ b/adapters/33across/33across_test.go @@ -4,17 +4,8 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.Bidder33Across, config.Adapter{ - Endpoint: "http://ssc.33across.com"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "33acrosstest", bidder) + adapterstest.RunJSONBidderTest(t, "33acrosstest", New33AcrossBidder("http://ssc.33across.com")) } diff --git a/adapters/33across/33acrosstest/exemplary/bidresponse-defaults.json b/adapters/33across/33acrosstest/exemplary/bidresponse-defaults.json index 50fba69bde1..bb0e6585fd0 100644 --- a/adapters/33across/33acrosstest/exemplary/bidresponse-defaults.json +++ b/adapters/33across/33acrosstest/exemplary/bidresponse-defaults.json @@ -29,16 +29,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -54,13 +44,14 @@ }, "ext": { "ttx": { - "prod": "instream", - "zoneid": "fake-site-id" + "prod": "instream" } } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/exemplary/instream-video-defaults.json b/adapters/33across/33acrosstest/exemplary/instream-video-defaults.json index c99e535cdb7..479b197077a 100644 --- a/adapters/33across/33acrosstest/exemplary/instream-video-defaults.json +++ b/adapters/33across/33acrosstest/exemplary/instream-video-defaults.json @@ -27,16 +27,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -52,13 +42,14 @@ }, "ext": { "ttx": { - "prod": "instream", - "zoneid": "fake-site-id" + "prod": "instream" } } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/exemplary/multi-format.json b/adapters/33across/33acrosstest/exemplary/multi-format.json index 3315ff72559..db15955ca87 100644 --- a/adapters/33across/33acrosstest/exemplary/multi-format.json +++ b/adapters/33across/33acrosstest/exemplary/multi-format.json @@ -30,16 +30,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -57,13 +47,14 @@ }, "ext": { "ttx": { - "prod": "inview", - "zoneid": "fake-site-id" + "prod": "inview" } } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/exemplary/multi-imp-banner.json b/adapters/33across/33acrosstest/exemplary/multi-imp-banner.json deleted file mode 100644 index b6d19f55683..00000000000 --- a/adapters/33across/33acrosstest/exemplary/multi-imp-banner.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id1", - "banner": { - "format": [{"w": 728, "h": 90}] - }, - "ext": { - "bidder": { - "siteId": "fake-site-id", - "productId": "inview" - } - } - }, - { - "id": "test-imp-id2", - "banner": { - "format": [{"w": 728, "h": 90}] - }, - "ext": { - "bidder": { - "siteId": "fake-site-id", - "productId": "inview" - } - } - } - ], - "site": {} - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ssc.33across.com", - "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id1", - "banner": { - "format": [{"w": 728, "h": 90}] - }, - "ext": { - "ttx": { - "prod": "inview", - "zoneid": "fake-site-id" - } - } - } - ], - "site": {} - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "ttx", - "bid": [{ - "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", - "impid": "test-imp-id1", - "price": 0.500000, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 90, - "w": 728, - "ext": { - "ttx": { - "mediaType": "banner" - } - } - }] - } - ], - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://ssc.33across.com", - "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id2", - "banner": { - "format": [{"w": 728, "h": 90}] - }, - "ext": { - "ttx": { - "prod": "inview", - "zoneid": "fake-site-id" - } - } - } - ], - "site": {} - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "ttx", - "bid": [{ - "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", - "impid": "test-imp-id2", - "price": 0.600000, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 90, - "w": 728, - "ext": { - "ttx": { - "mediaType": "banner" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", - "impid": "test-imp-id1", - "price": 0.5, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 728, - "h": 90, - "ext": { - "ttx": { - "mediaType": "banner" - } - } - }, - "type": "banner" - } - ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", - "impid": "test-imp-id2", - "price": 0.6, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 728, - "h": 90, - "ext": { - "ttx": { - "mediaType": "banner" - } - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/33across/33acrosstest/exemplary/optional-params.json b/adapters/33across/33acrosstest/exemplary/optional-params.json index f429f9458a7..e92958e73d7 100644 --- a/adapters/33across/33acrosstest/exemplary/optional-params.json +++ b/adapters/33across/33acrosstest/exemplary/optional-params.json @@ -24,16 +24,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -49,13 +39,14 @@ } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/33across/33acrosstest/exemplary/outstream-video-defaults.json b/adapters/33across/33acrosstest/exemplary/outstream-video-defaults.json index fdd422c7a63..c0c31168684 100644 --- a/adapters/33across/33acrosstest/exemplary/outstream-video-defaults.json +++ b/adapters/33across/33acrosstest/exemplary/outstream-video-defaults.json @@ -27,16 +27,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -51,13 +41,14 @@ }, "ext": { "ttx": { - "prod": "siab", - "zoneid": "fake-site-id" + "prod": "siab" } } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/exemplary/site-banner.json b/adapters/33across/33acrosstest/exemplary/simple-banner.json similarity index 85% rename from adapters/33across/33acrosstest/exemplary/site-banner.json rename to adapters/33across/33acrosstest/exemplary/simple-banner.json index 552daf25224..d8c215c06ae 100644 --- a/adapters/33across/33acrosstest/exemplary/site-banner.json +++ b/adapters/33across/33acrosstest/exemplary/simple-banner.json @@ -23,16 +23,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -42,13 +32,14 @@ }, "ext": { "ttx": { - "prod": "inview", - "zoneid": "fake-site-id" + "prod": "inview" } } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/exemplary/site-video.json b/adapters/33across/33acrosstest/exemplary/simple-video.json similarity index 87% rename from adapters/33across/33acrosstest/exemplary/site-video.json rename to adapters/33across/33acrosstest/exemplary/simple-video.json index 3cf44775efb..55337b92827 100644 --- a/adapters/33across/33acrosstest/exemplary/site-video.json +++ b/adapters/33across/33acrosstest/exemplary/simple-video.json @@ -29,16 +29,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -54,13 +44,14 @@ }, "ext": { "ttx": { - "prod": "instream", - "zoneid": "fake-site-id" + "prod": "instream" } } } ], - "site": {} + "site": { + "id": "fake-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/supplemental/multi-imp-mixed-validation.json b/adapters/33across/33acrosstest/supplemental/multi-imp-mixed-validation.json deleted file mode 100644 index a2bc7890e96..00000000000 --- a/adapters/33across/33acrosstest/supplemental/multi-imp-mixed-validation.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id1", - "banner": { - "format": [{"w": 728, "h": 90}] - }, - "ext": { - "bidder": { - "siteId": "fake-site-id", - "productId": "inview" - } - } - }, - { - "id": "test-imp-id2", - "ext": { - "bidder": { - "siteId": "fake-site-id", - "productId": "inview" - } - } - } - ], - "site": {} - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ssc.33across.com", - "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id1", - "banner": { - "format": [{"w": 728, "h": 90}] - }, - "ext": { - "ttx": { - "prod": "inview", - "zoneid": "fake-site-id" - } - } - } - ], - "site": {} - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "ttx", - "bid": [{ - "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", - "impid": "test-imp-id1", - "price": 0.500000, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 90, - "w": 728, - "ext": { - "ttx": { - "mediaType": "banner" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - "expectedMakeRequestsErrors": [ - { - "value": "Imp ID test-imp-id2 must have at least one of [Banner, Video] defined", - "comparison": "literal" - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", - "impid": "test-imp-id1", - "price": 0.5, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 728, - "h": 90, - "ext": { - "ttx": { - "mediaType": "banner" - } - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/33across/33acrosstest/supplemental/status-not-ok.json b/adapters/33across/33acrosstest/supplemental/status-not-ok.json index 2c7fcd013f3..98fe01c2e50 100644 --- a/adapters/33across/33acrosstest/supplemental/status-not-ok.json +++ b/adapters/33across/33acrosstest/supplemental/status-not-ok.json @@ -23,16 +23,6 @@ "expectedRequest": { "uri": "http://ssc.33across.com", "body": { - "ext": { - "ttx": { - "caller": [ - { - "name": "Prebid-Server", - "version": "n/a" - } - ] - } - }, "id": "test-request-id", "imp": [ { @@ -42,13 +32,14 @@ }, "ext": { "ttx": { - "prod": "inview", - "zoneid": "fake-invalid-site-id" + "prod": "inview" } } } ], - "site": {} + "site": { + "id": "fake-invalid-site-id" + } } }, "mockResponse": { diff --git a/adapters/33across/33acrosstest/supplemental/video-validation-fail.json b/adapters/33across/33acrosstest/supplemental/video-validation-fail.json index f29d728c9d7..97cb79bd26c 100644 --- a/adapters/33across/33acrosstest/supplemental/video-validation-fail.json +++ b/adapters/33across/33acrosstest/supplemental/video-validation-fail.json @@ -23,6 +23,10 @@ { "value": "One or more invalid or missing video field(s) w, h, protocols, mimes, playbackmethod", "comparison": "literal" + }, + { + "value": "At least one of [banner, video] formats must be defined in Imp. None found", + "comparison": "literal" } ] } diff --git a/adapters/acuityads/acuityads.go b/adapters/acuityads/acuityads.go index ac2c6ac7c4d..b123f82cbb0 100644 --- a/adapters/acuityads/acuityads.go +++ b/adapters/acuityads/acuityads.go @@ -8,27 +8,23 @@ import ( "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" ) type AcuityAdsAdapter struct { endpoint template.Template } -// Builder builds a new instance of the AcuityAds 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) +func NewAcuityAdsBidder(endpointTemplate string) *AcuityAdsAdapter { + template, err := template.New("endpointTemplate").Parse(endpointTemplate) if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) - } - - bidder := &AcuityAdsAdapter{ - endpoint: *template, + glog.Fatal("Unable to parse endpoint url template") + return nil } - return bidder, nil + return &AcuityAdsAdapter{endpoint: *template} } func getHeaders(request *openrtb.BidRequest) http.Header { diff --git a/adapters/acuityads/acuityads_test.go b/adapters/acuityads/acuityads_test.go index be12780a778..de44dba24ca 100644 --- a/adapters/acuityads/acuityads_test.go +++ b/adapters/acuityads/acuityads_test.go @@ -4,25 +4,8 @@ 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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAcuityAds, config.Adapter{ - Endpoint: "http://{{.Host}}.example.com/bid?token={{.AccountID}}"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "acuityadstest", bidder) -} - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAcuityAds, config.Adapter{ - Endpoint: "{{Malformed}}"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "acuityadstest", NewAcuityAdsBidder("http://{{.Host}}.example.com/bid?token={{.AccountID}}")) } diff --git a/adapters/acuityads/acuityadstest/exemplary/banner-app.json b/adapters/acuityads/acuityadstest/exemplary/banner-app.json index f4aedeb6788..72fbfb5711e 100644 --- a/adapters/acuityads/acuityadstest/exemplary/banner-app.json +++ b/adapters/acuityads/acuityadstest/exemplary/banner-app.json @@ -1,156 +1,150 @@ { - "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" + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 }, - "cat": [ - "IAB22-1" - ], - "bundle": "com.app.awesome", - "name": "Awesome App", - "domain": "awesomeapp.com", - "id": "123456789" - }, - "imp": [ - { - "id": "some-impression-id", - "tagid": "ogTAGID", - "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" - ] + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "app": { + "publisher": { + "id": "123456789" }, - "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 + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + "tagid": "ogTAGID", + "banner": { + "w":320, + "h":50 }, - "imp": [ - { - "id": "some-impression-id", - "banner": { - "w": 320, - "h": 50 - }, - "tagid": "ogTAGID" + "ext": { + "bidder": { + "host": "ep1", + "accountid": "hash" } - ], - "app": { - "id": "123456789", - "name": "Awesome App", - "bundle": "com.app.awesome", - "domain": "awesomeapp.com", - "cat": [ - "IAB22-1" + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" ], - "publisher": { - "id": "123456789" - } - }, - "user": { - "buyeruid": "awesome-user" + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] }, - "tmax": 1000 - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "awesome-resp-id", - "seatbid": [ - { - "bid": [ - { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "1", - "price": 3.5, - "adm": "awesome-markup", - "adomain": [ - "awesome.com" - ], - "crid": "20", - "w": 320, - "h": 50 - } + "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", + "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 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w":320, + "h":50 + } + ], "type": "banner", - "seat": "acuityads" + "seat": "acuityads" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "acuityads": 154 + }, + "tmaxrequest": 1000 } - ], - "cur": "USD", - "ext": { - "responsetimemillis": { - "acuityads": 154 - }, - "tmaxrequest": 1000 } } } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "1", - "price": 3.5, - "adm": "awesome-markup", - "adomain": [ - "awesome.com" - ], - "crid": "20", - "w": 320, - "h": 50 - }, - "type": "banner" - } - ] - } - ] -} + ], + "expectedBids": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w":320, + "h":50 + } + ] + } + \ No newline at end of file diff --git a/adapters/acuityads/acuityadstest/exemplary/banner-web.json b/adapters/acuityads/acuityadstest/exemplary/banner-web.json index f4616bc4030..83265367562 100644 --- a/adapters/acuityads/acuityadstest/exemplary/banner-web.json +++ b/adapters/acuityads/acuityadstest/exemplary/banner-web.json @@ -96,7 +96,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "1", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "adomain": [ "awesome.com" ], @@ -128,7 +128,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "1", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "crid": "20", "adomain": [ "awesome.com" diff --git a/adapters/acuityads/acuityadstest/exemplary/native-app.json b/adapters/acuityads/acuityadstest/exemplary/native-app.json index 6ada3926733..a8fb92c942d 100644 --- a/adapters/acuityads/acuityadstest/exemplary/native-app.json +++ b/adapters/acuityads/acuityadstest/exemplary/native-app.json @@ -108,7 +108,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "adomain": [ "awesome.com" ], @@ -138,7 +138,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "crid": "20", "adomain": [ "awesome.com" @@ -150,4 +150,4 @@ } ] } - + \ No newline at end of file diff --git a/adapters/acuityads/acuityadstest/exemplary/native-web.json b/adapters/acuityads/acuityadstest/exemplary/native-web.json index 96b3ca06aec..9becd23d881 100644 --- a/adapters/acuityads/acuityadstest/exemplary/native-web.json +++ b/adapters/acuityads/acuityadstest/exemplary/native-web.json @@ -96,7 +96,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "adomain": [ "awesome.com" ], @@ -125,7 +125,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "crid": "20", "adomain": [ "awesome.com" diff --git a/adapters/acuityads/acuityadstest/exemplary/video-app.json b/adapters/acuityads/acuityadstest/exemplary/video-app.json index 4130602db47..c6c75d903aa 100644 --- a/adapters/acuityads/acuityadstest/exemplary/video-app.json +++ b/adapters/acuityads/acuityadstest/exemplary/video-app.json @@ -118,7 +118,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "adomain": [ "awesome.com" ], @@ -149,7 +149,7 @@ "id": "a3ae1b4e2fc24a4fb45540082e98e161", "impid": "some-impression-id", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "crid": "20", "adomain": [ "awesome.com" diff --git a/adapters/acuityads/acuityadstest/exemplary/video-web.json b/adapters/acuityads/acuityadstest/exemplary/video-web.json index 60260aa5271..e2b9d9eb9d6 100644 --- a/adapters/acuityads/acuityadstest/exemplary/video-web.json +++ b/adapters/acuityads/acuityadstest/exemplary/video-web.json @@ -104,9 +104,9 @@ "bid": [ { "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "some-impression-id", + "impid": "1", "price": 3.5, - "adm": "awesome-markup", + "adm": "asesome-markup", "adomain": [ "awesome.com" ], @@ -134,30 +134,23 @@ } } ], - "expectedBidResponses": [ + "expectedBids": [ { - "bids": [ - { - "bid": { - "id": "a3ae1b4e2fc24a4fb45540082e98e161", - "impid": "some-impression-id", - "price": 3.5, - "adm": "awesome-markup", - "adomain": [ - "awesome.com" - ], - "crid": "20", - "w": 1280, - "h": 720, - "ext": { - "prebid": { - "type": "video" - } - } - }, - "type":"video" + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "prebid": { + "type": "video" } - ] + } } ] } diff --git a/adapters/acuityads/acuityadstest/supplemental/invalid-acuityads-ext-object.json b/adapters/acuityads/acuityadstest/supplemental/invalid-acuityads-ext-object.json deleted file mode 100644 index 77752d01edf..00000000000 --- a/adapters/acuityads/acuityadstest/supplemental/invalid-acuityads-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.go b/adapters/adform/adform.go index bb3f9f4d8a3..5cdef257f1c 100644 --- a/adapters/adform/adform.go +++ b/adapters/adform/adform.go @@ -5,7 +5,6 @@ import ( "context" "encoding/base64" "encoding/json" - "errors" "fmt" "io/ioutil" "net/http" @@ -14,7 +13,6 @@ import ( "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" @@ -24,8 +22,6 @@ import ( "golang.org/x/net/context/ctxhttp" ) -const version = "0.1.3" - type AdformAdapter struct { http *adapters.HTTPAdapter URL *url.URL @@ -44,11 +40,23 @@ type adformRequest struct { adUnits []*adformAdUnit gdprApplies string consent string + digitrust *adformDigitrust currency string eids string url string } +type adformDigitrust struct { + Id string `json:"id"` + Version int `json:"version"` + Keyv int `json:"keyv"` + Privacy adformDigitrustPrivacy `json:"privacy"` +} + +type adformDigitrustPrivacy struct { + Optout bool `json:"optout"` +} + type adformAdUnit struct { MasterTagId json.Number `json:"mid"` PriceType string `json:"priceType,omitempty"` @@ -87,18 +95,8 @@ func isPriceTypeValid(priceType string) (string, bool) { // ADAPTER Interface -// Builder builds a new instance of the Adform adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - uri, err := url.Parse(config.Endpoint) - if err != nil { - return nil, errors.New("unable to parse endpoint") - } - - bidder := &AdformAdapter{ - URL: uri, - version: version, - } - return bidder, nil +func NewAdformAdapter(config *adapters.HTTPAdapterConfig, endpointURL string) *AdformAdapter { + return NewAdformBidder(adapters.NewHTTPAdapter(config).Client, endpointURL) } // used for cookies and such @@ -204,6 +202,24 @@ func pbsRequestToAdformRequest(a *AdformAdapter, request *pbs.PBSRequest, bidder gdprApplies = "" } consent := request.ParseConsent() + var digitrustData *openrtb_ext.ExtUserDigiTrust + if request.User != nil { + var extUser *openrtb_ext.ExtUser + if err := json.Unmarshal(request.User.Ext, &extUser); err == nil { + digitrustData = extUser.DigiTrust + } + } + + var digitrust *adformDigitrust = nil + if digitrustData != nil { + digitrust = new(adformDigitrust) + digitrust.Id = digitrustData.ID + digitrust.Keyv = digitrustData.KeyV + digitrust.Version = 1 + digitrust.Privacy = adformDigitrustPrivacy{ + Optout: digitrustData.Pref != 0, + } + } return &adformRequest{ adUnits: adUnits, @@ -217,6 +233,7 @@ func pbsRequestToAdformRequest(a *AdformAdapter, request *pbs.PBSRequest, bidder tid: request.Tid, gdprApplies: gdprApplies, consent: consent, + digitrust: digitrust, currency: defaultCurrency, }, nil } @@ -340,9 +357,18 @@ func (r *adformRequest) buildAdformHeaders(a *AdformAdapter) http.Header { header.Set("Referer", r.referer) } + cookie := make([]string, 0, 2) if r.userId != "" { - header.Set("Cookie", fmt.Sprintf("uid=%s;", r.userId)) + cookie = append(cookie, fmt.Sprintf("uid=%s", r.userId)) } + if r.digitrust != nil { + if digitrustBytes, err := json.Marshal(r.digitrust); err == nil { + digitrust := base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(digitrustBytes) + // Cookie name and structure are described here: https://github.com/digi-trust/dt-cdn/wiki/Cookies-for-Platforms + cookie = append(cookie, fmt.Sprintf("DigiTrust.v1.identity=%s", digitrust)) + } + } + header.Set("Cookie", strings.Join(cookie, ";")) return header } @@ -360,7 +386,8 @@ func parseAdformBids(response []byte) ([]*adformBid, error) { // BIDDER Interface -func NewAdformLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, endpointURL string) *AdformAdapter { +func NewAdformBidder(client *http.Client, endpointURL string) *AdformAdapter { + a := &adapters.HTTPAdapter{Client: client} var uriObj *url.URL uriObj, err := url.Parse(endpointURL) if err != nil { @@ -368,9 +395,9 @@ func NewAdformLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, endpointURL } return &AdformAdapter{ - http: adapters.NewHTTPAdapter(httpConfig), + http: a, URL: uriObj, - version: version, + version: "0.1.3", } } @@ -466,14 +493,27 @@ func openRtbToAdformRequest(request *openrtb.BidRequest) (*adformRequest, []erro eids := "" consent := "" + var digitrustData *openrtb_ext.ExtUserDigiTrust if request.User != nil { var extUser openrtb_ext.ExtUser if err := json.Unmarshal(request.User.Ext, &extUser); err == nil { consent = extUser.Consent + digitrustData = extUser.DigiTrust eids = encodeEids(extUser.Eids) } } + var digitrust *adformDigitrust = nil + if digitrustData != nil { + digitrust = new(adformDigitrust) + digitrust.Id = digitrustData.ID + digitrust.Keyv = digitrustData.KeyV + digitrust.Version = 1 + digitrust.Privacy = adformDigitrustPrivacy{ + Optout: digitrustData.Pref != 0, + } + } + requestCurrency := defaultCurrency if len(request.Cur) != 0 { hasDefaultCurrency := false @@ -499,6 +539,7 @@ func openRtbToAdformRequest(request *openrtb.BidRequest) (*adformRequest, []erro tid: tid, gdprApplies: gdprApplies, consent: consent, + digitrust: digitrust, currency: requestCurrency, eids: eids, url: url, diff --git a/adapters/adform/adform_test.go b/adapters/adform/adform_test.go index a4e519e6bc5..76381966277 100644 --- a/adapters/adform/adform_test.go +++ b/adapters/adform/adform_test.go @@ -26,21 +26,7 @@ import ( ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdform, config.Adapter{ - Endpoint: "https://adx.adform.net/adx"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adformtest", bidder) -} - -func TestEndpointMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAdform, config.Adapter{ - Endpoint: ` https://malformed`}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "adformtest", NewAdformBidder(nil, "http://adx.adform.net/adx")) } type aTagInfo struct { @@ -207,7 +193,7 @@ func initTestData(server *httptest.Server, t *testing.T) (*AdformAdapter, contex // prepare adapter conf := *adapters.DefaultHTTPAdapterConfig - adapter := NewAdformLegacyAdapter(&conf, server.URL) + adapter := NewAdformAdapter(&conf, server.URL) prebidRequest := preparePrebidRequest(server.URL, t) ctx := context.TODO() @@ -299,12 +285,7 @@ func preparePrebidRequestBody(requestData aBidInfo, t *testing.T) *bytes.Buffer // OpenRTB auction tests func TestOpenRTBRequest(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdform, config.Adapter{ - Endpoint: "https://adx.adform.net"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } + bidder := NewAdformBidder(nil, "http://adx.adform.net") testData := createTestData(true) request := createOpenRtbRequest(&testData) @@ -502,7 +483,7 @@ func TestOpenRTBSurpriseResponse(t *testing.T) { // Properties tests func TestAdformProperties(t *testing.T) { - adapter := NewAdformLegacyAdapter(adapters.DefaultHTTPAdapterConfig, "adx.adform.net/adx") + adapter := NewAdformAdapter(adapters.DefaultHTTPAdapterConfig, "adx.adform.net/adx") if adapter.SkipNoCookies() != false { t.Fatalf("should have been false") @@ -525,6 +506,12 @@ func getRegs() openrtb.Regs { } func getUserExt() []byte { + digitrust := openrtb_ext.ExtUserDigiTrust{ + ID: "digitrustId", + KeyV: 1, + Pref: 0, + } + eids := []openrtb_ext.ExtUserEid{ { Source: "test.com", @@ -550,8 +537,9 @@ func getUserExt() []byte { } userExt := openrtb_ext.ExtUser{ - Eids: eids, - Consent: "abc", + Eids: eids, + Consent: "abc", + DigiTrust: &digitrust, } userExtData, err := json.Marshal(userExt) if err == nil { @@ -623,7 +611,7 @@ func assertAdformServerRequest(testData aBidInfo, r *http.Request, isOpenRtb boo if ok, err := equal(testData.referrer, r.Header.Get("Referer"), "Referer"); !ok { return err } - if ok, err := equal(fmt.Sprintf("uid=%s;", testData.buyerUID), r.Header.Get("Cookie"), "Buyer ID"); !ok { + if ok, err := equal(fmt.Sprintf("uid=%s;DigiTrust.v1.identity=eyJpZCI6ImRpZ2l0cnVzdElkIiwidmVyc2lvbiI6MSwia2V5diI6MSwicHJpdmFjeSI6eyJvcHRvdXQiOmZhbHNlfX0", testData.buyerUID), r.Header.Get("Cookie"), "Buyer ID"); !ok { return err } return nil diff --git a/adapters/adform/adformtest/exemplary/multiformat-impression.json b/adapters/adform/adformtest/exemplary/multiformat-impression.json index 5b3067ab927..efd4aca63e2 100644 --- a/adapters/adform/adformtest/exemplary/multiformat-impression.json +++ b/adapters/adform/adformtest/exemplary/multiformat-impression.json @@ -35,7 +35,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTEyMzQ1JnJjdXI9VVNE&bWlkPTU0MzIxJnJjdXI9VVNE" + "uri": "http://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTEyMzQ1JnJjdXI9VVNE&bWlkPTU0MzIxJnJjdXI9VVNE" }, "mockResponse": { "status": 200, diff --git a/adapters/adform/adformtest/exemplary/single-banner-impression.json b/adapters/adform/adformtest/exemplary/single-banner-impression.json index 8a5f81c8edb..fd7f3cde526 100644 --- a/adapters/adform/adformtest/exemplary/single-banner-impression.json +++ b/adapters/adform/adformtest/exemplary/single-banner-impression.json @@ -23,7 +23,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTEyMzQ1JnJjdXI9VVNE" + "uri": "http://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTEyMzQ1JnJjdXI9VVNE" }, "mockResponse": { "status": 200, diff --git a/adapters/adform/adformtest/exemplary/single-video-impression.json b/adapters/adform/adformtest/exemplary/single-video-impression.json index 383e091b3f7..e22977e6523 100644 --- a/adapters/adform/adformtest/exemplary/single-video-impression.json +++ b/adapters/adform/adformtest/exemplary/single-video-impression.json @@ -19,7 +19,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTU0MzIxJnJjdXI9VVNE" + "uri": "http://adx.adform.net/adx?CC=1&fd=1&gdpr=&gdpr_consent=&ip=&rp=4&stid=&bWlkPTU0MzIxJnJjdXI9VVNE" }, "mockResponse": { "status": 200, diff --git a/adapters/adform/adformtest/supplemental/user-nil.json b/adapters/adform/adformtest/supplemental/user-nil.json index 5f02fe85971..96007d58bf1 100644 --- a/adapters/adform/adformtest/supplemental/user-nil.json +++ b/adapters/adform/adformtest/supplemental/user-nil.json @@ -44,12 +44,11 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://adx.adform.net/adx?CC=1&fd=1&gdpr=1&gdpr_consent=abc2&ip=&pt=gross&rp=4&stid=&bWlkPTEmcmN1cj1VU0Q" + "uri": "http://adx.adform.net/adx?CC=1&fd=1&gdpr=1&gdpr_consent=abc2&ip=&pt=gross&rp=4&stid=&bWlkPTEmcmN1cj1VU0Q" }, "mockResponse": { "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/adgeneration/adgeneration.go b/adapters/adgeneration/adgeneration.go index 59a3ba5b6a2..376933734bd 100644 --- a/adapters/adgeneration/adgeneration.go +++ b/adapters/adgeneration/adgeneration.go @@ -12,7 +12,6 @@ import ( "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" ) @@ -259,12 +258,10 @@ func removeWrapper(ad string) string { return str } -// Builder builds a new instance of the Adgeneration adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AdgenerationAdapter{ - config.Endpoint, +func NewAdgenerationAdapter(endpoint string) *AdgenerationAdapter { + return &AdgenerationAdapter{ + endpoint, "1.0.2", "JPY", } - return bidder, nil } diff --git a/adapters/adgeneration/adgeneration_test.go b/adapters/adgeneration/adgeneration_test.go index a4041a5a1d7..d6152dc760b 100644 --- a/adapters/adgeneration/adgeneration_test.go +++ b/adapters/adgeneration/adgeneration_test.go @@ -7,32 +7,15 @@ import ( "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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdgeneration, config.Adapter{ - Endpoint: "https://d.socdm.com/adsv/v1"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adgenerationtest", bidder) + adapterstest.RunJSONBidderTest(t, "adgenerationtest", NewAdgenerationAdapter("https://d.socdm.com/adsv/v1")) } -func TestgetRequestUri(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdgeneration, config.Adapter{ - Endpoint: "https://d.socdm.com/adsv/v1"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) - +func TestGetRequestUri(t *testing.T) { + bidder := NewAdgenerationAdapter("https://d.socdm.com/adsv/v1") // Test items failedRequest := &openrtb.BidRequest{ ID: "test-failed-bid-request", @@ -59,7 +42,7 @@ func TestgetRequestUri(t *testing.T) { numRequests := len(failedRequest.Imp) for index := 0; index < numRequests; index++ { - httpRequests, err := bidderAdgeneration.getRequestUri(failedRequest, index) + httpRequests, err := bidder.getRequestUri(failedRequest, index) if err == nil { t.Errorf("getRequestUri: %v did not throw an error", failedRequest.Imp[index]) } @@ -74,15 +57,15 @@ func TestgetRequestUri(t *testing.T) { if err != nil { t.Errorf("unmarshalExtImpAdgeneration: %v did throw an error: %v", successRequest.Imp[index], err) } - rawQuery := bidderAdgeneration.getRawQuery(adgExt.Id, successRequest, &successRequest.Imp[index]) + rawQuery := bidder.getRawQuery(adgExt.Id, successRequest, &successRequest.Imp[index]) expectQueries := map[string]string{ "posall": "SSPLOC", "id": adgExt.Id, "sdktype": "0", "hb": "true", - "currency": bidderAdgeneration.getCurrency(successRequest), + "currency": bidder.getCurrency(successRequest), "sdkname": "prebidserver", - "adapterver": bidderAdgeneration.version, + "adapterver": bidder.version, "sizes": getSizes(&successRequest.Imp[index]), "tp": successRequest.Site.Page, "transactionid": successRequest.Source.TID, @@ -95,11 +78,11 @@ func TestgetRequestUri(t *testing.T) { } // RequestUri Test. - actualUri, err := bidderAdgeneration.getRequestUri(successRequest, index) + actualUri, err := bidder.getRequestUri(successRequest, index) if err != nil { t.Errorf("getRequestUri: %v did throw an error: %v", successRequest.Imp[index], err) } - expectedUri := "https://d.socdm.com/adsv/v1?adapterver=" + bidderAdgeneration.version + "¤cy=JPY&hb=true&id=58278&posall=SSPLOC&sdkname=prebidserver&sdktype=0&sizes=300x250&t=json3&tp=https%3A%2F%2Fsupership.com&transactionid=SourceTID" + expectedUri := "https://d.socdm.com/adsv/v1?adapterver=" + bidder.version + "¤cy=JPY&hb=true&id=58278&posall=SSPLOC&sdkname=prebidserver&sdktype=0&sizes=300x250&t=json3&tp=https%3A%2F%2Fsupership.com&transactionid=SourceTID" if actualUri != expectedUri { t.Errorf("getRequestUri: does not match expected %s, actual %s", expectedUri, actualUri) } @@ -132,15 +115,7 @@ func TestGetSizes(t *testing.T) { } func TestGetCurrency(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdgeneration, config.Adapter{ - Endpoint: "https://d.socdm.com/adsv/v1"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) - + bidder := NewAdgenerationAdapter("https://d.socdm.com/adsv/v1") // Test items var request *openrtb.BidRequest var currency string @@ -148,12 +123,12 @@ func TestGetCurrency(t *testing.T) { usdCur := []string{"USD", "EUR"} request = &openrtb.BidRequest{Cur: innerDefaultCur} - currency = bidderAdgeneration.getCurrency(request) + currency = bidder.getCurrency(request) if currency != "JPY" { t.Errorf("%v does not match currency.", innerDefaultCur) } request = &openrtb.BidRequest{Cur: usdCur} - currency = bidderAdgeneration.getCurrency(request) + currency = bidder.getCurrency(request) if currency != "USD" { t.Errorf("%v does not match currency.", usdCur) } @@ -203,15 +178,7 @@ func TestCreateAd(t *testing.T) { } func TestMakeBids(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdgeneration, config.Adapter{ - Endpoint: "https://d.socdm.com/adsv/v1"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - bidderAdgeneration, _ := bidder.(*AdgenerationAdapter) - + bidder := NewAdgenerationAdapter("https://d.socdm.com/adsv/v1") internalRequest := &openrtb.BidRequest{ ID: "test-success-bid-request", Imp: []openrtb.Imp{ @@ -231,7 +198,7 @@ func TestMakeBids(t *testing.T) { if len(errs) > 0 { t.Errorf("MakeBids return errors. errors: %v", errs) } - checkBidResponse(t, defaultCurBidderResponse, bidderAdgeneration.defaultCurrency) + checkBidResponse(t, defaultCurBidderResponse, bidder.defaultCurrency) // Specified Currency InternalRequest usdCur := "USD" diff --git a/adapters/adhese/adhese.go b/adapters/adhese/adhese.go index 96a936c2276..c6a16ed051e 100644 --- a/adapters/adhese/adhese.go +++ b/adapters/adhese/adhese.go @@ -12,7 +12,6 @@ import ( "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" @@ -268,15 +267,11 @@ func ContainsAny(raw string, keys []string) bool { } -// Builder builds a new instance of the Adhese 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) +func NewAdheseBidder(uri string) *AdheseAdapter { + template, err := template.New("endpointTemplate").Parse(uri) if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + glog.Fatal("Unable to parse endpoint url template") + return nil } - - bidder := &AdheseAdapter{ - endpointTemplate: *template, - } - return bidder, nil + return &AdheseAdapter{endpointTemplate: *template} } diff --git a/adapters/adhese/adhese_test.go b/adapters/adhese/adhese_test.go index 40b28887c20..6078d436cfe 100644 --- a/adapters/adhese/adhese_test.go +++ b/adapters/adhese/adhese_test.go @@ -4,25 +4,8 @@ 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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdhese, config.Adapter{ - Endpoint: "https://ads-{{.AccountID}}.adhese.com/json"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adhesetest", bidder) -} - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAdhese, config.Adapter{ - Endpoint: "{{Malformed}}"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "adhesetest", NewAdheseBidder("https://ads-{{.AccountID}}.adhese.com/json")) } diff --git a/adapters/adkernel/adkernel.go b/adapters/adkernel/adkernel.go index f483ba7ce49..2c78d104839 100644 --- a/adapters/adkernel/adkernel.go +++ b/adapters/adkernel/adkernel.go @@ -9,10 +9,10 @@ import ( "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" ) type adkernelAdapter struct { @@ -254,15 +254,12 @@ func newBadServerResponseError(message string) error { } } -// Builder builds a new instance of the Adkernel adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - urlTemplate, err := template.New("endpointTemplate").Parse(config.Endpoint) +// NewAdkernelAdapter to be called in prebid-server core to create Adkernel adapter instance +func NewAdkernelAdapter(endpointTemplate string) adapters.Bidder { + urlTemplate, err := template.New("endpointTemplate").Parse(endpointTemplate) if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + glog.Fatal("Unable to parse endpoint url template") + return nil } - - bidder := &adkernelAdapter{ - EndpointTemplate: *urlTemplate, - } - return bidder, nil + return &adkernelAdapter{EndpointTemplate: *urlTemplate} } diff --git a/adapters/adkernel/adkernel_test.go b/adapters/adkernel/adkernel_test.go index a85769f5565..f7cb9a22a9e 100644 --- a/adapters/adkernel/adkernel_test.go +++ b/adapters/adkernel/adkernel_test.go @@ -4,25 +4,8 @@ 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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdkernel, config.Adapter{ - Endpoint: "http://{{.Host}}/hb?zone={{.ZoneID}}"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adkerneltest", bidder) -} - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAdkernel, config.Adapter{ - Endpoint: "{{Malformed}}"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "adkerneltest", NewAdkernelAdapter("http://{{.Host}}/hb?zone={{.ZoneID}}")) } diff --git a/adapters/adkernelAdn/adkernelAdn.go b/adapters/adkernelAdn/adkernelAdn.go index 491bead4e8b..14100d48dac 100644 --- a/adapters/adkernelAdn/adkernelAdn.go +++ b/adapters/adkernelAdn/adkernelAdn.go @@ -9,10 +9,10 @@ import ( "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" ) const defaultDomain string = "tag.adkernel.com" @@ -278,15 +278,12 @@ func newBadServerResponseError(message string) error { } } -// Builder builds a new instance of the AdkernelAdn 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) +// NewAdkernelAdnAdapter to be called in prebid-server core to create AdkernelAdn adapter instance +func NewAdkernelAdnAdapter(endpointTemplate string) adapters.Bidder { + template, err := template.New("endpointTemplate").Parse(endpointTemplate) if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + glog.Fatal("Unable to parse endpoint url template") + return nil } - - bidder := &adkernelAdnAdapter{ - EndpointTemplate: *template, - } - return bidder, nil + return &adkernelAdnAdapter{EndpointTemplate: *template} } diff --git a/adapters/adkernelAdn/adkernelAdn_test.go b/adapters/adkernelAdn/adkernelAdn_test.go index a4311d3e550..e8145723822 100644 --- a/adapters/adkernelAdn/adkernelAdn_test.go +++ b/adapters/adkernelAdn/adkernelAdn_test.go @@ -4,25 +4,8 @@ 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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdkernelAdn, config.Adapter{ - Endpoint: "http://{{.Host}}/rtbpub?account={{.PublisherID}}"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adkerneladntest", bidder) -} - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAdkernelAdn, config.Adapter{ - Endpoint: "{{Malformed}}"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "adkerneladntest", NewAdkernelAdnAdapter("http://{{.Host}}/rtbpub?account={{.PublisherID}}")) } diff --git a/adapters/adman/adman.go b/adapters/adman/adman.go index 3c0342fe24f..b6276a9fac3 100644 --- a/adapters/adman/adman.go +++ b/adapters/adman/adman.go @@ -7,7 +7,6 @@ import ( "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" ) @@ -17,12 +16,11 @@ type AdmanAdapter struct { URI string } -// Builder builds a new instance of the Adman adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AdmanAdapter{ - URI: config.Endpoint, +// NewAdmanBidder Initializes the Bidder +func NewAdmanBidder(endpoint string) *AdmanAdapter { + return &AdmanAdapter{ + URI: endpoint, } - return bidder, nil } type admanParams struct { diff --git a/adapters/adman/adman_test.go b/adapters/adman/adman_test.go index 5dc10df8dad..66d84aa8b81 100644 --- a/adapters/adman/adman_test.go +++ b/adapters/adman/adman_test.go @@ -4,17 +4,9 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdman, config.Adapter{ - Endpoint: "http://pub.admanmedia.com/?c=o&m=ortb"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "admantest", bidder) + admanAdapter := NewAdmanBidder("http://pub.admanmedia.com/?c=o&m=ortb") + adapterstest.RunJSONBidderTest(t, "admantest", admanAdapter) } diff --git a/adapters/adman/admantest/supplemental/status-204.json b/adapters/adman/admantest/supplemental/status-204.json index a659754e8b0..72b28bffdcf 100644 --- a/adapters/adman/admantest/supplemental/status-204.json +++ b/adapters/adman/admantest/supplemental/status-204.json @@ -1,82 +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 - } - ] - }, - "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://pub.admanmedia.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 + } + ] + }, + "tagid": "17", + "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": 204, - "body": {} - } - } - ], - "expectedBidResponses": [] + }, + "httpCalls": [{ + "expectedRequest": { + "uri": "http://pub.admanmedia.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" + } + } + } + ], + "app": { + "id": "1", + "bundle": "com.wls.testwlsapplication" + }, + "device": { + "ip": "123.123.123.123", + "ifa": "sdjfksdf-dfsds-dsdg-dsgg" + } + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + }] } diff --git a/adapters/admixer/admixer.go b/adapters/admixer/admixer.go index b16dc0073d4..18f8331d45e 100644 --- a/adapters/admixer/admixer.go +++ b/adapters/admixer/admixer.go @@ -3,25 +3,19 @@ package admixer import ( "encoding/json" "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" + "net/http" ) type AdmixerAdapter struct { endpoint string } -// Builder builds a new instance of the Admixer adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AdmixerAdapter{ - endpoint: config.Endpoint, - } - return bidder, nil +func NewAdmixerBidder(endpoint string) *AdmixerAdapter { + return &AdmixerAdapter{endpoint: endpoint} } type admixerImpExt struct { diff --git a/adapters/admixer/admixer_test.go b/adapters/admixer/admixer_test.go index 629d4df83cd..c8df05f73a7 100644 --- a/adapters/admixer/admixer_test.go +++ b/adapters/admixer/admixer_test.go @@ -1,20 +1,10 @@ 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" + "testing" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdmixer, config.Adapter{ - Endpoint: "http://inv-nets.admixer.net/pbs.aspx"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "admixertest", bidder) + adapterstest.RunJSONBidderTest(t, "admixertest", NewAdmixerBidder("http://inv-nets.admixer.net/pbs.aspx")) } diff --git a/adapters/admixer/admixertest/exemplary/optional-params.json b/adapters/admixer/admixertest/exemplary/optional-params.json index 8ef112bbdb5..42a55ec95e8 100644 --- a/adapters/admixer/admixertest/exemplary/optional-params.json +++ b/adapters/admixer/admixertest/exemplary/optional-params.json @@ -100,6 +100,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/admixer/usersync_test.go b/adapters/admixer/usersync_test.go index 8a43b866804..cffe596cdce 100644 --- a/adapters/admixer/usersync_test.go +++ b/adapters/admixer/usersync_test.go @@ -11,7 +11,7 @@ import ( ) func TestAdmixerSyncer(t *testing.T) { - syncURL := "http://anyHost/anyPath" + syncURL := "https://inv-nets.admixer.net/adxcm.aspx?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=1&rurl=localhost%2Fsetuid%3Fbidder%3Dadmixer%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%24visitor_cookie%24%24" syncURLTemplate := template.Must( template.New("sync-template").Parse(syncURL), ) @@ -28,7 +28,7 @@ func TestAdmixerSyncer(t *testing.T) { }) assert.NoError(t, err) - assert.Equal(t, "http://anyHost/anyPath", syncInfo.URL) + assert.Equal(t, "https://inv-nets.admixer.net/adxcm.aspx?gdpr=A&gdpr_consent=B&us_privacy=C&redir=1&rurl=localhost%2Fsetuid%3Fbidder%3Dadmixer%26gdpr%3DA%26gdpr_consent%3DB%26uid%3D%24%24visitor_cookie%24%24", 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/adocean.go b/adapters/adocean/adocean.go index 8310626fcec..a70fc5ba1cb 100644 --- a/adapters/adocean/adocean.go +++ b/adapters/adocean/adocean.go @@ -2,7 +2,6 @@ package adocean import ( "encoding/json" - "errors" "fmt" "math/rand" "net/http" @@ -15,10 +14,10 @@ import ( "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" ) const adapterVersion = "1.1.0" @@ -59,23 +58,25 @@ type requestData struct { SlaveSizes map[string]string } -// Builder builds a new instance of the AdOcean adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - endpointTemplate, err := template.New("endpointTemplate").Parse(config.Endpoint) +func NewAdOceanBidder(client *http.Client, endpointTemplateString string) *AdOceanAdapter { + a := &adapters.HTTPAdapter{Client: client} + endpointTemplate, err := template.New("endpointTemplate").Parse(endpointTemplateString) if err != nil { - return nil, errors.New("Unable to parse endpoint template") + glog.Fatal("Unable to parse endpoint template") + return nil } whiteSpace := regexp.MustCompile(`\s+`) - bidder := &AdOceanAdapter{ + return &AdOceanAdapter{ + http: a, endpointTemplate: *endpointTemplate, measurementCode: whiteSpace.ReplaceAllString(measurementCode, " "), } - return bidder, nil } type AdOceanAdapter struct { + http *adapters.HTTPAdapter endpointTemplate template.Template measurementCode string } diff --git a/adapters/adocean/adocean_test.go b/adapters/adocean/adocean_test.go index b75de2a9235..1088fedd30e 100644 --- a/adapters/adocean/adocean_test.go +++ b/adapters/adocean/adocean_test.go @@ -1,28 +1,12 @@ package adocean import ( + "net/http" "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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdOcean, config.Adapter{ - Endpoint: "https://{{.Host}}"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adoceantest", bidder) -} - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAdOcean, config.Adapter{ - Endpoint: "{{Malformed}}"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "adoceantest", NewAdOceanBidder(new(http.Client), "https://{{.Host}}")) } diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index 498bb4c7cc0..717ad6211d1 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -10,10 +10,10 @@ import ( "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" ) const DefaultClient = "app" @@ -36,17 +36,14 @@ type AdopplerAdapter struct { endpoint *template.Template } -// Builder builds a new instance of the Adoppler 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) +func NewAdopplerBidder(endpoint string) *AdopplerAdapter { + t, err := template.New("endpoint").Parse(endpoint) if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + glog.Fatalf("Unable to parse endpoint url template: %s", err) + return nil } - bidder := &AdopplerAdapter{ - endpoint: template, - } - return bidder, nil + return &AdopplerAdapter{t} } func (ads *AdopplerAdapter) MakeRequests( diff --git a/adapters/adoppler/adoppler_test.go b/adapters/adoppler/adoppler_test.go index eab0ac5708d..775524b171d 100644 --- a/adapters/adoppler/adoppler_test.go +++ b/adapters/adoppler/adoppler_test.go @@ -4,17 +4,9 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdoppler, config.Adapter{ - Endpoint: "http://{{.AccountID}}.trustedmarketplace.com/processHeaderBid/{{.AdUnit}}"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - + bidder := NewAdopplerBidder("http://{{.AccountID}}.trustedmarketplace.com/processHeaderBid/{{.AdUnit}}") adapterstest.RunJSONBidderTest(t, "adopplertest", bidder) } diff --git a/adapters/adot/adot.go b/adapters/adot/adot.go deleted file mode 100644 index fcbb5a2906d..00000000000 --- a/adapters/adot/adot.go +++ /dev/null @@ -1,117 +0,0 @@ -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" - "net/http" -) - -type adapter struct { - endpoint string -} - -type adotBidExt struct { - Adot bidExt `json:"adot"` -} - -type bidExt struct { - MediaType string `json:"media_type"` -} - -// Builder builds a new instance of the Adot 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, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - var reqJSON []byte - var err error - - if reqJSON, err = json.Marshal(request); err != nil { - return nil, []error{fmt.Errorf("unable to marshal openrtb request (%v)", err)} - } - - headers := http.Header{} - headers.Add("Content-Type", "application/json;charset=utf-8") - - return []*adapters.RequestData{{ - Method: "POST", - Uri: a.endpoint, - Body: reqJSON, - Headers: headers, - }}, nil -} - -// 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) { - if response.StatusCode == http.StatusNoContent { - return nil, nil - } - - if response.StatusCode == http.StatusBadRequest { - return nil, []error{&errortypes.BadInput{ - Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), - }} - } - - if response.StatusCode != http.StatusOK { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), - }} - } - - var bidResp openrtb.BidResponse - if err := json.Unmarshal(response.Body, &bidResp); err != nil { - return nil, []error{err} - } - - bidsCapacity := 1 - if len(bidResp.SeatBid) > 0 { - bidsCapacity = len(bidResp.SeatBid[0].Bid) - } - bidResponse := adapters.NewBidderResponseWithBidsCapacity(bidsCapacity) - - for _, sb := range bidResp.SeatBid { - for i := range sb.Bid { - if bidType, err := getMediaTypeForBid(&sb.Bid[i]); err == nil { - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &sb.Bid[i], - BidType: bidType, - }) - } - } - } - - return bidResponse, nil -} - -// getMediaTypeForBid determines which type of bid. -func getMediaTypeForBid(bid *openrtb.Bid) (openrtb_ext.BidType, error) { - if bid == nil { - return "", fmt.Errorf("the bid request object is nil") - } - - var impExt adotBidExt - if err := json.Unmarshal(bid.Ext, &impExt); err == nil { - switch impExt.Adot.MediaType { - case string(openrtb_ext.BidTypeBanner): - return openrtb_ext.BidTypeBanner, nil - case string(openrtb_ext.BidTypeVideo): - return openrtb_ext.BidTypeVideo, nil - case string(openrtb_ext.BidTypeNative): - return openrtb_ext.BidTypeNative, nil - } - } - - return "", fmt.Errorf("unrecognized bid type in response from adot") -} diff --git a/adapters/adot/adot_test.go b/adapters/adot/adot_test.go deleted file mode 100644 index 2e6e74861d4..00000000000 --- a/adapters/adot/adot_test.go +++ /dev/null @@ -1,76 +0,0 @@ -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/stretchr/testify/assert" - "testing" -) - -const testsBidderEndpoint = "https://dsp.adotmob.com/headerbidding/bidrequest" - -func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdot, config.Adapter{ - Endpoint: testsBidderEndpoint}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adottest", bidder) -} - -//Test the media type error -func TestMediaTypeError(t *testing.T) { - _, err := getMediaTypeForBid(nil) - - assert.Error(t, err) - - byteInvalid, _ := json.Marshal(&adotBidExt{Adot: bidExt{"invalid"}}) - _, err = getMediaTypeForBid(&openrtb.Bid{Ext: json.RawMessage(byteInvalid)}) - - assert.Error(t, err) -} - -//Test the bid response when the bidder return a status code 204 -func TestBidResponseNoContent(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdot, config.Adapter{ - Endpoint: "https://dsp.adotmob.com/headerbidding/bidrequest"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - bidResponse, err := bidder.MakeBids(nil, nil, &adapters.ResponseData{StatusCode: 204}) - if bidResponse != nil { - t.Fatalf("the bid response should be nil since the bidder status is No Content") - } else if err != nil { - t.Fatalf("the error should be nil since the bidder status is 204 : No Content") - } -} - -//Test the media type for a bid response -func TestMediaTypeForBid(t *testing.T) { - byteBanner, _ := json.Marshal(&adotBidExt{Adot: bidExt{"banner"}}) - byteVideo, _ := json.Marshal(&adotBidExt{Adot: bidExt{"video"}}) - byteNative, _ := json.Marshal(&adotBidExt{Adot: bidExt{"native"}}) - - bidTypeBanner, _ := getMediaTypeForBid(&openrtb.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)}) - 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)}) - 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/exemplary/simple-banner.json b/adapters/adot/adottest/exemplary/simple-banner.json deleted file mode 100644 index 1b8cb9867f6..00000000000 --- a/adapters/adot/adottest/exemplary/simple-banner.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [{ - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-banner-id", - "seatbid": [{ - "seat": "adot", - "bid": [{ - "id": "test-request-banner-id", - "impid": "test-imp-banner-id", - "price": 1.16346, - "adm": "some-test-ad", - "w": 320, - "h": 50, - "ext": { - "adot": { - "media_type": "banner" - } - } - }] - } - ], - "cur": "USD" - } - } - }], - - "expectedBidResponses": [{ - "currency": "USD", - "bids": [{ - "bid": { - "id": "test-request-banner-id", - "impid": "test-imp-banner-id", - "price": 1.16346, - "adm": "some-test-ad", - "w": 320, - "h": 50, - "ext": { - "adot": { - "media_type": "banner" - } - } - }, - "type": "banner" - }] - }] -} - diff --git a/adapters/adot/adottest/exemplary/simple-interstitial.json b/adapters/adot/adottest/exemplary/simple-interstitial.json deleted file mode 100644 index 0e9b573a530..00000000000 --- a/adapters/adot/adottest/exemplary/simple-interstitial.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-inter-id", - "imp": [ - { - "id": "test-imp-inter-id", - "banner": { - "format": [ - { - "w": 320, - "h": 480 - } - ], - "w": 320, - "h": 480 - }, - "instl":1, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-inter-id", - "imp": [ - { - "id": "test-imp-inter-id", - "banner": { - "format": [ - { - "w": 320, - "h": 480 - } - ], - "w": 320, - "h": 480 - }, - "instl":1, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "adot", - "bid": [{ - "id": "test-request-inter-id", - "impid": "test-imp-inter-id", - "adm": "some-test-ad", - "price": 1.16346, - "w": 320, - "h": 480, - "ext": { - "adot": { - "media_type": "banner" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "bids": [{ - "bid": { - "id": "test-request-inter-id", - "impid": "test-imp-inter-id", - "price": 1.16346, - "adm": "some-test-ad", - "w": 320, - "h": 480, - "ext": { - "adot": { - "media_type": "banner" - } - } - }, - "type": "banner" - } - ] - } - ] -} - diff --git a/adapters/adot/adottest/exemplary/simple-native.json b/adapters/adot/adottest/exemplary/simple-native.json deleted file mode 100644 index 5fa3c70fd73..00000000000 --- a/adapters/adot/adottest/exemplary/simple-native.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-native-id", - "imp": [ - { - "id": "test-imp-native-id", - "native": { - "request": "test-native", - "ver": "1.1" - }, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-native-id", - "imp": [ - { - "id": "test-imp-native-id", - "native": { - "request": "test-native", - "ver": "1.1" - }, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "adot", - "bid": [{ - "id": "test-request-native-id", - "impid": "test-imp-native-id", - "price": 1.16346, - "adm" : "native-ad", - "w": 300, - "h": 250, - "ext": { - "adot": { - "media_type": "native" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "test-request-native-id", - "impid": "test-imp-native-id", - "price": 1.16346, - "adm" : "native-ad", - "w": 300, - "h": 250, - "ext": { - "adot": { - "media_type": "native" - } - } - }, - "type": "native" - } - ] - } - ] -} - diff --git a/adapters/adot/adottest/exemplary/simple-video.json b/adapters/adot/adottest/exemplary/simple-video.json deleted file mode 100644 index a453c4b9e18..00000000000 --- a/adapters/adot/adottest/exemplary/simple-video.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "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 - ] - }, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "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 - ] - }, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "adot", - "bid": [{ - "id": "test-request-video-id", - "impid": "test-imp-video-id", - "price": 1.16346, - "adm": "some-test-ad", - "w": 300, - "h": 250, - "ext": { - "adot": { - "media_type": "video" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "test-request-video-id", - "impid": "test-imp-video-id", - "price": 1.16346, - "adm": "some-test-ad", - "w": 300, - "h": 250, - "ext": { - "adot": { - "media_type": "video" - } - } - }, - "type": "video" - } - ] - } - ] -} - diff --git a/adapters/adot/adottest/params/race/banner.json b/adapters/adot/adottest/params/race/banner.json deleted file mode 100644 index ada77aa4440..00000000000 --- a/adapters/adot/adottest/params/race/banner.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "placementId": "ee234aac-113" -} \ No newline at end of file diff --git a/adapters/adot/adottest/params/race/video.json b/adapters/adot/adottest/params/race/video.json deleted file mode 100644 index 37808cd2ddc..00000000000 --- a/adapters/adot/adottest/params/race/video.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "placementId": "ee234aac-112" -} \ No newline at end of file diff --git a/adapters/adot/adottest/supplemental/simple-audio.json b/adapters/adot/adottest/supplemental/simple-audio.json deleted file mode 100644 index 9be53c4cee9..00000000000 --- a/adapters/adot/adottest/supplemental/simple-audio.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "mockBidRequest": { - "id": "unsupported-audio-request", - "imp": [ - { - "id": "unsupported-audio-imp", - "audio": { - "mimes": ["video/mp4"] - }, - "ext": { - "bidder": { - "placementId": 1 - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "unsupported-audio-request", - "imp": [ - { - "id": "unsupported-audio-imp", - "audio": { - "mimes": ["video/mp4"] - }, - "ext": { - "bidder": { - "placementId": 1 - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "adot", - "bid": [{ - "id": "test-request-audio-id", - "impid": "test-imp-audio-id", - "price": 1.16346, - "adm": "some-audio-ad", - "ext": { - "adot": { - "media_type": "audio" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [] -} diff --git a/adapters/adot/adottest/supplemental/simple-parallax.json b/adapters/adot/adottest/supplemental/simple-parallax.json deleted file mode 100644 index 4ee2ebc22d0..00000000000 --- a/adapters/adot/adottest/supplemental/simple-parallax.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-parallax-id", - "imp": [ - { - "id": "test-imp-parallax-id", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 600 - }, - "ext": { - "adot": { - "parallax": true - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-parallax-id", - "imp": [ - { - "id": "test-imp-parallax-id", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 600 - }, - "ext": { - "adot": { - "parallax": true - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "adot", - "bid": [{ - "id": "test-request-parallax-id", - "impid": "test-imp-parallax-id", - "price": 0.5, - "adm": "some-test-ad", - "w": 300, - "h": 600, - "ext": { - "adot": { - "media_type": "banner" - } - } - }] - } - ], - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "test-request-parallax-id", - "impid": "test-imp-parallax-id", - "price": 0.5, - "adm": "some-test-ad", - "w": 300, - "h": 600, - "ext": { - "adot": { - "media_type": "banner" - } - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/adot/adottest/supplemental/status_204.json b/adapters/adot/adottest/supplemental/status_204.json deleted file mode 100644 index 44a895b5c24..00000000000 --- a/adapters/adot/adottest/supplemental/status_204.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": {}, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": {}, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 204, - "body": {} - } - } - ], - "expectedBidResponses": [] -} - diff --git a/adapters/adot/adottest/supplemental/status_400.json b/adapters/adot/adottest/supplemental/status_400.json deleted file mode 100644 index 22328fd9908..00000000000 --- a/adapters/adot/adottest/supplemental/status_400.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 400, - "body": {} - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} - diff --git a/adapters/adot/adottest/supplemental/status_500.json b/adapters/adot/adottest/supplemental/status_500.json deleted file mode 100644 index 879bb8c5581..00000000000 --- a/adapters/adot/adottest/supplemental/status_500.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 500, - "body": {} - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} - diff --git a/adapters/adot/adottest/supplemental/unmarshal_error.json b/adapters/adot/adottest/supplemental/unmarshal_error.json deleted file mode 100644 index a87e1189a62..00000000000 --- a/adapters/adot/adottest/supplemental/unmarshal_error.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://dsp.adotmob.com/headerbidding/bidrequest", - "body": { - "id": "test-request-banner-id", - "imp": [ - { - "id": "test-imp-banner-id", - "banner": { - "format": [ - { - "w": 320, - "h": 250 - } - ], - "w": 320, - "h": 250 - }, - "ext": { - "adot": {} - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": "fail for unmarshal" - } - }], - - "expectedMakeBidsErrors": [ - { - "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", - "comparison": "literal" - } - ] -} - diff --git a/adapters/adot/params_test.go b/adapters/adot/params_test.go deleted file mode 100644 index 2a6dc17d916..00000000000 --- a/adapters/adot/params_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package adot - -import ( - "encoding/json" - "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" - "testing" -) - -// This file actually intends to test static/bidder-params/adot.json -// -// These also validate the format of the external API: request.imp[i].ext.adot - -// TestValidParams makes sure that the adot 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.BidderAdot, json.RawMessage(validParam)); err != nil { - t.Errorf("Schema rejected adot 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.BidderAdot, json.RawMessage(invalidParam)); err == nil { - t.Errorf("Schema allowed unexpected params: %s", invalidParam) - } - } -} - -var validParams = []string{ - `{}`, - `{"placementId": "test-114"}`, - `{"placementId": "test-113", "parallax": true}`, - `{"placementId": "test-113", "parallax": false}`, -} - -var invalidParams = []string{ - `{"parallax": 1}`, - `{"placementId": 135123}`, - `{"placementId": 113, "parallax": 1}`, - `{"placementId": 142, "parallax": true}`, - `{"placementId": "test-114", "parallax": 1}`, -} diff --git a/adapters/adpone/adpone.go b/adapters/adpone/adpone.go index ec4cba75f87..9064e971fcb 100644 --- a/adapters/adpone/adpone.go +++ b/adapters/adpone/adpone.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" - "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/openrtb_ext" "github.com/PubMatic-OpenWrap/openrtb" @@ -13,12 +12,8 @@ import ( "github.com/PubMatic-OpenWrap/prebid-server/errortypes" ) -// Builder builds a new instance of the Adpone adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &adponeAdapter{ - endpoint: config.Endpoint, - } - return bidder, nil +func NewAdponeBidder(endpoint string) *adponeAdapter { + return &adponeAdapter{endpoint: endpoint} } type adponeAdapter struct { diff --git a/adapters/adpone/adpone_test.go b/adapters/adpone/adpone_test.go index 69726e31d50..2cce1d7c62c 100644 --- a/adapters/adpone/adpone_test.go +++ b/adapters/adpone/adpone_test.go @@ -4,20 +4,11 @@ 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" ) const testsDir = "adponetest" const testsBidderEndpoint = "http://localhost/prebid_server" func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdpone, config.Adapter{ - Endpoint: testsBidderEndpoint}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, testsDir, bidder) + adapterstest.RunJSONBidderTest(t, testsDir, NewAdponeBidder(testsBidderEndpoint)) } diff --git a/adapters/adprime/adprime.go b/adapters/adprime/adprime.go index 053999fd5d1..2ef5f26edc7 100644 --- a/adapters/adprime/adprime.go +++ b/adapters/adprime/adprime.go @@ -7,7 +7,6 @@ import ( "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" @@ -18,12 +17,11 @@ type AdprimeAdapter struct { URI string } -// Builder builds a new instance of the Adprime adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AdprimeAdapter{ - URI: config.Endpoint, +// NewAdprimeBidder Initializes the Bidder +func NewAdprimeBidder(endpoint string) *AdprimeAdapter { + return &AdprimeAdapter{ + URI: endpoint, } - return bidder, nil } // MakeRequests create bid request for adprime demand diff --git a/adapters/adprime/adprime_test.go b/adapters/adprime/adprime_test.go index cfcf255a5cc..1da70595401 100644 --- a/adapters/adprime/adprime_test.go +++ b/adapters/adprime/adprime_test.go @@ -4,17 +4,9 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdprime, config.Adapter{ - Endpoint: "http://delta.adprime.com/?c=o&m=ortb"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adprimetest", bidder) + adprimeAdapter := NewAdprimeBidder("http://delta.adprime.com/?c=o&m=ortb") + adapterstest.RunJSONBidderTest(t, "adprimetest", adprimeAdapter) } diff --git a/adapters/adprime/adprimetest/supplemental/status-204.json b/adapters/adprime/adprimetest/supplemental/status-204.json index 4fa57dcee86..44ee59d4d28 100644 --- a/adapters/adprime/adprimetest/supplemental/status-204.json +++ b/adapters/adprime/adprimetest/supplemental/status-204.json @@ -75,6 +75,5 @@ "status": 204, "body": {} } - }], - "expectedBidResponses": [] + }] } diff --git a/adapters/adtarget/adtarget.go b/adapters/adtarget/adtarget.go index 070ede40feb..d3d13fd33de 100644 --- a/adapters/adtarget/adtarget.go +++ b/adapters/adtarget/adtarget.go @@ -7,7 +7,6 @@ import ( "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" ) @@ -183,10 +182,8 @@ func validateImpressionAndSetExt(imp *openrtb.Imp) (int, error) { return impExt.SourceId, nil } -// Builder builds a new instance of the Adtarget adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AdtargetAdapter{ - endpoint: config.Endpoint, +func NewAdtargetBidder(endpoint string) *AdtargetAdapter { + return &AdtargetAdapter{ + endpoint: endpoint, } - return bidder, nil } diff --git a/adapters/adtarget/adtarget_test.go b/adapters/adtarget/adtarget_test.go index bb20b40c286..1fd67dfe7b1 100644 --- a/adapters/adtarget/adtarget_test.go +++ b/adapters/adtarget/adtarget_test.go @@ -4,17 +4,8 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdtarget, config.Adapter{ - Endpoint: "http://ghb.console.adtarget.com.tr/pbs/ortb"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adtargettest", bidder) + adapterstest.RunJSONBidderTest(t, "adtargettest", NewAdtargetBidder("http://ghb.console.adtarget.com.tr/pbs/ortb")) } diff --git a/adapters/adtarget/adtargettest/exemplary/simple-banner.json b/adapters/adtarget/adtargettest/exemplary/simple-banner.json index 3799612455f..b63739bda0f 100644 --- a/adapters/adtarget/adtargettest/exemplary/simple-banner.json +++ b/adapters/adtarget/adtargettest/exemplary/simple-banner.json @@ -58,6 +58,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] -} + ] +} \ No newline at end of file diff --git a/adapters/adtarget/adtargettest/exemplary/simple-video.json b/adapters/adtarget/adtargettest/exemplary/simple-video.json index bf6de569496..4dc4547d7d1 100644 --- a/adapters/adtarget/adtargettest/exemplary/simple-video.json +++ b/adapters/adtarget/adtargettest/exemplary/simple-video.json @@ -51,6 +51,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] -} + ] +} \ No newline at end of file diff --git a/adapters/adtarget/adtargettest/supplemental/explicit-dimensions.json b/adapters/adtarget/adtargettest/supplemental/explicit-dimensions.json index c33b1bb2daa..a4e487466ea 100644 --- a/adapters/adtarget/adtargettest/supplemental/explicit-dimensions.json +++ b/adapters/adtarget/adtargettest/supplemental/explicit-dimensions.json @@ -54,6 +54,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/adtelligent/adtelligent.go b/adapters/adtelligent/adtelligent.go index 7d8f6099fbf..60989aaa315 100644 --- a/adapters/adtelligent/adtelligent.go +++ b/adapters/adtelligent/adtelligent.go @@ -7,7 +7,6 @@ import ( "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" ) @@ -184,10 +183,8 @@ func validateImpression(imp *openrtb.Imp) (int, error) { return impExt.SourceId, nil } -// Builder builds a new instance of the Adtelligent adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AdtelligentAdapter{ - endpoint: config.Endpoint, +func NewAdtelligentBidder(endpoint string) *AdtelligentAdapter { + return &AdtelligentAdapter{ + endpoint: endpoint, } - return bidder, nil } diff --git a/adapters/adtelligent/adtelligent_test.go b/adapters/adtelligent/adtelligent_test.go index 6a104aa7463..ce8d24a3c21 100644 --- a/adapters/adtelligent/adtelligent_test.go +++ b/adapters/adtelligent/adtelligent_test.go @@ -4,17 +4,8 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdtelligent, config.Adapter{ - Endpoint: "http://ghb.adtelligent.com/pbs/ortb"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "adtelligenttest", bidder) + adapterstest.RunJSONBidderTest(t, "adtelligenttest", NewAdtelligentBidder("http://ghb.adtelligent.com/pbs/ortb")) } diff --git a/adapters/adtelligent/adtelligenttest/exemplary/simple-banner.json b/adapters/adtelligent/adtelligenttest/exemplary/simple-banner.json index 8c6fe3ade1b..a06477b4d18 100644 --- a/adapters/adtelligent/adtelligenttest/exemplary/simple-banner.json +++ b/adapters/adtelligent/adtelligenttest/exemplary/simple-banner.json @@ -58,6 +58,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } \ No newline at end of file diff --git a/adapters/adtelligent/adtelligenttest/exemplary/simple-video.json b/adapters/adtelligent/adtelligenttest/exemplary/simple-video.json index aabcf952f78..f108cc94b17 100644 --- a/adapters/adtelligent/adtelligenttest/exemplary/simple-video.json +++ b/adapters/adtelligent/adtelligenttest/exemplary/simple-video.json @@ -51,6 +51,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } \ No newline at end of file diff --git a/adapters/adtelligent/adtelligenttest/supplemental/explicit-dimensions.json b/adapters/adtelligent/adtelligenttest/supplemental/explicit-dimensions.json index 7d6ce5b8084..6155e9bc56b 100644 --- a/adapters/adtelligent/adtelligenttest/supplemental/explicit-dimensions.json +++ b/adapters/adtelligent/adtelligenttest/supplemental/explicit-dimensions.json @@ -54,6 +54,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/advangelists/advangelists.go b/adapters/advangelists/advangelists.go index 249e3282481..e882a6f266a 100644 --- a/adapters/advangelists/advangelists.go +++ b/adapters/advangelists/advangelists.go @@ -8,10 +8,10 @@ import ( "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" ) type AdvangelistsAdapter struct { @@ -239,15 +239,12 @@ func getMediaTypeForImpID(impID string, imps []openrtb.Imp) openrtb_ext.BidType return openrtb_ext.BidTypeBanner } -// Builder builds a new instance of the Advangelists 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) +// NewAdvangelistsAdapter to be called in prebid-server core to create advangelists adapter instance +func NewAdvangelistsBidder(endpointTemplate string) adapters.Bidder { + template, err := template.New("endpointTemplate").Parse(endpointTemplate) if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + glog.Fatal("Unable to parse endpoint url template") + return nil } - - bidder := &AdvangelistsAdapter{ - EndpointTemplate: *template, - } - return bidder, nil + return &AdvangelistsAdapter{EndpointTemplate: *template} } diff --git a/adapters/advangelists/advangelists_test.go b/adapters/advangelists/advangelists_test.go index 49cca96a78a..d21c325d84d 100644 --- a/adapters/advangelists/advangelists_test.go +++ b/adapters/advangelists/advangelists_test.go @@ -1,28 +1,10 @@ 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/stretchr/testify/assert" + "testing" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAdvangelists, config.Adapter{ - Endpoint: "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "advangeliststest", bidder) -} - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAdvangelists, config.Adapter{ - Endpoint: "{{Malformed}}"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "advangeliststest", NewAdvangelistsBidder("http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}")) } diff --git a/adapters/aja/aja.go b/adapters/aja/aja.go index afd9c6d7131..55de9567ff8 100644 --- a/adapters/aja/aja.go +++ b/adapters/aja/aja.go @@ -3,13 +3,11 @@ package aja import ( "encoding/json" "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" + "net/http" ) type AJAAdapter struct { @@ -127,10 +125,8 @@ func (a *AJAAdapter) MakeBids(bidReq *openrtb.BidRequest, adapterReq *adapters.R return bidderResp, errors } -// Builder builds a new instance of the AJA adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AJAAdapter{ - endpoint: config.Endpoint, +func NewAJABidder(endpoint string) adapters.Bidder { + return &AJAAdapter{ + endpoint: endpoint, } - return bidder, nil } diff --git a/adapters/aja/aja_test.go b/adapters/aja/aja_test.go index d2d9d7fa7c1..95906b14c2a 100644 --- a/adapters/aja/aja_test.go +++ b/adapters/aja/aja_test.go @@ -4,19 +4,10 @@ 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" ) const testsBidderEndpoint = "https://localhost/bid/4" func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAJA, config.Adapter{ - Endpoint: testsBidderEndpoint}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "ajatest", bidder) + adapterstest.RunJSONBidderTest(t, "ajatest", NewAJABidder(testsBidderEndpoint)) } diff --git a/adapters/amx/amx.go b/adapters/amx/amx.go index ddd0c0373da..2578ab786c6 100644 --- a/adapters/amx/amx.go +++ b/adapters/amx/amx.go @@ -9,40 +9,39 @@ import ( "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" ) const vastImpressionFormat = "" const vastSearchPoint = "" const nbrHeaderName = "x-nbr" -const adapterVersion = "pbs1.1" +const adapterVersion = "pbs1.0" // AMXAdapter is the AMX bid adapter type AMXAdapter struct { endpoint string } -// Builder builds a new instance of the AMX adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - endpointURL, err := url.Parse(config.Endpoint) +// NewAMXBidder creates an AMXAdapter +func NewAMXBidder(endpoint string) *AMXAdapter { + endpointURL, err := url.Parse(endpoint) if err != nil { - return nil, fmt.Errorf("invalid endpoint: %v", err) + glog.Fatalf("invalid endpoint provided to AMX: %s, error: %v", endpoint, err) + return nil } qs, err := url.ParseQuery(endpointURL.RawQuery) if err != nil { - return nil, fmt.Errorf("invalid query parameters in the endpoint: %v", err) + glog.Fatalf("invalid query parameters in the endpoint: %s, error: %v", endpointURL.RawQuery, err) + return nil } qs.Add("v", adapterVersion) endpointURL.RawQuery = qs.Encode() - bidder := &AMXAdapter{ - endpoint: endpointURL.String(), - } - return bidder, nil + return &AMXAdapter{endpoint: endpointURL.String()} } type amxExt struct { @@ -149,7 +148,6 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest for _, sb := range bidResp.SeatBid { for _, bid := range sb.Bid { - bid := bid bidExt, bidExtErr := getBidExt(bid.Ext) if bidExtErr != nil { errs = append(errs, bidExtErr) @@ -166,12 +164,11 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest // remove the NURL so a client/player doesn't fire it twice b.Bid.NURL = "" } - bidResponse.Bids = append(bidResponse.Bids, b) } } - return bidResponse, errs + } func getBidExt(ext json.RawMessage) (amxBidExt, error) { diff --git a/adapters/amx/amx_test.go b/adapters/amx/amx_test.go index 6fc850cb2cc..3d6e118772f 100644 --- a/adapters/amx/amx_test.go +++ b/adapters/amx/amx_test.go @@ -8,8 +8,6 @@ import ( "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/stretchr/testify/assert" "github.com/PubMatic-OpenWrap/prebid-server/adapters/adapterstest" @@ -22,40 +20,13 @@ const ( ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ - Endpoint: amxTestEndpoint}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "amxtest", bidder) -} - -func TestEndpointMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ - Endpoint: " http://leading.space.is.invalid"}) - - assert.Error(t, buildErr) -} - -func TestEndpointQueryStringMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ - Endpoint: "http://invalid.query.from.go.docs/page?%gh&%ij"}) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "amxtest", NewAMXBidder(amxTestEndpoint)) } func TestMakeRequestsTagID(t *testing.T) { var w, h int = 300, 250 var width, height uint64 = uint64(w), uint64(h) - - bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ - Endpoint: amxTestEndpoint}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } + adapter := NewAMXBidder(amxTestEndpoint) type testCase struct { tagID string @@ -100,7 +71,7 @@ func TestMakeRequestsTagID(t *testing.T) { Site: &openrtb.Site{}, } - actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) + actualAdapterRequests, err := adapter.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) var body openrtb.BidRequest @@ -112,13 +83,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) - - bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ - Endpoint: amxTestEndpoint}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } + adapter := NewAMXBidder(amxTestEndpoint) type testCase struct { publisherID string @@ -165,7 +130,7 @@ func TestMakeRequestsPublisherId(t *testing.T) { } } - actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) + actualAdapterRequests, err := adapter.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) var body openrtb.BidRequest diff --git a/adapters/amx/amxtest/exemplary/app-simple.json b/adapters/amx/amxtest/exemplary/app-simple.json index c208bff9da4..b2f538493da 100644 --- a/adapters/amx/amxtest/exemplary/app-simple.json +++ b/adapters/amx/amxtest/exemplary/app-simple.json @@ -64,7 +64,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", + "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0", "body": { "app": { "bundle": "639881495", diff --git a/adapters/amx/amxtest/exemplary/display-multiple.json b/adapters/amx/amxtest/exemplary/display-multiple.json deleted file mode 100644 index f885bdb2c5b..00000000000 --- a/adapters/amx/amxtest/exemplary/display-multiple.json +++ /dev/null @@ -1,292 +0,0 @@ -{ - "mockBidRequest": { - "device": { - "dnt": 0, - "h": 1120, - "ip": "98.249.0.0", - "language": "en", - "os": "macos", - "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36", - "w": 1792 - }, - "id": "TL3JS6F43CKNDQFY", - "imp": [ - { - "banner": { - "format": [ - { - "h": 600, - "w": 300 - } - ], - "h": 600, - "pos": 1, - "w": 300 - }, - "ext": { - "bidder": { - "tagId": "cHJlYmlkLm9yZw" - } - }, - "tagid": "example-tag-id", - "id": "1", - "secure": 1 - } - ], - "regs": { - "ext": { - "gdpr": 0, - "us_privacy": "1---" - } - }, - "site": { - "domain": "www.example.com", - "ext": { - "amp": 0 - }, - "publisher": { - "id": "unused_publisher_id" - }, - "page": "https://www.example.com/es6/es6_objects.htm", - "ref": "https://www.example.com/es6/es6_objects.htm" - }, - "source": { - "ext": { - "schain": { - "complete": 1, - "nodes": [ - { - "asi": "amxrtb.com", - "hp": 1, - "sid": "1234" - } - ], - "ver": "1.0" - } - } - }, - "test": 0, - "tmax": 300, - "user": { - "ext": { - "eids": [ - { - "source": "amxid", - "uids": [ - { - "atype": 1, - "id": "88de601e-3d98-48e7-81d7-00000000" - } - ] - }, - { - "source": "adserver.org", - "uids": [ - { - "id": "1234567", - "ext": { - "rtiPartner": "TDID" - } - } - ] - } - ], - "gdpr": 0, - "us_privacy": "1---" - } - } - }, - "httpCalls": [{ - "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", - "body": { - "device": { - "dnt": 0, - "h": 1120, - "ip": "98.249.0.0", - "language": "en", - "os": "macos", - "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36", - "w": 1792 - }, - "id": "TL3JS6F43CKNDQFY", - "imp": [ - { - "banner": { - "format": [ - { - "h": 600, - "w": 300 - } - ], - "h": 600, - "pos": 1, - "w": 300 - }, - "ext": { - "bidder": { - "tagId": "cHJlYmlkLm9yZw" - } - }, - "tagid": "example-tag-id", - "id": "1", - "secure": 1 - } - ], - "regs": { - "ext": { - "gdpr": 0, - "us_privacy": "1---" - } - }, - "site": { - "domain": "www.example.com", - "ext": { - "amp": 0 - }, - "publisher": { - "id": "cHJlYmlkLm9yZw" - }, - "page": "https://www.example.com/es6/es6_objects.htm", - "ref": "https://www.example.com/es6/es6_objects.htm" - }, - "source": { - "ext": { - "schain": { - "complete": 1, - "nodes": [ - { - "asi": "amxrtb.com", - "hp": 1, - "sid": "1234" - } - ], - "ver": "1.0" - } - } - }, - "tmax": 300, - "user": { - "ext": { - "eids": [ - { - "source": "amxid", - "uids": [ - { - "atype": 1, - "id": "88de601e-3d98-48e7-81d7-00000000" - } - ] - }, - { - "source": "adserver.org", - "uids": [ - { - "id": "1234567", - "ext": { - "rtiPartner": "TDID" - } - } - ] - } - ], - "gdpr": 0, - "us_privacy": "1---" - } - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "cur": "USD", - "id": "os4jorvupkyaa===", - "seatbid": [ - { - "bid": [ - { - "adid": "253510977", - "adm": "", - "adomain": [ - "dell.com.au" - ], - "cid": "668", - "crid": "253510977", - "ext": { - }, - "h": 250, - "id": "8911104898220857797", - "impid": "6a362d3a9db4eba300x250", - "nurl": "https://1x1.a-mo.net/hbx/bwin", - "price": 0.50, - "w": 300 - }, - { - "adid": "253510977", - "adm": "", - "adomain": [ - "dell.com.au" - ], - "cid": "668", - "crid": "253510977", - "ext": {}, - "h": 250, - "id": "430444686086263488", - "impid": "6a362d3a9db4eba300x250", - "nurl": "https://1x1.a-mo.net/hbx/bwin", - "price": 0.50, - "w": 300 - } - ], - "group": 0 - } - ] - } - } - }], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "adid": "253510977", - "adm": "", - "adomain": [ - "dell.com.au" - ], - "cid": "668", - "crid": "253510977", - "ext": {}, - "h": 250, - "id": "8911104898220857797", - "impid": "6a362d3a9db4eba300x250", - "nurl": "https://1x1.a-mo.net/hbx/bwin", - "price": 0.50, - "w": 300 - }, - "type": "banner" - }, - { - "bid": { - "adid": "253510977", - "adm": "", - "adomain": [ - "dell.com.au" - ], - "cid": "668", - "crid": "253510977", - "ext": {}, - "h": 250, - "id": "430444686086263488", - "impid": "6a362d3a9db4eba300x250", - "nurl": "https://1x1.a-mo.net/hbx/bwin", - "price": 0.50, - "w": 300 - }, - "type": "banner" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/amx/amxtest/exemplary/video-simple.json b/adapters/amx/amxtest/exemplary/video-simple.json index f8fe587ff63..8fb3baa26d0 100644 --- a/adapters/amx/amxtest/exemplary/video-simple.json +++ b/adapters/amx/amxtest/exemplary/video-simple.json @@ -93,7 +93,7 @@ }, "httpCalls": [{ "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", + "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0", "body": { "device": { "dnt": 0, @@ -242,4 +242,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/adapters/amx/amxtest/exemplary/web-simple.json b/adapters/amx/amxtest/exemplary/web-simple.json index 92fc4afc018..74854f912ae 100644 --- a/adapters/amx/amxtest/exemplary/web-simple.json +++ b/adapters/amx/amxtest/exemplary/web-simple.json @@ -98,7 +98,7 @@ }, "httpCalls": [{ "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", + "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0", "body": { "device": { "dnt": 0, @@ -243,4 +243,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/adapters/amx/amxtest/supplemental/204-response.json b/adapters/amx/amxtest/supplemental/204-response.json index f51347d34d2..09571a03569 100644 --- a/adapters/amx/amxtest/supplemental/204-response.json +++ b/adapters/amx/amxtest/supplemental/204-response.json @@ -47,7 +47,7 @@ }, "httpCalls": [{ "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", + "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0", "body": { "device": { "dnt": 0, diff --git a/adapters/amx/amxtest/supplemental/400-response.json b/adapters/amx/amxtest/supplemental/400-response.json index bb20bc94e7c..f10cea89718 100644 --- a/adapters/amx/amxtest/supplemental/400-response.json +++ b/adapters/amx/amxtest/supplemental/400-response.json @@ -47,7 +47,7 @@ }, "httpCalls": [{ "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", + "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0", "body": { "device": { "dnt": 0, diff --git a/adapters/amx/amxtest/supplemental/500-response.json b/adapters/amx/amxtest/supplemental/500-response.json index c56a217ce2e..fe5d89930c8 100644 --- a/adapters/amx/amxtest/supplemental/500-response.json +++ b/adapters/amx/amxtest/supplemental/500-response.json @@ -47,7 +47,7 @@ }, "httpCalls": [{ "expectedRequest": { - "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1", + "uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0", "body": { "device": { "dnt": 0, diff --git a/adapters/applogy/applogy.go b/adapters/applogy/applogy.go index cdeafa0f426..2c760bc3995 100644 --- a/adapters/applogy/applogy.go +++ b/adapters/applogy/applogy.go @@ -8,7 +8,6 @@ import ( "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" ) @@ -154,10 +153,8 @@ func (a *ApplogyAdapter) MakeBids(request *openrtb.BidRequest, _ *adapters.Reque return response, errs } -// Builder builds a new instance of the Applogy adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &ApplogyAdapter{ - endpoint: config.Endpoint, +func NewApplogyBidder(endpoint string) *ApplogyAdapter { + return &ApplogyAdapter{ + endpoint: endpoint, } - return bidder, nil } diff --git a/adapters/applogy/applogy_test.go b/adapters/applogy/applogy_test.go index 63e99ed5895..4e656259f35 100644 --- a/adapters/applogy/applogy_test.go +++ b/adapters/applogy/applogy_test.go @@ -4,17 +4,8 @@ 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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderApplogy, config.Adapter{ - Endpoint: "http://example.com/prebid"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "applogytest", bidder) + adapterstest.RunJSONBidderTest(t, "applogytest", NewApplogyBidder("http://example.com/prebid")) } diff --git a/adapters/applogy/applogytest/supplemental/status-204.json b/adapters/applogy/applogytest/supplemental/status-204.json index 1c849b4fa3a..c3516b184b5 100644 --- a/adapters/applogy/applogytest/supplemental/status-204.json +++ b/adapters/applogy/applogytest/supplemental/status-204.json @@ -37,6 +37,5 @@ "status": 204, "body": {} } - }], - "expectedBidResponses": [] + }] } diff --git a/adapters/appnexus/appnexus.go b/adapters/appnexus/appnexus.go index 954fce5efb9..145c830dbb6 100644 --- a/adapters/appnexus/appnexus.go +++ b/adapters/appnexus/appnexus.go @@ -11,7 +11,6 @@ import ( "strconv" "strings" - "github.com/PubMatic-OpenWrap/prebid-server/config" "github.com/PubMatic-OpenWrap/prebid-server/pbs" "github.com/buger/jsonparser" @@ -20,12 +19,10 @@ import ( "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/PubMatic-OpenWrap/prebid-server/pbsmetrics" ) -const defaultPlatformID int = 5 - type AppNexusAdapter struct { http *adapters.HTTPAdapter URI string @@ -336,9 +333,9 @@ func (a *AppNexusAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *ada // Add Appnexus request level extension var isAMP, isVIDEO int - if reqInfo.PbsEntryPoint == metrics.ReqTypeAMP { + if reqInfo.PbsEntryPoint == pbsmetrics.ReqTypeAMP { isAMP = 1 - } else if reqInfo.PbsEntryPoint == metrics.ReqTypeVideo { + } else if reqInfo.PbsEntryPoint == pbsmetrics.ReqTypeVideo { isVIDEO = 1 } @@ -604,9 +601,6 @@ func (a *AppNexusAdapter) MakeBids(internalRequest *openrtb.BidRequest, external } } } - if bidResp.Cur != "" { - bidResponse.Currency = bidResp.Cur - } return bidResponse, errs } @@ -644,49 +638,42 @@ func appendMemberId(uri string, memberId string) string { return uri + "?member_id=" + memberId } -// Builder builds a new instance of the AppNexus adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AppNexusAdapter{ - URI: config.Endpoint, - iabCategoryMap: loadCategoryMapFromFileSystem(), - hbSource: resolvePlatformID(config.PlatformID), - } - return bidder, nil +func NewAppNexusAdapter(config *adapters.HTTPAdapterConfig, endpoint, platformID string) *AppNexusAdapter { + return NewAppNexusBidder(adapters.NewHTTPAdapter(config).Client, endpoint, platformID) } -// NewAppNexusLegacyAdapter builds a legacy version of the AppNexus adapter. -func NewAppNexusLegacyAdapter(httpConfig *adapters.HTTPAdapterConfig, endpoint, platformID string) *AppNexusAdapter { - return &AppNexusAdapter{ - http: adapters.NewHTTPAdapter(httpConfig), - URI: endpoint, - iabCategoryMap: loadCategoryMapFromFileSystem(), - hbSource: resolvePlatformID(platformID), - } -} +func NewAppNexusBidder(client *http.Client, endpoint, platformID string) *AppNexusAdapter { + a := &adapters.HTTPAdapter{Client: client} -func resolvePlatformID(platformID string) int { - if len(platformID) > 0 { - if val, err := strconv.Atoi(platformID); err == nil { - return val - } - } - - return defaultPlatformID -} - -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("./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") + var catmap map[string]string + var fileUri string + if client == nil { + // This is for tests + fileUri = "./static/adapter/appnexus/opts.json" + } else { + fileUri = "./home/http/GO_SERVER/dmhbserver/static/adapter/appnexus/opts.json" } + opts, err := ioutil.ReadFile(fileUri) if err == nil { var adapterOptions appnexusAdapterOptions if err := json.Unmarshal(opts, &adapterOptions); err == nil { - return adapterOptions.IabCategories + catmap = adapterOptions.IabCategories + } + } + + platid := 5 + if len(platformID) > 0 { + if val, err := strconv.Atoi(platformID); err == nil { + platid = val } } - return nil + + return &AppNexusAdapter{ + http: a, + URI: endpoint, + iabCategoryMap: catmap, + hbSource: platid, + } } diff --git a/adapters/appnexus/appnexus_test.go b/adapters/appnexus/appnexus_test.go index e63d287a70b..7468250b28d 100644 --- a/adapters/appnexus/appnexus_test.go +++ b/adapters/appnexus/appnexus_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "net/http/httptest" @@ -11,10 +12,7 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" - "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" @@ -27,26 +25,11 @@ import ( ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAppnexus, config.Adapter{ - Endpoint: "http://ib.adnxs.com/openrtb2"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "appnexustest", bidder) + adapterstest.RunJSONBidderTest(t, "appnexustest", NewAppNexusBidder(nil, "http://ib.adnxs.com/openrtb2", "")) } func TestVideoSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAppnexus, config.Adapter{ - Endpoint: "http://ib.adnxs.com/openrtb2", - PlatformID: "8"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "appnexusplatformtest", bidder) + adapterstest.RunJSONBidderTest(t, "appnexusplatformtest", NewAppNexusBidder(nil, "http://ib.adnxs.com/openrtb2", "8")) } func TestMemberQueryParam(t *testing.T) { @@ -509,7 +492,7 @@ func bidTypeToInt(bidType string) int { return -1 } } -func TestAppNexusLegacyBasicResponse(t *testing.T) { +func TestAppNexusBasicResponse(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(DummyAppNexusServer)) defer server.Close() @@ -548,7 +531,7 @@ func TestAppNexusLegacyBasicResponse(t *testing.T) { } conf := *adapters.DefaultHTTPAdapterConfig - an := NewAppNexusLegacyAdapter(&conf, server.URL, "") + an := NewAppNexusAdapter(&conf, server.URL, "") pbin := pbs.PBSRequest{ AdUnits: make([]pbs.AdUnit, 2), diff --git a/adapters/appnexus/appnexustest/exemplary/optional-params.json b/adapters/appnexus/appnexustest/exemplary/optional-params.json index ae7e9ff31a8..626c1f2db90 100644 --- a/adapters/appnexus/appnexustest/exemplary/optional-params.json +++ b/adapters/appnexus/appnexustest/exemplary/optional-params.json @@ -77,6 +77,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } \ No newline at end of file diff --git a/adapters/appnexus/appnexustest/exemplary/simple-banner-foreign-currency.json b/adapters/appnexus/appnexustest/exemplary/simple-banner-foreign-currency.json deleted file mode 100644 index b46c6f5f76f..00000000000 --- a/adapters/appnexus/appnexustest/exemplary/simple-banner-foreign-currency.json +++ /dev/null @@ -1,141 +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_id": 1 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", - "body": { - "id": "test-request-id", - "ext": { - "appnexus": { - "hb_source": 5 - }, - "prebid": {} - }, - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "appnexus": { - "placement_id": 1 - } - } - } - ] - } - }, - "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": ["appnexus.com"], - "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "appnexus": { - "brand_id": 1, - "brand_category_id": 1, - "auction_id": 8189378542222915032, - "bid_ad_type": 0, - "bidder_id": 2, - "ranking_price": 0.000000, - "deal_priority": 5 - } - } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "MXN" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "MXN", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": ["appnexus.com"], - "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": ["IAB20-3"], - "ext": { - "appnexus": { - "brand_id": 1, - "brand_category_id": 1, - "auction_id": 8189378542222915032, - "bid_ad_type": 0, - "bidder_id": 2, - "ranking_price": 0.000000, - "deal_priority": 5 - } - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json b/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json index 685a908b4f7..06e7724a23b 100644 --- a/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json +++ b/adapters/appnexus/appnexustest/supplemental/explicit-dimensions.json @@ -60,6 +60,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/audienceNetwork/audienceNetworktest/supplemental/no-bid-204.json b/adapters/audienceNetwork/audienceNetworktest/supplemental/no-bid-204.json index 8c97f3e9098..642e495810a 100644 --- a/adapters/audienceNetwork/audienceNetworktest/supplemental/no-bid-204.json +++ b/adapters/audienceNetwork/audienceNetworktest/supplemental/no-bid-204.json @@ -81,6 +81,5 @@ "status": 204 } } - ], - "expectedBidResponses": [] + ] } diff --git a/adapters/audienceNetwork/facebook.go b/adapters/audienceNetwork/facebook.go index a74c51d9ecb..0759a09d80b 100644 --- a/adapters/audienceNetwork/facebook.go +++ b/adapters/audienceNetwork/facebook.go @@ -11,30 +11,31 @@ import ( "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/PubMatic-OpenWrap/openrtb" "github.com/buger/jsonparser" + "github.com/golang/glog" ) -var supportedBannerHeights = map[uint64]bool{ - 50: true, - 250: true, -} - type FacebookAdapter struct { - URI string - platformID string - appSecret string + URI string + nonSecureUri string + platformID string + appSecret string } type facebookAdMarkup struct { BidID string `json:"bid_id"` } +var supportedBannerHeights = map[uint64]bool{ + 50: true, + 250: true, +} + type facebookReqExt struct { PlatformID string `json:"platformid"` AuthID string `json:"authentication_id"` @@ -428,22 +429,30 @@ func resolveImpType(imp *openrtb.Imp) (openrtb_ext.BidType, bool) { return openrtb_ext.BidTypeBanner, false } -// Builder builds a new instance of Facebook's Audience Network adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - if config.PlatformID == "" { - return nil, errors.New("PartnerID is not configured. Did you set adapters.facebook.platform_id in the app config?") +func NewFacebookBidder(platformID string, appSecret string) adapters.Bidder { + if platformID == "" { + glog.Errorf("No facebook partnerID specified. Calls to the Audience Network will fail. Did you set adapters.facebook.platform_id in the app config?") + return &adapters.MisconfiguredBidder{ + Name: "audienceNetwork", + Error: errors.New("Audience Network is not configured properly on this Prebid Server deploy. If you believe this should work, contact the company hosting the service and tell them to check their configuration."), + } } - if config.AppSecret == "" { - return nil, errors.New("AppSecret is not configured. Did you set adapters.facebook.app_secret in the app config?") + if appSecret == "" { + glog.Errorf("No facebook app secret specified. Calls to the Audience Network will fail. Did you set adapters.facebook.app_secret in the app config?") + return &adapters.MisconfiguredBidder{ + Name: "audienceNetwork", + Error: errors.New("Audience Network is not configured properly on this Prebid Server deploy. If you believe this should work, contact the company hosting the service and tell them to check their configuration."), + } } - bidder := &FacebookAdapter{ - URI: config.Endpoint, - platformID: config.PlatformID, - appSecret: config.AppSecret, + return &FacebookAdapter{ + URI: "https://an.facebook.com/placementbid.ortb", + //for AB test + nonSecureUri: "http://an.facebook.com/placementbid.ortb", + platformID: platformID, + appSecret: appSecret, } - return bidder, nil } func (fa *FacebookAdapter) MakeTimeoutNotification(req *adapters.RequestData) (*adapters.RequestData, []error) { diff --git a/adapters/audienceNetwork/facebook_test.go b/adapters/audienceNetwork/facebook_test.go index 596529dbb9a..8ff05118a35 100644 --- a/adapters/audienceNetwork/facebook_test.go +++ b/adapters/audienceNetwork/facebook_test.go @@ -1,13 +1,12 @@ package audienceNetwork import ( + "errors" "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/stretchr/testify/assert" ) @@ -42,34 +41,16 @@ type FacebookExt struct { } func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAudienceNetwork, config.Adapter{ - Endpoint: "https://an.facebook.com/placementbid.ortb", - PlatformID: "test-platform-id", - AppSecret: "test-app-secret", - }) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "audienceNetworktest", bidder) + adapterstest.RunJSONBidderTest(t, "audienceNetworktest", NewFacebookBidder("test-platform-id", "test-app-secret")) } func TestMakeTimeoutNoticeApp(t *testing.T) { req := adapters.RequestData{ Body: []byte(`{"id":"1234","imp":[{"id":"1234"}],"app":{"publisher":{"id":"5678"}}}`), } - bidder, buildErr := Builder(openrtb_ext.BidderAudienceNetwork, config.Adapter{ - Endpoint: "https://an.facebook.com/placementbid.ortb", - PlatformID: "test-platform-id", - AppSecret: "test-app-secret", - }) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } + fba := NewFacebookBidder("test-platform-id", "test-app-secret") - tb, ok := bidder.(adapters.TimeoutBidder) + tb, ok := fba.(adapters.TimeoutBidder) if !ok { t.Error("Facebook adapter is not a TimeoutAdapter") } @@ -84,17 +65,9 @@ func TestMakeTimeoutNoticeBadRequest(t *testing.T) { req := adapters.RequestData{ Body: []byte(`{"imp":[{{"id":"1234"}}`), } - bidder, buildErr := Builder(openrtb_ext.BidderAudienceNetwork, config.Adapter{ - Endpoint: "https://an.facebook.com/placementbid.ortb", - PlatformID: "test-platform-id", - AppSecret: "test-app-secret", - }) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } + fba := NewFacebookBidder("test-platform-id", "test-app-secret") - tb, ok := bidder.(adapters.TimeoutBidder) + tb, ok := fba.(adapters.TimeoutBidder) if !ok { t.Error("Facebook adapter is not a TimeoutAdapter") } @@ -106,21 +79,23 @@ func TestMakeTimeoutNoticeBadRequest(t *testing.T) { } func TestNewFacebookBidderMissingPlatformID(t *testing.T) { - bidder, err := Builder(openrtb_ext.BidderAudienceNetwork, config.Adapter{ - Endpoint: "https://an.facebook.com/placementbid.ortb", - AppSecret: "test-app-secret", - }) + result := NewFacebookBidder("", "anyAppSecret") - assert.Empty(t, bidder) - assert.EqualError(t, err, "PartnerID is not configured. Did you set adapters.facebook.platform_id in the app config?") + expected := &adapters.MisconfiguredBidder{ + Name: "audienceNetwork", + Error: errors.New("Audience Network is not configured properly on this Prebid Server deploy. If you believe this should work, contact the company hosting the service and tell them to check their configuration."), + } + + assert.Equal(t, expected, result) } func TestNewFacebookBidderMissingAppSecret(t *testing.T) { - bidder, err := Builder(openrtb_ext.BidderAudienceNetwork, config.Adapter{ - Endpoint: "https://an.facebook.com/placementbid.ortb", - PlatformID: "test-platform-id", - }) + result := NewFacebookBidder("anyPlatformID", "") + + expected := &adapters.MisconfiguredBidder{ + Name: "audienceNetwork", + Error: errors.New("Audience Network is not configured properly on this Prebid Server deploy. If you believe this should work, contact the company hosting the service and tell them to check their configuration."), + } - assert.Empty(t, bidder) - assert.EqualError(t, err, "AppSecret is not configured. Did you set adapters.facebook.app_secret in the app config?") + assert.Equal(t, expected, result) } diff --git a/adapters/avocet/avocet.go b/adapters/avocet/avocet.go index ef2314e7ebb..ef6e1bb4344 100644 --- a/adapters/avocet/avocet.go +++ b/adapters/avocet/avocet.go @@ -7,7 +7,6 @@ import ( "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" ) @@ -117,10 +116,9 @@ func getBidType(bid openrtb.Bid, ext avocetBidExt) openrtb_ext.BidType { } } -// Builder builds a new instance of the Avocet adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - bidder := &AvocetAdapter{ - Endpoint: config.Endpoint, +// NewAvocetAdapter returns a new AvocetAdapter using the provided endpoint. +func NewAvocetAdapter(endpoint string) *AvocetAdapter { + return &AvocetAdapter{ + Endpoint: endpoint, } - return bidder, nil } diff --git a/adapters/avocet/avocet_test.go b/adapters/avocet/avocet_test.go index f669e34492f..9c8d3d07932 100644 --- a/adapters/avocet/avocet_test.go +++ b/adapters/avocet/avocet_test.go @@ -9,20 +9,12 @@ import ( "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" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderAvocet, config.Adapter{ - Endpoint: "https://bid.staging.avct.cloud/ortb/bid/5e722ee9bd6df11d063a8013"}) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "avocet", bidder) + adapterstest.RunJSONBidderTest(t, "avocet", NewAvocetAdapter("https://bid.staging.avct.cloud/ortb/bid/5e722ee9bd6df11d063a8013")) } func TestAvocetAdapter_MakeRequests(t *testing.T) { diff --git a/adapters/avocet/avocettest/exemplary/banner.json b/adapters/avocet/avocettest/exemplary/banner.json deleted file mode 100644 index ea5173f9137..00000000000 --- a/adapters/avocet/avocettest/exemplary/banner.json +++ /dev/null @@ -1,112 +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" - } - ] - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "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" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/avocet/avocettest/exemplary/video.json b/adapters/avocet/avocettest/exemplary/video.json deleted file mode 100644 index 2398256b0dd..00000000000 --- a/adapters/avocet/avocettest/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/beachfront/beachfront.go b/adapters/beachfront/beachfront.go index 8aca4ca0427..c7d224c31a7 100644 --- a/adapters/beachfront/beachfront.go +++ b/adapters/beachfront/beachfront.go @@ -11,9 +11,9 @@ import ( "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" ) const Seat = "beachfront" @@ -24,7 +24,7 @@ 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.0" const minBidFloor = 0.01 @@ -202,8 +202,8 @@ func preprocess(request *openrtb.BidRequest) (beachfrontReqs beachfrontRequests, var bannerImps = make([]openrtb.Imp, 0) for i := 0; i < len(request.Imp); i++ { - if request.Imp[i].Banner != nil && request.Imp[i].Banner.Format != nil && - request.Imp[i].Banner.Format[0].H != 0 && request.Imp[i].Banner.Format[0].W != 0 { + if request.Imp[i].Banner != nil && ((request.Imp[i].Banner.Format[0].H != 0 && request.Imp[i].Banner.Format[0].W != 0) || + (request.Imp[i].Banner.H != nil && request.Imp[i].Banner.W != nil)) { bannerImps = append(bannerImps, request.Imp[i]) } @@ -232,11 +232,11 @@ func preprocess(request *openrtb.BidRequest) (beachfrontReqs beachfrontRequests, errs = append(errs, videoErrs...) for i := 0; i < len(videoList); i++ { - if videoList[i].VideoResponseType == "nurl" { + if videoList[i].VideoResponseType == "nurl" || videoList[i].VideoResponseType == "both" { beachfrontReqs.NurlVideo = append(beachfrontReqs.NurlVideo, videoList[i]) } - if videoList[i].VideoResponseType == "adm" { + if videoList[i].VideoResponseType == "adm" || videoList[i].VideoResponseType == "both" { beachfrontReqs.ADMVideo = append(beachfrontReqs.ADMVideo, videoList[i]) } } @@ -412,7 +412,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] if beachfrontExt.VideoResponseType != "" { bfReqs[i].VideoResponseType = beachfrontExt.VideoResponseType } else { - bfReqs[i].VideoResponseType = "adm" + bfReqs[i].VideoResponseType = "nurl" } bfReqs[i].Request = *request @@ -436,7 +436,7 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, [] } - if bfReqs[i].Request.Device != nil && bfReqs[i].Request.Device.DeviceType == 0 { + if bfReqs[i].Request.Device.DeviceType == 0 { // More fine graned deviceType methods will be added in the future bfReqs[i].Request.Device.DeviceType = fallBackDeviceType(request) } @@ -683,39 +683,21 @@ func removeVideoElement(slice []beachfrontVideoRequest, s int) []beachfrontVideo return append(slice[:s], slice[s+1:]...) } -// Builder builds a new instance of the Beachfront adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { - extraInfo, err := getExtraInfo(config.ExtraAdapterInfo) - if err != nil { - return nil, err - } +func NewBeachfrontBidder(bannerEndpoint string, extraAdapterInfo string) adapters.Bidder { + var extraInfo ExtraInfo - bidder := &BeachfrontAdapter{ - bannerEndpoint: config.Endpoint, - extraInfo: extraInfo, + if len(extraAdapterInfo) == 0 { + extraAdapterInfo = "{\"video_endpoint\":\"" + defaultVideoEndpoint + "\"}" } - return bidder, nil -} -func getExtraInfo(v string) (ExtraInfo, error) { - if len(v) == 0 { - return getDefaultExtraInfo(), nil - } - - var extraInfo ExtraInfo - if err := json.Unmarshal([]byte(v), &extraInfo); err != nil { - return extraInfo, fmt.Errorf("invalid extra info: %v", err) + if err := json.Unmarshal([]byte(extraAdapterInfo), &extraInfo); err != nil { + glog.Fatal("Invalid Beachfront extra adapter info: " + err.Error()) + return nil } if extraInfo.VideoEndpoint == "" { extraInfo.VideoEndpoint = defaultVideoEndpoint } - return extraInfo, nil -} - -func getDefaultExtraInfo() ExtraInfo { - return ExtraInfo{ - VideoEndpoint: defaultVideoEndpoint, - } + return &BeachfrontAdapter{bannerEndpoint: bannerEndpoint, extraInfo: extraInfo} } diff --git a/adapters/beachfront/beachfront_test.go b/adapters/beachfront/beachfront_test.go index aace3224534..905fbde6c8b 100644 --- a/adapters/beachfront/beachfront_test.go +++ b/adapters/beachfront/beachfront_test.go @@ -4,59 +4,8 @@ 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/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderBeachfront, config.Adapter{ - Endpoint: `https://qa.beachrtb.com/prebid_display`, - ExtraAdapterInfo: `{"video_endpoint":"https://qa.beachrtb.com/bid.json?exchange_id"}`, - }) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - adapterstest.RunJSONBidderTest(t, "beachfronttest", bidder) -} - -func TestExtraInfoDefaultWhenEmpty(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderBeachfront, config.Adapter{ - Endpoint: `https://qa.beachrtb.com/prebid_display`, - ExtraAdapterInfo: ``, - }) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - bidderBeachfront, _ := bidder.(*BeachfrontAdapter) - - assert.Equal(t, bidderBeachfront.extraInfo.VideoEndpoint, defaultVideoEndpoint) -} - -func TestExtraInfoDefaultWhenNotSpecified(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderBeachfront, config.Adapter{ - Endpoint: `https://qa.beachrtb.com/prebid_display`, - ExtraAdapterInfo: `{"video_endpoint":""}`, - }) - - if buildErr != nil { - t.Fatalf("Builder returned unexpected error %v", buildErr) - } - - bidderBeachfront, _ := bidder.(*BeachfrontAdapter) - - assert.Equal(t, bidderBeachfront.extraInfo.VideoEndpoint, defaultVideoEndpoint) -} - -func TestExtraInfoMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderBeachfront, config.Adapter{ - Endpoint: `https://qa.beachrtb.com/prebid_display`, - ExtraAdapterInfo: `malformed`, - }) - - assert.Error(t, buildErr) + adapterstest.RunJSONBidderTest(t, "beachfronttest", NewBeachfrontBidder("https://display.bfmio.com/prebid_display", "{\"video_endpoint\":\"https://reachms.bfmio.com/bid.json?exchange_id\"}")) } diff --git a/adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json b/adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json deleted file mode 100644 index d3fa41a23c5..00000000000 --- a/adapters/beachfront/beachfronttest/exemplary/adm-video-by-default.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "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": { - "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/adm-video-by-explicit-type.json b/adapters/beachfront/beachfronttest/exemplary/adm-video-by-explicit-type.json deleted file mode 100644 index 8c05d65a3b1..00000000000 --- a/adapters/beachfront/beachfronttest/exemplary/adm-video-by-explicit-type.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "mockBidRequest": { - "id": "adm-video", - "imp": [ - { - "id": "video1", - "ext": { - "bidder": { - "videoResponseType": "adm", - "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": { - "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-and-adm-video-by-default.json b/adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-default.json deleted file mode 100644 index bff1b76a688..00000000000 --- a/adapters/beachfront/beachfronttest/exemplary/banner-and-adm-video-by-default.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "mockBidRequest": { - "id": "banner-and-video", - "imp": [ - { - "id": "mix1", - "ext": { - "bidder": { - "bidfloor": 0.41, - "appIds": { - "banner": "bannerAppId1", - "video": "videoAppId1" - } - } - }, - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "video": { - "mimes": [ - "video/mp4" - ], - "context": "instream", - "w": 300, - "h": 250 - } - } - ], - "site": { - "page": "https://some.domain.us/some/page.html" - } - }, - - "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", - "referrer": "", - "search": "", - "secure": 1, - "deviceOs": "", - "deviceModel": "", - "isMobile": 0, - "ua": "", - "ip": "", - "dnt": 0, - "user": {}, - "adapterName": "BF_PREBID_S2S", - "adapterVersion": "0.9.1", - "requestId": "banner-and-video" - } - }, - "mockResponse": { - "status": 200, - "body": [ - { - "crid": "crid_1", - "price": 9.5019655, - "w": 300, - "h": 250, - "slot": "mix1", - "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 + }, + "type": "banner" + }, { - "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", + "id": "some_test_ad_id_2", + "impid": "some_test_ad_id_2", + "ttl": 300, + "crid": "9999999", + "w": 1020, + "price": 1, + "adid": "9999999", + "h": 1000 }, - { - "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" - }] + "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 15ae05d7835..c2b20cf1c5d 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 @@ -167,34 +167,34 @@ } }], - "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" + "expectedBids": [{ + "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 }, - { - "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" - }] + "type": "banner" + }, + { + "bid": { + "adm": "00:00:15", + "id": "some_test_ad_id_2", + "impid": "some_test_ad_id_2", + "ttl": 300, + "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-app.json b/adapters/emx_digital/emx_digitaltest/exemplary/banner-app.json index 20c62402fc1..8de90f52192 100644 --- a/adapters/emx_digital/emx_digitaltest/exemplary/banner-app.json +++ b/adapters/emx_digital/emx_digitaltest/exemplary/banner-app.json @@ -102,19 +102,18 @@ } }], - "expectedBidResponses": [{ - "bids": [{ - "bid": { - "adm": "