From 6fd65356790cfb08093ea6cf2a2cafbc61055ed1 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 12:14:15 +0300 Subject: [PATCH 01/17] bidder info --- static/bidder-info/krushmedia.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 static/bidder-info/krushmedia.yaml diff --git a/static/bidder-info/krushmedia.yaml b/static/bidder-info/krushmedia.yaml new file mode 100644 index 00000000000..342e11df2c7 --- /dev/null +++ b/static/bidder-info/krushmedia.yaml @@ -0,0 +1,13 @@ +maintainer: + email: "adapter@krushmedia.com" +capabilities: + app: + mediaTypes: + - banner + - video + - native + site: + mediaTypes: + - banner + - video + - native \ No newline at end of file From ef117631e4d0fd241d910accb26f66d758a19eed Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 14:24:57 +0300 Subject: [PATCH 02/17] initial --- adapters/krushmedia/krushmedia.go | 208 ++++++++++++++++++ adapters/krushmedia/krushmedia_test.go | 11 + .../krushmediatest/exemplary/banner-app.json | 157 +++++++++++++ .../krushmediatest/exemplary/banner-web.json | 149 +++++++++++++ .../krushmediatest/exemplary/native-app.json | 160 ++++++++++++++ .../krushmediatest/exemplary/native-web.json | 144 ++++++++++++ .../krushmediatest/exemplary/video-app.json | 170 ++++++++++++++ .../krushmediatest/exemplary/video-web.json | 161 ++++++++++++++ .../krushmediatest/params/race/banner.json | 3 + .../krushmediatest/params/race/native.json | 3 + .../krushmediatest/params/race/video.json | 3 + .../supplemental/invalid-ext-object.json | 29 +++ .../supplemental/invalid-response.json | 116 ++++++++++ .../supplemental/requires-imp-object.json | 16 ++ .../supplemental/status-code-bad-request.json | 91 ++++++++ .../supplemental/status-code-no-content.json | 78 +++++++ .../supplemental/status-code-other-error.json | 78 +++++++ .../status-code-service-unavailable.json | 78 +++++++ adapters/krushmedia/params_test.go | 50 +++++ adapters/krushmedia/usersync.go | 12 + adapters/krushmedia/usersync_test.go | 34 +++ exchange/adapter_map.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_krushmedia.go | 6 + static/bidder-params/krushmedia.json | 13 ++ usersync/usersyncers/syncer.go | 2 + 26 files changed, 1776 insertions(+) create mode 100644 adapters/krushmedia/krushmedia.go create mode 100644 adapters/krushmedia/krushmedia_test.go create mode 100644 adapters/krushmedia/krushmediatest/exemplary/banner-app.json create mode 100644 adapters/krushmedia/krushmediatest/exemplary/banner-web.json create mode 100644 adapters/krushmedia/krushmediatest/exemplary/native-app.json create mode 100644 adapters/krushmedia/krushmediatest/exemplary/native-web.json create mode 100644 adapters/krushmedia/krushmediatest/exemplary/video-app.json create mode 100644 adapters/krushmedia/krushmediatest/exemplary/video-web.json create mode 100644 adapters/krushmedia/krushmediatest/params/race/banner.json create mode 100644 adapters/krushmedia/krushmediatest/params/race/native.json create mode 100644 adapters/krushmedia/krushmediatest/params/race/video.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/invalid-ext-object.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/invalid-response.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/requires-imp-object.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json create mode 100644 adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json create mode 100644 adapters/krushmedia/params_test.go create mode 100644 adapters/krushmedia/usersync.go create mode 100644 adapters/krushmedia/usersync_test.go create mode 100644 openrtb_ext/imp_krushmedia.go create mode 100644 static/bidder-params/krushmedia.json diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go new file mode 100644 index 00000000000..ee7606f15aa --- /dev/null +++ b/adapters/krushmedia/krushmedia.go @@ -0,0 +1,208 @@ +package krushmedia + +import ( + "encoding/json" + "fmt" + "net/http" + "strconv" + "text/template" + + "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/macros" + "github.com/prebid/prebid-server/openrtb_ext" +) + +type KrushmediaAdapter struct { + endpoint template.Template +} + +func NewKrushmediaBidder(endpointTemplate string) *KrushmediaAdapter { + template, err := template.New("endpointTemplate").Parse(endpointTemplate) + if err != nil { + return nil + } + return &KrushmediaAdapter{endpoint: *template} +} + +func (a *KrushmediaAdapter) CheckHasImps(request *openrtb.BidRequest) error { + if len(request.Imp) == 0 { + err := &errortypes.BadInput{ + Message: "Missing Imp Object", + } + return err + } + return nil +} + +func GetHeaders(request *openrtb.BidRequest) *http.Header { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("X-Openrtb-Version", "2.5") + + if request.Device != nil { + if len(request.Device.UA) > 0 { + headers.Add("User-Agent", request.Device.UA) + } + + if len(request.Device.IP) > 0 { + headers.Add("X-Forwarded-For", request.Device.IP) + } + + if len(request.Device.Language) > 0 { + headers.Add("Accept-Language", request.Device.Language) + } + + if request.Device.DNT != nil { + headers.Add("Dnt", strconv.Itoa(int(*request.Device.DNT))) + } + } + + return &headers +} + +func (a *KrushmediaAdapter) MakeRequests( + openRTBRequest *openrtb.BidRequest, + reqInfo *adapters.ExtraRequestInfo, +) ( + requestsToBidder []*adapters.RequestData, + errs []error, +) { + + request := *openRTBRequest + + if noImps := a.CheckHasImps(&request); noImps != nil { + return nil, []error{noImps} + } + + var errors []error + var krushmediaExt *openrtb_ext.ExtKrushmedia + var err error + + for i, imp := range request.Imp { + krushmediaExt, err = a.getImpressionExt(&imp) + if err != nil { + errors = append(errors, err) + break + } + request.Imp[i].Ext = nil + } + + if len(errors) > 0 { + return nil, errors + } + + url, err := a.buildEndpointURL(krushmediaExt) + if err != nil { + return nil, []error{err} + } + + reqJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + return []*adapters.RequestData{{ + Method: http.MethodPost, + Body: reqJSON, + Uri: url, + Headers: *GetHeaders(&request), + }}, nil +} + +func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtKrushmedia, error) { + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return nil, &errortypes.BadInput{ + Message: "ext.bidder not provided", + } + } + var krushmediaExt openrtb_ext.ExtKrushmedia + if err := json.Unmarshal(bidderExt.Bidder, &krushmediaExt); err != nil { + return nil, &errortypes.BadInput{ + Message: "ext.bidder not provided", + } + } + return &krushmediaExt, nil +} + +func (a *KrushmediaAdapter) buildEndpointURL(params *openrtb_ext.ExtKrushmedia) (string, error) { + endpointParams := macros.EndpointTemplateParams{Key: params.Key} + return macros.ResolveMacros(a.endpoint, endpointParams) +} + +func (a *KrushmediaAdapter) CheckResponseStatusCodes(response *adapters.ResponseData) error { + if response.StatusCode == http.StatusNoContent { + return &errortypes.BadInput{Message: "No bid response"} + } + + if response.StatusCode == http.StatusBadRequest { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Unexpected status code: [ %d ]", response.StatusCode), + } + } + + if response.StatusCode == http.StatusServiceUnavailable { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Something went wrong, please contact your Account Manager. Status Code: [ %d ] ", response.StatusCode), + } + } + + if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices { + return &errortypes.BadInput{ + Message: fmt.Sprintf("Something went wrong, please contact your Account Manager. Status Code: [ %d ] ", response.StatusCode), + } + } + + return nil +} + +func (a *KrushmediaAdapter) MakeBids( + openRTBRequest *openrtb.BidRequest, + requestToBidder *adapters.RequestData, + bidderRawResponse *adapters.ResponseData, +) ( + bidderResponse *adapters.BidderResponse, + errs []error, +) { + httpStatusError := a.CheckResponseStatusCodes(bidderRawResponse) + if httpStatusError != nil { + return nil, []error{httpStatusError} + } + + responseBody := bidderRawResponse.Body + var bidResp openrtb.BidResponse + if err := json.Unmarshal(responseBody, &bidResp); err != nil { + return nil, []error{&errortypes.BadServerResponse{ + Message: "Bad Server Response", + }} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResp.SeatBid[0].Bid)) + sb := bidResp.SeatBid[0] + + for _, bid := range sb.Bid { + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: getMediaTypeForImp(bid.ImpID, openRTBRequest.Imp), + }) + } + return bidResponse, nil +} + +func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType { + mediaType := openrtb_ext.BidTypeBanner + for _, imp := range imps { + if imp.ID == impId { + if imp.Video != nil { + mediaType = openrtb_ext.BidTypeVideo + } else if imp.Native != nil { + mediaType = openrtb_ext.BidTypeNative + } + return mediaType + } + } + return mediaType +} diff --git a/adapters/krushmedia/krushmedia_test.go b/adapters/krushmedia/krushmedia_test.go new file mode 100644 index 00000000000..d72abe1017b --- /dev/null +++ b/adapters/krushmedia/krushmedia_test.go @@ -0,0 +1,11 @@ +package krushmedia + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" +) + +func TestJsonSamples(t *testing.T) { + adapterstest.RunJSONBidderTest(t, "krushmediatest", NewKrushmediaBidder("http://ads4.krushmedia.com/?c=rtb&m=req&key={{.Key}}")) +} diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json new file mode 100644 index 00000000000..da7a72eee49 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json @@ -0,0 +1,157 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "host": "example.com", + "sourceid": "partner", + "accountid": "hash" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w":320, + "h":50 + }, + "tagid": "ogTAGID" + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w":320, + "h":50 + } + ], + "type": "banner", + "seat": "krushmedia" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "krushmedia": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBids": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w":320, + "h":50 + } + ] + } + \ No newline at end of file diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-web.json b/adapters/krushmedia/krushmediatest/exemplary/banner-web.json new file mode 100644 index 00000000000..9a7fe10ab3c --- /dev/null +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-web.json @@ -0,0 +1,149 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + + "banner": { + "w":320, + "h":50 + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50 + } + ], + "type": "banner", + "seat": "krushmedia" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "krushmedia": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/exemplary/native-app.json b/adapters/krushmedia/krushmediatest/exemplary/native-app.json new file mode 100644 index 00000000000..bcf492e1013 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/exemplary/native-app.json @@ -0,0 +1,160 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "host": "example.com", + "sourceid": "partner", + "accountid": "hash" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "tagid": "ogTAGID" + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20" + } + ], + "type": "native", + "seat": "krushmedia" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "krushmedia": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "asesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ] + }, + "type": "native" + } + ] + } + ] + } + \ No newline at end of file diff --git a/adapters/krushmedia/krushmediatest/exemplary/native-web.json b/adapters/krushmedia/krushmediatest/exemplary/native-web.json new file mode 100644 index 00000000000..80a421b9d37 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/exemplary/native-web.json @@ -0,0 +1,144 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20" + } + ], + "seat": "krushmedia" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "krushmedia": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "asesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ] + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/exemplary/video-app.json b/adapters/krushmedia/krushmediatest/exemplary/video-app.json new file mode 100644 index 00000000000..efe75a9b85f --- /dev/null +++ b/adapters/krushmedia/krushmediatest/exemplary/video-app.json @@ -0,0 +1,170 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + }, + "tagid": "ogTAGID" + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720 + } + ], + "seat": "krushmedia" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "krushmedia": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "asesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 1280, + "h": 720 + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/exemplary/video-web.json b/adapters/krushmedia/krushmediatest/exemplary/video-web.json new file mode 100644 index 00000000000..5975a616e1a --- /dev/null +++ b/adapters/krushmedia/krushmediatest/exemplary/video-web.json @@ -0,0 +1,161 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "krushmedia" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "krushmedia": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBids": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "1", + "price": 3.5, + "adm": "asesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "prebid": { + "type": "video" + } + } + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/params/race/banner.json b/adapters/krushmedia/krushmediatest/params/race/banner.json new file mode 100644 index 00000000000..8f4ee2f5025 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/params/race/banner.json @@ -0,0 +1,3 @@ +{ + "key": "2" +} \ No newline at end of file diff --git a/adapters/krushmedia/krushmediatest/params/race/native.json b/adapters/krushmedia/krushmediatest/params/race/native.json new file mode 100644 index 00000000000..3c55c54e6bc --- /dev/null +++ b/adapters/krushmedia/krushmediatest/params/race/native.json @@ -0,0 +1,3 @@ +{ + "key": "2" +} diff --git a/adapters/krushmedia/krushmediatest/params/race/video.json b/adapters/krushmedia/krushmediatest/params/race/video.json new file mode 100644 index 00000000000..3c55c54e6bc --- /dev/null +++ b/adapters/krushmedia/krushmediatest/params/race/video.json @@ -0,0 +1,3 @@ +{ + "key": "2" +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/invalid-ext-object.json b/adapters/krushmedia/krushmediatest/supplemental/invalid-ext-object.json new file mode 100644 index 00000000000..360d94c2fe6 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/invalid-ext-object.json @@ -0,0 +1,29 @@ +{ + "expectedMakeRequestsErrors": [ + { + "value": "ext.bidder not provided", + "comparison": "literal" + } + ], + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "some-impression-id", + "tagid": "my-adcode", + "video": { + "mimes": ["video/mp4"], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": "" + } + ], + "site": { + "page": "test.com" + } + }, + "httpCalls": [] +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json b/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json new file mode 100644 index 00000000000..e8dac65af26 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json @@ -0,0 +1,116 @@ + +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + + "httpCalls": [{ + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Openrtb-Version": [ + "2.5" + ], + "User-Agent": [ + "test-user-agent" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ], + "Accept-Language": [ + "en" + ], + "Dnt": [ + "0" + ] + }, + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w":320, + "h":50 + } + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": "invalid response" + } + }], + "expectedMakeBidsErrors": [ + { + "value": "Bad Server Response", + "comparison": "literal" + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/requires-imp-object.json b/adapters/krushmedia/krushmediatest/supplemental/requires-imp-object.json new file mode 100644 index 00000000000..1fcf1b48c5a --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/requires-imp-object.json @@ -0,0 +1,16 @@ +{ + "expectedMakeRequestsErrors": [ + { + "value": "Missing Imp Object", + "comparison": "literal" + } + ], + "mockBidRequest": { + "id": "test-request-id", + "imp": [], + "site": { + "page": "test.com" + } + }, + "httpCalls": [] +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json new file mode 100644 index 00000000000..26fe9ac498a --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json @@ -0,0 +1,91 @@ + +{ + "mockBidRequest": { + "id": "some-request-id", + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + } + } + ], + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789" + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 400 + } + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: [ 400 ]", + "comparison": "literal" + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json new file mode 100644 index 00000000000..ff59c8e6ce2 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json @@ -0,0 +1,78 @@ + +{ + "mockBidRequest": { + "id": "some-request-id", + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": ["video/mp4"], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 204 + } + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "No bid response", + "comparison": "literal" + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json new file mode 100644 index 00000000000..fc885299cf0 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json @@ -0,0 +1,78 @@ + +{ + "mockBidRequest": { + "id": "some-request-id", + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": ["video/mp4"], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 306 + } + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Something went wrong, please contact your Account Manager. Status Code: [ 306 ] ", + "comparison": "literal" + } + ] +} diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json new file mode 100644 index 00000000000..87d327eab39 --- /dev/null +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json @@ -0,0 +1,78 @@ + +{ + "mockBidRequest": { + "id": "some-request-id", + "tmax": 1000, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": ["video/mp4"], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "key": 2 + } + } + } + ] + }, + + "httpCalls": [{ + "expectedRequest": { + "uri": "http://example.com/?c=rtb&m=req&key=2", + "body": { + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "0000-000-000-0000" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 503 + } + }], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Something went wrong, please contact your Account Manager. Status Code: [ 503 ] ", + "comparison": "literal" + } + ] +} diff --git a/adapters/krushmedia/params_test.go b/adapters/krushmedia/params_test.go new file mode 100644 index 00000000000..ddb0e613dbc --- /dev/null +++ b/adapters/krushmedia/params_test.go @@ -0,0 +1,50 @@ +package krushmedia + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +var validParams = []string{ + `{ "key": 2 }`, +} + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderKrushmedia, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Krushmedia params: %s", validParam) + } + } +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{ "key": "2" }`, + `{ "anyparam": "anyvalue" }`, +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderKrushmedia, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} diff --git a/adapters/krushmedia/usersync.go b/adapters/krushmedia/usersync.go new file mode 100644 index 00000000000..5dc1471fb9f --- /dev/null +++ b/adapters/krushmedia/usersync.go @@ -0,0 +1,12 @@ +package krushmedia + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewKrushmediaSyncer(temp *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("krushmedia", 0, temp, adapters.SyncTypeRedirect) +} diff --git a/adapters/krushmedia/usersync_test.go b/adapters/krushmedia/usersync_test.go new file mode 100644 index 00000000000..d304cce8d6b --- /dev/null +++ b/adapters/krushmedia/usersync_test.go @@ -0,0 +1,34 @@ +package krushmedia + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestKrushmediaSyncer(t *testing.T) { + syncURL := "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dkrushmedia%26uid%3D%5BUID%5D" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + syncer := NewKrushmediaSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "0", + Consent: "allGdpr", + }, + CCPA: ccpa.Policy{ + Value: "1-YY", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr=0&gdpr_consent=allGdpr&us_privacy=1-YY&redir=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dkrushmedia%26uid%3D%5BUID%5D", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 0, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/exchange/adapter_map.go b/exchange/adapter_map.go index d428168921a..dd0b2a750ad 100755 --- a/exchange/adapter_map.go +++ b/exchange/adapter_map.go @@ -48,6 +48,7 @@ import ( "github.com/prebid/prebid-server/adapters/inmobi" "github.com/prebid/prebid-server/adapters/ix" "github.com/prebid/prebid-server/adapters/kidoz" + "github.com/prebid/prebid-server/adapters/krushmedia" "github.com/prebid/prebid-server/adapters/kubient" "github.com/prebid/prebid-server/adapters/lifestreet" "github.com/prebid/prebid-server/adapters/lockerdome" @@ -139,6 +140,7 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter openrtb_ext.BidderInMobi: inmobi.NewInMobiAdapter(cfg.Adapters[string(openrtb_ext.BidderInMobi)].Endpoint), openrtb_ext.BidderKidoz: kidoz.NewKidozBidder(cfg.Adapters[string(openrtb_ext.BidderKidoz)].Endpoint), openrtb_ext.BidderKubient: kubient.NewKubientBidder(cfg.Adapters[string(openrtb_ext.BidderKubient)].Endpoint), + openrtb_ext.BidderKrushmedia: krushmedia.NewKrushmediaBidder(cfg.Adapters[string(openrtb_ext.BidderKrushmedia)].Endpoint), openrtb_ext.BidderLockerDome: lockerdome.NewLockerDomeBidder(cfg.Adapters[string(openrtb_ext.BidderLockerDome)].Endpoint), openrtb_ext.BidderLunaMedia: lunamedia.NewLunaMediaBidder(cfg.Adapters[string(openrtb_ext.BidderLunaMedia)].Endpoint), openrtb_ext.BidderLogicad: logicad.NewLogicadBidder(cfg.Adapters[string(openrtb_ext.BidderLogicad)].Endpoint), diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index dcfd663ebc7..dd4016b74c0 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -66,6 +66,7 @@ const ( BidderImprovedigital BidderName = "improvedigital" BidderInMobi BidderName = "inmobi" BidderIx BidderName = "ix" + BidderKrushmedia BidderName = "krushmedia" BidderKidoz BidderName = "kidoz" BidderKubient BidderName = "kubient" BidderLifestreet BidderName = "lifestreet" @@ -152,6 +153,7 @@ var BidderMap = map[string]BidderName{ "improvedigital": BidderImprovedigital, "inmobi": BidderInMobi, "ix": BidderIx, + "krushmedia": BidderKrushmedia, "kidoz": BidderKidoz, "kubient": BidderKubient, "lifestreet": BidderLifestreet, diff --git a/openrtb_ext/imp_krushmedia.go b/openrtb_ext/imp_krushmedia.go new file mode 100644 index 00000000000..8743c286f9e --- /dev/null +++ b/openrtb_ext/imp_krushmedia.go @@ -0,0 +1,6 @@ +package openrtb_ext + +// ExtKrushmedia defines imp[0].ext object structure +type ExtKrushmedia struct { + Key string `json:"key"` +} diff --git a/static/bidder-params/krushmedia.json b/static/bidder-params/krushmedia.json new file mode 100644 index 00000000000..2bbd9f02349 --- /dev/null +++ b/static/bidder-params/krushmedia.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Krushmedia Adapter Params", + "description": "A schema which validates params accepted by the Krushmedia adapter", + "type": "object", + "properties": { + "key": { + "type": "integer", + "description": "ssp key" + } + }, + "required": ["key"] + } \ No newline at end of file diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index c6ae984efc9..2146a214b77 100755 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -38,6 +38,7 @@ import ( "github.com/prebid/prebid-server/adapters/gumgum" "github.com/prebid/prebid-server/adapters/improvedigital" "github.com/prebid/prebid-server/adapters/ix" + "github.com/prebid/prebid-server/adapters/krushmedia" "github.com/prebid/prebid-server/adapters/lifestreet" "github.com/prebid/prebid-server/adapters/lockerdome" "github.com/prebid/prebid-server/adapters/logicad" @@ -116,6 +117,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderGumGum, gumgum.NewGumGumSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderImprovedigital, improvedigital.NewImprovedigitalSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderIx, ix.NewIxSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderKrushmedia, krushmedia.NewKrushmediaSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLifestreet, lifestreet.NewLifestreetSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLockerDome, lockerdome.NewLockerDomeSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderLogicad, logicad.NewLogicadSyncer) From 3096ca49df51253af13d8d1d0f6ed542251251e2 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 14:34:20 +0300 Subject: [PATCH 03/17] initial --- adapters/krushmedia/krushmedia.go | 2 +- adapters/krushmedia/krushmedia_test.go | 2 +- openrtb_ext/imp_krushmedia.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index ee7606f15aa..b67c14be51d 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -129,7 +129,7 @@ func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.Ext } func (a *KrushmediaAdapter) buildEndpointURL(params *openrtb_ext.ExtKrushmedia) (string, error) { - endpointParams := macros.EndpointTemplateParams{Key: params.Key} + endpointParams := macros.EndpointTemplateParams{AccountID: params.AccountID} return macros.ResolveMacros(a.endpoint, endpointParams) } diff --git a/adapters/krushmedia/krushmedia_test.go b/adapters/krushmedia/krushmedia_test.go index d72abe1017b..f59962e433b 100644 --- a/adapters/krushmedia/krushmedia_test.go +++ b/adapters/krushmedia/krushmedia_test.go @@ -7,5 +7,5 @@ import ( ) func TestJsonSamples(t *testing.T) { - adapterstest.RunJSONBidderTest(t, "krushmediatest", NewKrushmediaBidder("http://ads4.krushmedia.com/?c=rtb&m=req&key={{.Key}}")) + adapterstest.RunJSONBidderTest(t, "krushmediatest", NewKrushmediaBidder("http://ads4.krushmedia.com/?c=rtb&m=req&key={{.AccountID}}")) } diff --git a/openrtb_ext/imp_krushmedia.go b/openrtb_ext/imp_krushmedia.go index 8743c286f9e..a175c227fda 100644 --- a/openrtb_ext/imp_krushmedia.go +++ b/openrtb_ext/imp_krushmedia.go @@ -2,5 +2,5 @@ package openrtb_ext // ExtKrushmedia defines imp[0].ext object structure type ExtKrushmedia struct { - Key string `json:"key"` + AccountID string `json:"key"` } From 28ca14bbf4da130c7729e1156d3ad1a2598d34f9 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 14:51:34 +0300 Subject: [PATCH 04/17] initial --- adapters/krushmedia/usersync_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/krushmedia/usersync_test.go b/adapters/krushmedia/usersync_test.go index d304cce8d6b..b58f2f1bc4e 100644 --- a/adapters/krushmedia/usersync_test.go +++ b/adapters/krushmedia/usersync_test.go @@ -22,7 +22,7 @@ func TestKrushmediaSyncer(t *testing.T) { Consent: "allGdpr", }, CCPA: ccpa.Policy{ - Value: "1-YY", + Consent: "1-YY", }, }) From fa58583111d08c44dbacfcb4a6a702cb31e79365 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 14:54:17 +0300 Subject: [PATCH 05/17] initial --- usersync/usersyncers/syncer_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index bd250489fdd..ce1b3516009 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -47,6 +47,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderGumGum): syncConfig, string(openrtb_ext.BidderImprovedigital): syncConfig, string(openrtb_ext.BidderIx): syncConfig, + string(openrtb_ext.BidderKrushmedia): syncConfig, string(openrtb_ext.BidderLifestreet): syncConfig, string(openrtb_ext.BidderLockerDome): syncConfig, string(openrtb_ext.BidderLogicad): syncConfig, From 4583ccb0ea25f831ea1fdf1713d64dc17ed6acee Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:02:02 +0300 Subject: [PATCH 06/17] initial --- adapters/krushmedia/krushmedia_test.go | 2 +- .../krushmedia/krushmediatest/exemplary/banner-app.json | 3 +-- .../krushmedia/krushmediatest/exemplary/native-app.json | 3 +-- adapters/krushmedia/usersync_test.go | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/adapters/krushmedia/krushmedia_test.go b/adapters/krushmedia/krushmedia_test.go index f59962e433b..216fb50e17a 100644 --- a/adapters/krushmedia/krushmedia_test.go +++ b/adapters/krushmedia/krushmedia_test.go @@ -7,5 +7,5 @@ import ( ) func TestJsonSamples(t *testing.T) { - adapterstest.RunJSONBidderTest(t, "krushmediatest", NewKrushmediaBidder("http://ads4.krushmedia.com/?c=rtb&m=req&key={{.AccountID}}")) + adapterstest.RunJSONBidderTest(t, "krushmediatest", NewKrushmediaBidder("http://example.com/?c=rtb&m=req&key=2")) } diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json index da7a72eee49..a34d97d5f9a 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json @@ -82,8 +82,7 @@ "banner": { "w":320, "h":50 - }, - "tagid": "ogTAGID" + } } ], "app": { diff --git a/adapters/krushmedia/krushmediatest/exemplary/native-app.json b/adapters/krushmedia/krushmediatest/exemplary/native-app.json index bcf492e1013..b167ceaab21 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/native-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/native-app.json @@ -82,8 +82,7 @@ "native": { "ver":"1.1", "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" - }, - "tagid": "ogTAGID" + } } ], "app": { diff --git a/adapters/krushmedia/usersync_test.go b/adapters/krushmedia/usersync_test.go index b58f2f1bc4e..d8475e3631f 100644 --- a/adapters/krushmedia/usersync_test.go +++ b/adapters/krushmedia/usersync_test.go @@ -18,11 +18,11 @@ func TestKrushmediaSyncer(t *testing.T) { syncer := NewKrushmediaSyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "0", - Consent: "allGdpr", + Signal: "A", + Consent: "B", }, CCPA: ccpa.Policy{ - Consent: "1-YY", + Consent: "C", }, }) From 77105a04b74f7f6ef87d8c788796f620ae3a707f Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:06:09 +0300 Subject: [PATCH 07/17] initial --- config/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config.go b/config/config.go index 53daf117fdf..c1894ad7879 100755 --- a/config/config.go +++ b/config/config.go @@ -928,6 +928,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.improvedigital.endpoint", "http://ad.360yield.com/pbs") v.SetDefault("adapters.inmobi.endpoint", "https://api.w.inmobi.com/showad/openrtb/bidder/prebid") v.SetDefault("adapters.ix.endpoint", "http://appnexus-us-east.lb.indexww.com/transbidder?p=184932") + v.SetDefault("adapters.krushmedia.endpoint", "http://ads4.krushmedia.com/?c=rtb&m=req&key={{.AccountID}}") v.SetDefault("adapters.kidoz.endpoint", "http://prebid-adapter.kidoz.net/openrtb2/auction?src=prebid-server") v.SetDefault("adapters.kubient.endpoint", "https://kssp.kbntx.ch/prebid") v.SetDefault("adapters.lifestreet.endpoint", "https://prebid.s2s.lfstmedia.com/adrequest") From 40b54b1f472ac42dbea4bde63f2eb15db20575a6 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:09:18 +0300 Subject: [PATCH 08/17] initial --- adapters/krushmedia/usersync_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/krushmedia/usersync_test.go b/adapters/krushmedia/usersync_test.go index d8475e3631f..b58f2f1bc4e 100644 --- a/adapters/krushmedia/usersync_test.go +++ b/adapters/krushmedia/usersync_test.go @@ -18,11 +18,11 @@ func TestKrushmediaSyncer(t *testing.T) { syncer := NewKrushmediaSyncer(syncURLTemplate) syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ GDPR: gdpr.Policy{ - Signal: "A", - Consent: "B", + Signal: "0", + Consent: "allGdpr", }, CCPA: ccpa.Policy{ - Consent: "C", + Consent: "1-YY", }, }) From 247148968802698d47c86fc90db1fcd55bf6b005 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:14:06 +0300 Subject: [PATCH 09/17] initial --- adapters/krushmedia/krushmedia.go | 2 ++ adapters/krushmedia/krushmediatest/exemplary/banner-web.json | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index b67c14be51d..f89ca847da7 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -115,12 +115,14 @@ func (a *KrushmediaAdapter) MakeRequests( func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtKrushmedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + fmt.Println(118, err) return nil, &errortypes.BadInput{ Message: "ext.bidder not provided", } } var krushmediaExt openrtb_ext.ExtKrushmedia if err := json.Unmarshal(bidderExt.Bidder, &krushmediaExt); err != nil { + fmt.Println(125, err) return nil, &errortypes.BadInput{ Message: "ext.bidder not provided", } diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-web.json b/adapters/krushmedia/krushmediatest/exemplary/banner-web.json index 9a7fe10ab3c..d7e17f50442 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/banner-web.json +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-web.json @@ -20,7 +20,6 @@ "imp": [ { "id": "some-impression-id", - "banner": { "w":320, "h":50 From cdc68f66ecc698051e566f22ccd257045ab2ed52 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:15:40 +0300 Subject: [PATCH 10/17] initial --- openrtb_ext/imp_krushmedia.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openrtb_ext/imp_krushmedia.go b/openrtb_ext/imp_krushmedia.go index a175c227fda..b5b1f4d3d0e 100644 --- a/openrtb_ext/imp_krushmedia.go +++ b/openrtb_ext/imp_krushmedia.go @@ -2,5 +2,5 @@ package openrtb_ext // ExtKrushmedia defines imp[0].ext object structure type ExtKrushmedia struct { - AccountID string `json:"key"` + AccountID uint32 `json:"key"` } From 02086becc1f9f2854afc74f5bc433257cb1e7470 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:15:56 +0300 Subject: [PATCH 11/17] initial --- adapters/krushmedia/krushmedia.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/adapters/krushmedia/krushmedia.go b/adapters/krushmedia/krushmedia.go index f89ca847da7..b67c14be51d 100644 --- a/adapters/krushmedia/krushmedia.go +++ b/adapters/krushmedia/krushmedia.go @@ -115,14 +115,12 @@ func (a *KrushmediaAdapter) MakeRequests( func (a *KrushmediaAdapter) getImpressionExt(imp *openrtb.Imp) (*openrtb_ext.ExtKrushmedia, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - fmt.Println(118, err) return nil, &errortypes.BadInput{ Message: "ext.bidder not provided", } } var krushmediaExt openrtb_ext.ExtKrushmedia if err := json.Unmarshal(bidderExt.Bidder, &krushmediaExt); err != nil { - fmt.Println(125, err) return nil, &errortypes.BadInput{ Message: "ext.bidder not provided", } From 1cd73f36d94efecd0010737f8e97ed21db986bb4 Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:18:21 +0300 Subject: [PATCH 12/17] initial --- adapters/krushmedia/krushmediatest/exemplary/banner-web.json | 2 +- adapters/krushmedia/krushmediatest/exemplary/native-web.json | 2 +- adapters/krushmedia/krushmediatest/exemplary/video-app.json | 2 +- adapters/krushmedia/krushmediatest/exemplary/video-web.json | 2 +- .../krushmediatest/supplemental/invalid-response.json | 2 +- .../krushmediatest/supplemental/status-code-bad-request.json | 2 +- .../krushmediatest/supplemental/status-code-no-content.json | 2 +- .../krushmediatest/supplemental/status-code-other-error.json | 2 +- .../supplemental/status-code-service-unavailable.json | 2 +- adapters/krushmedia/params_test.go | 2 +- openrtb_ext/imp_krushmedia.go | 2 +- static/bidder-params/krushmedia.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-web.json b/adapters/krushmedia/krushmediatest/exemplary/banner-web.json index d7e17f50442..0af14203d56 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/banner-web.json +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-web.json @@ -26,7 +26,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/exemplary/native-web.json b/adapters/krushmedia/krushmediatest/exemplary/native-web.json index 80a421b9d37..1811e8cde29 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/native-web.json +++ b/adapters/krushmedia/krushmediatest/exemplary/native-web.json @@ -27,7 +27,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/exemplary/video-app.json b/adapters/krushmedia/krushmediatest/exemplary/video-app.json index efe75a9b85f..88d66a30c57 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/video-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/video-app.json @@ -38,7 +38,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/exemplary/video-web.json b/adapters/krushmedia/krushmediatest/exemplary/video-web.json index 5975a616e1a..8bf6f8fb668 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/video-web.json +++ b/adapters/krushmedia/krushmediatest/exemplary/video-web.json @@ -32,7 +32,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json b/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json index e8dac65af26..b60e5317243 100644 --- a/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json +++ b/adapters/krushmedia/krushmediatest/supplemental/invalid-response.json @@ -34,7 +34,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json index 26fe9ac498a..d8a091b036b 100644 --- a/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-bad-request.json @@ -33,7 +33,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json index ff59c8e6ce2..25a8caffd53 100644 --- a/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-no-content.json @@ -25,7 +25,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json index fc885299cf0..b7a24f35e1c 100644 --- a/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-other-error.json @@ -25,7 +25,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json b/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json index 87d327eab39..4049da2f52b 100644 --- a/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json +++ b/adapters/krushmedia/krushmediatest/supplemental/status-code-service-unavailable.json @@ -25,7 +25,7 @@ }, "ext": { "bidder": { - "key": 2 + "key": "2" } } } diff --git a/adapters/krushmedia/params_test.go b/adapters/krushmedia/params_test.go index ddb0e613dbc..d27ae920bcf 100644 --- a/adapters/krushmedia/params_test.go +++ b/adapters/krushmedia/params_test.go @@ -8,7 +8,7 @@ import ( ) var validParams = []string{ - `{ "key": 2 }`, + `{ "key": "2" }`, } func TestValidParams(t *testing.T) { diff --git a/openrtb_ext/imp_krushmedia.go b/openrtb_ext/imp_krushmedia.go index b5b1f4d3d0e..a175c227fda 100644 --- a/openrtb_ext/imp_krushmedia.go +++ b/openrtb_ext/imp_krushmedia.go @@ -2,5 +2,5 @@ package openrtb_ext // ExtKrushmedia defines imp[0].ext object structure type ExtKrushmedia struct { - AccountID uint32 `json:"key"` + AccountID string `json:"key"` } diff --git a/static/bidder-params/krushmedia.json b/static/bidder-params/krushmedia.json index 2bbd9f02349..e395da85617 100644 --- a/static/bidder-params/krushmedia.json +++ b/static/bidder-params/krushmedia.json @@ -5,7 +5,7 @@ "type": "object", "properties": { "key": { - "type": "integer", + "type": "string", "description": "ssp key" } }, From cee66e881bcdff135e4ef655966d50247468c83e Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:34:05 +0300 Subject: [PATCH 13/17] initial --- adapters/krushmedia/krushmediatest/exemplary/video-app.json | 3 +-- adapters/krushmedia/params_test.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/adapters/krushmedia/krushmediatest/exemplary/video-app.json b/adapters/krushmedia/krushmediatest/exemplary/video-app.json index 88d66a30c57..c13923a5bd6 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/video-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/video-app.json @@ -90,8 +90,7 @@ "maxduration": 150, "w": 640, "h": 480 - }, - "tagid": "ogTAGID" + } } ], "app": { diff --git a/adapters/krushmedia/params_test.go b/adapters/krushmedia/params_test.go index d27ae920bcf..26daa56e10b 100644 --- a/adapters/krushmedia/params_test.go +++ b/adapters/krushmedia/params_test.go @@ -32,7 +32,7 @@ var invalidParams = []string{ `4.2`, `[]`, `{}`, - `{ "key": "2" }`, + `{ "key": 2 }`, `{ "anyparam": "anyvalue" }`, } From 365a926b281eabe57ba0a2a7ef52425dc54f653d Mon Sep 17 00:00:00 2001 From: Aiholkin Date: Thu, 17 Sep 2020 15:50:04 +0300 Subject: [PATCH 14/17] fix failing test from colossus adapter --- adapters/colossus/usersync_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/colossus/usersync_test.go b/adapters/colossus/usersync_test.go index 79d5483d528..0d0da7b8813 100644 --- a/adapters/colossus/usersync_test.go +++ b/adapters/colossus/usersync_test.go @@ -23,7 +23,7 @@ func TestColossusSyncer(t *testing.T) { Consent: "A", }, CCPA: ccpa.Policy{ - Value: "1-YY", + Consent: "1-YY", // I've change here Value to Consent to prevent test from failing }, }) From 91303790473cf552eca626412b58c26739978308 Mon Sep 17 00:00:00 2001 From: Krushmedia Date: Mon, 14 Oct 2024 13:36:15 +0300 Subject: [PATCH 15/17] update user sync urls --- static/bidder-info/krushmedia.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/bidder-info/krushmedia.yaml b/static/bidder-info/krushmedia.yaml index 75d29b5ebe7..37069882074 100644 --- a/static/bidder-info/krushmedia.yaml +++ b/static/bidder-info/krushmedia.yaml @@ -14,5 +14,8 @@ capabilities: - native userSync: redirect: - url: "https://cs.krushmedia.com/4e4abdd5ecc661643458a730b1aa927d.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir={{.RedirectURL}}" + url: "https://cs.krushmedia.com/pbserver?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redir={{.RedirectURL}}" userMacro: "[UID]" + iframe: + url: "https://cs.krushmedia.com/pbserverIframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&pbserverUrl={{.RedirectURL}}" + userMacro: "[UID]" \ No newline at end of file From f4a922b6d7c2076321b0a7f7b4767df19395aad0 Mon Sep 17 00:00:00 2001 From: Krushmedia Date: Mon, 14 Oct 2024 13:37:42 +0300 Subject: [PATCH 16/17] upd --- adapters/krushmedia/krushmediatest/exemplary/banner-app.json | 4 ++-- adapters/krushmedia/krushmediatest/exemplary/video-web.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json index ba8344aa7c2..6bdc0fed349 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json @@ -3,7 +3,7 @@ "id": "some-request-id", "device": { "ua": "test-user-agent", - "ip": "123.123.123.123", + "ip": "123.13.123.123", "language": "en", "dnt": 0 }, @@ -157,4 +157,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/adapters/krushmedia/krushmediatest/exemplary/video-web.json b/adapters/krushmedia/krushmediatest/exemplary/video-web.json index 2194236ad4c..ddb5defe21e 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/video-web.json +++ b/adapters/krushmedia/krushmediatest/exemplary/video-web.json @@ -164,4 +164,4 @@ ] } ] -} +} \ No newline at end of file From b02f1e0f4c82000dd731c0a8fb7490d7540073a6 Mon Sep 17 00:00:00 2001 From: Krushmedia Date: Mon, 14 Oct 2024 13:38:42 +0300 Subject: [PATCH 17/17] upd --- adapters/krushmedia/krushmediatest/exemplary/banner-app.json | 2 +- static/bidder-info/krushmedia.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json index 6bdc0fed349..43039c0ef4e 100644 --- a/adapters/krushmedia/krushmediatest/exemplary/banner-app.json +++ b/adapters/krushmedia/krushmediatest/exemplary/banner-app.json @@ -3,7 +3,7 @@ "id": "some-request-id", "device": { "ua": "test-user-agent", - "ip": "123.13.123.123", + "ip": "123.123.123.123", "language": "en", "dnt": 0 }, diff --git a/static/bidder-info/krushmedia.yaml b/static/bidder-info/krushmedia.yaml index 37069882074..aa28b473ce5 100644 --- a/static/bidder-info/krushmedia.yaml +++ b/static/bidder-info/krushmedia.yaml @@ -18,4 +18,4 @@ userSync: userMacro: "[UID]" iframe: url: "https://cs.krushmedia.com/pbserverIframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ccpa={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&pbserverUrl={{.RedirectURL}}" - userMacro: "[UID]" \ No newline at end of file + userMacro: "[UID]"