From 49229ce5e502e14b483043c1fee161d53bd3fb95 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Wed, 17 Jul 2019 13:27:42 -0700 Subject: [PATCH 01/12] engagebdr adapter --- adapters/engagebdr/engagebdr.go | 138 ++++++++++++++++++ adapters/engagebdr/engagebdr_test.go | 11 ++ .../engagebdrtest/params/race/banner.json | 3 + .../engagebdrtest/params/race/video.json | 3 + adapters/engagebdr/params_test.go | 43 ++++++ adapters/engagebdr/usersync.go | 11 ++ adapters/engagebdr/usersync_test.go | 1 + 7 files changed, 210 insertions(+) create mode 100644 adapters/engagebdr/engagebdr.go create mode 100644 adapters/engagebdr/engagebdr_test.go create mode 100644 adapters/engagebdr/engagebdrtest/params/race/banner.json create mode 100644 adapters/engagebdr/engagebdrtest/params/race/video.json create mode 100644 adapters/engagebdr/params_test.go create mode 100644 adapters/engagebdr/usersync.go create mode 100644 adapters/engagebdr/usersync_test.go diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go new file mode 100644 index 00000000000..ddc452fd5da --- /dev/null +++ b/adapters/engagebdr/engagebdr.go @@ -0,0 +1,138 @@ +package engagebdr + +import ( + "encoding/json" + "github.com/prebid/prebid-server/openrtb_ext" + "net/http" + //"regexp" + + "fmt" + + "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" +) + +type EngageBDRAdapter struct { + http *adapters.HTTPAdapter + URI string +} + +//func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { +func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + + errors := make([]error, 0) + + // EngageBDR uses different sspid parameters for banner and video. + sspidImps := make(map[string][]openrtb.Imp) + + for _, imp := range request.Imp { + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + errors = append(errors, &errortypes.BadInput{ + Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err), + }) + } + impExt := openrtb_ext.ExtImpEngageBDR{} + err := json.Unmarshal(bidderExt.Bidder, &impExt) + if err != nil { + errors = append(errors, &errortypes.BadInput{ + Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding impExt, err: %s", imp.ID, err), + }) + } + if impExt.Sspid == "" { + errors = append(errors, &errortypes.BadInput{ + Message: fmt.Sprintf("Ignoring imp id=%s, no sspid present", imp.ID), + }) + } + sspidImps[impExt.Sspid] = append(sspidImps[impExt.Sspid], imp) + } + + var adapterRequests []*adapters.RequestData + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + + for sspid, imps := range sspidImps { + if len(imps) > 0 { + // Make a copy as we don't want to change the original request + reqCopy := *request + reqCopy.Imp = imps + reqJSON, err := json.Marshal(reqCopy) + if err != nil { + errors = append(errors, err) + return nil, errors + } + adapterReq := adapters.RequestData{ + Method: "POST", + Uri: adapter.URI + "?zoneid=" + sspid, + Body: reqJSON, + Headers: headers, + } + adapterRequests = append(adapterRequests, &adapterReq) + } + } + + if len(adapterRequests) == 0 { + errors = append(errors, &errortypes.BadInput{Message: fmt.Sprintf("No imps present")}) + return nil, errors + } + + return adapterRequests, errors +} + +func (adapter *EngageBDRAdapter) 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} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) + + for _, sb := range bidResp.SeatBid { + for i := range sb.Bid { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &sb.Bid[i], + BidType: getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp), + }) + } + } + return bidResponse, nil +} + +func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { + mediaType := openrtb_ext.BidTypeBanner + for _, imp := range imps { + if imp.ID == impId { + if imp.Banner == nil && imp.Video != nil { + mediaType = openrtb_ext.BidTypeVideo + } + return mediaType + } + } + return mediaType +} + +func NewEngageBDRBidder(client *http.Client, endpoint string) *EngageBDRAdapter { + adapter := &adapters.HTTPAdapter{Client: client} + return &EngageBDRAdapter{ + http: adapter, + URI: endpoint, + } +} diff --git a/adapters/engagebdr/engagebdr_test.go b/adapters/engagebdr/engagebdr_test.go new file mode 100644 index 00000000000..069cf8b8210 --- /dev/null +++ b/adapters/engagebdr/engagebdr_test.go @@ -0,0 +1,11 @@ +package engagebdr + +import ( + "github.com/prebid/prebid-server/adapters/adapterstest" + "net/http" + "testing" +) + +func TestJsonSamples(t *testing.T) { + adapterstest.RunJSONBidderTest(t, "engagebdrtest", NewEngageBDRBidder(new(http.Client), "http://dsp.bnmla.com/hb")) +} diff --git a/adapters/engagebdr/engagebdrtest/params/race/banner.json b/adapters/engagebdr/engagebdrtest/params/race/banner.json new file mode 100644 index 00000000000..c447f6c348d --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/params/race/banner.json @@ -0,0 +1,3 @@ +{ + "zoneid": "10589" +} diff --git a/adapters/engagebdr/engagebdrtest/params/race/video.json b/adapters/engagebdr/engagebdrtest/params/race/video.json new file mode 100644 index 00000000000..e5bb8da9797 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/params/race/video.json @@ -0,0 +1,3 @@ +{ + "zoneid": "10592" +} diff --git a/adapters/engagebdr/params_test.go b/adapters/engagebdr/params_test.go new file mode 100644 index 00000000000..33c84eedb10 --- /dev/null +++ b/adapters/engagebdr/params_test.go @@ -0,0 +1,43 @@ +package engagebdr + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderEngageBDR, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected beachfront 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.BidderEngageBDR, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"sspid":"12345"}`, +} + +var invalidParams = []string{ + `{"sspid":null}`, + `{"appId":"11bc5dd5-7421-4dd8-c926-40fa653bec76"}`, +} diff --git a/adapters/engagebdr/usersync.go b/adapters/engagebdr/usersync.go new file mode 100644 index 00000000000..ae4047aa89c --- /dev/null +++ b/adapters/engagebdr/usersync.go @@ -0,0 +1,11 @@ +package engagebdr + +import ( + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" + "text/template" +) + +func NewEngageBDRSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("engagebdr", 62, temp, adapters.SyncTypeIframe) +} diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go new file mode 100644 index 00000000000..5fa3c074683 --- /dev/null +++ b/adapters/engagebdr/usersync_test.go @@ -0,0 +1 @@ +package engagebdr From 0289413c1ab4e6cc2ea1b082935cd2da11c592f8 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Wed, 17 Jul 2019 14:31:30 -0700 Subject: [PATCH 02/12] engagebdr-ext params --- config/config.go | 1 + exchange/adapter_map.go | 4 +++- openrtb_ext/bidders.go | 2 ++ openrtb_ext/imp_engagebdr.go | 6 ++++++ static/bidder-info/engagebdr.yaml | 7 +++++++ static/bidder-params/engagebdr.json | 14 ++++++++++++++ usersync/usersyncers/syncer.go | 4 +++- usersync/usersyncers/syncer_test.go | 1 + 8 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 openrtb_ext/imp_engagebdr.go create mode 100644 static/bidder-info/engagebdr.yaml create mode 100644 static/bidder-params/engagebdr.json diff --git a/config/config.go b/config/config.go index 01a73e1ffa2..14a0a3a5060 100644 --- a/config/config.go +++ b/config/config.go @@ -613,6 +613,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/prebid/") v.SetDefault("adapters.visx.endpoint", "https://t.visx.net/s2s_bid?wrapperType=s2s_prebid_standard") v.SetDefault("adapters.tappx.endpoint", "https://{{.Host}}") + v.SetDefault("adapters.engagebdr.endpoint", "http://dsp.bnmla.com/hb") v.SetDefault("max_request_size", 1024*256) v.SetDefault("analytics.file.filename", "") diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index d192f9c20ad..dfa0f2aacaf 100644 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/prebid/prebid-server/adapters" - ttx "github.com/prebid/prebid-server/adapters/33across" + "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernelAdn" "github.com/prebid/prebid-server/adapters/adtelligent" @@ -16,6 +16,7 @@ import ( "github.com/prebid/prebid-server/adapters/brightroll" "github.com/prebid/prebid-server/adapters/consumable" "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/engagebdr" "github.com/prebid/prebid-server/adapters/eplanning" "github.com/prebid/prebid-server/adapters/gamoshi" "github.com/prebid/prebid-server/adapters/grid" @@ -82,6 +83,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.BidderMgid: mgid.NewMgidBidder(cfg.Adapters[string(openrtb_ext.BidderMgid)].Endpoint), openrtb_ext.BidderImprovedigital: improvedigital.NewImprovedigitalBidder(cfg.Adapters[string(openrtb_ext.BidderImprovedigital)].Endpoint), openrtb_ext.BidderTappx: tappx.NewTappxBidder(client, cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderTappx))].Endpoint), + openrtb_ext.BidderEngageBDR: engagebdr.NewEngageBDRBidder(client, cfg.Adapters[string(openrtb_ext.BidderEngageBDR)].Endpoint), } legacyBidders := map[openrtb_ext.BidderName]adapters.Adapter{ diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index e08ce532b99..8ec05a9bb15 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -53,6 +53,7 @@ const ( BidderYieldmo BidderName = "yieldmo" BidderVisx BidderName = "visx" BidderTappx BidderName = "tappx" + BidderEngageBDR BidderName = "engagebdr" ) // BidderMap stores all the valid OpenRTB 2.x Bidders in the project. This map *must not* be mutated. @@ -90,6 +91,7 @@ var BidderMap = map[string]BidderName{ "yieldmo": BidderYieldmo, "visx": BidderVisx, "tappx": BidderTappx, + "engagebdr": BidderEngageBDR, } // BidderList returns the values of the BidderMap diff --git a/openrtb_ext/imp_engagebdr.go b/openrtb_ext/imp_engagebdr.go new file mode 100644 index 00000000000..14cb444c040 --- /dev/null +++ b/openrtb_ext/imp_engagebdr.go @@ -0,0 +1,6 @@ +package openrtb_ext + +// ExtImpEngageBDR defines the contract for bidrequest.imp[i].ext.engagebdr +type ExtImpEngageBDR struct { + Sspid string `json:"sspid"` +} diff --git a/static/bidder-info/engagebdr.yaml b/static/bidder-info/engagebdr.yaml new file mode 100644 index 00000000000..aeec945f2ad --- /dev/null +++ b/static/bidder-info/engagebdr.yaml @@ -0,0 +1,7 @@ +maintainer: + email: "admin@engagebdr.com" +capabilities: + app: + mediaTypes: + - banner + - video diff --git a/static/bidder-params/engagebdr.json b/static/bidder-params/engagebdr.json new file mode 100644 index 00000000000..4f987004045 --- /dev/null +++ b/static/bidder-params/engagebdr.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "EngageBDR Adapter Params", + "description": "A schema which validates params accepted by the EngageBDR adapter", + "type": "object", + "properties": { + "sspid": { + "type": "string", + "description": "SSPID parameter", + "pattern": "^[0-9]+$" + } + }, + "required": ["sspid"] +} diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 6159f922531..4e2c53e1cd6 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -5,7 +5,7 @@ import ( "text/template" "github.com/golang/glog" - ttx "github.com/prebid/prebid-server/adapters/33across" + "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernelAdn" "github.com/prebid/prebid-server/adapters/adtelligent" @@ -15,6 +15,7 @@ import ( "github.com/prebid/prebid-server/adapters/brightroll" "github.com/prebid/prebid-server/adapters/consumable" "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/engagebdr" "github.com/prebid/prebid-server/adapters/eplanning" "github.com/prebid/prebid-server/adapters/gamoshi" "github.com/prebid/prebid-server/adapters/grid" @@ -57,6 +58,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderBrightroll, brightroll.NewBrightrollSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderConsumable, consumable.NewConsumableSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderConversant, conversant.NewConversantSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderEngageBDR, engagebdr.NewEngageBDRSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderEPlanning, eplanning.NewEPlanningSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderFacebook, audienceNetwork.NewFacebookSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderGrid, grid.NewGridSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 0d9dc3d1937..7d981dbff05 100644 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -46,6 +46,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderVisx): syncConfig, string(openrtb_ext.BidderGamoshi): syncConfig, string(openrtb_ext.BidderUnruly): syncConfig, + string(openrtb_ext.BidderEngageBDR): syncConfig, }, } From 9cd025184f3299350810ae5bd2434b5fe5e46fb3 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Thu, 18 Jul 2019 13:30:12 -0700 Subject: [PATCH 03/12] added exemplary --- .../engagebdrtest/exemplary/banner.json | 89 ++++++++++++++++++ .../engagebdrtest/exemplary/video.json | 91 +++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 adapters/engagebdr/engagebdrtest/exemplary/banner.json create mode 100644 adapters/engagebdr/engagebdrtest/exemplary/video.json diff --git a/adapters/engagebdr/engagebdrtest/exemplary/banner.json b/adapters/engagebdr/engagebdrtest/exemplary/banner.json new file mode 100644 index 00000000000..bf59919afda --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/exemplary/banner.json @@ -0,0 +1,89 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99999" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99999", + "body":{ + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99999" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain":[ + "advertiserdomain.com" + ], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + + } + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/exemplary/video.json b/adapters/engagebdr/engagebdrtest/exemplary/video.json new file mode 100644 index 00000000000..0c0ef06e993 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/exemplary/video.json @@ -0,0 +1,91 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 300, + "mimes": null, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99998" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99998", + "body":{ + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "video": { + "w": 300, + "mimes": null, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99998" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "\nStatic VASTStatic VAST Tag", + "adomain":[ + "advertiserdomain.com" + ], + "iurl": "https://cdn0.bnmla.com/vtest.xml", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + + } + ] +} + From 8f56e29c39869167b84804a9ea1c9e45aeab7212 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Mon, 22 Jul 2019 14:49:17 -0700 Subject: [PATCH 04/12] engagebdr adapter updated --- adapters/engagebdr/engagebdr.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index ddc452fd5da..aab2ece8798 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -4,7 +4,6 @@ import ( "encoding/json" "github.com/prebid/prebid-server/openrtb_ext" "net/http" - //"regexp" "fmt" @@ -18,15 +17,17 @@ type EngageBDRAdapter struct { URI string } -//func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { errors := make([]error, 0) // EngageBDR uses different sspid parameters for banner and video. sspidImps := make(map[string][]openrtb.Imp) - for _, imp := range request.Imp { + if imp.Native != nil { + // filter native imps from bid request + continue + } var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { errors = append(errors, &errortypes.BadInput{ From 0b7abc7f9b91ee793c1682341de2e8180c5d59c6 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Wed, 24 Jul 2019 15:43:07 -0700 Subject: [PATCH 05/12] update engagebdr adapter usersync --- adapters/engagebdr/usersync_test.go | 16 ++++++++++++++++ config/config.go | 1 + 2 files changed, 17 insertions(+) diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go index 5fa3c074683..4fde51c620c 100644 --- a/adapters/engagebdr/usersync_test.go +++ b/adapters/engagebdr/usersync_test.go @@ -1 +1,17 @@ package engagebdr +import ( + "testing" + "text/template" + "github.com/stretchr/testify/assert" +) + +func TestEngageBDRSyncer(t *testing.T) { + temp := template.Must(template.New("sync-template").Parse("https://match.bnmla.com/usersync?sspid=99999&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D")) + syncer := NewEngageBDRSyncer(temp) + syncInfo, err := syncer.GetUsersyncInfo("1", "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA") + assert.NoError(t, err) + assert.Equal(t, "https://match.bnmla.com/usersync?sspid=99999&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redir=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) + assert.Equal(t, "iframe", syncInfo.Type) + assert.EqualValues(t, 62, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index 14a0a3a5060..9675ffb9057 100644 --- a/config/config.go +++ b/config/config.go @@ -450,6 +450,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") // openrtb_ext.BidderTappx doesn't have a good default. } From e8aeb8d2b987848cf42ccd6c009807a2e6d51d7d Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Wed, 24 Jul 2019 17:23:13 -0700 Subject: [PATCH 06/12] update engagebdr usersync fix --- adapters/engagebdr/usersync_test.go | 11 ++++++----- config/config.go | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go index 4fde51c620c..a421cf651eb 100644 --- a/adapters/engagebdr/usersync_test.go +++ b/adapters/engagebdr/usersync_test.go @@ -1,16 +1,17 @@ package engagebdr + import ( - "testing" - "text/template" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/assert" + "testing" + "text/template" ) func TestEngageBDRSyncer(t *testing.T) { - temp := template.Must(template.New("sync-template").Parse("https://match.bnmla.com/usersync?sspid=99999&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D")) + temp := template.Must(template.New("sync-template").Parse("https://match.bnmla.com/usersync?sspid=99999&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir=http%3A%2F%2Flocalhost")) syncer := NewEngageBDRSyncer(temp) syncInfo, err := syncer.GetUsersyncInfo("1", "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA") assert.NoError(t, err) - assert.Equal(t, "https://match.bnmla.com/usersync?sspid=99999&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redir=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) + assert.Equal(t, "https://match.bnmla.com/usersync?sspid=99999&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redir=http%3A%2F%2Flocalhost", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 62, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) diff --git a/config/config.go b/config/config.go index 9675ffb9057..1c7b3f6a4be 100644 --- a/config/config.go +++ b/config/config.go @@ -450,7 +450,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync?sspid=99999&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") // openrtb_ext.BidderTappx doesn't have a good default. } From 6128fef705903569ec02234e494e00e4efb3bb44 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Wed, 31 Jul 2019 16:54:39 -0700 Subject: [PATCH 07/12] revert ttx back --- exchange/adapter_map.go | 2 +- usersync/usersyncers/syncer.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index dfa0f2aacaf..df35003cd97 100644 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/prebid/prebid-server/adapters" - "github.com/prebid/prebid-server/adapters/33across" + ttx "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernelAdn" "github.com/prebid/prebid-server/adapters/adtelligent" diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 4e2c53e1cd6..e73f445a233 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -5,7 +5,7 @@ import ( "text/template" "github.com/golang/glog" - "github.com/prebid/prebid-server/adapters/33across" + ttx "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernelAdn" "github.com/prebid/prebid-server/adapters/adtelligent" From 852ce0c760acf816f81d49db8d90fa22f206934a Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Fri, 2 Aug 2019 11:52:42 -0700 Subject: [PATCH 08/12] update merge file --- config/config.go | 13 +++++++++---- exchange/adapter_map.go | 16 +++++++++++----- usersync/usersyncers/syncer.go | 8 +++++++- usersync/usersyncers/syncer_test.go | 3 +++ 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index 1c7b3f6a4be..262ff249651 100644 --- a/config/config.go +++ b/config/config.go @@ -184,7 +184,7 @@ func (cfg *HostCookie) TTLDuration() time.Duration { const ( dummyHost string = "dummyhost.com" - dummyPublisherID int = 12 + dummyPublisherID string = "12" dummyGDPR string = "0" dummyGDPRConsent string = "someGDPRConsentString" ) @@ -422,11 +422,13 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdkernelAdn, "https://tag.adkernel.com/syncr?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3DadkernelAdn%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdtelligent, "https://sync.adtelligent.com/csync?t=p&ep=0&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadtelligent%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdform, "https://cm.adform.net/cookie?redirect_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadform%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdvangelists, "https://nep.advangelists.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadvangelists%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAppnexus, "https://ib.adnxs.com/getuid?"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadnxs%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBrightroll, "https://pr-bh.ybp.yahoo.com/sync/appnexusprebidserver/?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbrightroll%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBeachfront, "https://sync.bfmio.com/sync_s2s?gdpr={{.GDPR}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbeachfront%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Bio_cid%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderConsumable, "https://e.serverbid.com/udb/9969/match?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dconsumable%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderConversant, "https://prebid-match.dotomi.com/prebid/match?rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dconversant%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEmxDigital, "https://biddr.brealtime.com/check_pbs.html?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Demx_digital%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7BUID%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEPlanning, "https://ads.us.e-planning.net/uspd/1/?du=https%3A%2F%2Fads.us.e-planning.net%2Fgetuid%2F1%2F5a1ad71d2d53a0f5%3F"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Deplanning%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") // openrtb_ext.BidderFacebook doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGrid, "https://grid.bidswitch.net/sp_sync?sp_id=prebid&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgrid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") @@ -449,8 +451,8 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderGamoshi, "https://rtb.gamoshi.io/pix/0000/scm?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dgamoshi%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5Bgusr%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync?sspid=99999&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dengagebdr%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") // openrtb_ext.BidderTappx doesn't have a good default. } @@ -583,11 +585,14 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.adtelligent.endpoint", "http://hb.adtelligent.com/auction") v.SetDefault("adapters.adform.endpoint", "http://adx.adform.net/adx") v.SetDefault("adapters.appnexus.endpoint", "http://ib.adnxs.com/openrtb2") // Docs: https://wiki.appnexus.com/display/supply/Incoming+Bid+Request+from+SSPs + v.SetDefault("adapters.advangelists.endpoint", "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}") v.SetDefault("adapters.beachfront.endpoint", "https://display.bfmio.com/prebid_display") v.SetDefault("adapters.beachfront.platform_id", "155") v.SetDefault("adapters.brightroll.endpoint", "http://east-bid.ybp.yahoo.com/bid/appnexuspbs") v.SetDefault("adapters.consumable.endpoint", "https://e.serverbid.com/api/v2") + v.SetDefault("adapters.engagebdr.endpoint", "http://dsp.bnmla.com/hb") v.SetDefault("adapters.conversant.endpoint", "http://api.hb.ad.cpe.dotomi.com/s2s/header/24") + v.SetDefault("adapters.emx_digital.endpoint", "https://hb.emxdgt.com") v.SetDefault("adapters.eplanning.endpoint", "http://ads.us.e-planning.net/hb/1") v.SetDefault("adapters.improvedigital.endpoint", "http://ad.360yield.com/pbs") v.SetDefault("adapters.ix.endpoint", "http://appnexus-us-east.lb.indexww.com/transbidder?p=184932") @@ -612,9 +617,9 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.yieldmo.endpoint", "http://ads.yieldmo.com/exchange/prebid-server") v.SetDefault("adapters.gamoshi.endpoint", "https://rtb.gamoshi.io") v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/prebid/") + v.SetDefault("adapters.verizonmedia.disabled", true) v.SetDefault("adapters.visx.endpoint", "https://t.visx.net/s2s_bid?wrapperType=s2s_prebid_standard") v.SetDefault("adapters.tappx.endpoint", "https://{{.Host}}") - v.SetDefault("adapters.engagebdr.endpoint", "http://dsp.bnmla.com/hb") v.SetDefault("max_request_size", 1024*256) v.SetDefault("analytics.file.filename", "") diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index df35003cd97..8d56e153b8b 100644 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -10,12 +10,14 @@ import ( "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernelAdn" "github.com/prebid/prebid-server/adapters/adtelligent" + "github.com/prebid/prebid-server/adapters/advangelists" "github.com/prebid/prebid-server/adapters/appnexus" "github.com/prebid/prebid-server/adapters/audienceNetwork" "github.com/prebid/prebid-server/adapters/beachfront" "github.com/prebid/prebid-server/adapters/brightroll" "github.com/prebid/prebid-server/adapters/consumable" "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/emx_digital" "github.com/prebid/prebid-server/adapters/engagebdr" "github.com/prebid/prebid-server/adapters/eplanning" "github.com/prebid/prebid-server/adapters/gamoshi" @@ -37,6 +39,7 @@ import ( "github.com/prebid/prebid-server/adapters/sovrn" "github.com/prebid/prebid-server/adapters/tappx" "github.com/prebid/prebid-server/adapters/unruly" + "github.com/prebid/prebid-server/adapters/verizonmedia" "github.com/prebid/prebid-server/adapters/visx" "github.com/prebid/prebid-server/adapters/vrtcal" "github.com/prebid/prebid-server/adapters/yieldmo" @@ -49,14 +52,17 @@ import ( func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapters.BidderInfos) map[openrtb_ext.BidderName]adaptedBidder { ortbBidders := map[openrtb_ext.BidderName]adapters.Bidder{ - openrtb_ext.BidderAdform: adform.NewAdformBidder(client, cfg.Adapters[string(openrtb_ext.BidderAdform)].Endpoint), - openrtb_ext.BidderAdkernelAdn: adkernelAdn.NewAdkernelAdnAdapter(cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderAdkernelAdn))].Endpoint), - openrtb_ext.BidderAdtelligent: adtelligent.NewAdtelligentBidder(cfg.Adapters[string(openrtb_ext.BidderAdtelligent)].Endpoint), - openrtb_ext.BidderAppnexus: appnexus.NewAppNexusBidder(client, cfg.Adapters[string(openrtb_ext.BidderAppnexus)].Endpoint), + openrtb_ext.BidderAdform: adform.NewAdformBidder(client, cfg.Adapters[string(openrtb_ext.BidderAdform)].Endpoint), + openrtb_ext.BidderAdkernelAdn: adkernelAdn.NewAdkernelAdnAdapter(cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderAdkernelAdn))].Endpoint), + openrtb_ext.BidderAdtelligent: adtelligent.NewAdtelligentBidder(cfg.Adapters[string(openrtb_ext.BidderAdtelligent)].Endpoint), + openrtb_ext.BidderAdvangelists: advangelists.NewAdvangelistsBidder(cfg.Adapters[string(openrtb_ext.BidderAdvangelists)].Endpoint), + openrtb_ext.BidderAppnexus: appnexus.NewAppNexusBidder(client, cfg.Adapters[string(openrtb_ext.BidderAppnexus)].Endpoint), // TODO #615: Update the config setup so that the Beachfront URLs can be configured, and use those in TestRaceIntegration in exchange_test.go openrtb_ext.BidderBeachfront: beachfront.NewBeachfrontBidder(), openrtb_ext.BidderBrightroll: brightroll.NewBrightrollBidder(cfg.Adapters[string(openrtb_ext.BidderBrightroll)].Endpoint), openrtb_ext.BidderConsumable: consumable.NewConsumableBidder(cfg.Adapters[string(openrtb_ext.BidderConsumable)].Endpoint), + openrtb_ext.BidderEngageBDR: engagebdr.NewEngageBDRBidder(client, cfg.Adapters[string(openrtb_ext.BidderEngageBDR)].Endpoint), + openrtb_ext.BidderEmxDigital: emx_digital.NewEmxDigitalBidder(cfg.Adapters[string(openrtb_ext.BidderEmxDigital)].Endpoint), openrtb_ext.BidderEPlanning: eplanning.NewEPlanningBidder(client, cfg.Adapters[string(openrtb_ext.BidderEPlanning)].Endpoint), openrtb_ext.BidderGumGum: gumgum.NewGumGumBidder(cfg.Adapters[string(openrtb_ext.BidderGumGum)].Endpoint), openrtb_ext.BidderOpenx: openx.NewOpenxBidder(cfg.Adapters[string(openrtb_ext.BidderOpenx)].Endpoint), @@ -83,7 +89,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.BidderMgid: mgid.NewMgidBidder(cfg.Adapters[string(openrtb_ext.BidderMgid)].Endpoint), openrtb_ext.BidderImprovedigital: improvedigital.NewImprovedigitalBidder(cfg.Adapters[string(openrtb_ext.BidderImprovedigital)].Endpoint), openrtb_ext.BidderTappx: tappx.NewTappxBidder(client, cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderTappx))].Endpoint), - openrtb_ext.BidderEngageBDR: engagebdr.NewEngageBDRBidder(client, cfg.Adapters[string(openrtb_ext.BidderEngageBDR)].Endpoint), + openrtb_ext.BidderVerizonMedia: verizonmedia.NewVerizonMediaBidder(client, cfg.Adapters[string(openrtb_ext.BidderVerizonMedia)].Endpoint), } legacyBidders := map[openrtb_ext.BidderName]adapters.Adapter{ diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index e73f445a233..87ecf1b4c0f 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -9,12 +9,14 @@ import ( "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernelAdn" "github.com/prebid/prebid-server/adapters/adtelligent" + "github.com/prebid/prebid-server/adapters/advangelists" "github.com/prebid/prebid-server/adapters/appnexus" "github.com/prebid/prebid-server/adapters/audienceNetwork" "github.com/prebid/prebid-server/adapters/beachfront" "github.com/prebid/prebid-server/adapters/brightroll" "github.com/prebid/prebid-server/adapters/consumable" "github.com/prebid/prebid-server/adapters/conversant" + "github.com/prebid/prebid-server/adapters/emx_digital" "github.com/prebid/prebid-server/adapters/engagebdr" "github.com/prebid/prebid-server/adapters/eplanning" "github.com/prebid/prebid-server/adapters/gamoshi" @@ -35,6 +37,7 @@ import ( "github.com/prebid/prebid-server/adapters/sonobi" "github.com/prebid/prebid-server/adapters/sovrn" "github.com/prebid/prebid-server/adapters/unruly" + "github.com/prebid/prebid-server/adapters/verizonmedia" "github.com/prebid/prebid-server/adapters/visx" "github.com/prebid/prebid-server/adapters/vrtcal" "github.com/prebid/prebid-server/adapters/yieldmo" @@ -53,16 +56,18 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderAdform, adform.NewAdformSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdkernelAdn, adkernelAdn.NewAdkernelAdnSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtelligent, adtelligent.NewAdtelligentSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderAdvangelists, advangelists.NewAdvangelistsSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAppnexus, appnexus.NewAppnexusSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderBeachfront, beachfront.NewBeachfrontSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderBrightroll, brightroll.NewBrightrollSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderConsumable, consumable.NewConsumableSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderConversant, conversant.NewConversantSyncer) - insertIntoMap(cfg, syncers, openrtb_ext.BidderEngageBDR, engagebdr.NewEngageBDRSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderEmxDigital, emx_digital.NewEMXDigitalSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderEPlanning, eplanning.NewEPlanningSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderFacebook, audienceNetwork.NewFacebookSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderGrid, grid.NewGridSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderGumGum, gumgum.NewGumGumSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderEngageBDR, engagebdr.NewEngageBDRSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderImprovedigital, improvedigital.NewImprovedigitalSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderIx, ix.NewIxSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLifestreet, lifestreet.NewLifestreetSyncer) @@ -82,6 +87,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderGamoshi, gamoshi.NewGamoshiSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderUnruly, unruly.NewUnrulySyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderMgid, mgid.NewMgidSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderVerizonMedia, verizonmedia.NewVerizonMediaSyncer) return syncers } diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 7d981dbff05..2820f19e363 100644 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -17,12 +17,14 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderAdform): syncConfig, string(openrtb_ext.BidderAdkernelAdn): syncConfig, string(openrtb_ext.BidderAdtelligent): syncConfig, + string(openrtb_ext.BidderAdvangelists): syncConfig, string(openrtb_ext.BidderAppnexus): syncConfig, string(openrtb_ext.BidderBeachfront): syncConfig, string(openrtb_ext.BidderFacebook): syncConfig, string(openrtb_ext.BidderBrightroll): syncConfig, string(openrtb_ext.BidderConsumable): syncConfig, string(openrtb_ext.BidderConversant): syncConfig, + string(openrtb_ext.BidderEmxDigital): syncConfig, string(openrtb_ext.BidderEPlanning): syncConfig, string(openrtb_ext.BidderGrid): syncConfig, string(openrtb_ext.BidderGumGum): syncConfig, @@ -46,6 +48,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderVisx): syncConfig, string(openrtb_ext.BidderGamoshi): syncConfig, string(openrtb_ext.BidderUnruly): syncConfig, + string(openrtb_ext.BidderVerizonMedia): syncConfig, string(openrtb_ext.BidderEngageBDR): syncConfig, }, } From 722678ecc6e89affed2968413e0d231014efe1f8 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Mon, 12 Aug 2019 11:51:01 -0700 Subject: [PATCH 09/12] update supplemental and update on engagebdr.go --- adapters/engagebdr/engagebdr.go | 33 +++++-- .../engagebdrtest/exemplary/banner.json | 38 +++++--- .../engagebdrtest/exemplary/native.json | 95 +++++++++++++++++++ .../engagebdrtest/exemplary/video.json | 59 +++++++----- .../engagebdrtest/supplemental/audio.json | 22 +++++ .../supplemental/no-imp-ext-bidder.json | 21 ++++ .../supplemental/no-imp-ext.json | 19 ++++ .../supplemental/no-imp-sspid.json | 23 +++++ .../engagebdrtest/supplemental/no-imp.json | 12 +++ .../supplemental/response-500.json | 49 ++++++++++ 10 files changed, 321 insertions(+), 50 deletions(-) create mode 100644 adapters/engagebdr/engagebdrtest/exemplary/native.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/audio.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/no-imp.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/response-500.json diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index aab2ece8798..d8965c8a4a7 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -19,20 +19,32 @@ type EngageBDRAdapter struct { func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - errors := make([]error, 0) + errors := make([]error, 0, len(request.Imp)) + + if request.Imp == nil || len(request.Imp) == 0 { + errors = append(errors, &errortypes.BadInput{ + Message: fmt.Sprintf("Invalid BidRequest. No valid imp."), + }) + return nil, errors + } // EngageBDR uses different sspid parameters for banner and video. sspidImps := make(map[string][]openrtb.Imp) for _, imp := range request.Imp { - if imp.Native != nil { - // filter native imps from bid request - continue + + if imp.Audio != nil { + errors = append(errors, &errortypes.BadInput{ + Message: fmt.Sprintf("Invalid MediaType. EngageBDR only supports Banner, Video and Native. Ignoring imp id=%s", imp.ID), + }) + return nil, errors } + var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { errors = append(errors, &errortypes.BadInput{ Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err), }) + return nil, errors } impExt := openrtb_ext.ExtImpEngageBDR{} err := json.Unmarshal(bidderExt.Bidder, &impExt) @@ -40,11 +52,13 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn errors = append(errors, &errortypes.BadInput{ Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding impExt, err: %s", imp.ID, err), }) + return nil, errors } if impExt.Sspid == "" { errors = append(errors, &errortypes.BadInput{ Message: fmt.Sprintf("Ignoring imp id=%s, no sspid present", imp.ID), }) + return nil, errors } sspidImps[impExt.Sspid] = append(sspidImps[impExt.Sspid], imp) } @@ -74,11 +88,6 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn } } - if len(adapterRequests) == 0 { - errors = append(errors, &errortypes.BadInput{Message: fmt.Sprintf("No imps present")}) - return nil, errors - } - return adapterRequests, errors } @@ -121,8 +130,12 @@ func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { mediaType := openrtb_ext.BidTypeBanner for _, imp := range imps { if imp.ID == impId { - if imp.Banner == nil && imp.Video != nil { + if imp.Video != nil { mediaType = openrtb_ext.BidTypeVideo + } else if imp.Audio != nil { + mediaType = openrtb_ext.BidTypeAudio + } else if imp.Native != nil { + mediaType = openrtb_ext.BidTypeNative } return mediaType } diff --git a/adapters/engagebdr/engagebdrtest/exemplary/banner.json b/adapters/engagebdr/engagebdrtest/exemplary/banner.json index bf59919afda..92b79e8f349 100644 --- a/adapters/engagebdr/engagebdrtest/exemplary/banner.json +++ b/adapters/engagebdr/engagebdrtest/exemplary/banner.json @@ -44,6 +44,21 @@ "seatbid": [ { "bid": [ + { + "id" : "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } ], "seat": "test-request-id" } @@ -57,32 +72,25 @@ "expectedBidResponses": [ { - "id": "test-request-id", - "seatbid": [ + "currency": "USD", + "bids": [ { - "bid": [ - { + "bid": { "id": "test-imp-id", "impid": "test-imp-id", "price": 9.81, "adid": "abcde-12345", - "adm": "
", - "adomain":[ - "advertiserdomain.com" - ], + "adm": "
", + "adomain": ["advertiserdomain.com"], "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", "cid": "campaign1", "crid": "abcde-12345", "w": 300, "h": 250 - } - ], - "seat": "test-request-id" + }, + "type": "banner" } - ], - "bidid": "test-request-id", - "cur": "USD" - + ] } ] } diff --git a/adapters/engagebdr/engagebdrtest/exemplary/native.json b/adapters/engagebdr/engagebdrtest/exemplary/native.json new file mode 100644 index 00000000000..963194fb8bd --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/exemplary/native.json @@ -0,0 +1,95 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver":"1.1" + }, + "ext": { + "bidder": { + "sspid": "99997" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99997", + "body":{ + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "native": { + "request": "{\"ver\":\"1.1\",\"context\":1,\"contextsubtype\":11,\"plcmttype\":4,\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":500}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"wmin\":1,\"hmin\":1}},{\"id\":3,\"required\":0,\"data\":{\"type\":1,\"len\":200}},{\"id\":4,\"required\":0,\"data\":{\"type\":2,\"len\":15000}},{\"id\":5,\"required\":0,\"data\":{\"type\":6,\"len\":40}},{\"id\":6,\"required\":0,\"data\":{\"type\":500}}]}", + "ver":"1.1" + }, + "ext": { + "bidder": { + "sspid":"99997" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id" : "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "{\"native\":{\"link\":{\"url\":\"https://rtb-use.mfadsrvr.com/click/ESoNneAwqCPnn97YSh0EoJzPUnSmqwdERCYPCdrHr1_TJz_V-x2xjMgxcROeooIH5fe1exAsWt2aqg1ESQEVQM8i0TpI1QBcV4V87Uzmf_XfAR6-6xqvqfGuDs-pJDWqAYz0P0OtHlrvVztlMdWu6JT9_GAtVAnB9gp0JchRJLSqr1h_GRZwuNUri7NvveTD7m8ZUHKNFldKPwHCbom120NFFn2Z3a6v0owsZfIgOff-1YyvZ9WkzVr3755kGRT_D1FUy3r2kurY8HdfeTiRuZAajluniEkJql7yGlS6hVfQ3vT3X93BKIo1F_A3o4bfywT49tM-3l2X8vwlc-w9X-B5VudQPJ8kboJZ2OuaD5AN///\"},\"assets\":[{\"id\":0,\"title\":{\"text\":\"4 Signs Your Heart Is Quietly Failing You\"},\"required\":1},{\"id\":3,\"img\":{\"w\":1200,\"h\":627,\"url\":\"https://de9a11s35xj3d.cloudfront.net/5922785fd53de8084607850abdaace4f.jpg\"}},{\"id\":4,\"data\":{\"value\":\"PhysioTru\"}},{\"id\":6,\"data\":{\"value\":\"\\n How To Avoid A Heart Attack (Do This For 7 Seconds Twice A Day)\\n \"}}],\"imptrackers\":[\"https://rtb-use.mfadsrvr.com/imp_c2s/v1/ESoNneAwqCPnn97YSh0EoJzPUnSmqwdERCYPCdrHr1_TJz_V-x2xjMgxcROeooIH5fe1exAsWt2aqg1ESQEVQM8i0TpI1QBcV4V87Uzmf_XfAR6-6xqvqfGuDs-pJDWqAYz0P0OtHlrvVztlMdWu6JT9_GAtVAnB9gp0JchRJLSqr1h_GRZwuNUri7NvveTD7m8ZUHKNFldKPwHCbom120NFFn2Z3a6v0owsZfIgOff-1YyvZ9WkzVr3755kGRT_D1FUy3r2kurY8HdfeTiRuZAajluniEkJql7yGlS6hVfQ3vT3X93BKIo1F_A3o4bfywT49tM-3l2X8vwlc-w9X-B5VudQPJ8kboJZ2OuaD5AN/${AUCTION_PRICE}\"],\"ver\":1}}", + "adomain": [ + "advertiserdomain.com" + ], + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "{\"native\":{\"link\":{\"url\":\"https://rtb-use.mfadsrvr.com/click/ESoNneAwqCPnn97YSh0EoJzPUnSmqwdERCYPCdrHr1_TJz_V-x2xjMgxcROeooIH5fe1exAsWt2aqg1ESQEVQM8i0TpI1QBcV4V87Uzmf_XfAR6-6xqvqfGuDs-pJDWqAYz0P0OtHlrvVztlMdWu6JT9_GAtVAnB9gp0JchRJLSqr1h_GRZwuNUri7NvveTD7m8ZUHKNFldKPwHCbom120NFFn2Z3a6v0owsZfIgOff-1YyvZ9WkzVr3755kGRT_D1FUy3r2kurY8HdfeTiRuZAajluniEkJql7yGlS6hVfQ3vT3X93BKIo1F_A3o4bfywT49tM-3l2X8vwlc-w9X-B5VudQPJ8kboJZ2OuaD5AN///\"},\"assets\":[{\"id\":0,\"title\":{\"text\":\"4 Signs Your Heart Is Quietly Failing You\"},\"required\":1},{\"id\":3,\"img\":{\"w\":1200,\"h\":627,\"url\":\"https://de9a11s35xj3d.cloudfront.net/5922785fd53de8084607850abdaace4f.jpg\"}},{\"id\":4,\"data\":{\"value\":\"PhysioTru\"}},{\"id\":6,\"data\":{\"value\":\"\\n How To Avoid A Heart Attack (Do This For 7 Seconds Twice A Day)\\n \"}}],\"imptrackers\":[\"https://rtb-use.mfadsrvr.com/imp_c2s/v1/ESoNneAwqCPnn97YSh0EoJzPUnSmqwdERCYPCdrHr1_TJz_V-x2xjMgxcROeooIH5fe1exAsWt2aqg1ESQEVQM8i0TpI1QBcV4V87Uzmf_XfAR6-6xqvqfGuDs-pJDWqAYz0P0OtHlrvVztlMdWu6JT9_GAtVAnB9gp0JchRJLSqr1h_GRZwuNUri7NvveTD7m8ZUHKNFldKPwHCbom120NFFn2Z3a6v0owsZfIgOff-1YyvZ9WkzVr3755kGRT_D1FUy3r2kurY8HdfeTiRuZAajluniEkJql7yGlS6hVfQ3vT3X93BKIo1F_A3o4bfywT49tM-3l2X8vwlc-w9X-B5VudQPJ8kboJZ2OuaD5AN/${AUCTION_PRICE}\"],\"ver\":1}}", + "adomain": ["advertiserdomain.com"], + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + "type": "native" + } + ] + } + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/exemplary/video.json b/adapters/engagebdr/engagebdrtest/exemplary/video.json index 0c0ef06e993..53c00dc4523 100644 --- a/adapters/engagebdr/engagebdrtest/exemplary/video.json +++ b/adapters/engagebdr/engagebdrtest/exemplary/video.json @@ -40,50 +40,59 @@ } }, "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "bid": [ + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "\nStatic VASTStatic VAST Tag", + "adomain":[ + "advertiserdomain.com" + ], + "iurl": "https://cdn0.bnmla.com/vtest.xml", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } + ], + "seat": "test-request-id" + } ], - "seat": "test-request-id" - } - ], - "bidid": "test-request-id", - "cur": "USD" - } + "bidid": "test-request-id", + "cur": "USD" + } } } ], "expectedBidResponses": [ { - "id": "test-request-id", - "seatbid": [ + "currency": "USD", + "bids": [ { - "bid": [ - { + "bid": { "id": "test-imp-id", "impid": "test-imp-id", "price": 9.81, "adid": "abcde-12345", "adm": "\nStatic VASTStatic VAST Tag", - "adomain":[ - "advertiserdomain.com" - ], + "adomain": ["advertiserdomain.com"], "iurl": "https://cdn0.bnmla.com/vtest.xml", "cid": "campaign1", "crid": "abcde-12345", "w": 300, "h": 250 - } - ], - "seat": "test-request-id" + }, + "type": "video" } - ], - "bidid": "test-request-id", - "cur": "USD" + ] } ] diff --git a/adapters/engagebdr/engagebdrtest/supplemental/audio.json b/adapters/engagebdr/engagebdrtest/supplemental/audio.json new file mode 100644 index 00000000000..f74518dc408 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/audio.json @@ -0,0 +1,22 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "audio": { + }, + "ext": { + "bidder": { + "sspid": "99996" + } + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + "Invalid MediaType. EngageBDR only supports Banner, Video and Native. Ignoring imp id=test-imp-id" + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json new file mode 100644 index 00000000000..16c036f1cb5 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json @@ -0,0 +1,21 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + "Ignoring imp id=test-imp-id, error while decoding impExt, err: unexpected end of JSON input" + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json new file mode 100644 index 00000000000..20260557850 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json @@ -0,0 +1,19 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + "Ignoring imp id=test-imp-id, error while decoding extImpBidder, err: unexpected end of JSON input" + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json new file mode 100644 index 00000000000..e89192e81dc --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json @@ -0,0 +1,23 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + } + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + "Ignoring imp id=test-imp-id, no sspid present" + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp.json new file mode 100644 index 00000000000..ff82607d7ab --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp.json @@ -0,0 +1,12 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + ] + }, + + "expectedMakeRequestsErrors": [ + "Invalid BidRequest. No valid imp." + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/response-500.json b/adapters/engagebdr/engagebdrtest/supplemental/response-500.json new file mode 100644 index 00000000000..45338870aa8 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/response-500.json @@ -0,0 +1,49 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99999" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99999", + "body":{ + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99999" + } + } + }] + } + }, + "mockResponse": { + "status": 500 + } + } + ], + "expectedMakeBidsErrors": [ + "Unexpected status code: 500. Run with request.debug = 1 for more info" + ] +} + From 129b3ac8d955ca8418fdac2d03fc3a44b83a4a74 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Fri, 16 Aug 2019 17:33:01 -0700 Subject: [PATCH 10/12] multi banner multi video test --- adapters/engagebdr/engagebdr.go | 18 +- .../engagebdrtest/exemplary/multi-banner.json | 154 +++++++++++++++++ .../engagebdrtest/exemplary/multi-video.json | 159 ++++++++++++++++++ .../engagebdrtest/params/race/banner.json | 2 +- .../engagebdrtest/params/race/native.json | 3 + .../engagebdrtest/params/race/video.json | 2 +- .../engagebdrtest/supplemental/audio.json | 2 +- .../supplemental/multi-1-invalid-imp.json | 108 ++++++++++++ .../supplemental/multi-banner-video.json | 108 ++++++++++++ .../supplemental/no-imp-ext-bidder.json | 2 +- .../supplemental/no-imp-ext.json | 2 +- .../supplemental/no-imp-sspid.json | 2 +- adapters/engagebdr/params_test.go | 7 + adapters/engagebdr/usersync_test.go | 4 +- 14 files changed, 555 insertions(+), 18 deletions(-) create mode 100644 adapters/engagebdr/engagebdrtest/exemplary/multi-banner.json create mode 100644 adapters/engagebdr/engagebdrtest/exemplary/multi-video.json create mode 100644 adapters/engagebdr/engagebdrtest/params/race/native.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/multi-1-invalid-imp.json create mode 100644 adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json diff --git a/adapters/engagebdr/engagebdr.go b/adapters/engagebdr/engagebdr.go index d8965c8a4a7..48b103ae7b4 100644 --- a/adapters/engagebdr/engagebdr.go +++ b/adapters/engagebdr/engagebdr.go @@ -34,31 +34,31 @@ func (adapter *EngageBDRAdapter) MakeRequests(request *openrtb.BidRequest, reqIn if imp.Audio != nil { errors = append(errors, &errortypes.BadInput{ - Message: fmt.Sprintf("Invalid MediaType. EngageBDR only supports Banner, Video and Native. Ignoring imp id=%s", imp.ID), + Message: fmt.Sprintf("Ignoring imp id=%s, invalid MediaType. EngageBDR only supports Banner, Video and Native.", imp.ID), }) - return nil, errors + continue } var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { errors = append(errors, &errortypes.BadInput{ - Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err), + Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding extImpBidder, err: %s.", imp.ID, err), }) - return nil, errors + continue } impExt := openrtb_ext.ExtImpEngageBDR{} err := json.Unmarshal(bidderExt.Bidder, &impExt) if err != nil { errors = append(errors, &errortypes.BadInput{ - Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding impExt, err: %s", imp.ID, err), + Message: fmt.Sprintf("Ignoring imp id=%s, error while decoding impExt, err: %s.", imp.ID, err), }) - return nil, errors + continue } if impExt.Sspid == "" { errors = append(errors, &errortypes.BadInput{ - Message: fmt.Sprintf("Ignoring imp id=%s, no sspid present", imp.ID), + Message: fmt.Sprintf("Ignoring imp id=%s, no sspid present.", imp.ID), }) - return nil, errors + continue } sspidImps[impExt.Sspid] = append(sspidImps[impExt.Sspid], imp) } @@ -132,8 +132,6 @@ func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { if imp.ID == impId { if imp.Video != nil { mediaType = openrtb_ext.BidTypeVideo - } else if imp.Audio != nil { - mediaType = openrtb_ext.BidTypeAudio } else if imp.Native != nil { mediaType = openrtb_ext.BidTypeNative } diff --git a/adapters/engagebdr/engagebdrtest/exemplary/multi-banner.json b/adapters/engagebdr/engagebdrtest/exemplary/multi-banner.json new file mode 100644 index 00000000000..d11e38c46fc --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/exemplary/multi-banner.json @@ -0,0 +1,154 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99999" + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "sspid": "99999" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99999", + "body":{ + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99999" + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "sspid":"99999" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id" : "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + { + "id" : "test-imp-id-2", + "impid": "test-imp-id-2", + "price": 7.50, + "adid": "abcde-12345-2", + "adm": "
", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345-2", + "w": 320, + "h": 50 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": ["advertiserdomain.com"], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + "type": "banner" + }, + { + "bid": { + "id": "test-imp-id-2", + "impid": "test-imp-id-2", + "price": 7.50, + "adid": "abcde-12345-2", + "adm": "
", + "adomain": ["advertiserdomain.com"], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345-2", + "w": 320, + "h": 50 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/exemplary/multi-video.json b/adapters/engagebdr/engagebdrtest/exemplary/multi-video.json new file mode 100644 index 00000000000..9506c963578 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/exemplary/multi-video.json @@ -0,0 +1,159 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 300, + "mimes": null, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99998" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "w": 320, + "mimes": null, + "h": 50 + }, + "ext": { + "bidder": { + "sspid": "99998" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99998", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 300, + "mimes": null, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99998" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "w": 320, + "mimes": null, + "h": 50 + }, + "ext": { + "bidder": { + "sspid": "99998" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "\nStatic VASTStatic VAST Tag", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "https://cdn0.bnmla.com/vtest.xml", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + { + "id": "test-imp-id-2", + "impid": "test-imp-id-2", + "price": 7.81, + "adid": "abcde-12345-2", + "adm": "\nStatic VASTStatic VAST Tag", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "https://cdn0.bnmla.com/vtest.xml", + "cid": "campaign1", + "crid": "abcde-12345-2", + "w": 320, + "h": 50 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "\nStatic VASTStatic VAST Tag", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "https://cdn0.bnmla.com/vtest.xml", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + "type": "video" + }, + { + "bid": { + "id": "test-imp-id-2", + "impid": "test-imp-id-2", + "price": 7.81, + "adid": "abcde-12345-2", + "adm": "\nStatic VASTStatic VAST Tag", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "https://cdn0.bnmla.com/vtest.xml", + "cid": "campaign1", + "crid": "abcde-12345-2", + "w": 320, + "h": 50 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/engagebdr/engagebdrtest/params/race/banner.json b/adapters/engagebdr/engagebdrtest/params/race/banner.json index c447f6c348d..55128cf449f 100644 --- a/adapters/engagebdr/engagebdrtest/params/race/banner.json +++ b/adapters/engagebdr/engagebdrtest/params/race/banner.json @@ -1,3 +1,3 @@ { - "zoneid": "10589" + "zoneid": "99999" } diff --git a/adapters/engagebdr/engagebdrtest/params/race/native.json b/adapters/engagebdr/engagebdrtest/params/race/native.json new file mode 100644 index 00000000000..7df27654325 --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/params/race/native.json @@ -0,0 +1,3 @@ +{ + "zoneid": "99997" +} diff --git a/adapters/engagebdr/engagebdrtest/params/race/video.json b/adapters/engagebdr/engagebdrtest/params/race/video.json index e5bb8da9797..b60e65203bf 100644 --- a/adapters/engagebdr/engagebdrtest/params/race/video.json +++ b/adapters/engagebdr/engagebdrtest/params/race/video.json @@ -1,3 +1,3 @@ { - "zoneid": "10592" + "zoneid": "99998" } diff --git a/adapters/engagebdr/engagebdrtest/supplemental/audio.json b/adapters/engagebdr/engagebdrtest/supplemental/audio.json index f74518dc408..34cedd6f4db 100644 --- a/adapters/engagebdr/engagebdrtest/supplemental/audio.json +++ b/adapters/engagebdr/engagebdrtest/supplemental/audio.json @@ -16,7 +16,7 @@ }, "expectedMakeRequestsErrors": [ - "Invalid MediaType. EngageBDR only supports Banner, Video and Native. Ignoring imp id=test-imp-id" + "Ignoring imp id=test-imp-id, invalid MediaType. EngageBDR only supports Banner, Video and Native." ] } diff --git a/adapters/engagebdr/engagebdrtest/supplemental/multi-1-invalid-imp.json b/adapters/engagebdr/engagebdrtest/supplemental/multi-1-invalid-imp.json new file mode 100644 index 00000000000..305d78e294d --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/multi-1-invalid-imp.json @@ -0,0 +1,108 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99999" + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + } + } + ] + }, + "expectedMakeRequestsErrors": [ + "Ignoring imp id=test-imp-id-2, error while decoding impExt, err: unexpected end of JSON input." + ], + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99999", + "body":{ + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99999" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id" : "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": ["advertiserdomain.com"], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json b/adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json new file mode 100644 index 00000000000..305d78e294d --- /dev/null +++ b/adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json @@ -0,0 +1,108 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid": "99999" + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + } + } + ] + }, + "expectedMakeRequestsErrors": [ + "Ignoring imp id=test-imp-id-2, error while decoding impExt, err: unexpected end of JSON input." + ], + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://dsp.bnmla.com/hb?zoneid=99999", + "body":{ + "id": "test-request-id", + "imp": [{ + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "sspid":"99999" + } + } + }] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "bid": [ + { + "id" : "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": [ + "advertiserdomain.com" + ], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + } + ], + "seat": "test-request-id" + } + ], + "bidid": "test-request-id", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 9.81, + "adid": "abcde-12345", + "adm": "
", + "adomain": ["advertiserdomain.com"], + "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", + "cid": "campaign1", + "crid": "abcde-12345", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json index 16c036f1cb5..a7a44b6a656 100644 --- a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext-bidder.json @@ -15,7 +15,7 @@ }, "expectedMakeRequestsErrors": [ - "Ignoring imp id=test-imp-id, error while decoding impExt, err: unexpected end of JSON input" + "Ignoring imp id=test-imp-id, error while decoding impExt, err: unexpected end of JSON input." ] } diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json index 20260557850..154f514d390 100644 --- a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-ext.json @@ -13,7 +13,7 @@ }, "expectedMakeRequestsErrors": [ - "Ignoring imp id=test-imp-id, error while decoding extImpBidder, err: unexpected end of JSON input" + "Ignoring imp id=test-imp-id, error while decoding extImpBidder, err: unexpected end of JSON input." ] } diff --git a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json index e89192e81dc..d9cd3b96697 100644 --- a/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json +++ b/adapters/engagebdr/engagebdrtest/supplemental/no-imp-sspid.json @@ -17,7 +17,7 @@ }, "expectedMakeRequestsErrors": [ - "Ignoring imp id=test-imp-id, no sspid present" + "Ignoring imp id=test-imp-id, no sspid present." ] } diff --git a/adapters/engagebdr/params_test.go b/adapters/engagebdr/params_test.go index 33c84eedb10..c797d04ecc8 100644 --- a/adapters/engagebdr/params_test.go +++ b/adapters/engagebdr/params_test.go @@ -38,6 +38,13 @@ var validParams = []string{ } var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, `{"sspid":null}`, `{"appId":"11bc5dd5-7421-4dd8-c926-40fa653bec76"}`, } diff --git a/adapters/engagebdr/usersync_test.go b/adapters/engagebdr/usersync_test.go index a421cf651eb..1e24ff5e2fd 100644 --- a/adapters/engagebdr/usersync_test.go +++ b/adapters/engagebdr/usersync_test.go @@ -7,11 +7,11 @@ import ( ) func TestEngageBDRSyncer(t *testing.T) { - temp := template.Must(template.New("sync-template").Parse("https://match.bnmla.com/usersync?sspid=99999&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir=http%3A%2F%2Flocalhost")) + temp := template.Must(template.New("sync-template").Parse("https://match.bnmla.com/usersync/prbds2s?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D")) syncer := NewEngageBDRSyncer(temp) syncInfo, err := syncer.GetUsersyncInfo("1", "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA") assert.NoError(t, err) - assert.Equal(t, "https://match.bnmla.com/usersync?sspid=99999&gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&redir=http%3A%2F%2Flocalhost", syncInfo.URL) + assert.Equal(t, "https://match.bnmla.com/usersync/prbds2s?gdpr=1&gdpr_consent=BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA&r=localhost%2Fsetuid%3Fbidder%3Dgumgum%26gdpr%3D1%26gdpr_consent%3DBOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA%26uid%3D", syncInfo.URL) assert.Equal(t, "iframe", syncInfo.Type) assert.EqualValues(t, 62, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) From fcd3a54d26a86409ddf31c42b51339c6b68b18d0 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Mon, 26 Aug 2019 11:39:07 -0700 Subject: [PATCH 11/12] update 08/26 --- config/config.go | 1 - static/bidder-info/engagebdr.yaml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index c4c8525b27c..c4f5f0efcb1 100644 --- a/config/config.go +++ b/config/config.go @@ -452,7 +452,6 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderUnruly, "https://usermatch.targeting.unrulymedia.com/pbsync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dunruly%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderVisx, "https://t.visx.net/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") - setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderEngageBDR, "https://match.bnmla.com/usersync/s2s_sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dvisx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D") // openrtb_ext.BidderTappx doesn't have a good default. diff --git a/static/bidder-info/engagebdr.yaml b/static/bidder-info/engagebdr.yaml index aeec945f2ad..d2f7476235f 100644 --- a/static/bidder-info/engagebdr.yaml +++ b/static/bidder-info/engagebdr.yaml @@ -5,3 +5,4 @@ capabilities: mediaTypes: - banner - video + - native From 146defe740bb8d5995eca9e377bdba36e8648373 Mon Sep 17 00:00:00 2001 From: Yan Naing Kyaw Date: Fri, 6 Sep 2019 13:22:29 -0700 Subject: [PATCH 12/12] delete multi banner video json --- .../supplemental/multi-banner-video.json | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json diff --git a/adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json b/adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json deleted file mode 100644 index 305d78e294d..00000000000 --- a/adapters/engagebdr/engagebdrtest/supplemental/multi-banner-video.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "sspid": "99999" - } - } - }, - { - "id": "test-imp-id-2", - "banner": { - "w": 320, - "h": 50 - }, - "ext": { - } - } - ] - }, - "expectedMakeRequestsErrors": [ - "Ignoring imp id=test-imp-id-2, error while decoding impExt, err: unexpected end of JSON input." - ], - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://dsp.bnmla.com/hb?zoneid=99999", - "body":{ - "id": "test-request-id", - "imp": [{ - "id": "test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "sspid":"99999" - } - } - }] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "bid": [ - { - "id" : "test-imp-id", - "impid": "test-imp-id", - "price": 9.81, - "adid": "abcde-12345", - "adm": "
", - "adomain": [ - "advertiserdomain.com" - ], - "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", - "cid": "campaign1", - "crid": "abcde-12345", - "w": 300, - "h": 250 - } - ], - "seat": "test-request-id" - } - ], - "bidid": "test-request-id", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "test-imp-id", - "impid": "test-imp-id", - "price": 9.81, - "adid": "abcde-12345", - "adm": "
", - "adomain": ["advertiserdomain.com"], - "iurl": "http://match.bnmla.com/usersync?sspid=59&redir=", - "cid": "campaign1", - "crid": "abcde-12345", - "w": 300, - "h": 250 - }, - "type": "banner" - } - ] - } - ] -} -