From d2b2e19de35bddd0dd52330cb001b51559d605cc Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 15:51:51 -0400 Subject: [PATCH 01/72] ignore swp files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index c2cbc1e97d5..1d0b59fb74e 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,6 @@ inventory_url.yaml # autogenerated mac file .DS_Store + +# vim swp +*.swp From d21014534b1f154e2186d4d23843de7d761c6c7f Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 16:31:09 -0400 Subject: [PATCH 02/72] start small --- adapters/triplelift/triplelift.go | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 adapters/triplelift/triplelift.go diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go new file mode 100644 index 00000000000..62ac5d3ceb0 --- /dev/null +++ b/adapters/triplelift/triplelift.go @@ -0,0 +1,36 @@ +package adapters + +import ( + "encoding/base64" + "encoding/json" + "net/http" + + "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" +) + + func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { + errs := make([]error, 0, len(request.Imp)) + reqs = make([]*RequestData, 0, 1) + ad = "http://localhost:8076/s2s/auction" + reqJSON, err = json.Marshal(request) + if err != nil { + errs = append(errs,err) + return nil, errs + } + headers := http.Header{} + headers.add("Content-Type","application/json;charset=utf-8") + headers.add("Accept", "application/json") + reqs = append(reqs, &adapters.RequestData{ + Method: "POST", + Uri: ad, + Body: reqJSON, + Headers: headers + }) + return reqs, errs + } + + func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) { + } + From 3acedbe9b43e49d0b9245d434f019080061e0c03 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 16:32:30 -0400 Subject: [PATCH 03/72] start really small --- adapters/triplelift/triplelift.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 62ac5d3ceb0..0630fd54f4d 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -32,5 +32,7 @@ import ( } func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) { + bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) + return bidResponse } From 04a6137fe088a6d73e284b1ffcb5639b7adc0307 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 16:35:08 -0400 Subject: [PATCH 04/72] add a user sync --- adapters/triplelift/usersync.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 adapters/triplelift/usersync.go diff --git a/adapters/triplelift/usersync.go b/adapters/triplelift/usersync.go new file mode 100644 index 00000000000..75067740084 --- /dev/null +++ b/adapters/triplelift/usersync.go @@ -0,0 +1,12 @@ +package triplelift + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("tlx", 32, temp, adapters.SyncTypeRedirect) +} From 5babcb1609535de1f95f1be2599f74864dacddbb Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 16:40:00 -0400 Subject: [PATCH 05/72] justify --- adapters/triplelift/triplelift.go | 50 ++++++++++++++++--------------- exchange/adapter_map.go | 2 ++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 0630fd54f4d..09ca517e54d 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -10,29 +10,31 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) - func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { - errs := make([]error, 0, len(request.Imp)) - reqs = make([]*RequestData, 0, 1) - ad = "http://localhost:8076/s2s/auction" - reqJSON, err = json.Marshal(request) - if err != nil { - errs = append(errs,err) - return nil, errs - } - headers := http.Header{} - headers.add("Content-Type","application/json;charset=utf-8") - headers.add("Accept", "application/json") - reqs = append(reqs, &adapters.RequestData{ - Method: "POST", - Uri: ad, - Body: reqJSON, - Headers: headers - }) - return reqs, errs - } - - func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) { - bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) - return bidResponse +func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { + errs := make([]error, 0, len(request.Imp)) + reqs = make([]*RequestData, 0, 1) + ad = "http://localhost:8076/s2s/auction" + reqJSON, err = json.Marshal(request) + if err != nil { + errs = append(errs,err) + return nil, errs } + headers := http.Header{} + headers.add("Content-Type","application/json;charset=utf-8") + headers.add("Accept", "application/json") + reqs = append(reqs, &adapters.RequestData{ + Method: "POST", + Uri: ad, + Body: reqJSON, + Headers: headers + }) + return reqs, errs +} + +func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) { + bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) + return bidResponse +} + + diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index 3c835571673..bdc440f378e 100644 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -33,6 +33,7 @@ import ( "github.com/prebid/prebid-server/adapters/somoaudience" "github.com/prebid/prebid-server/adapters/sonobi" "github.com/prebid/prebid-server/adapters/sovrn" + "github.com/prebid/prebid-server/adapters/triplelift" "github.com/prebid/prebid-server/adapters/yieldmo" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -68,6 +69,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.Bidder33Across: ttx.New33AcrossBidder(cfg.Adapters[string(openrtb_ext.Bidder33Across)].Endpoint), openrtb_ext.BidderGrid: grid.NewGridBidder(cfg.Adapters[string(openrtb_ext.BidderGrid)].Endpoint), openrtb_ext.BidderSonobi: sonobi.NewSonobiBidder(client, cfg.Adapters[string(openrtb_ext.BidderSonobi)].Endpoint), + openrtb_ext.BidderTriplelift: triplelift.NewTripleliftBidder(client, cfg.Adapters[string(openrtb_ext.Triplelift)].Endpoint), openrtb_ext.BidderYieldmo: yieldmo.NewYieldmoBidder(cfg.Adapters[string(openrtb_ext.BidderYieldmo)].Endpoint), openrtb_ext.BidderGamoshi: gamoshi.NewGamoshiBidder(cfg.Adapters[string(openrtb_ext.BidderGamoshi)].Endpoint), openrtb_ext.BidderMgid: mgid.NewMgidBidder(cfg.Adapters[string(openrtb_ext.BidderMgid)].Endpoint), From a55a9c11d21dbd761d717a14bc1ef957c288379e Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 16:43:08 -0400 Subject: [PATCH 06/72] triplelift adapter --- adapters/triplelift/triplelift.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 09ca517e54d..7b25579d552 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -10,6 +10,10 @@ import ( "github.com/prebid/prebid-server/openrtb_ext" ) +type TripleliftAdapter struct { + endpoint String +} + func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) reqs = make([]*RequestData, 0, 1) @@ -36,5 +40,10 @@ func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, return bidResponse } +func NewTripleliftBidder(client *adapters.HTTPAdapterConfig, endpoint string) *TripleiftAdapter { + return &TripleliftAdapter{ + endpoint: endpoint + } +} From 3c4ccbc4a15a3da5a5e79817ccc29acc02f70508 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 16:49:32 -0400 Subject: [PATCH 07/72] add our endpoint --- config/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config.go b/config/config.go index f457f5501f5..8306b62ae68 100644 --- a/config/config.go +++ b/config/config.go @@ -593,6 +593,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.rubicon.endpoint", "http://exapi-us-east.rubiconproject.com/a/api/exchange.json") v.SetDefault("adapters.somoaudience.endpoint", "http://publisher-east.mobileadtrading.com/rtb/bid") v.SetDefault("adapters.sovrn.endpoint", "http://ap.lijit.com/rtb/bid?src=prebid_server") + v.SetDefault("adapters.triplelift.endpoint", "https://tlx.3lift.com/s2s/auction?supplier_id=12") v.SetDefault("adapters.adkerneladn.endpoint", "http://{{.Host}}/rtbpub?account={{.PublisherID}}") v.SetDefault("adapters.33across.partner_id", "") v.SetDefault("adapters.33across.endpoint", "http://ssc.33across.com/api/v1/hb") From 44f921b73076984bc807b6e5cc83790f52f7ceac Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 18:30:06 -0400 Subject: [PATCH 08/72] fix syntax --- adapters/triplelift/triplelift.go | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 7b25579d552..f31ce3b7ac9 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -1,49 +1,49 @@ -package adapters +package triplelift import ( - "encoding/base64" + //"encoding/base64" "encoding/json" "net/http" "github.com/mxmCherry/openrtb" - "github.com/prebid/prebid-server/errortypes" - "github.com/prebid/prebid-server/openrtb_ext" + //"github.com/prebid/prebid-server/errortypes" + //"github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/adapters" ) type TripleliftAdapter struct { - endpoint String + endpoint string } func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) - reqs = make([]*RequestData, 0, 1) - ad = "http://localhost:8076/s2s/auction" - reqJSON, err = json.Marshal(request) + reqs := make([]*adapters.RequestData, 0, 1) + ad := "http://localhost:8076/s2s/auction" + reqJSON, err := json.Marshal(request) if err != nil { errs = append(errs,err) return nil, errs } headers := http.Header{} - headers.add("Content-Type","application/json;charset=utf-8") - headers.add("Accept", "application/json") + headers.Add("Content-Type","application/json;charset=utf-8") + headers.Add("Accept", "application/json") reqs = append(reqs, &adapters.RequestData{ Method: "POST", Uri: ad, Body: reqJSON, - Headers: headers - }) + Headers: headers}) return reqs, errs } -func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) { +func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + errs := make([]error,2) bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) - return bidResponse + return bidResponse,errs } -func NewTripleliftBidder(client *adapters.HTTPAdapterConfig, endpoint string) *TripleiftAdapter { +func NewTripleliftBidder(client *adapters.HTTPAdapterConfig, endpoint string) *TripleliftAdapter { return &TripleliftAdapter{ - endpoint: endpoint - } + endpoint: endpoint} } From f9d30c4b77e83b9e441b14b04e67e6b6028380f7 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 18:35:13 -0400 Subject: [PATCH 09/72] config stuff --- openrtb_ext/bidders.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 7a45c5b88d9..b74456fdf4f 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -47,6 +47,7 @@ const ( BidderSomoaudience BidderName = "somoaudience" BidderSovrn BidderName = "sovrn" BidderSonobi BidderName = "sonobi" + BidderTriplelift BidderName = "triplelift" BidderYieldmo BidderName = "yieldmo" ) @@ -79,6 +80,7 @@ var BidderMap = map[string]BidderName{ "somoaudience": BidderSomoaudience, "sovrn": BidderSovrn, "sonobi": BidderSonobi, + "triplelift": BidderTriplelift, "yieldmo": BidderYieldmo, } From 9f299fefe2575d65876f002925d98c3ab13133c9 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 13 Jun 2019 18:44:28 -0400 Subject: [PATCH 10/72] compiler fixes --- adapters/triplelift/triplelift.go | 8 ++++---- exchange/adapter_map.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index f31ce3b7ac9..e86ab24c6e9 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -15,7 +15,7 @@ type TripleliftAdapter struct { endpoint string } -func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { +func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) reqs := make([]*adapters.RequestData, 0, 1) ad := "http://localhost:8076/s2s/auction" @@ -35,13 +35,13 @@ func MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error return reqs, errs } -func MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { errs := make([]error,2) bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) - return bidResponse,errs + return bidResponse, errs } -func NewTripleliftBidder(client *adapters.HTTPAdapterConfig, endpoint string) *TripleliftAdapter { +func NewTripleliftBidder(client *http.Client, endpoint string) *TripleliftAdapter { return &TripleliftAdapter{ endpoint: endpoint} } diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index bdc440f378e..64c2d737ef7 100644 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -69,7 +69,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.Bidder33Across: ttx.New33AcrossBidder(cfg.Adapters[string(openrtb_ext.Bidder33Across)].Endpoint), openrtb_ext.BidderGrid: grid.NewGridBidder(cfg.Adapters[string(openrtb_ext.BidderGrid)].Endpoint), openrtb_ext.BidderSonobi: sonobi.NewSonobiBidder(client, cfg.Adapters[string(openrtb_ext.BidderSonobi)].Endpoint), - openrtb_ext.BidderTriplelift: triplelift.NewTripleliftBidder(client, cfg.Adapters[string(openrtb_ext.Triplelift)].Endpoint), + openrtb_ext.BidderTriplelift: triplelift.NewTripleliftBidder(client, cfg.Adapters[string(openrtb_ext.BidderTriplelift)].Endpoint), openrtb_ext.BidderYieldmo: yieldmo.NewYieldmoBidder(cfg.Adapters[string(openrtb_ext.BidderYieldmo)].Endpoint), openrtb_ext.BidderGamoshi: gamoshi.NewGamoshiBidder(cfg.Adapters[string(openrtb_ext.BidderGamoshi)].Endpoint), openrtb_ext.BidderMgid: mgid.NewMgidBidder(cfg.Adapters[string(openrtb_ext.BidderMgid)].Endpoint), From bc3b636a11f2a97290b25084aa3ef39f9929913c Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 14 Jun 2019 11:57:44 -0400 Subject: [PATCH 11/72] more config --- adapters/triplelift/triplelift.go | 1 + config/config.go | 1 + openrtb_ext/imp_tripelift.go | 26 ++++++++++++++++++++++++++ static/bidder-info/triplelift.yaml | 12 ++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 openrtb_ext/imp_tripelift.go create mode 100644 static/bidder-info/triplelift.yaml diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index e86ab24c6e9..9f52776d0d5 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -24,6 +24,7 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapt errs = append(errs,err) return nil, errs } + println("hi") headers := http.Header{} headers.Add("Content-Type","application/json;charset=utf-8") headers.Add("Accept", "application/json") diff --git a/config/config.go b/config/config.go index 8306b62ae68..e44684bb24a 100644 --- a/config/config.go +++ b/config/config.go @@ -446,6 +446,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") 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.BidderTriplelift, "https://eb2.3lift.com/uid?gpdr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}) } diff --git a/openrtb_ext/imp_tripelift.go b/openrtb_ext/imp_tripelift.go new file mode 100644 index 00000000000..9ef69d06458 --- /dev/null +++ b/openrtb_ext/imp_tripelift.go @@ -0,0 +1,26 @@ +package openrtb_ext + +import "encoding/json" + +// ExtImpAppnexus defines the contract for bidrequest.imp[i].ext.appnexus +type ExtImpAppnexus struct { + LegacyPlacementId int `json:"placementId"` + LegacyInvCode string `json:"invCode"` + LegacyTrafficSourceCode string `json:"trafficSourceCode"` + PlacementId int `json:"placement_id"` + InvCode string `json:"inv_code"` + Member string `json:"member"` + Keywords []*ExtImpAppnexusKeyVal `json:"keywords"` + TrafficSourceCode string `json:"traffic_source_code"` + Reserve float64 `json:"reserve"` + Position string `json:"position"` + UsePmtRule *bool `json:"use_pmt_rule"` + // At this time we do no processing on the private sizes, so just leaving it as a JSON blob. + PrivateSizes json.RawMessage `json:"private_sizes"` +} + +// ExtImpAppnexusKeyVal defines the contract for bidrequest.imp[i].ext.appnexus.keywords[i] +type ExtImpAppnexusKeyVal struct { + Key string `json:"key,omitempty"` + Values []string `json:"value,omitempty"` +} diff --git a/static/bidder-info/triplelift.yaml b/static/bidder-info/triplelift.yaml new file mode 100644 index 00000000000..28f57acfdb3 --- /dev/null +++ b/static/bidder-info/triplelift.yaml @@ -0,0 +1,12 @@ +maintainer: + email: "info@prebid.org" +capabilities: + app: + mediaTypes: + - banner + - native + site: + mediaTypes: + - banner + - video + - native From 408c011b5f2a8f94f9ff3fcbc7d53641576f5300 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 14 Jun 2019 14:02:06 -0400 Subject: [PATCH 12/72] add params --- adapters/triplelift/triplelift.go | 1 + static/bidder-params/triplelift.json | 101 +++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 static/bidder-params/triplelift.json diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 9f52776d0d5..c7b32d11a3d 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -16,6 +16,7 @@ type TripleliftAdapter struct { } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { + println("hi") errs := make([]error, 0, len(request.Imp)) reqs := make([]*adapters.RequestData, 0, 1) ad := "http://localhost:8076/s2s/auction" diff --git a/static/bidder-params/triplelift.json b/static/bidder-params/triplelift.json new file mode 100644 index 00000000000..7da41a67055 --- /dev/null +++ b/static/bidder-params/triplelift.json @@ -0,0 +1,101 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Appnexus Adapter Params", + "description": "A schema which validates params accepted by the AppNexus adapter", + + "type": "object", + "properties": { + "placement_id": { + "type": "integer", + "description": "An ID which identifies this placement of the impression" + }, + "placementId": { + "type": "integer", + "description": "Deprecated, use placement_id instead." + }, + "inv_code": { + "type": "string", + "description": "A code identifying the inventory of this placement." + }, + "invCode": { + "type": "string", + "description": "Deprecated, use inv_code instead." + }, + "member": { + "type": "string", + "description": "An ID which identifies the member selling the impression." + }, + "keywords": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "description": "A key with one or more values associated with it. These are used in buy-side segment targeting.", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + }, + "required": ["key"] + } + }, + "traffic_source_code": { + "type": "string", + "description": "Specifies the third-party source of this impression." + }, + "trafficSourceCode": { + "type": "string", + "description": "Deprecated, use traffic_source_code instead." + }, + "reserve": { + "type": "number", + "description": "The minimium acceptable bid, in CPM, using US Dollars" + }, + "position": { + "type": "string", + "enum": ["above", "below"], + "description": "Specifies the ad unit as above or below the fold" + }, + "use_pmt_rule": { + "type": "boolean", + "description": "Boolean to signal AppNexus to apply the relevant payment rule" + }, + "private_sizes" :{ + "type": "array", + "items": { + "type": "object", + "properties": { + "w": { "type": "integer" }, + "h": { "type": "integer" } + }, + "required": [ "w", "h"] + }, + "description": "Private sizes (ex: [{\"w\": 300, \"h\": 250},{...}]), experimental, may not be supported." + } + }, + + "oneOf": [{ + "oneOf": [{ + "required": ["placementId"] + }, { + "required": ["placement_id"] + }] + }, { + "oneOf": [{ + "required": ["invCode", "member"] + }, { + "required": ["inv_code", "member"] + }] + }], + + "not": { + "required": ["placementId", "invCode", "member"] + } +} From e7cb43d4f1bfce1d7c0a34dbeb3ac74d424b0355 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 14 Jun 2019 14:52:46 -0400 Subject: [PATCH 13/72] making progress --- adapters/triplelift/triplelift.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index c7b32d11a3d..b3616b907f2 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -16,19 +16,17 @@ type TripleliftAdapter struct { } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { - println("hi") errs := make([]error, 0, len(request.Imp)) reqs := make([]*adapters.RequestData, 0, 1) - ad := "http://localhost:8076/s2s/auction" reqJSON, err := json.Marshal(request) if err != nil { errs = append(errs,err) return nil, errs } - println("hi") headers := http.Header{} headers.Add("Content-Type","application/json;charset=utf-8") headers.Add("Accept", "application/json") + ad := a.endpoint reqs = append(reqs, &adapters.RequestData{ Method: "POST", Uri: ad, @@ -38,7 +36,7 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapt } func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { - errs := make([]error,2) + errs := make([]error,0,2) bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) return bidResponse, errs } From cf6bbe880ffb85984066635b309ae2358ea3c5d3 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 14 Jun 2019 15:05:39 -0400 Subject: [PATCH 14/72] make our ext more exty --- openrtb_ext/imp_tripelift.go | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/openrtb_ext/imp_tripelift.go b/openrtb_ext/imp_tripelift.go index 9ef69d06458..7975c993770 100644 --- a/openrtb_ext/imp_tripelift.go +++ b/openrtb_ext/imp_tripelift.go @@ -2,25 +2,25 @@ package openrtb_ext import "encoding/json" -// ExtImpAppnexus defines the contract for bidrequest.imp[i].ext.appnexus -type ExtImpAppnexus struct { - LegacyPlacementId int `json:"placementId"` - LegacyInvCode string `json:"invCode"` - LegacyTrafficSourceCode string `json:"trafficSourceCode"` - PlacementId int `json:"placement_id"` - InvCode string `json:"inv_code"` - Member string `json:"member"` - Keywords []*ExtImpAppnexusKeyVal `json:"keywords"` - TrafficSourceCode string `json:"traffic_source_code"` - Reserve float64 `json:"reserve"` - Position string `json:"position"` - UsePmtRule *bool `json:"use_pmt_rule"` - // At this time we do no processing on the private sizes, so just leaving it as a JSON blob. - PrivateSizes json.RawMessage `json:"private_sizes"` +// ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.appnexus +type ExtImpTriplelift struct { + SSP string `json:"ssp"` + PaymentChain string `json:"pchain"` + AppID string `json:"appId"` + SupplyChain *ExtTLSupplyChain `json:"schain"` } -// ExtImpAppnexusKeyVal defines the contract for bidrequest.imp[i].ext.appnexus.keywords[i] -type ExtImpAppnexusKeyVal struct { - Key string `json:"key,omitempty"` - Values []string `json:"value,omitempty"` +// ExtTLSupplyChainNode defines the format of bidrequest.imp[i].ext.triplelift.schain.nodes[n] +type ExtTLSupplyChainNode struct { + ASI string `json:"asi"` + PID string `json:"pid"` + RID string `json:"rid"` + NAME string `json:"name"` + DOMAIN string `json:"domain"` +} + +// ExtTLSupplyChain defines the format of bidrequest.imp[i].ext.triplelift.schain +type ExtTLSupplyChain struct { + Complete int `json:"complete"` + Values []*ExtTLSupplyChainNode `json:"nodes"` } From 61f72b3c6de8d8dba50f76cd08c59c56d8d88d06 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 14 Jun 2019 15:50:13 -0400 Subject: [PATCH 15/72] start making responses --- adapters/triplelift/triplelift.go | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index b3616b907f2..da66fbf5993 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -35,9 +35,40 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapt return reqs, errs } +func getBidCount(seatBid SeatBid) (int) { + c := 0 + for _, sb := range seatBid { + c = c + len(sb.Bid) + } + return c; +} + func (a *TripleliftAdapter) 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{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} + } errs := make([]error,0,2) - bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) + var bidResp openrtb.BidResponse + if err := json.Unmarshal(response.Body, &bidResp); err != nil { + return nil, []error{err} + } + count := getBidCount(bidResp.SeatBid) + bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) + + for _, sb := range bidResp.SeatBig { + + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid return bidResponse, errs } From d9b8c5911554f6549767befee468d000bc36c294 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Sat, 15 Jun 2019 14:50:29 -0400 Subject: [PATCH 16/72] more logic --- adapters/triplelift/triplelift.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index da66fbf5993..9e6b61c1a30 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -66,9 +66,18 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) for _, sb := range bidResp.SeatBig { - - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid + for i := 0; i < len(sb.Bid); i++ { + bid := sb.Bid[i] + impVideo = &openrtb_ext.ExtBidPrebidVideo { + Duration: 2 + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: openrtb_ext.BidTypeBanner, + BidVideo: impVideo + } + } + } return bidResponse, errs } From c6e5f5583815176e7a8430fbc13130325724c633 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Sat, 15 Jun 2019 15:04:40 -0400 Subject: [PATCH 17/72] fix compilation errors --- adapters/triplelift/triplelift.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 9e6b61c1a30..2d07da231e5 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -4,10 +4,11 @@ import ( //"encoding/base64" "encoding/json" "net/http" + "fmt" "github.com/mxmCherry/openrtb" - //"github.com/prebid/prebid-server/errortypes" - //"github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/adapters" ) @@ -35,9 +36,9 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapt return reqs, errs } -func getBidCount(seatBid SeatBid) (int) { +func getBidCount(bidResponse openrtb.BidResponse) (int) { c := 0 - for _, sb := range seatBid { + for _, sb := range bidResponse.SeatBid { c = c + len(sb.Bid) } return c; @@ -62,20 +63,20 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } - count := getBidCount(bidResp.SeatBid) + count := getBidCount(bidResp) bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) - for _, sb := range bidResp.SeatBig { + for _, sb := range bidResp.SeatBid { for i := 0; i < len(sb.Bid); i++ { bid := sb.Bid[i] - impVideo = &openrtb_ext.ExtBidPrebidVideo { - Duration: 2 + impVideo := &openrtb_ext.ExtBidPrebidVideo { + Duration: 2, } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &bid, BidType: openrtb_ext.BidTypeBanner, - BidVideo: impVideo - } + BidVideo: impVideo, + }) } } return bidResponse, errs From a57cfdea4dd301d8d75290658fce4b2467d3534a Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Sat, 15 Jun 2019 16:38:41 -0400 Subject: [PATCH 18/72] can we just nil this out? --- adapters/triplelift/triplelift.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 2d07da231e5..166a53edb4a 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -8,7 +8,7 @@ import ( "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/errortypes" - "github.com/prebid/prebid-server/openrtb_ext" + //"github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/adapters" ) @@ -69,13 +69,8 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern for _, sb := range bidResp.SeatBid { for i := 0; i < len(sb.Bid); i++ { bid := sb.Bid[i] - impVideo := &openrtb_ext.ExtBidPrebidVideo { - Duration: 2, - } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &bid, - BidType: openrtb_ext.BidTypeBanner, - BidVideo: impVideo, }) } } From 1707d8ac64ab9db27cda8d756fb710775754a2e6 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 11:02:42 -0400 Subject: [PATCH 19/72] augment our json --- openrtb_ext/imp_tripelift.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openrtb_ext/imp_tripelift.go b/openrtb_ext/imp_tripelift.go index 7975c993770..58d503f06e2 100644 --- a/openrtb_ext/imp_tripelift.go +++ b/openrtb_ext/imp_tripelift.go @@ -2,12 +2,13 @@ package openrtb_ext import "encoding/json" -// ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.appnexus +// ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { SSP string `json:"ssp"` PaymentChain string `json:"pchain"` AppID string `json:"appId"` SupplyChain *ExtTLSupplyChain `json:"schain"` + InvCode string `json:"inv_code"` } // ExtTLSupplyChainNode defines the format of bidrequest.imp[i].ext.triplelift.schain.nodes[n] From 6d3a72eef1cf576706db9b6fdf972f794f602c33 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 11:54:13 -0400 Subject: [PATCH 20/72] radically simplify our json --- openrtb_ext/imp_tripelift.go | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/openrtb_ext/imp_tripelift.go b/openrtb_ext/imp_tripelift.go index 58d503f06e2..9df5e60816c 100644 --- a/openrtb_ext/imp_tripelift.go +++ b/openrtb_ext/imp_tripelift.go @@ -4,24 +4,5 @@ import "encoding/json" // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { - SSP string `json:"ssp"` - PaymentChain string `json:"pchain"` - AppID string `json:"appId"` - SupplyChain *ExtTLSupplyChain `json:"schain"` - InvCode string `json:"inv_code"` -} - -// ExtTLSupplyChainNode defines the format of bidrequest.imp[i].ext.triplelift.schain.nodes[n] -type ExtTLSupplyChainNode struct { - ASI string `json:"asi"` - PID string `json:"pid"` - RID string `json:"rid"` - NAME string `json:"name"` - DOMAIN string `json:"domain"` -} - -// ExtTLSupplyChain defines the format of bidrequest.imp[i].ext.triplelift.schain -type ExtTLSupplyChain struct { - Complete int `json:"complete"` - Values []*ExtTLSupplyChainNode `json:"nodes"` + InvCode string `json:"inventoryCode"` } From e1efc38fb08c9d9c47f553fc1ba06bc3a5a9e5fa Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 11:59:11 -0400 Subject: [PATCH 21/72] fix errs --- adapters/triplelift/triplelift.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 166a53edb4a..31c523b716e 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -54,15 +54,15 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern 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{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } - errs := make([]error,0,2) var bidResp openrtb.BidResponse if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } + var errs []error count := getBidCount(bidResp) bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) From 0a25607ee10822f73338b83922ae50f2e1bfcb45 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 12:11:23 -0400 Subject: [PATCH 22/72] infer the bid type --- adapters/triplelift/triplelift.go | 39 ++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 31c523b716e..3b176c4416c 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -16,6 +16,27 @@ type TripleliftAdapter struct { endpoint string } +type TripleliftRespExt struct { + format int `json:"format" +} + +type TripleliftRespExt struct { + Triplelift TripleliftRespExtTriplelift `json:"triplelift"` +} + +func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { + t := ext.Triplelift.format + if t == 1 { + return openrtb_ext.BidTypeNative, nil + } + if t == 2 || t == 8 || t == 11 { + return openrtb_ext.BidTypeVideo, nil + } + if t == 10 { + return openrtb_ext.BidTypeBanner, nil + } +} + func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) reqs := make([]*adapters.RequestData, 0, 1) @@ -69,9 +90,21 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern for _, sb := range bidResp.SeatBid { for i := 0; i < len(sb.Bid); i++ { bid := sb.Bid[i] - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - }) + var bidExt TripleliftRespExt + if err := json.Unmarshal(bid.Ext, &bidExtx); err != nil { + errs = append(errs,err) + } + else { + if bidType, err := getBidType(*bidExt); err != nil { + errs = append(errs,err) + } + else { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: bidType + }) + } + } } } return bidResponse, errs From 856f3abb43abf85a8beea72ab7d9be754d239f86 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 12:13:15 -0400 Subject: [PATCH 23/72] fix syntax --- adapters/triplelift/triplelift.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 3b176c4416c..2fce9b89142 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -17,7 +17,7 @@ type TripleliftAdapter struct { } type TripleliftRespExt struct { - format int `json:"format" + format int `json:"format`" } type TripleliftRespExt struct { From c46c510ca8f69628603795df3d86cae5d791547f Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 12:23:44 -0400 Subject: [PATCH 24/72] fix comilation errors --- adapters/triplelift/triplelift.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 2fce9b89142..d613cda98d0 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -8,7 +8,7 @@ import ( "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/errortypes" - //"github.com/prebid/prebid-server/openrtb_ext" + "github.com/prebid/prebid-server/openrtb_ext" "github.com/prebid/prebid-server/adapters" ) @@ -16,8 +16,8 @@ type TripleliftAdapter struct { endpoint string } -type TripleliftRespExt struct { - format int `json:"format`" +type TripleliftRespExtTriplelift struct { + format int `json:"format"` } type TripleliftRespExt struct { @@ -35,6 +35,7 @@ func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { if t == 10 { return openrtb_ext.BidTypeBanner, nil } + return "", fmt.Errorf("could not find bid type") } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { @@ -91,17 +92,15 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern for i := 0; i < len(sb.Bid); i++ { bid := sb.Bid[i] var bidExt TripleliftRespExt - if err := json.Unmarshal(bid.Ext, &bidExtx); err != nil { + if err := json.Unmarshal(bid.Ext, &bidExt); err != nil { errs = append(errs,err) - } - else { - if bidType, err := getBidType(*bidExt); err != nil { + } else { + if bidType, err := getBidType(bidExt); err != nil { errs = append(errs,err) - } - else { + } else { bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &bid, - BidType: bidType + BidType: bidType, }) } } From f49c552c317f6805a92a25cc8d406c03e4709be0 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 13:35:34 -0400 Subject: [PATCH 25/72] rename --- openrtb_ext/{imp_tripelift.go => imp_triplelift.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename openrtb_ext/{imp_tripelift.go => imp_triplelift.go} (100%) diff --git a/openrtb_ext/imp_tripelift.go b/openrtb_ext/imp_triplelift.go similarity index 100% rename from openrtb_ext/imp_tripelift.go rename to openrtb_ext/imp_triplelift.go From 7bd8bb0614efd2fe496013467e90b8d653d82b22 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 13:37:12 -0400 Subject: [PATCH 26/72] fix compilation error --- openrtb_ext/imp_triplelift.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index 9df5e60816c..df6b73115d3 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -1,7 +1,5 @@ package openrtb_ext -import "encoding/json" - // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { InvCode string `json:"inventoryCode"` From 2a6c2be030fb9ae570248e6e7a74592a8a5cee87 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 15:34:40 -0400 Subject: [PATCH 27/72] config stuff --- config/config.go | 6 +++--- openrtb_ext/bidders.go | 2 +- openrtb_ext/imp.go | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index e44684bb24a..346b5907704 100644 --- a/config/config.go +++ b/config/config.go @@ -446,7 +446,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") 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.BidderTriplelift, "https://eb2.3lift.com/uid?gpdr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}) + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTriplelift, "https://eb2.3lift.com/uid?gpdr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}") } @@ -469,9 +469,9 @@ func SetupViper(v *viper.Viper, filename string) { } // Fixes #475: Some defaults will be set just so they are accessible via environment variables // (basically so viper knows they exist) - v.SetDefault("external_url", "http://localhost:8000") + v.SetDefault("external_url", "http://localhost:8002") v.SetDefault("host", "") - v.SetDefault("port", 8000) + v.SetDefault("port", 8002) v.SetDefault("admin_port", 6060) v.SetDefault("enable_gzip", false) v.SetDefault("status_response", "") diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index b74456fdf4f..07fb34ef909 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -127,7 +127,7 @@ func NewBidderParamsValidator(schemaDirectory string) (BidderParamValidator, err for _, fileInfo := range fileInfos { bidderName := strings.TrimSuffix(fileInfo.Name(), ".json") if _, isValid := BidderMap[bidderName]; !isValid { - return nil, fmt.Errorf("File %s/%s does not match a valid BidderName.", schemaDirectory, fileInfo.Name()) + return nil, fmt.Errorf("File %s/%s does not match a valid BidderName.", schemaDirectory, bidderName) } toOpen, err := filepath.Abs(filepath.Join(schemaDirectory, fileInfo.Name())) if err != nil { diff --git a/openrtb_ext/imp.go b/openrtb_ext/imp.go index 5a5157d0c8a..11dae3ff27d 100644 --- a/openrtb_ext/imp.go +++ b/openrtb_ext/imp.go @@ -12,6 +12,7 @@ type ExtImp struct { Rubicon *ExtImpRubicon `json:"rubicon"` Adform *ExtImpAdform `json:"adform"` Rhythmone *ExtImpRhythmone `json:"rhythmone"` + Triplelift *ExtImpTriplelift `json:"triplelift"` } // ExtImpPrebid defines the contract for bidrequest.imp[i].ext.prebid From dae5782b4812f422e740c26bde82fc970f58e470 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 15:40:12 -0400 Subject: [PATCH 28/72] simplify params --- static/bidder-params/triplelift.json | 98 ++-------------------------- 1 file changed, 6 insertions(+), 92 deletions(-) diff --git a/static/bidder-params/triplelift.json b/static/bidder-params/triplelift.json index 7da41a67055..a2e04024198 100644 --- a/static/bidder-params/triplelift.json +++ b/static/bidder-params/triplelift.json @@ -1,101 +1,15 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Appnexus Adapter Params", - "description": "A schema which validates params accepted by the AppNexus adapter", + "title": "Triplelift Adapter Params", + "description": "A schema which validates params accepted by the Triplelift adapter", "type": "object", "properties": { - "placement_id": { - "type": "integer", - "description": "An ID which identifies this placement of the impression" - }, - "placementId": { - "type": "integer", - "description": "Deprecated, use placement_id instead." - }, - "inv_code": { - "type": "string", - "description": "A code identifying the inventory of this placement." - }, - "invCode": { - "type": "string", - "description": "Deprecated, use inv_code instead." - }, - "member": { - "type": "string", - "description": "An ID which identifies the member selling the impression." - }, - "keywords": { - "type": "array", - "minItems": 1, - "items": { - "type": "object", - "description": "A key with one or more values associated with it. These are used in buy-side segment targeting.", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - } - }, - "required": ["key"] - } - }, - "traffic_source_code": { + "inventoryCode": { "type": "string", - "description": "Specifies the third-party source of this impression." + "description": "A code which identifies this placement of the impression" }, - "trafficSourceCode": { - "type": "string", - "description": "Deprecated, use traffic_source_code instead." - }, - "reserve": { - "type": "number", - "description": "The minimium acceptable bid, in CPM, using US Dollars" - }, - "position": { - "type": "string", - "enum": ["above", "below"], - "description": "Specifies the ad unit as above or below the fold" - }, - "use_pmt_rule": { - "type": "boolean", - "description": "Boolean to signal AppNexus to apply the relevant payment rule" - }, - "private_sizes" :{ - "type": "array", - "items": { - "type": "object", - "properties": { - "w": { "type": "integer" }, - "h": { "type": "integer" } - }, - "required": [ "w", "h"] - }, - "description": "Private sizes (ex: [{\"w\": 300, \"h\": 250},{...}]), experimental, may not be supported." + "not": { + "required": ["inventoryCode"] } - }, - - "oneOf": [{ - "oneOf": [{ - "required": ["placementId"] - }, { - "required": ["placement_id"] - }] - }, { - "oneOf": [{ - "required": ["invCode", "member"] - }, { - "required": ["inv_code", "member"] - }] - }], - - "not": { - "required": ["placementId", "invCode", "member"] - } } From b1aa20de446f31297d8195f67413ff8ca6fd9569 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 15:45:08 -0400 Subject: [PATCH 29/72] more config stuff --- static/bidder-params/triplelift.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/bidder-params/triplelift.json b/static/bidder-params/triplelift.json index a2e04024198..e6a60fec0f2 100644 --- a/static/bidder-params/triplelift.json +++ b/static/bidder-params/triplelift.json @@ -8,8 +8,13 @@ "inventoryCode": { "type": "string", "description": "A code which identifies this placement of the impression" - }, - "not": { - "required": ["inventoryCode"] } + }, + "oneOf": [{ + "oneOf": [{ + "required": ["inventoryCode"] + }] }], + "not": { + "required": [] + } } From 796ab7a3c065711d56999868398bd78d078eb6de Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 16:07:39 -0400 Subject: [PATCH 30/72] fixes --- config/config.go | 2 +- openrtb_ext/imp.go | 1 - static/bidder-params/triplelift.json | 5 +---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index 346b5907704..357834bc289 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.rubicon.endpoint", "http://exapi-us-east.rubiconproject.com/a/api/exchange.json") v.SetDefault("adapters.somoaudience.endpoint", "http://publisher-east.mobileadtrading.com/rtb/bid") v.SetDefault("adapters.sovrn.endpoint", "http://ap.lijit.com/rtb/bid?src=prebid_server") - v.SetDefault("adapters.triplelift.endpoint", "https://tlx.3lift.com/s2s/auction?supplier_id=12") + v.SetDefault("adapters.triplelift.endpoint", "https://tlx.3lift.com/s2s/auction?supplier_id=19") v.SetDefault("adapters.adkerneladn.endpoint", "http://{{.Host}}/rtbpub?account={{.PublisherID}}") v.SetDefault("adapters.33across.partner_id", "") v.SetDefault("adapters.33across.endpoint", "http://ssc.33across.com/api/v1/hb") diff --git a/openrtb_ext/imp.go b/openrtb_ext/imp.go index 11dae3ff27d..5a5157d0c8a 100644 --- a/openrtb_ext/imp.go +++ b/openrtb_ext/imp.go @@ -12,7 +12,6 @@ type ExtImp struct { Rubicon *ExtImpRubicon `json:"rubicon"` Adform *ExtImpAdform `json:"adform"` Rhythmone *ExtImpRhythmone `json:"rhythmone"` - Triplelift *ExtImpTriplelift `json:"triplelift"` } // ExtImpPrebid defines the contract for bidrequest.imp[i].ext.prebid diff --git a/static/bidder-params/triplelift.json b/static/bidder-params/triplelift.json index e6a60fec0f2..5753c6d47cd 100644 --- a/static/bidder-params/triplelift.json +++ b/static/bidder-params/triplelift.json @@ -13,8 +13,5 @@ "oneOf": [{ "oneOf": [{ "required": ["inventoryCode"] - }] }], - "not": { - "required": [] - } + }] }] } From d2d8a8af2b4ee69fdc7856f4cd164037956744b4 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 16:09:43 -0400 Subject: [PATCH 31/72] revert this --- config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 357834bc289..acd46a7661c 100644 --- a/config/config.go +++ b/config/config.go @@ -469,9 +469,9 @@ func SetupViper(v *viper.Viper, filename string) { } // Fixes #475: Some defaults will be set just so they are accessible via environment variables // (basically so viper knows they exist) - v.SetDefault("external_url", "http://localhost:8002") + v.SetDefault("external_url", "http://localhost:8000") v.SetDefault("host", "") - v.SetDefault("port", 8002) + v.SetDefault("port", 8000) v.SetDefault("admin_port", 6060) v.SetDefault("enable_gzip", false) v.SetDefault("status_response", "") From 02f1073d64a656b2ab850d30948883cc4de4b406 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 16:41:20 -0400 Subject: [PATCH 32/72] fix up the extension --- adapters/triplelift/triplelift.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index d613cda98d0..63079ad4d26 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -21,21 +21,18 @@ type TripleliftRespExtTriplelift struct { } type TripleliftRespExt struct { - Triplelift TripleliftRespExtTriplelift `json:"triplelift"` + Triplelift TripleliftRespExtTriplelift `json:"triplelift_pb"` } func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { t := ext.Triplelift.format - if t == 1 { - return openrtb_ext.BidTypeNative, nil - } if t == 2 || t == 8 || t == 11 { return openrtb_ext.BidTypeVideo, nil } if t == 10 { return openrtb_ext.BidTypeBanner, nil } - return "", fmt.Errorf("could not find bid type") + return openrtb_ext.BidTypeNative, nil } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { From 7d9df4d49be39c33b024c7b0793d1e1257ba4908 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 17:09:44 -0400 Subject: [PATCH 33/72] getting closer --- adapters/triplelift/usersync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/triplelift/usersync.go b/adapters/triplelift/usersync.go index 75067740084..37321523dd7 100644 --- a/adapters/triplelift/usersync.go +++ b/adapters/triplelift/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("tlx", 32, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("triplelift", 32, temp, adapters.SyncTypeRedirect) } From a835c6c886bd38790160c3985a57421d402ee879 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Mon, 17 Jun 2019 17:26:29 -0400 Subject: [PATCH 34/72] add a test --- adapters/triplelift/triplelift_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 adapters/triplelift/triplelift_test.go diff --git a/adapters/triplelift/triplelift_test.go b/adapters/triplelift/triplelift_test.go new file mode 100644 index 00000000000..45f8263b9f1 --- /dev/null +++ b/adapters/triplelift/triplelift_test.go @@ -0,0 +1,11 @@ +package appnexus + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" +) + +func TestJsonSamples(t *testing.T) { + adapterstest.RunJSONBidderTest(t, "triplelifttest", NewTripleliftBidder(nil, "http://tlx.3lift.net/s2s/auction?supplier_id=19")) +} From eabff67d594217d3467ba90947346561d1547c65 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 10:49:05 -0400 Subject: [PATCH 35/72] update config --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index acd46a7661c..2d901833102 100644 --- a/config/config.go +++ b/config/config.go @@ -446,7 +446,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") 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.BidderTriplelift, "https://eb2.3lift.com/uid?gpdr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderTriplelift, "https://eb2.3lift.com/sync?gpdr={{.GDPR}}&cmp_cs={{.GDPRConsent}}") } From 645879de59064a6c4ae8873dea3a7636b0012bf3 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 10:58:30 -0400 Subject: [PATCH 36/72] update bidder params --- static/bidder-params/triplelift.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/static/bidder-params/triplelift.json b/static/bidder-params/triplelift.json index 5753c6d47cd..9f13045977d 100644 --- a/static/bidder-params/triplelift.json +++ b/static/bidder-params/triplelift.json @@ -7,11 +7,15 @@ "properties": { "inventoryCode": { "type": "string", - "description": "A code which identifies this placement of the impression" - } + "description": "TripleLift inventory code for this ad unit (provided to you by your partner manager)" + }, + "floor" : {"description" : "the bid floor", "type": "number" } }, "oneOf": [{ "oneOf": [{ "required": ["inventoryCode"] - }] }] + }] }], + "not": { + "required": ["floor"] + } } From 68abbf988e0c02f5fd00f7c817912cd6e84fbaf2 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 10:59:28 -0400 Subject: [PATCH 37/72] add the floor here, too --- openrtb_ext/imp_triplelift.go | 1 + 1 file changed, 1 insertion(+) diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index df6b73115d3..f85a49f711b 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -3,4 +3,5 @@ package openrtb_ext // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { InvCode string `json:"inventoryCode"` + Floor string `json:"floor"` } From 3de38ec328c3edbd55f8be4dfbfb781d759d8adc Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 11:10:00 -0400 Subject: [PATCH 38/72] add a usersync test --- adapters/triplelift/usersync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/triplelift/usersync.go b/adapters/triplelift/usersync.go index 37321523dd7..468307c640b 100644 --- a/adapters/triplelift/usersync.go +++ b/adapters/triplelift/usersync.go @@ -8,5 +8,5 @@ import ( ) func NewTripleliftSyncer(temp *template.Template) usersync.Usersyncer { - return adapters.NewSyncer("triplelift", 32, temp, adapters.SyncTypeRedirect) + return adapters.NewSyncer("triplelift", 28, temp, adapters.SyncTypeRedirect) } From 248a2b85b88651e70121c03fcaf7869890171722 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 11:19:33 -0400 Subject: [PATCH 39/72] validation, ws, and a test --- adapters/triplelift/triplelift.go | 128 ++++++++++++------------- adapters/triplelift/triplelift_test.go | 5 +- adapters/triplelift/usersync.go | 2 +- adapters/triplelift/usersync_test.go | 19 ++++ openrtb_ext/imp_triplelift.go | 4 +- 5 files changed, 87 insertions(+), 71 deletions(-) create mode 100644 adapters/triplelift/usersync_test.go diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 63079ad4d26..f1440038e7e 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -1,66 +1,66 @@ -package triplelift +package triplelift import ( //"encoding/base64" "encoding/json" + "fmt" "net/http" - "fmt" "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openrtb_ext" - "github.com/prebid/prebid-server/adapters" ) type TripleliftAdapter struct { - endpoint string + endpoint string } type TripleliftRespExtTriplelift struct { - format int `json:"format"` + format int `json:"format"` } type TripleliftRespExt struct { - Triplelift TripleliftRespExtTriplelift `json:"triplelift_pb"` + Triplelift TripleliftRespExtTriplelift `json:"triplelift_pb"` } func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { - t := ext.Triplelift.format - if t == 2 || t == 8 || t == 11 { - return openrtb_ext.BidTypeVideo, nil - } - if t == 10 { - return openrtb_ext.BidTypeBanner, nil - } - return openrtb_ext.BidTypeNative, nil + t := ext.Triplelift.format + if t == 2 || t == 8 || t == 11 { + return openrtb_ext.BidTypeVideo, nil + } + if t == 10 { + return openrtb_ext.BidTypeBanner, nil + } + return openrtb_ext.BidTypeNative, nil } -func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { - errs := make([]error, 0, len(request.Imp)) - reqs := make([]*adapters.RequestData, 0, 1) - reqJSON, err := json.Marshal(request) - if err != nil { - errs = append(errs,err) - return nil, errs - } - headers := http.Header{} - headers.Add("Content-Type","application/json;charset=utf-8") - headers.Add("Accept", "application/json") - ad := a.endpoint - reqs = append(reqs, &adapters.RequestData{ - Method: "POST", - Uri: ad, - Body: reqJSON, - Headers: headers}) - return reqs, errs +func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { + errs := make([]error, 0, len(request.Imp)) + reqs := make([]*adapters.RequestData, 0, 1) + reqJSON, err := json.Marshal(request) + if err != nil { + errs = append(errs, err) + return nil, errs + } + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + ad := a.endpoint + reqs = append(reqs, &adapters.RequestData{ + Method: "POST", + Uri: ad, + Body: reqJSON, + Headers: headers}) + return reqs, errs } -func getBidCount(bidResponse openrtb.BidResponse) (int) { - c := 0 - for _, sb := range bidResponse.SeatBid { - c = c + len(sb.Bid) - } - return c; +func getBidCount(bidResponse openrtb.BidResponse) int { + c := 0 + for _, sb := range bidResponse.SeatBid { + c = c + len(sb.Bid) + } + return c } func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalRequest *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { @@ -73,7 +73,7 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern 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{fmt.Errorf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode)} } @@ -81,34 +81,32 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern if err := json.Unmarshal(response.Body, &bidResp); err != nil { return nil, []error{err} } - var errs []error - count := getBidCount(bidResp) - bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) + var errs []error + count := getBidCount(bidResp) + bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) - for _, sb := range bidResp.SeatBid { - for i := 0; i < len(sb.Bid); i++ { - bid := sb.Bid[i] - var bidExt TripleliftRespExt - if err := json.Unmarshal(bid.Ext, &bidExt); err != nil { - errs = append(errs,err) - } else { - if bidType, err := getBidType(bidExt); err != nil { - errs = append(errs,err) - } else { - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: bidType, - }) - } - } - } - } - return bidResponse, errs + for _, sb := range bidResp.SeatBid { + for i := 0; i < len(sb.Bid); i++ { + bid := sb.Bid[i] + var bidExt TripleliftRespExt + if err := json.Unmarshal(bid.Ext, &bidExt); err != nil { + errs = append(errs, err) + } else { + if bidType, err := getBidType(bidExt); err != nil { + errs = append(errs, err) + } else { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + }) + } + } + } + } + return bidResponse, errs } func NewTripleliftBidder(client *http.Client, endpoint string) *TripleliftAdapter { - return &TripleliftAdapter{ - endpoint: endpoint} + return &TripleliftAdapter{ + endpoint: endpoint} } - - diff --git a/adapters/triplelift/triplelift_test.go b/adapters/triplelift/triplelift_test.go index 45f8263b9f1..0c167509688 100644 --- a/adapters/triplelift/triplelift_test.go +++ b/adapters/triplelift/triplelift_test.go @@ -1,9 +1,8 @@ -package appnexus +package triplelift import ( - "testing" - "github.com/prebid/prebid-server/adapters/adapterstest" + "testing" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/triplelift/usersync.go b/adapters/triplelift/usersync.go index 468307c640b..5cb524bea11 100644 --- a/adapters/triplelift/usersync.go +++ b/adapters/triplelift/usersync.go @@ -1,4 +1,4 @@ -package triplelift +package triplelift import ( "text/template" diff --git a/adapters/triplelift/usersync_test.go b/adapters/triplelift/usersync_test.go new file mode 100644 index 00000000000..fe3401f10b6 --- /dev/null +++ b/adapters/triplelift/usersync_test.go @@ -0,0 +1,19 @@ +package triplelift + +import ( + "testing" + "text/template" + + "github.com/stretchr/testify/assert" +) + +func TestTripleliftSyncer(t *testing.T) { + temp := template.Must(template.New("sync-template").Parse("//eb2.3lift.com/sync?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}")) + syncer := NewTripleliftSyncer(temp) + syncInfo, err := syncer.GetUsersyncInfo("", "") + assert.NoError(t, err) + assert.Equal(t, "//eb2.3lift.com/sync?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 28, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index f85a49f711b..a40ca5bd771 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -2,6 +2,6 @@ package openrtb_ext // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { - InvCode string `json:"inventoryCode"` - Floor string `json:"floor"` + InvCode string `json:"inventoryCode"` + Floor string `json:"floor"` } From 22acdce08a4595aae6ac8a5a91bddc1c9cd63b6e Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 11:24:24 -0400 Subject: [PATCH 40/72] update tests --- usersync/usersyncers/syncer.go | 2 ++ usersync/usersyncers/syncer_test.go | 1 + 2 files changed, 3 insertions(+) diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index d06db0441bf..7b9b7f99d57 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -32,6 +32,7 @@ import ( "github.com/prebid/prebid-server/adapters/somoaudience" "github.com/prebid/prebid-server/adapters/sonobi" "github.com/prebid/prebid-server/adapters/sovrn" + "github.com/prebid/prebid-server/adapters/triplelift" "github.com/prebid/prebid-server/adapters/yieldmo" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/openrtb_ext" @@ -69,6 +70,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderSomoaudience, somoaudience.NewSomoaudienceSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderSovrn, sovrn.NewSovrnSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderSonobi, sonobi.NewSonobiSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderTriplelift, triplelift.NewTripleliftSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldmo, yieldmo.NewYieldmoSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderGamoshi, gamoshi.NewGamoshiSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderMgid, mgid.NewMgidSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 11555827316..981da58fa23 100644 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -38,6 +38,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderSharethrough): syncConfig, string(openrtb_ext.BidderSomoaudience): syncConfig, string(openrtb_ext.BidderSovrn): syncConfig, + string(openrtb_ext.BidderTriplelift): syncConfig, string(openrtb_ext.Bidder33Across): syncConfig, string(openrtb_ext.BidderSonobi): syncConfig, string(openrtb_ext.BidderYieldmo): syncConfig, From 951dcf454f8f7a807e1ce142dd12e8d2e39e0759 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 11:36:54 -0400 Subject: [PATCH 41/72] fix test --- adapters/triplelift/usersync_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/triplelift/usersync_test.go b/adapters/triplelift/usersync_test.go index fe3401f10b6..3406ec2a74b 100644 --- a/adapters/triplelift/usersync_test.go +++ b/adapters/triplelift/usersync_test.go @@ -12,7 +12,7 @@ func TestTripleliftSyncer(t *testing.T) { syncer := NewTripleliftSyncer(temp) syncInfo, err := syncer.GetUsersyncInfo("", "") assert.NoError(t, err) - assert.Equal(t, "//eb2.3lift.com/sync?gdpr={{.GDPR}}&cmp_cs={{.GDPRConsent}}", syncInfo.URL) + assert.Equal(t, "//eb2.3lift.com/sync?gdpr=&cmp_cs=", syncInfo.URL) assert.Equal(t, "redirect", syncInfo.Type) assert.EqualValues(t, 28, syncer.GDPRVendorID()) assert.Equal(t, false, syncInfo.SupportCORS) From 9c75da6bf7c9804ae8acda0894db49812d95ccea Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 14:19:29 -0400 Subject: [PATCH 42/72] update email --- static/bidder-info/triplelift.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/triplelift.yaml b/static/bidder-info/triplelift.yaml index 28f57acfdb3..6b58af49d92 100644 --- a/static/bidder-info/triplelift.yaml +++ b/static/bidder-info/triplelift.yaml @@ -1,5 +1,5 @@ maintainer: - email: "info@prebid.org" + email: "solutions@triplelift.com" capabilities: app: mediaTypes: From 3d8635ac0610f21b00d6025709b5e27091fe97c6 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 18 Jun 2019 14:19:54 -0400 Subject: [PATCH 43/72] why not --- static/bidder-info/triplelift.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/static/bidder-info/triplelift.yaml b/static/bidder-info/triplelift.yaml index 6b58af49d92..1d24f71944f 100644 --- a/static/bidder-info/triplelift.yaml +++ b/static/bidder-info/triplelift.yaml @@ -5,6 +5,7 @@ capabilities: mediaTypes: - banner - native + - video site: mediaTypes: - banner From 1160d94e20c2937bc767182ac61373a94df51306 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 19 Jun 2019 09:40:29 -0400 Subject: [PATCH 44/72] change email --- static/bidder-info/triplelift.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/triplelift.yaml b/static/bidder-info/triplelift.yaml index 1d24f71944f..29c6cdaad1d 100644 --- a/static/bidder-info/triplelift.yaml +++ b/static/bidder-info/triplelift.yaml @@ -1,5 +1,5 @@ maintainer: - email: "solutions@triplelift.com" + email: "prebid@triplelift.com" capabilities: app: mediaTypes: From 0b59aa4e59eebcfab7a89532a07ba9797ea740e3 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 26 Jun 2019 14:08:57 -0400 Subject: [PATCH 45/72] preprocess requests --- adapters/triplelift/triplelift.go | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index f1440038e7e..d58c6165489 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -35,10 +35,35 @@ func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { return openrtb_ext.BidTypeNative, nil } +func processImp(imp openrtb.Imp) (error) { + // get the triplelift extension + var ext adapters.ExtImpBidder + var tlext ExtImpTriplelift + if err = json.Unmarshal(imp.Ext, &ext); err != nil { + return err + } + if err = json.Unmarshal(ext.Bidder, &tlext); err != nil { + return err + } + imp.TagId = tlext.InvCode + imp.BidFloor = tlext.Floor +} + func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) reqs := make([]*adapters.RequestData, 0, 1) - reqJSON, err := json.Marshal(request) + // copy the request, because we are going to mutate it + tlRequest := *request + // this will contain all the valid impressions + var validImps []openrtb.Imp + // pre-process the imps + for _, imp := range tlRequest.Imp { + if err := processImp(&imp); err == nil { + append(validImps, imp) + } + } + tlRequest.Imp = validImps + reqJSON, err := json.Marshal(tlRequest) if err != nil { errs = append(errs, err) return nil, errs From d14a353554c7299ff1dc6bea58659196b9326c8b Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 26 Jun 2019 14:14:57 -0400 Subject: [PATCH 46/72] do some parsing --- adapters/triplelift/triplelift.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index d58c6165489..528d9960339 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -1,8 +1,8 @@ package triplelift import ( - //"encoding/base64" - "encoding/json" + "strconv" + "encoding/json" "fmt" "net/http" @@ -38,15 +38,18 @@ func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { func processImp(imp openrtb.Imp) (error) { // get the triplelift extension var ext adapters.ExtImpBidder - var tlext ExtImpTriplelift - if err = json.Unmarshal(imp.Ext, &ext); err != nil { + var tlext openrtb_ext.ExtImpTriplelift + if err := json.Unmarshal(imp.Ext, &ext); err != nil { return err } - if err = json.Unmarshal(ext.Bidder, &tlext); err != nil { + if err := json.Unmarshal(ext.Bidder, &tlext); err != nil { return err } - imp.TagId = tlext.InvCode - imp.BidFloor = tlext.Floor + if floor, err = strconv.ParseFloat(tlext.InvCode,64); err != nil { + return err + } + imp.TagID = tlext.InvCode + imp.BidFloor = floor } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { From 67f241c169435e46521660fb187cb667d5ca37eb Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 26 Jun 2019 14:18:56 -0400 Subject: [PATCH 47/72] take care of some errors --- adapters/triplelift/triplelift.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 528d9960339..3e56e326fbf 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -35,7 +35,7 @@ func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { return openrtb_ext.BidTypeNative, nil } -func processImp(imp openrtb.Imp) (error) { +func processImp(imp *openrtb.Imp) (error) { // get the triplelift extension var ext adapters.ExtImpBidder var tlext openrtb_ext.ExtImpTriplelift @@ -45,11 +45,14 @@ func processImp(imp openrtb.Imp) (error) { if err := json.Unmarshal(ext.Bidder, &tlext); err != nil { return err } - if floor, err = strconv.ParseFloat(tlext.InvCode,64); err != nil { + imp.TagID = tlext.InvCode + if floor, err := strconv.ParseFloat(tlext.InvCode,64); err != nil { return err + } else { + imp.BidFloor = floor } - imp.TagID = tlext.InvCode - imp.BidFloor = floor + // no error + return nil } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { @@ -62,7 +65,7 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapte // pre-process the imps for _, imp := range tlRequest.Imp { if err := processImp(&imp); err == nil { - append(validImps, imp) + validImps = append(validImps, imp) } } tlRequest.Imp = validImps From 863a2c595d5faecfa9590136764be87312c581b4 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 26 Jun 2019 14:51:24 -0400 Subject: [PATCH 48/72] floor is optional --- adapters/triplelift/triplelift.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 3e56e326fbf..691d8beaf14 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -46,8 +46,9 @@ func processImp(imp *openrtb.Imp) (error) { return err } imp.TagID = tlext.InvCode - if floor, err := strconv.ParseFloat(tlext.InvCode,64); err != nil { - return err + // floor is optional + if floor, err := strconv.ParseFloat(tlext.Floor,64); err != nil { + return nil } else { imp.BidFloor = floor } From 0955972b6d5040f8a7f2cd26205ad146261c39d8 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 2 Jul 2019 16:17:25 -0400 Subject: [PATCH 49/72] ws --- adapters/triplelift/triplelift.go | 66 +++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 691d8beaf14..514ad9aafac 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -1,10 +1,10 @@ package triplelift import ( - "strconv" - "encoding/json" + "encoding/json" "fmt" "net/http" + "strconv" "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" @@ -35,42 +35,42 @@ func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { return openrtb_ext.BidTypeNative, nil } -func processImp(imp *openrtb.Imp) (error) { - // get the triplelift extension - var ext adapters.ExtImpBidder - var tlext openrtb_ext.ExtImpTriplelift - if err := json.Unmarshal(imp.Ext, &ext); err != nil { - return err - } - if err := json.Unmarshal(ext.Bidder, &tlext); err != nil { - return err - } - imp.TagID = tlext.InvCode - // floor is optional - if floor, err := strconv.ParseFloat(tlext.Floor,64); err != nil { - return nil - } else { - imp.BidFloor = floor - } - // no error - return nil +func processImp(imp *openrtb.Imp) error { + // get the triplelift extension + var ext adapters.ExtImpBidder + var tlext openrtb_ext.ExtImpTriplelift + if err := json.Unmarshal(imp.Ext, &ext); err != nil { + return err + } + if err := json.Unmarshal(ext.Bidder, &tlext); err != nil { + return err + } + imp.TagID = tlext.InvCode + // floor is optional + if floor, err := strconv.ParseFloat(tlext.Floor, 64); err != nil { + return nil + } else { + imp.BidFloor = floor + } + // no error + return nil } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) { errs := make([]error, 0, len(request.Imp)) reqs := make([]*adapters.RequestData, 0, 1) - // copy the request, because we are going to mutate it - tlRequest := *request - // this will contain all the valid impressions - var validImps []openrtb.Imp - // pre-process the imps - for _, imp := range tlRequest.Imp { - if err := processImp(&imp); err == nil { - validImps = append(validImps, imp) - } - } - tlRequest.Imp = validImps - reqJSON, err := json.Marshal(tlRequest) + // copy the request, because we are going to mutate it + tlRequest := *request + // this will contain all the valid impressions + var validImps []openrtb.Imp + // pre-process the imps + for _, imp := range tlRequest.Imp { + if err := processImp(&imp); err == nil { + validImps = append(validImps, imp) + } + } + tlRequest.Imp = validImps + reqJSON, err := json.Marshal(tlRequest) if err != nil { errs = append(errs, err) return nil, errs From 7a1d04414adb824c424fcd4f55e6ca1d854d7fe7 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 2 Jul 2019 16:18:06 -0400 Subject: [PATCH 50/72] remove native --- static/bidder-info/triplelift.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/static/bidder-info/triplelift.yaml b/static/bidder-info/triplelift.yaml index 29c6cdaad1d..2b9ff8d5675 100644 --- a/static/bidder-info/triplelift.yaml +++ b/static/bidder-info/triplelift.yaml @@ -4,10 +4,8 @@ capabilities: app: mediaTypes: - banner - - native - video site: mediaTypes: - banner - video - - native From f7630644568d27d23f83e2c84ea7151ac15c8406 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 2 Jul 2019 16:21:43 -0400 Subject: [PATCH 51/72] everything is either banner or video --- adapters/triplelift/triplelift.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 514ad9aafac..1ce5ab63b56 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -26,13 +26,10 @@ type TripleliftRespExt struct { func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { t := ext.Triplelift.format - if t == 2 || t == 8 || t == 11 { + if t == 11 { return openrtb_ext.BidTypeVideo, nil } - if t == 10 { - return openrtb_ext.BidTypeBanner, nil - } - return openrtb_ext.BidTypeNative, nil + return openrtb_ext.BidTypeBanner, nil } func processImp(imp *openrtb.Imp) error { From f6183ff9a67b6f261fe13ad4c0f99bd046fecb94 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 10 Jul 2019 17:22:00 -0400 Subject: [PATCH 52/72] this should be a float --- openrtb_ext/imp_triplelift.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index a40ca5bd771..c1cefbc154f 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -3,5 +3,5 @@ package openrtb_ext // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { InvCode string `json:"inventoryCode"` - Floor string `json:"floor"` + Floor float64 `json:"floor"` } From 8b2706bb43babe98a711b4c7307927738b965933 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 11 Jul 2019 12:03:42 -0400 Subject: [PATCH 53/72] floor to floor --- adapters/triplelift/triplelift.go | 4 ++-- openrtb_ext/imp_triplelift.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 6929b48c41f..23de8a98ee6 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -44,10 +44,10 @@ func processImp(imp *openrtb.Imp) error { } imp.TagID = tlext.InvCode // floor is optional - if floor, err := strconv.ParseFloat(tlext.Floor, 64); err != nil { + if tlext.Floor == nil { return nil } else { - imp.BidFloor = floor + imp.BidFloor = tlext.Floor } // no error return nil diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index c1cefbc154f..bbe9eee7c09 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -2,6 +2,6 @@ package openrtb_ext // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { - InvCode string `json:"inventoryCode"` - Floor float64 `json:"floor"` + InvCode string `json:"inventoryCode"` + Floor float64 `json:"floor,omitempty"` } From df5fbc836416c5b2f76b5b27dd345926e546c06e Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 11 Jul 2019 12:08:22 -0400 Subject: [PATCH 54/72] fix compilation errors --- adapters/triplelift/triplelift.go | 3 +-- openrtb_ext/imp_triplelift.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 23de8a98ee6..5cfbad31dc5 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "net/http" - "strconv" "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" @@ -47,7 +46,7 @@ func processImp(imp *openrtb.Imp) error { if tlext.Floor == nil { return nil } else { - imp.BidFloor = tlext.Floor + imp.BidFloor = *tlext.Floor } // no error return nil diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index bbe9eee7c09..796ab578d4b 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -3,5 +3,5 @@ package openrtb_ext // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { InvCode string `json:"inventoryCode"` - Floor float64 `json:"floor,omitempty"` + Floor *float64 `json:"floor"` } From 21d95263cbfed329cf4459d7e19c0bb150f33ba5 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 11 Jul 2019 13:56:35 -0400 Subject: [PATCH 55/72] add some tests --- .../triplelifttest/amp/simple-banner.json | 140 ++++++++++++++ .../triplelifttest/amp/simple-video.json | 131 +++++++++++++ .../exemplary/optional-params.json | 66 +++++++ .../exemplary/simple-banner.json | 131 +++++++++++++ .../exemplary/simple-video.json | 124 ++++++++++++ .../exemplary/video-invalid-category.json | 122 ++++++++++++ .../triplelifttest/params/race/banner.json | 10 + .../triplelifttest/params/race/video.json | 10 + .../supplemental/displaymanager-test.json | 150 ++++++++++++++ .../supplemental/explicit-dimensions.json | 58 ++++++ .../supplemental/multi-bid.json | 183 ++++++++++++++++++ 11 files changed, 1125 insertions(+) create mode 100644 adapters/triplelift/triplelifttest/amp/simple-banner.json create mode 100644 adapters/triplelift/triplelifttest/amp/simple-video.json create mode 100644 adapters/triplelift/triplelifttest/exemplary/optional-params.json create mode 100644 adapters/triplelift/triplelifttest/exemplary/simple-banner.json create mode 100644 adapters/triplelift/triplelifttest/exemplary/simple-video.json create mode 100644 adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json create mode 100644 adapters/triplelift/triplelifttest/params/race/banner.json create mode 100644 adapters/triplelift/triplelifttest/params/race/video.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/multi-bid.json diff --git a/adapters/triplelift/triplelifttest/amp/simple-banner.json b/adapters/triplelift/triplelifttest/amp/simple-banner.json new file mode 100644 index 00000000000..79df8d63913 --- /dev/null +++ b/adapters/triplelift/triplelifttest/amp/simple-banner.json @@ -0,0 +1,140 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placement_id": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", + "body": { + "ext": { + "triplelift": { + "is_amp": 1 + }, + "prebid": { + } + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "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 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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 + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/triplelift/triplelifttest/amp/simple-video.json b/adapters/triplelift/triplelifttest/amp/simple-video.json new file mode 100644 index 00000000000..5bf3ebb1752 --- /dev/null +++ b/adapters/triplelift/triplelifttest/amp/simple-video.json @@ -0,0 +1,131 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6, 7, 8], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "placement_id": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ib.adnxs.com/openrtb2", + "body": { + "ext": { + "appnexus": { + "is_amp": 1 + }, + "prebid": { + } + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6, 7, 8], + "w": 940, + "h": 560 + }, + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "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, + "cat": ["IAB9-1"], + "ext": { + "appnexus": { + "brand_id": 9, + "brand_category_id": 9, + "auction_id": 8189378542222915032, + "bid_ad_type": 1, + "bidder_id": 2, + "ranking_price": 0.000000 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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": ["IAB5-3"], + "ext": { + "appnexus": { + "brand_id": 9, + "brand_category_id": 9, + "auction_id": 8189378542222915032, + "bid_ad_type": 1, + "bidder_id": 2, + "ranking_price": 0.000000 + } + } + }, + "type": "video" + } + ] + } + ] + } diff --git a/adapters/triplelift/triplelifttest/exemplary/optional-params.json b/adapters/triplelift/triplelifttest/exemplary/optional-params.json new file mode 100644 index 00000000000..63b88c3a5fd --- /dev/null +++ b/adapters/triplelift/triplelifttest/exemplary/optional-params.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor" : 20 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "tagid": "foo", + "bidfloor": 20, + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor" : 20 + } + } + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ] +} diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json new file mode 100644 index 00000000000..e35323f0490 --- /dev/null +++ b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json @@ -0,0 +1,131 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "inventoryCode": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ], + }, + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + } + }, + "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 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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 + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-video.json b/adapters/triplelift/triplelifttest/exemplary/simple-video.json new file mode 100644 index 00000000000..b73a3f64bf6 --- /dev/null +++ b/adapters/triplelift/triplelifttest/exemplary/simple-video.json @@ -0,0 +1,124 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6, 7, 8], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "placement_id": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ib.adnxs.com/openrtb2", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6, 7, 8], + "w": 940, + "h": 560 + }, + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "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, + "cat": ["IAB9-1"], + "ext": { + "appnexus": { + "brand_id": 9, + "brand_category_id": 9, + "auction_id": 8189378542222915032, + "bid_ad_type": 1, + "bidder_id": 2, + "ranking_price": 0.000000 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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": ["IAB5-3"], + "ext": { + "appnexus": { + "brand_id": 9, + "brand_category_id": 9, + "auction_id": 8189378542222915032, + "bid_ad_type": 1, + "bidder_id": 2, + "ranking_price": 0.000000 + } + } + }, + "type": "video" + } + ] + } + ] + } \ No newline at end of file diff --git a/adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json b/adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json new file mode 100644 index 00000000000..427dfde118f --- /dev/null +++ b/adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json @@ -0,0 +1,122 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6, 7, 8], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "placement_id": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ib.adnxs.com/openrtb2", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6, 7, 8], + "w": 940, + "h": 560 + }, + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "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": 99, + "brand_category_id": 99, + "auction_id": 8189378542222915032, + "bid_ad_type": 1, + "bidder_id": 2, + "ranking_price": 0.000000 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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, + "ext": { + "appnexus": { + "brand_id": 99, + "brand_category_id": 99, + "auction_id": 8189378542222915032, + "bid_ad_type": 1, + "bidder_id": 2, + "ranking_price": 0.000000 + } + } + }, + "type": "video" + } + ] + } + ] + } \ No newline at end of file diff --git a/adapters/triplelift/triplelifttest/params/race/banner.json b/adapters/triplelift/triplelifttest/params/race/banner.json new file mode 100644 index 00000000000..2e2b39e9429 --- /dev/null +++ b/adapters/triplelift/triplelifttest/params/race/banner.json @@ -0,0 +1,10 @@ +{ + "placement_id": 10433394, + "reserve": 20, + "position": "below", + "traffic_source_code": "trafficSource", + "keywords": [ + {"key": "foo", "value": ["bar","baz"]}, + {"key": "valueless"} + ] +} diff --git a/adapters/triplelift/triplelifttest/params/race/video.json b/adapters/triplelift/triplelifttest/params/race/video.json new file mode 100644 index 00000000000..2e2b39e9429 --- /dev/null +++ b/adapters/triplelift/triplelifttest/params/race/video.json @@ -0,0 +1,10 @@ +{ + "placement_id": 10433394, + "reserve": 20, + "position": "below", + "traffic_source_code": "trafficSource", + "keywords": [ + {"key": "foo", "value": ["bar","baz"]}, + {"key": "valueless"} + ] +} diff --git a/adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json b/adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json new file mode 100644 index 00000000000..d4cfedf27a4 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json @@ -0,0 +1,150 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "ext": { + "prebid":{ + "source": "prebid-mobile", + "version": "1.0.0" + } + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placement_id": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ib.adnxs.com/openrtb2", + "body": { + "id": "test-request-id", + "app": { + "ext": { + "prebid":{ + "source": "prebid-mobile", + "version": "1.0.0" + } + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 250 + }, + "displaymanagerver": "prebid-mobile-1.0.0", + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "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 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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 + } + } + }, + "type": "banner" + } + ] + } + ] + } \ No newline at end of file diff --git a/adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json b/adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json new file mode 100644 index 00000000000..4bbeeab0d63 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json @@ -0,0 +1,58 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 100, + "h": 400 + }, + "ext": { + "bidder": { + "placementId": 10433394 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ib.adnxs.com/openrtb2", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 100, + "h": 400 + }, + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "mockResponse": { + "status": 204 + } + } + ] +} diff --git a/adapters/triplelift/triplelifttest/supplemental/multi-bid.json b/adapters/triplelift/triplelifttest/supplemental/multi-bid.json new file mode 100644 index 00000000000..d77c6955ed4 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/multi-bid.json @@ -0,0 +1,183 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "placement_id": 10433394 + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ib.adnxs.com/openrtb2", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "appnexus": { + "placement_id": 10433394 + } + } + } + ] + } + }, + "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 + } + } + }, + { + "id": "7706636740145184842", + "impid": "test-imp-id", + "price": 0.400000, + "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 + } + } + }] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "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 + } + } + }, + "type": "banner" + }, + { + "bid": { + "id": "7706636740145184842", + "impid": "test-imp-id", + "price": 0.400000, + "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, + "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 + } + } + }, + "type": "banner" + } + ] + } + ] +} From edda36e3a35872ff35f01bc7f39126ac77513254 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 11 Jul 2019 16:48:51 -0400 Subject: [PATCH 56/72] more tests --- .../exemplary/simple-banner.json | 62 +++++++++---------- .../exemplary/simple-video.json | 16 +++-- openrtb_ext/imp_triplelift.go | 2 +- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json index e35323f0490..6e7d6c621bb 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json @@ -18,13 +18,12 @@ }, "ext": { "bidder": { - "inventoryCode": 10433394 + "inventoryCode": "aa" } } } ] }, - "httpCalls": [ { "expectedRequest": { @@ -44,8 +43,9 @@ "w": 300, "h": 600 } - ], + ] }, + "tagid" : "aa", "ext": { "bidder": { "inventoryCode": "aa" @@ -62,29 +62,28 @@ "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 + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "triplelift": { + "format" : 11 + } } } - }] + ] } ], "bidid": "5778926625248726496", @@ -93,7 +92,6 @@ } } ], - "expectedBidResponses": [ { "currency": "USD", @@ -105,21 +103,17 @@ "price": 0.5, "adm": "some-test-ad", "adid": "29681110", - "adomain": ["appnexus.com"], + "adomain": [ + "triplelift.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 + "triplelift": { + "format" : 11 } } }, diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-video.json b/adapters/triplelift/triplelifttest/exemplary/simple-video.json index b73a3f64bf6..b1e177685ea 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-video.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-video.json @@ -14,7 +14,8 @@ }, "ext": { "bidder": { - "placement_id": 10433394 + "inventoryCode" : "aaw", + "floor" : 0.10 } } } @@ -24,9 +25,11 @@ "httpCalls": [ { "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", "body": { "id": "test-request-id", + "tagid" : "aaw", + "bidfloor" : 0.10, "imp": [ { "id": "test-imp-id", @@ -39,8 +42,9 @@ "h": 560 }, "ext": { - "appnexus": { - "placement_id": 10433394 + "bidder": { + "inventoryCode": "aaw", + "floor" : 0.10 } } } @@ -61,7 +65,7 @@ "adid": "29681110", "adm": "some-test-ad", "adomain": ["appnexus.com"], - "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "iurl": "http://tlx.3lift.net/s2s/auction?supplier_id=19", "cid": "958", "crid": "29681110", "h": 250, @@ -121,4 +125,4 @@ ] } ] - } \ No newline at end of file + } diff --git a/openrtb_ext/imp_triplelift.go b/openrtb_ext/imp_triplelift.go index 796ab578d4b..77ac9afdaf7 100644 --- a/openrtb_ext/imp_triplelift.go +++ b/openrtb_ext/imp_triplelift.go @@ -2,6 +2,6 @@ package openrtb_ext // ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift type ExtImpTriplelift struct { - InvCode string `json:"inventoryCode"` + InvCode string `json:"inventoryCode"` Floor *float64 `json:"floor"` } From d63b2fd9b4f42804d889b700dcc50a5d1a0a0c6d Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 11 Jul 2019 16:55:46 -0400 Subject: [PATCH 57/72] more tests --- .../exemplary/simple-video.json | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-video.json b/adapters/triplelift/triplelifttest/exemplary/simple-video.json index b1e177685ea..0f036a3e43e 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-video.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-video.json @@ -28,10 +28,10 @@ "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", "body": { "id": "test-request-id", - "tagid" : "aaw", - "bidfloor" : 0.10, "imp": [ { + "tagid" : "aaw", + "bidfloor" : 0.10, "id": "test-imp-id", "video": { "mimes": ["video/mp4"], @@ -72,13 +72,8 @@ "w": 300, "cat": ["IAB9-1"], "ext": { - "appnexus": { - "brand_id": 9, - "brand_category_id": 9, - "auction_id": 8189378542222915032, - "bid_ad_type": 1, - "bidder_id": 2, - "ranking_price": 0.000000 + "triplelift": { + "format": 11 } } }] @@ -103,20 +98,15 @@ "adm": "some-test-ad", "adid": "29681110", "adomain": ["appnexus.com"], - "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "iurl": "http://tlx.3lift.net/s2s/auction?supplier_id=19", "cid": "958", "crid": "29681110", "w": 300, "h": 250, - "cat": ["IAB5-3"], + "cat": ["IAB9-1"], "ext": { - "appnexus": { - "brand_id": 9, - "brand_category_id": 9, - "auction_id": 8189378542222915032, - "bid_ad_type": 1, - "bidder_id": 2, - "ranking_price": 0.000000 + "triplelift": { + "format": 11 } } }, From 121efee54f05f07116faa203a95c1da6d65eee9f Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Thu, 11 Jul 2019 17:06:14 -0400 Subject: [PATCH 58/72] simplify --- adapters/triplelift/triplelift.go | 19 ++++++++----------- .../exemplary/simple-video.json | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 5cfbad31dc5..266478f87e5 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -23,12 +23,12 @@ type TripleliftRespExt struct { Triplelift TripleliftRespExtTriplelift `json:"triplelift_pb"` } -func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType, error) { +func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType) { t := ext.Triplelift.format if t == 11 { - return openrtb_ext.BidTypeVideo, nil + return openrtb_ext.BidTypeVideo } - return openrtb_ext.BidTypeBanner, nil + return openrtb_ext.BidTypeBanner } func processImp(imp *openrtb.Imp) error { @@ -120,14 +120,11 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern if err := json.Unmarshal(bid.Ext, &bidExt); err != nil { errs = append(errs, err) } else { - if bidType, err := getBidType(bidExt); err != nil { - errs = append(errs, err) - } else { - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: bidType, - }) - } + bidType := getBidType(bidExt) + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + }) } } } diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-video.json b/adapters/triplelift/triplelifttest/exemplary/simple-video.json index 0f036a3e43e..957dee1bab4 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-video.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-video.json @@ -64,7 +64,7 @@ "price": 0.500000, "adid": "29681110", "adm": "some-test-ad", - "adomain": ["appnexus.com"], + "adomain": ["foo.com"], "iurl": "http://tlx.3lift.net/s2s/auction?supplier_id=19", "cid": "958", "crid": "29681110", @@ -97,7 +97,7 @@ "price": 0.5, "adm": "some-test-ad", "adid": "29681110", - "adomain": ["appnexus.com"], + "adomain": ["foo.com"], "iurl": "http://tlx.3lift.net/s2s/auction?supplier_id=19", "cid": "958", "crid": "29681110", From 0212e676fb7a9d59cf1029e9198767e9bd2eeb74 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:03:50 -0400 Subject: [PATCH 59/72] more progress --- adapters/triplelift/triplelift.go | 6 +++--- .../triplelifttest/exemplary/simple-video.json | 12 ++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 266478f87e5..a42ab263aa2 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -15,12 +15,12 @@ type TripleliftAdapter struct { endpoint string } -type TripleliftRespExtTriplelift struct { - format int `json:"format"` +type TripleliftInnerExt struct { + Format int `json:"format"` } type TripleliftRespExt struct { - Triplelift TripleliftRespExtTriplelift `json:"triplelift_pb"` + Triplelift TripleliftInnerExt `json:"triplelift_pb"` } func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType) { diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-video.json b/adapters/triplelift/triplelifttest/exemplary/simple-video.json index 957dee1bab4..5cf4296a815 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-video.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-video.json @@ -71,11 +71,7 @@ "h": 250, "w": 300, "cat": ["IAB9-1"], - "ext": { - "triplelift": { - "format": 11 - } - } + "ext": {"triplelift_pb":{"format":11}} }] } ], @@ -104,10 +100,10 @@ "w": 300, "h": 250, "cat": ["IAB9-1"], - "ext": { - "triplelift": { + "ext": { + "triplelift_pb": { "format": 11 - } + } } }, "type": "video" From 04063ae6e88dcf3adaf8e16ad0ade160db209c5e Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:05:05 -0400 Subject: [PATCH 60/72] format --- adapters/triplelift/triplelift.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index a42ab263aa2..74fa5b3baf4 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -24,7 +24,7 @@ type TripleliftRespExt struct { } func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType) { - t := ext.Triplelift.format + t := ext.Triplelift.Format if t == 11 { return openrtb_ext.BidTypeVideo } From 3a357764aa895c9640ddb615c222c8ba75de4ca0 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:12:21 -0400 Subject: [PATCH 61/72] ws --- adapters/triplelift/triplelift.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 74fa5b3baf4..1fbabdf0311 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -23,7 +23,7 @@ type TripleliftRespExt struct { Triplelift TripleliftInnerExt `json:"triplelift_pb"` } -func getBidType(ext TripleliftRespExt) (openrtb_ext.BidType) { +func getBidType(ext TripleliftRespExt) openrtb_ext.BidType { t := ext.Triplelift.Format if t == 11 { return openrtb_ext.BidTypeVideo @@ -120,11 +120,11 @@ func (a *TripleliftAdapter) MakeBids(internalRequest *openrtb.BidRequest, extern if err := json.Unmarshal(bid.Ext, &bidExt); err != nil { errs = append(errs, err) } else { - bidType := getBidType(bidExt) - bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: bidType, - }) + bidType := getBidType(bidExt) + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + }) } } } From 4d474600829ebb0ba1405523b788f92c24e2916e Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:20:19 -0400 Subject: [PATCH 62/72] rm --- .../triplelifttest/amp/simple-banner.json | 140 -------------- .../triplelifttest/amp/simple-video.json | 131 ------------- .../exemplary/video-invalid-category.json | 122 ------------ .../supplemental/displaymanager-test.json | 150 -------------- .../supplemental/explicit-dimensions.json | 58 ------ .../supplemental/multi-bid.json | 183 ------------------ 6 files changed, 784 deletions(-) delete mode 100644 adapters/triplelift/triplelifttest/amp/simple-banner.json delete mode 100644 adapters/triplelift/triplelifttest/amp/simple-video.json delete mode 100644 adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json delete mode 100644 adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json delete mode 100644 adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json delete mode 100644 adapters/triplelift/triplelifttest/supplemental/multi-bid.json diff --git a/adapters/triplelift/triplelifttest/amp/simple-banner.json b/adapters/triplelift/triplelifttest/amp/simple-banner.json deleted file mode 100644 index 79df8d63913..00000000000 --- a/adapters/triplelift/triplelifttest/amp/simple-banner.json +++ /dev/null @@ -1,140 +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": 10433394 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", - "body": { - "ext": { - "triplelift": { - "is_amp": 1 - }, - "prebid": { - } - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "appnexus": { - "placement_id": 10433394 - } - } - } - ] - } - }, - "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 - } - } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "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 - } - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/triplelift/triplelifttest/amp/simple-video.json b/adapters/triplelift/triplelifttest/amp/simple-video.json deleted file mode 100644 index 5bf3ebb1752..00000000000 --- a/adapters/triplelift/triplelifttest/amp/simple-video.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "minduration": 15, - "maxduration": 30, - "protocols": [2, 3, 5, 6, 7, 8], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "placement_id": 10433394 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", - "body": { - "ext": { - "appnexus": { - "is_amp": 1 - }, - "prebid": { - } - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "minduration": 15, - "maxduration": 30, - "protocols": [2, 3, 5, 6, 7, 8], - "w": 940, - "h": 560 - }, - "ext": { - "appnexus": { - "placement_id": 10433394 - } - } - } - ] - } - }, - "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, - "cat": ["IAB9-1"], - "ext": { - "appnexus": { - "brand_id": 9, - "brand_category_id": 9, - "auction_id": 8189378542222915032, - "bid_ad_type": 1, - "bidder_id": 2, - "ranking_price": 0.000000 - } - } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "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": ["IAB5-3"], - "ext": { - "appnexus": { - "brand_id": 9, - "brand_category_id": 9, - "auction_id": 8189378542222915032, - "bid_ad_type": 1, - "bidder_id": 2, - "ranking_price": 0.000000 - } - } - }, - "type": "video" - } - ] - } - ] - } diff --git a/adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json b/adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json deleted file mode 100644 index 427dfde118f..00000000000 --- a/adapters/triplelift/triplelifttest/exemplary/video-invalid-category.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "minduration": 15, - "maxduration": 30, - "protocols": [2, 3, 5, 6, 7, 8], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "placement_id": 10433394 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": ["video/mp4"], - "minduration": 15, - "maxduration": 30, - "protocols": [2, 3, 5, 6, 7, 8], - "w": 940, - "h": 560 - }, - "ext": { - "appnexus": { - "placement_id": 10433394 - } - } - } - ] - } - }, - "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": 99, - "brand_category_id": 99, - "auction_id": 8189378542222915032, - "bid_ad_type": 1, - "bidder_id": 2, - "ranking_price": 0.000000 - } - } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "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, - "ext": { - "appnexus": { - "brand_id": 99, - "brand_category_id": 99, - "auction_id": 8189378542222915032, - "bid_ad_type": 1, - "bidder_id": 2, - "ranking_price": 0.000000 - } - } - }, - "type": "video" - } - ] - } - ] - } \ No newline at end of file diff --git a/adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json b/adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json deleted file mode 100644 index d4cfedf27a4..00000000000 --- a/adapters/triplelift/triplelifttest/supplemental/displaymanager-test.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "app": { - "ext": { - "prebid":{ - "source": "prebid-mobile", - "version": "1.0.0" - } - } - }, - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "placement_id": 10433394 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", - "body": { - "id": "test-request-id", - "app": { - "ext": { - "prebid":{ - "source": "prebid-mobile", - "version": "1.0.0" - } - } - }, - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 250 - }, - "displaymanagerver": "prebid-mobile-1.0.0", - "ext": { - "appnexus": { - "placement_id": 10433394 - } - } - } - ] - } - }, - "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 - } - } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "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 - } - } - }, - "type": "banner" - } - ] - } - ] - } \ No newline at end of file diff --git a/adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json b/adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json deleted file mode 100644 index 4bbeeab0d63..00000000000 --- a/adapters/triplelift/triplelifttest/supplemental/explicit-dimensions.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 100, - "h": 400 - }, - "ext": { - "bidder": { - "placementId": 10433394 - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 100, - "h": 400 - }, - "ext": { - "appnexus": { - "placement_id": 10433394 - } - } - } - ] - } - }, - "mockResponse": { - "status": 204 - } - } - ] -} diff --git a/adapters/triplelift/triplelifttest/supplemental/multi-bid.json b/adapters/triplelift/triplelifttest/supplemental/multi-bid.json deleted file mode 100644 index d77c6955ed4..00000000000 --- a/adapters/triplelift/triplelifttest/supplemental/multi-bid.json +++ /dev/null @@ -1,183 +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": 10433394 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ib.adnxs.com/openrtb2", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "appnexus": { - "placement_id": 10433394 - } - } - } - ] - } - }, - "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 - } - } - }, - { - "id": "7706636740145184842", - "impid": "test-imp-id", - "price": 0.400000, - "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 - } - } - }] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - - "expectedBidResponses": [ - { - "currency": "USD", - "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 - } - } - }, - "type": "banner" - }, - { - "bid": { - "id": "7706636740145184842", - "impid": "test-imp-id", - "price": 0.400000, - "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, - "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 - } - } - }, - "type": "banner" - } - ] - } - ] -} From b1219c38b087c18fc7e3d37d7522f2ab647cc824 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:24:59 -0400 Subject: [PATCH 63/72] don't need this --- .../triplelift/triplelifttest/params/race/banner.json | 10 ---------- .../triplelift/triplelifttest/params/race/video.json | 10 ---------- 2 files changed, 20 deletions(-) delete mode 100644 adapters/triplelift/triplelifttest/params/race/banner.json delete mode 100644 adapters/triplelift/triplelifttest/params/race/video.json diff --git a/adapters/triplelift/triplelifttest/params/race/banner.json b/adapters/triplelift/triplelifttest/params/race/banner.json deleted file mode 100644 index 2e2b39e9429..00000000000 --- a/adapters/triplelift/triplelifttest/params/race/banner.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "placement_id": 10433394, - "reserve": 20, - "position": "below", - "traffic_source_code": "trafficSource", - "keywords": [ - {"key": "foo", "value": ["bar","baz"]}, - {"key": "valueless"} - ] -} diff --git a/adapters/triplelift/triplelifttest/params/race/video.json b/adapters/triplelift/triplelifttest/params/race/video.json deleted file mode 100644 index 2e2b39e9429..00000000000 --- a/adapters/triplelift/triplelifttest/params/race/video.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "placement_id": 10433394, - "reserve": 20, - "position": "below", - "traffic_source_code": "trafficSource", - "keywords": [ - {"key": "foo", "value": ["bar","baz"]}, - {"key": "valueless"} - ] -} From da4664bbdef75cf42bc62fe2ce4c6f805a092186 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:41:46 -0400 Subject: [PATCH 64/72] fix test --- .../triplelift/triplelifttest/exemplary/simple-banner.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json index 6e7d6c621bb..5c3ec982672 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json @@ -78,8 +78,8 @@ "h": 250, "w": 300, "ext": { - "triplelift": { - "format" : 11 + "triplelift_pb": { + "format" : 2 } } } @@ -112,7 +112,7 @@ "w": 300, "h": 250, "ext": { - "triplelift": { + "triplelift_pb": { "format" : 11 } } From 8d64ae39111478c8d5fe037338fbc8917768fbcb Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 16 Jul 2019 17:43:23 -0400 Subject: [PATCH 65/72] fix test --- adapters/triplelift/triplelifttest/exemplary/simple-banner.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json index 5c3ec982672..e7f59a81582 100644 --- a/adapters/triplelift/triplelifttest/exemplary/simple-banner.json +++ b/adapters/triplelift/triplelifttest/exemplary/simple-banner.json @@ -113,7 +113,7 @@ "h": 250, "ext": { "triplelift_pb": { - "format" : 11 + "format" : 2 } } }, From 6e5024f45121066577decc3ba1188b4d0e513e82 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Wed, 17 Jul 2019 10:38:00 -0400 Subject: [PATCH 66/72] don't ignore swap --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1d0b59fb74e..c2cbc1e97d5 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,3 @@ inventory_url.yaml # autogenerated mac file .DS_Store - -# vim swp -*.swp From 88e42612f8ab1b377bf8f4016737281f7db3fe7d Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 23 Jul 2019 15:28:13 -0400 Subject: [PATCH 67/72] change line back --- openrtb_ext/bidders.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 5cb0fb4dbfd..3cd15ee624c 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -137,7 +137,7 @@ func NewBidderParamsValidator(schemaDirectory string) (BidderParamValidator, err for _, fileInfo := range fileInfos { bidderName := strings.TrimSuffix(fileInfo.Name(), ".json") if _, isValid := BidderMap[bidderName]; !isValid { - return nil, fmt.Errorf("File %s/%s does not match a valid BidderName.", schemaDirectory, bidderName) + return nil, fmt.Errorf("File %s/%s does not match a valid BidderName.", schemaDirectory, fileInfo.Name()) } toOpen, err := filepath.Abs(filepath.Join(schemaDirectory, fileInfo.Name())) if err != nil { From 7898b4e8c9e59a5d9c2da1d290b128d01b2e27ee Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 23 Jul 2019 15:39:08 -0400 Subject: [PATCH 68/72] report an error if there are no valid impressions for triplelift --- adapters/triplelift/triplelift.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 1fbabdf0311..9a9b607b72a 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -53,7 +53,7 @@ func processImp(imp *openrtb.Imp) error { } func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest, extra *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - errs := make([]error, 0, len(request.Imp)) + errs := make([]error, 0, len(request.Imp)+1) reqs := make([]*adapters.RequestData, 0, 1) // copy the request, because we are going to mutate it tlRequest := *request @@ -63,8 +63,15 @@ func (a *TripleliftAdapter) MakeRequests(request *openrtb.BidRequest, extra *ada for _, imp := range tlRequest.Imp { if err := processImp(&imp); err == nil { validImps = append(validImps, imp) + } else { + errs = append(errs, err) } } + if len(validImps) == 0 { + err := fmt.Errorf("No valid impressions for triplelift") + errs = append(errs, err) + return nil, errs + } tlRequest.Imp = validImps reqJSON, err := json.Marshal(tlRequest) if err != nil { From f83bdab5396bb5bf90a9de5640b829b8eb15eccb Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Tue, 23 Jul 2019 15:45:50 -0400 Subject: [PATCH 69/72] check for either a Banner or Video object on the impression --- adapters/triplelift/triplelift.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adapters/triplelift/triplelift.go b/adapters/triplelift/triplelift.go index 9a9b607b72a..b33ef8d0112 100644 --- a/adapters/triplelift/triplelift.go +++ b/adapters/triplelift/triplelift.go @@ -41,6 +41,9 @@ func processImp(imp *openrtb.Imp) error { if err := json.Unmarshal(ext.Bidder, &tlext); err != nil { return err } + if imp.Banner == nil && imp.Video == nil { + return fmt.Errorf("neither Banner nor Video object specified") + } imp.TagID = tlext.InvCode // floor is optional if tlext.Floor == nil { From 45f67494ae2510764affc1a389ab99a0d8685623 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 2 Aug 2019 18:24:11 -0400 Subject: [PATCH 70/72] more tests --- .../supplemental/badlyformed.json | 18 +++++++++++++ .../triplelifttest/supplemental/nofloor.json | 26 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 adapters/triplelift/triplelifttest/supplemental/badlyformed.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/nofloor.json diff --git a/adapters/triplelift/triplelifttest/supplemental/badlyformed.json b/adapters/triplelift/triplelifttest/supplemental/badlyformed.json new file mode 100644 index 00000000000..31d246bdeb7 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/badlyformed.json @@ -0,0 +1,18 @@ +{ + "expectedMakeRequestsErrors" : ["neither Banner nor Video object specified","No valid impressions for triplelift"], + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + }, + "httpCalls": [ + ] +} diff --git a/adapters/triplelift/triplelifttest/supplemental/nofloor.json b/adapters/triplelift/triplelifttest/supplemental/nofloor.json new file mode 100644 index 00000000000..df6a9b88be5 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/nofloor.json @@ -0,0 +1,26 @@ +{ + "expectedMakeRequestsErrors" : ["json: cannot unmarshal string into Go value of type adapters.ExtImpBidder","No valid impressions for triplelift"], + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": "aaa" + } + ] + }, + "httpCalls": [ + ] +} From 7feeb75ed7ed81234cafd5adecdacd6cf318f991 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 2 Aug 2019 18:24:32 -0400 Subject: [PATCH 71/72] mv --- .../triplelifttest/supplemental/{nofloor.json => badext.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename adapters/triplelift/triplelifttest/supplemental/{nofloor.json => badext.json} (100%) diff --git a/adapters/triplelift/triplelifttest/supplemental/nofloor.json b/adapters/triplelift/triplelifttest/supplemental/badext.json similarity index 100% rename from adapters/triplelift/triplelifttest/supplemental/nofloor.json rename to adapters/triplelift/triplelifttest/supplemental/badext.json From f21041d3f81f3c1caa3d730faefcd76383bcaf49 Mon Sep 17 00:00:00 2001 From: Kevin Kerr Date: Fri, 2 Aug 2019 18:43:02 -0400 Subject: [PATCH 72/72] more tests --- .../supplemental/badextbidder.json | 28 ++++++ .../supplemental/badresponseext.json | 99 +++++++++++++++++++ .../supplemental/badstatuscode.json | 98 ++++++++++++++++++ .../supplemental/notgoodstatuscode.json | 98 ++++++++++++++++++ 4 files changed, 323 insertions(+) create mode 100644 adapters/triplelift/triplelifttest/supplemental/badextbidder.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/badresponseext.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/badstatuscode.json create mode 100644 adapters/triplelift/triplelifttest/supplemental/notgoodstatuscode.json diff --git a/adapters/triplelift/triplelifttest/supplemental/badextbidder.json b/adapters/triplelift/triplelifttest/supplemental/badextbidder.json new file mode 100644 index 00000000000..90651e4d8d2 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/badextbidder.json @@ -0,0 +1,28 @@ +{ + "expectedMakeRequestsErrors" : ["json: cannot unmarshal string into Go value of type openrtb_ext.ExtImpTriplelift","No valid impressions for triplelift"], + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": "aaa" + } + } + ] + }, + "httpCalls":[], + "expectedBidResponses": [] +} diff --git a/adapters/triplelift/triplelifttest/supplemental/badresponseext.json b/adapters/triplelift/triplelifttest/supplemental/badresponseext.json new file mode 100644 index 00000000000..9c819add4ad --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/badresponseext.json @@ -0,0 +1,99 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "tagid" : "aa", + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": "aaa" + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + ] + } + ], + "expectedMakeBidsErrors": ["json: cannot unmarshal string into Go value of type triplelift.TripleliftRespExt"] +} diff --git a/adapters/triplelift/triplelifttest/supplemental/badstatuscode.json b/adapters/triplelift/triplelifttest/supplemental/badstatuscode.json new file mode 100644 index 00000000000..18094a42758 --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/badstatuscode.json @@ -0,0 +1,98 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "tagid" : "aa", + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "triplelift_pb": { + "format" : 2 + } + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + ], + "expectedMakeBidsErrors": ["Unexpected status code: 400. Run with request.debug = 1 for more info"] +} diff --git a/adapters/triplelift/triplelifttest/supplemental/notgoodstatuscode.json b/adapters/triplelift/triplelifttest/supplemental/notgoodstatuscode.json new file mode 100644 index 00000000000..6332493c70a --- /dev/null +++ b/adapters/triplelift/triplelifttest/supplemental/notgoodstatuscode.json @@ -0,0 +1,98 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://tlx.3lift.net/s2s/auction?supplier_id=19", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "tagid" : "aa", + "ext": { + "bidder": { + "inventoryCode": "aa" + } + } + } + ] + } + }, + "mockResponse": { + "status": 302, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "triplelift.com" + ], + "iurl": "http://nym1-ib.adnxs.com/cr?id=29681110", + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "triplelift_pb": { + "format" : 2 + } + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + ], + "expectedMakeBidsErrors": ["Unexpected status code: 302. Run with request.debug = 1 for more info"] +}