From f26eff95d8c7685b9dbfdce4f0322868324bd776 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Mon, 4 Nov 2024 09:09:19 +0100 Subject: [PATCH 1/9] New Adapter: Ogury --- adapters/ogury/ogury.go | 175 ++++++++++++++++++ adapters/ogury/ogury_test.go | 21 +++ .../exemplary/banner_asset_ad_unit.json | 90 +++++++++ .../ogurytest/exemplary/banner_publisher.json | 88 +++++++++ adapters/ogury/param_test.go | 54 ++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + openrtb_ext/imp_ogury.go | 7 + static/bidder-info/ogury.yaml | 16 ++ static/bidder-params/ogury.json | 30 +++ 10 files changed, 485 insertions(+) create mode 100644 adapters/ogury/ogury.go create mode 100644 adapters/ogury/ogury_test.go create mode 100644 adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json create mode 100644 adapters/ogury/ogurytest/exemplary/banner_publisher.json create mode 100644 adapters/ogury/param_test.go create mode 100644 openrtb_ext/imp_ogury.go create mode 100644 static/bidder-info/ogury.yaml create mode 100644 static/bidder-params/ogury.json diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go new file mode 100644 index 00000000000..3b97c06d720 --- /dev/null +++ b/adapters/ogury/ogury.go @@ -0,0 +1,175 @@ +package ogury + +import ( + "encoding/json" + "fmt" + "net/http" + "strings" + + "github.com/prebid/openrtb/v20/openrtb2" + + "github.com/prebid/prebid-server/v2/adapters" + "github.com/prebid/prebid-server/v2/config" + "github.com/prebid/prebid-server/v2/errortypes" + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +type oguryAdapter struct { + endpoint string +} + +func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { + adapter := &oguryAdapter{ + endpoint: config.Endpoint, + } + return adapter, nil +} + +func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + headers := setHeaders(request) + + var errors []error + var bidderImpExt adapters.ExtImpBidder + var oguryExtParams openrtb_ext.ImpExtOgury + for i, imp := range request.Imp { + // extract Ogury params + if err := json.Unmarshal(imp.Ext, &bidderImpExt); err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Bidder extension not provided or can't be unmarshalled", + }) + } + if err := json.Unmarshal(bidderImpExt.Bidder, &oguryExtParams); err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Error while unmarshalling Ogury bidder extension", + }) + } + + // map Ogury params to top of Ext object + ext, err := json.Marshal(struct { + adapters.ExtImpBidder + openrtb_ext.ImpExtOgury + }{bidderImpExt, oguryExtParams}) + if err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Error while marshaling Imp.Ext bidder exension", + }) + } + request.Imp[i].Ext = ext + + if oguryExtParams.PublisherID != "" { + request.Imp[i].TagID = imp.ID + } + } + + for i, imp := range request.Imp { + // Check if imp comes with bid floor amount defined in a foreign currency + if imp.BidFloor > 0 && imp.BidFloorCur != "" && strings.ToUpper(imp.BidFloorCur) != "USD" { + + // Convert to US dollars + convertedValue, err := requestInfo.ConvertCurrency(imp.BidFloor, imp.BidFloorCur, "USD") + if err != nil { + return nil, []error{err} + } + + // Update after conversion. All imp elements inside request.Imp are shallow copies + // therefore, their non-pointer values are not shared memory and are safe to modify. + request.Imp[i].BidFloorCur = "USD" + request.Imp[i].BidFloor = convertedValue + } + } + + requestJSON, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + } + + return []*adapters.RequestData{requestData}, nil + +} + +func setHeaders(request *openrtb2.BidRequest) http.Header { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + if request.Device != nil { + headers.Add("X-Forwarded-For", request.Device.IP) + headers.Add("User-Agent", request.Device.UA) + headers.Add("Accept-Language", request.Device.Language) + } + return headers + +} + +func getMediaTypeForBid(impressions []openrtb2.Imp, bid openrtb2.Bid) (openrtb_ext.BidType, error) { + for _, imp := range impressions { + if imp.ID == bid.ImpID { + switch { + case imp.Banner != nil: + return openrtb_ext.BidTypeBanner, nil + case imp.Video != nil: + return openrtb_ext.BidTypeVideo, nil + case imp.Native != nil: + return openrtb_ext.BidTypeNative, nil + } + } + + } + + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Failed to determine media type of impression \"%s\"", bid.ImpID), + } +} + +func (a oguryAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if responseData.StatusCode == http.StatusNoContent { + return nil, nil + } + + if responseData.StatusCode == http.StatusBadRequest { + err := &errortypes.BadInput{ + Message: "Unexpected status code: 400. Bad request from publisher. Run with request.debug = 1 for more info.", + } + return nil, []error{err} + } + + if responseData.StatusCode != http.StatusOK { + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode), + } + return nil, []error{err} + } + + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur + var errors []error + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidType, err := getMediaTypeForBid(request.Imp, bid) + if err != nil { + errors = append(errors, err) + continue + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidType, + }) + } + } + if errors != nil { + return nil, errors + } + + return bidResponse, nil +} diff --git a/adapters/ogury/ogury_test.go b/adapters/ogury/ogury_test.go new file mode 100644 index 00000000000..4add931218c --- /dev/null +++ b/adapters/ogury/ogury_test.go @@ -0,0 +1,21 @@ +package ogury + +import ( + "testing" + + "github.com/prebid/prebid-server/v2/adapters/adapterstest" + "github.com/prebid/prebid-server/v2/config" + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderOgury, config.Adapter{ + Endpoint: "http://ogury.example.com"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "ogurytest", bidder) +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json new file mode 100644 index 00000000000..1c96caf1981 --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json @@ -0,0 +1,90 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "imp": [ + { + "id":"test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "assetKey": "OGY", + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + }, + "prebid": null + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/ogury/ogurytest/exemplary/banner_publisher.json b/adapters/ogury/ogurytest/exemplary/banner_publisher.json new file mode 100644 index 00000000000..a711737adb9 --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_publisher.json @@ -0,0 +1,88 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "bidder": { + "publisherId": "pub123" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "publisherId": "pub123", + "bidder": { + "publisherId": "pub123" + }, + "prebid": null + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }, + "type": "banner" + } + ] + } + ] +} + diff --git a/adapters/ogury/param_test.go b/adapters/ogury/param_test.go new file mode 100644 index 00000000000..dbede6cb48f --- /dev/null +++ b/adapters/ogury/param_test.go @@ -0,0 +1,54 @@ +package ogury + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range validParams { + if err := validator.Validate(openrtb_ext.BidderOgury, json.RawMessage(p)); err != nil { + t.Errorf("Schema rejected valid params: %s", p) + } + } +} + +var validParams = []string{ + `{"adUnitId": "12", "assetKey": "OGY"}`, + `{"publisherId": "some publisher id"}`, + `{"publisherId": "some publisher id", "assetKey": "ogy"}`, + `{"publisherId": "some publisher id", "adUnitId": "12"}`, +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderOgury, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var invalidParams = []string{ + ``, + `null`, + `[]`, + `{"adUnitId": "test 12"}`, + `{"assetKey": "ogy asset"}`, + `{"adUnitId": 12, "assetKey": "OGY"}`, + `{"adUnitId": "45test", "assetKey": false}`, + `{"publisherId": true}`, + + `{"publisherId": "some publisher", "assetKey": "ogy asset", "adUnitId": "1"}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 7f1496810e2..114500a653f 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -144,6 +144,7 @@ import ( "github.com/prebid/prebid-server/v2/adapters/motorik" "github.com/prebid/prebid-server/v2/adapters/nextmillennium" "github.com/prebid/prebid-server/v2/adapters/nobid" + "github.com/prebid/prebid-server/v2/adapters/ogury" "github.com/prebid/prebid-server/v2/adapters/oms" "github.com/prebid/prebid-server/v2/adapters/onetag" "github.com/prebid/prebid-server/v2/adapters/openweb" @@ -376,6 +377,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderMotorik: motorik.Builder, openrtb_ext.BidderNextMillennium: nextmillennium.Builder, openrtb_ext.BidderNoBid: nobid.Builder, + openrtb_ext.BidderOgury: ogury.Builder, openrtb_ext.BidderOms: oms.Builder, openrtb_ext.BidderOneTag: onetag.Builder, openrtb_ext.BidderOpenWeb: openweb.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index f7706ce5c25..eca946561fe 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -162,6 +162,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderMotorik, BidderNextMillennium, BidderNoBid, + BidderOgury, BidderOms, BidderOneTag, BidderOpenWeb, @@ -491,6 +492,7 @@ const ( BidderMotorik BidderName = "motorik" BidderNextMillennium BidderName = "nextmillennium" BidderNoBid BidderName = "nobid" + BidderOgury BidderName = "ogury" BidderOms BidderName = "oms" BidderOneTag BidderName = "onetag" BidderOpenWeb BidderName = "openweb" diff --git a/openrtb_ext/imp_ogury.go b/openrtb_ext/imp_ogury.go new file mode 100644 index 00000000000..62f853b536a --- /dev/null +++ b/openrtb_ext/imp_ogury.go @@ -0,0 +1,7 @@ +package openrtb_ext + +type ImpExtOgury struct { + AdUnitID string `json:"adUnitId,omitempty"` + AssetKey string `json:"assetKey,omitempty"` + PublisherID string `json:"publisherId,omitempty"` +} diff --git a/static/bidder-info/ogury.yaml b/static/bidder-info/ogury.yaml new file mode 100644 index 00000000000..2ebcec9c35e --- /dev/null +++ b/static/bidder-info/ogury.yaml @@ -0,0 +1,16 @@ +endpoint: "http://prebids2s.presage.com/api/header-bidding-request" +endpointCompression: gzip +geoscope: + - global +maintainer: + email: deliveryservices@ogury.co +gvlVendorID: 31 +modifyingVastXmlAllowed: true +capabilities: + site: + mediaTypes: + - banner +userSync: + iframe: + url: "https://ms-cookie-sync.presage.io/user-sync.html?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}&source=prebids2s" + userMacro: "{{OGURY_UID}}" diff --git a/static/bidder-params/ogury.json b/static/bidder-params/ogury.json new file mode 100644 index 00000000000..f4030fc095b --- /dev/null +++ b/static/bidder-params/ogury.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Ogury Adapter Params", + "description": "A schema which validates params accepted by the Ogury adapter", + "type": "object", + + "properties": { + "assetKey": { + "type": "string", + "minLength": 1, + "description": "Ogury provided id for you site." + }, + "adUnitId": { + "type": "string", + "minLength": 1, + "description": "Ogury provided id for you placement." + }, + "publisherId": { + "type": "string", + "format": "uuid", + "description": "Ogury provided publisher id." + } + }, + + "oneOf": [ + { "required": ["assetKey", "adUnitId"] }, + { "required": ["publisherId"] } + ] +} + From a7b21042c3abcd13aa4166c95c9dc635a1070ad1 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Mon, 4 Nov 2024 10:08:54 +0100 Subject: [PATCH 2/9] New Adapter: Ogury - fix tests --- adapters/ogury/param_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/ogury/param_test.go b/adapters/ogury/param_test.go index dbede6cb48f..734ddfa94a9 100644 --- a/adapters/ogury/param_test.go +++ b/adapters/ogury/param_test.go @@ -22,9 +22,9 @@ func TestValidParams(t *testing.T) { var validParams = []string{ `{"adUnitId": "12", "assetKey": "OGY"}`, - `{"publisherId": "some publisher id"}`, - `{"publisherId": "some publisher id", "assetKey": "ogy"}`, - `{"publisherId": "some publisher id", "adUnitId": "12"}`, + `{"publisherId": "0b33fb0a-7b2d-44f0-ab0a-a6df93740dba"}`, + `{"publisherId": "0b33fb0a-7b2d-44f0-ab0a-a6df93740dba", "assetKey": "ogy"}`, + `{"publisherId": "0b33fb0a-7b2d-44f0-ab0a-a6df93740dba", "adUnitId": "12"}`, } func TestInvalidParams(t *testing.T) { From ec83b5207021be85259f994eb49ac88fc038a793 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Thu, 14 Nov 2024 11:56:07 +0100 Subject: [PATCH 3/9] New Adapter: Ogury - fix url * Accept all three params simultaneously * Fix bidder url --- adapters/ogury/param_test.go | 9 ++++----- static/bidder-info/ogury.yaml | 2 +- static/bidder-params/ogury.json | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/adapters/ogury/param_test.go b/adapters/ogury/param_test.go index 734ddfa94a9..2bc27e4796d 100644 --- a/adapters/ogury/param_test.go +++ b/adapters/ogury/param_test.go @@ -22,9 +22,10 @@ func TestValidParams(t *testing.T) { var validParams = []string{ `{"adUnitId": "12", "assetKey": "OGY"}`, - `{"publisherId": "0b33fb0a-7b2d-44f0-ab0a-a6df93740dba"}`, - `{"publisherId": "0b33fb0a-7b2d-44f0-ab0a-a6df93740dba", "assetKey": "ogy"}`, - `{"publisherId": "0b33fb0a-7b2d-44f0-ab0a-a6df93740dba", "adUnitId": "12"}`, + `{"publisherId": "00000000-0000-0000-0000-000000000000"}`, + `{"publisherId": "00000000-0000-0000-0000-000000000000", "assetKey": "ogy"}`, + `{"publisherId": "00000000-0000-0000-0000-000000000000", "adUnitId": "12"}`, + `{"publisherId": "00000000-0000-0000-0000-000000000000", "assetKey": "ogy asset", "adUnitId": "1"}`, } func TestInvalidParams(t *testing.T) { @@ -49,6 +50,4 @@ var invalidParams = []string{ `{"adUnitId": 12, "assetKey": "OGY"}`, `{"adUnitId": "45test", "assetKey": false}`, `{"publisherId": true}`, - - `{"publisherId": "some publisher", "assetKey": "ogy asset", "adUnitId": "1"}`, } diff --git a/static/bidder-info/ogury.yaml b/static/bidder-info/ogury.yaml index 2ebcec9c35e..c6b356517ba 100644 --- a/static/bidder-info/ogury.yaml +++ b/static/bidder-info/ogury.yaml @@ -1,4 +1,4 @@ -endpoint: "http://prebids2s.presage.com/api/header-bidding-request" +endpoint: "http://prebids2s.presage.io/api/header-bidding-request" endpointCompression: gzip geoscope: - global diff --git a/static/bidder-params/ogury.json b/static/bidder-params/ogury.json index f4030fc095b..1097509b54f 100644 --- a/static/bidder-params/ogury.json +++ b/static/bidder-params/ogury.json @@ -22,7 +22,7 @@ } }, - "oneOf": [ + "anyOf": [ { "required": ["assetKey", "adUnitId"] }, { "required": ["publisherId"] } ] From 0eaa327127da3538508173832ece9c65a410286c Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Fri, 15 Nov 2024 11:11:12 +0100 Subject: [PATCH 4/9] New Adapter: Ogury - Fix user sync url --- static/bidder-info/ogury.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/bidder-info/ogury.yaml b/static/bidder-info/ogury.yaml index c6b356517ba..a28a767a7ab 100644 --- a/static/bidder-info/ogury.yaml +++ b/static/bidder-info/ogury.yaml @@ -12,5 +12,5 @@ capabilities: - banner userSync: iframe: - url: "https://ms-cookie-sync.presage.io/user-sync.html?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}&source=prebids2s" + url: "https://ms-cookie-sync.presage.io/user-sync.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}&source=prebids2s" userMacro: "{{OGURY_UID}}" From 3a6c990d5d2e812020ef7fa53d55a50f6ad043b8 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Fri, 22 Nov 2024 16:18:51 +0100 Subject: [PATCH 5/9] add text params --- adapters/ogury/ogury.go | 48 ++++++---- .../exemplary/banner_asset_ad_unit.json | 10 +-- .../ogurytest/exemplary/banner_publisher.json | 6 +- .../banner_with_arbitary_bidder_param.json | 89 +++++++++++++++++++ 4 files changed, 126 insertions(+), 27 deletions(-) create mode 100644 adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go index 3b97c06d720..b7b0ad1139d 100644 --- a/adapters/ogury/ogury.go +++ b/adapters/ogury/ogury.go @@ -29,38 +29,54 @@ func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *ad headers := setHeaders(request) var errors []error - var bidderImpExt adapters.ExtImpBidder - var oguryExtParams openrtb_ext.ImpExtOgury + var impExt, impExtBidderHoist map[string]json.RawMessage for i, imp := range request.Imp { - // extract Ogury params - if err := json.Unmarshal(imp.Ext, &bidderImpExt); err != nil { + // extract ext + if err := json.Unmarshal(imp.Ext, &impExt); err != nil { return nil, append(errors, &errortypes.BadInput{ Message: "Bidder extension not provided or can't be unmarshalled", }) } - if err := json.Unmarshal(bidderImpExt.Bidder, &oguryExtParams); err != nil { - return nil, append(errors, &errortypes.BadInput{ - Message: "Error while unmarshalling Ogury bidder extension", - }) + // find Ogury bidder params + bidder, ok := impExt["bidder"] + if ok { + if err := json.Unmarshal(bidder, &impExtBidderHoist); err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Bidder extension not provided or can't be unmarshalled", + }) + } + + } + + impExtOut := make(map[string]any, len(impExt)-1+len(impExtBidderHoist)) + + // extract Ogury "bidder" params from imp.ext.bidder to imp.ext + for key, value := range impExt { + if key != "bidder" { + impExtOut[key] = value + } + } + for key, value := range impExtBidderHoist { + impExtOut[key] = value } - // map Ogury params to top of Ext object - ext, err := json.Marshal(struct { - adapters.ExtImpBidder - openrtb_ext.ImpExtOgury - }{bidderImpExt, oguryExtParams}) + ext, err := json.Marshal(impExtOut) if err != nil { return nil, append(errors, &errortypes.BadInput{ Message: "Error while marshaling Imp.Ext bidder exension", }) } - request.Imp[i].Ext = ext - if oguryExtParams.PublisherID != "" { - request.Imp[i].TagID = imp.ID + // save adUnitCode + request.Imp[i].TagID = imp.ID + if impExtOut["gpid"] == "" { + impExtOut["gpid"] = imp.ID } + + request.Imp[i].Ext = ext } + // currency conversion for i, imp := range request.Imp { // Check if imp comes with bid floor amount defined in a foreign currency if imp.BidFloor > 0 && imp.BidFloorCur != "" && strings.ToUpper(imp.BidFloorCur) != "USD" { diff --git a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json index 1c96caf1981..c3fd79ca7b7 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json +++ b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json @@ -8,6 +8,7 @@ "format": [{"w": 128, "h": 100}] }, "ext": { + "gpid": "global position id", "bidder": { "assetKey": "OGY", "adUnitId": "123" @@ -26,17 +27,14 @@ "imp": [ { "id":"test-imp-id", + "tagid": "test-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { + "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123", - "bidder": { - "assetKey": "OGY", - "adUnitId": "123" - }, - "prebid": null + "adUnitId": "123" } } ] diff --git a/adapters/ogury/ogurytest/exemplary/banner_publisher.json b/adapters/ogury/ogurytest/exemplary/banner_publisher.json index a711737adb9..ae92a576b01 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_publisher.json +++ b/adapters/ogury/ogurytest/exemplary/banner_publisher.json @@ -30,11 +30,7 @@ "format": [{"w": 128, "h": 100}] }, "ext": { - "publisherId": "pub123", - "bidder": { - "publisherId": "pub123" - }, - "prebid": null + "publisherId": "pub123" } } ] diff --git a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json new file mode 100644 index 00000000000..bb5c8ba8d96 --- /dev/null +++ b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json @@ -0,0 +1,89 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123", + "testcampaign": "test123" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123", + "testcampaign": "test123" + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }, + "type": "banner" + } + ] + } + ] +} From cfc66d0bccaf0462a2b1105f4202f1d74af44416 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Thu, 28 Nov 2024 11:48:14 +0100 Subject: [PATCH 6/9] * New Adapter: Ogury - filter imps --- adapters/ogury/ogury.go | 95 ++++++++---- adapters/ogury/ogury_test.go | 6 +- .../exemplary/banner_asset_ad_unit.json | 11 +- .../banner_multi_imp_with_params.json | 141 ++++++++++++++++++ ...banner_multi_imp_without_ogury_params.json | 113 ++++++++++++++ .../ogurytest/exemplary/banner_publisher.json | 21 ++- .../supplemental/banner_invalid_request.json | 24 +++ .../banner_with_arbitary_bidder_param.json | 10 +- .../banner_without_ad_unit_code.json | 87 +++++++++++ adapters/ogury/param_test.go | 9 +- exchange/adapter_builders.go | 1 + openrtb_ext/imp_ogury.go | 5 +- static/bidder-params/ogury.json | 20 +-- 13 files changed, 483 insertions(+), 60 deletions(-) create mode 100644 adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json create mode 100644 adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json create mode 100644 adapters/ogury/ogurytest/supplemental/banner_invalid_request.json create mode 100644 adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go index b7b0ad1139d..6210f04c306 100644 --- a/adapters/ogury/ogury.go +++ b/adapters/ogury/ogury.go @@ -8,10 +8,10 @@ import ( "github.com/prebid/openrtb/v20/openrtb2" - "github.com/prebid/prebid-server/v2/adapters" - "github.com/prebid/prebid-server/v2/config" - "github.com/prebid/prebid-server/v2/errortypes" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/adapters" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/errortypes" + "github.com/prebid/prebid-server/v3/openrtb_ext" ) type oguryAdapter struct { @@ -28,9 +28,16 @@ func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) ( func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := setHeaders(request) + request.Imp = filterValidImps(request) + if len(request.Imp) == 0 { + return nil, []error{&errortypes.BadInput{ + Message: "Invalid request. assetKey/adUnitId or request.site.publisher.id required", + }} + } + var errors []error - var impExt, impExtBidderHoist map[string]json.RawMessage for i, imp := range request.Imp { + var impExt, impExtBidderHoist map[string]json.RawMessage // extract ext if err := json.Unmarshal(imp.Ext, &impExt); err != nil { return nil, append(errors, &errortypes.BadInput{ @@ -38,21 +45,19 @@ func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *ad }) } // find Ogury bidder params - bidder, ok := impExt["bidder"] - if ok { + if bidder, ok := impExt[openrtb_ext.PrebidExtBidderKey]; ok { if err := json.Unmarshal(bidder, &impExtBidderHoist); err != nil { return nil, append(errors, &errortypes.BadInput{ - Message: "Bidder extension not provided or can't be unmarshalled", + Message: "Ogury bidder extension not provided or can't be unmarshalled", }) } - } impExtOut := make(map[string]any, len(impExt)-1+len(impExtBidderHoist)) // extract Ogury "bidder" params from imp.ext.bidder to imp.ext for key, value := range impExt { - if key != "bidder" { + if key != openrtb_ext.PrebidExtBidderKey { impExtOut[key] = value } } @@ -66,14 +71,14 @@ func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *ad Message: "Error while marshaling Imp.Ext bidder exension", }) } + request.Imp[i].Ext = ext // save adUnitCode - request.Imp[i].TagID = imp.ID - if impExtOut["gpid"] == "" { - impExtOut["gpid"] = imp.ID + if adUnitCode := getAdUnitCode(impExt); adUnitCode != "" { + request.Imp[i].TagID = adUnitCode + } else { + request.Imp[i].TagID = imp.ID } - - request.Imp[i].Ext = ext } // currency conversion @@ -111,6 +116,51 @@ func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *ad } +func filterValidImps(request *openrtb2.BidRequest) (validImps []openrtb2.Imp) { + for _, imp := range request.Imp { + var impExt adapters.ExtImpBidder + var impExtOgury openrtb_ext.ImpExtOgury + + if err := json.Unmarshal(imp.Ext, &impExt); err != nil { + continue + } + if err := json.Unmarshal(impExt.Bidder, &impExtOgury); err != nil { + continue + } + if impExtOgury.AssetKey != "" && impExtOgury.AdUnitID != "" { + validImps = append(validImps, imp) + } + } + + // if we have imp with assetKey/adUnitId then we want to serve them + if len(validImps) > 0 { + return validImps + } + + // no assetKey/adUnitId imps then we serve everything if publisher.ID exists + if request.Site != nil && request.Site.Publisher.ID != "" { + return request.Imp + } + + // else no valid imp + return nil +} + +func getAdUnitCode(ext map[string]json.RawMessage) string { + var prebidExt openrtb_ext.ExtImpPrebid + v, ok := ext["prebid"] + if !ok { + return "" + } + + err := json.Unmarshal(v, &prebidExt) + if err != nil { + return "" + } + + return prebidExt.AdUnitCode +} + func setHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") @@ -144,21 +194,10 @@ func getMediaTypeForBid(impressions []openrtb2.Imp, bid openrtb2.Bid) (openrtb_e } func (a oguryAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { - if responseData.StatusCode == http.StatusNoContent { + if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil } - - if responseData.StatusCode == http.StatusBadRequest { - err := &errortypes.BadInput{ - Message: "Unexpected status code: 400. Bad request from publisher. Run with request.debug = 1 for more info.", - } - return nil, []error{err} - } - - if responseData.StatusCode != http.StatusOK { - err := &errortypes.BadServerResponse{ - Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode), - } + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { return nil, []error{err} } diff --git a/adapters/ogury/ogury_test.go b/adapters/ogury/ogury_test.go index 4add931218c..504be6ccaaa 100644 --- a/adapters/ogury/ogury_test.go +++ b/adapters/ogury/ogury_test.go @@ -3,9 +3,9 @@ package ogury import ( "testing" - "github.com/prebid/prebid-server/v2/adapters/adapterstest" - "github.com/prebid/prebid-server/v2/config" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/adapters/adapterstest" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/openrtb_ext" ) func TestJsonSamples(t *testing.T) { diff --git a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json index c3fd79ca7b7..66e68b88ff4 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json +++ b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json @@ -9,6 +9,9 @@ }, "ext": { "gpid": "global position id", + "prebid": { + "adunitcode": "ad-unit-code" + }, "bidder": { "assetKey": "OGY", "adUnitId": "123" @@ -27,14 +30,17 @@ "imp": [ { "id":"test-imp-id", - "tagid": "test-imp-id", + "tagid": "ad-unit-code", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123" + "adUnitId": "123", + "prebid": { + "adunitcode": "ad-unit-code" + } } } ] @@ -85,4 +91,3 @@ } ] } - diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json new file mode 100644 index 00000000000..bbadc273979 --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json @@ -0,0 +1,141 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "prebid": { + "adunitcode": "ad-unit-code" + }, + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": {"bidder": {}} + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [{"w": 1, "h": 1}] + }, + "ext": { + "gpid": "global position id", + "prebid": { + "adunitcode": "ad-unit-code-2" + }, + "bidder": { + "assetKey": "OGY3", + "adUnitId": "1234" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id":"test-imp-id", + "tagid": "ad-unit-code", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123", + "prebid": { + "adunitcode": "ad-unit-code" + } + } + }, + { + "id":"test-imp-id-3", + "tagid": "ad-unit-code-2", + "banner": { + "format": [{"w": 1, "h": 1}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY3", + "adUnitId": "1234", + "prebid": { + "adunitcode": "ad-unit-code-2" + } + } + } + ] + }, + "impIDs":["test-imp-id", "test-imp-id-3"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json new file mode 100644 index 00000000000..62cc253ecbc --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json @@ -0,0 +1,113 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "prebid": { + "adunitcode": "ad-unit-code" + }, + "bidder": {} + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": {"bidder": {}} + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id":"test-imp-id", + "tagid": "ad-unit-code", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "prebid": { + "adunitcode": "ad-unit-code" + } + } + }, + { + "id": "test-imp-id-2", + "tagid": "test-imp-id-2", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": {} + } + ] + }, + "impIDs":["test-imp-id", "test-imp-id-2"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_publisher.json b/adapters/ogury/ogurytest/exemplary/banner_publisher.json index ae92a576b01..1d8e2fd5a61 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_publisher.json +++ b/adapters/ogury/ogurytest/exemplary/banner_publisher.json @@ -1,6 +1,11 @@ { "mockBidRequest": { "id": "test-request-id", + "site": { + "publisher": { + "id": "pub123" + } + }, "imp": [ { "id": "test-imp-id", @@ -8,8 +13,8 @@ "format": [{"w": 128, "h": 100}] }, "ext": { - "bidder": { - "publisherId": "pub123" + "prebid": { + "adunitcode": "ad-unit-code" } } } @@ -22,15 +27,22 @@ "uri": "http://ogury.example.com", "body": { "id": "test-request-id", + "site": { + "publisher": { + "id": "pub123" + } + }, "imp": [ { "id":"test-imp-id", - "tagid": "test-imp-id", + "tagid": "ad-unit-code", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { - "publisherId": "pub123" + "prebid": { + "adunitcode": "ad-unit-code" + } } } ] @@ -81,4 +93,3 @@ } ] } - diff --git a/adapters/ogury/ogurytest/supplemental/banner_invalid_request.json b/adapters/ogury/ogurytest/supplemental/banner_invalid_request.json new file mode 100644 index 00000000000..aac99257c26 --- /dev/null +++ b/adapters/ogury/ogurytest/supplemental/banner_invalid_request.json @@ -0,0 +1,24 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": {} + } + } + ] + }, + + "httpCalls": [], + "expectedBidResponses": [], + "expectedMakeRequestsErrors": [{ + "value": "Invalid request. assetKey/adUnitId or request.site.publisher.id required", + "comparison": "literal" + }] +} diff --git a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json index bb5c8ba8d96..b1e4ec26748 100644 --- a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json +++ b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json @@ -9,6 +9,9 @@ }, "ext": { "gpid": "global position id", + "prebid": { + "adunitcode": "ad-unit-code" + }, "bidder": { "assetKey": "OGY", "adUnitId": "123", @@ -28,7 +31,7 @@ "imp": [ { "id":"test-imp-id", - "tagid": "test-imp-id", + "tagid": "ad-unit-code", "banner": { "format": [{"w": 128, "h": 100}] }, @@ -36,7 +39,10 @@ "gpid": "global position id", "assetKey": "OGY", "adUnitId": "123", - "testcampaign": "test123" + "testcampaign": "test123", + "prebid": { + "adunitcode": "ad-unit-code" + } } } ] diff --git a/adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json b/adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json new file mode 100644 index 00000000000..6ac73bc2212 --- /dev/null +++ b/adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json @@ -0,0 +1,87 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123" + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/param_test.go b/adapters/ogury/param_test.go index 2bc27e4796d..f4c7c83445f 100644 --- a/adapters/ogury/param_test.go +++ b/adapters/ogury/param_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/openrtb_ext" ) func TestValidParams(t *testing.T) { @@ -21,11 +21,9 @@ func TestValidParams(t *testing.T) { } var validParams = []string{ + `{}`, `{"adUnitId": "12", "assetKey": "OGY"}`, - `{"publisherId": "00000000-0000-0000-0000-000000000000"}`, - `{"publisherId": "00000000-0000-0000-0000-000000000000", "assetKey": "ogy"}`, - `{"publisherId": "00000000-0000-0000-0000-000000000000", "adUnitId": "12"}`, - `{"publisherId": "00000000-0000-0000-0000-000000000000", "assetKey": "ogy asset", "adUnitId": "1"}`, + `{"adUnitId": "123", "assetKey": "OGY", "thirdParam": "something"}`, } func TestInvalidParams(t *testing.T) { @@ -49,5 +47,4 @@ var invalidParams = []string{ `{"assetKey": "ogy asset"}`, `{"adUnitId": 12, "assetKey": "OGY"}`, `{"adUnitId": "45test", "assetKey": false}`, - `{"publisherId": true}`, } diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index c37907180ca..4af5bff3a94 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -145,6 +145,7 @@ import ( "github.com/prebid/prebid-server/v3/adapters/nativo" "github.com/prebid/prebid-server/v3/adapters/nextmillennium" "github.com/prebid/prebid-server/v3/adapters/nobid" + "github.com/prebid/prebid-server/v3/adapters/ogury" "github.com/prebid/prebid-server/v3/adapters/oms" "github.com/prebid/prebid-server/v3/adapters/onetag" "github.com/prebid/prebid-server/v3/adapters/openweb" diff --git a/openrtb_ext/imp_ogury.go b/openrtb_ext/imp_ogury.go index 62f853b536a..295bd7d26d8 100644 --- a/openrtb_ext/imp_ogury.go +++ b/openrtb_ext/imp_ogury.go @@ -1,7 +1,6 @@ package openrtb_ext type ImpExtOgury struct { - AdUnitID string `json:"adUnitId,omitempty"` - AssetKey string `json:"assetKey,omitempty"` - PublisherID string `json:"publisherId,omitempty"` + AdUnitID string `json:"adUnitId,omitempty"` + AssetKey string `json:"assetKey,omitempty"` } diff --git a/static/bidder-params/ogury.json b/static/bidder-params/ogury.json index 1097509b54f..fd77fbe849c 100644 --- a/static/bidder-params/ogury.json +++ b/static/bidder-params/ogury.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Ogury Adapter Params", "description": "A schema which validates params accepted by the Ogury adapter", "type": "object", @@ -14,17 +14,17 @@ "type": "string", "minLength": 1, "description": "Ogury provided id for you placement." - }, - "publisherId": { - "type": "string", - "format": "uuid", - "description": "Ogury provided publisher id." } }, - "anyOf": [ - { "required": ["assetKey", "adUnitId"] }, - { "required": ["publisherId"] } + "allOf": [ + { + "if": { "required": ["assetKey"] }, + "then": { "required": ["adUnitId"] } + }, + { + "if": { "required": ["adUnitId"] }, + "then": { "required": ["assetKey"] } + } ] } - From 11257957ce6cbe8e5630132f06f0fb9132dee7d9 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Fri, 29 Nov 2024 09:47:06 +0100 Subject: [PATCH 7/9] change oguryAdapter to adapter --- adapters/ogury/ogury.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go index 6210f04c306..3d2f4c95be7 100644 --- a/adapters/ogury/ogury.go +++ b/adapters/ogury/ogury.go @@ -14,18 +14,16 @@ import ( "github.com/prebid/prebid-server/v3/openrtb_ext" ) -type oguryAdapter struct { +type adapter struct { endpoint string } func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { - adapter := &oguryAdapter{ - endpoint: config.Endpoint, - } - return adapter, nil + return &adapter{endpoint: config.Endpoint,}, nil + } -func (a oguryAdapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { +func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { headers := setHeaders(request) request.Imp = filterValidImps(request) @@ -193,7 +191,7 @@ func getMediaTypeForBid(impressions []openrtb2.Imp, bid openrtb2.Bid) (openrtb_e } } -func (a oguryAdapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { +func (a adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil } From 2289c6c6639f796e248e107ded4b6d116cb6ee0e Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Wed, 11 Dec 2024 12:09:42 +0100 Subject: [PATCH 8/9] remove adunitcode mapping always use imp.id for adunitcode, to map to imp.tagid --- adapters/ogury/ogury.go | 35 +++++-------------- .../exemplary/banner_asset_ad_unit.json | 20 ++++------- .../banner_multi_imp_with_params.json | 24 ++++--------- ...banner_multi_imp_without_ogury_params.json | 14 +++----- .../ogurytest/exemplary/banner_publisher.json | 14 ++------ .../banner_with_arbitary_bidder_param.json | 14 +++----- 6 files changed, 32 insertions(+), 89 deletions(-) diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go index 3d2f4c95be7..5e7436434e8 100644 --- a/adapters/ogury/ogury.go +++ b/adapters/ogury/ogury.go @@ -19,8 +19,7 @@ type adapter struct { } func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { - return &adapter{endpoint: config.Endpoint,}, nil - + return &adapter{endpoint: config.Endpoint}, nil } func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { @@ -51,19 +50,20 @@ func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapter } } - impExtOut := make(map[string]any, len(impExt)-1+len(impExtBidderHoist)) + newImpExt := make(map[string]any, len(impExt)-1+len(impExtBidderHoist)) - // extract Ogury "bidder" params from imp.ext.bidder to imp.ext + // copy every imp.ext field to the new "ext" object except for imp.ext.bidder for key, value := range impExt { if key != openrtb_ext.PrebidExtBidderKey { - impExtOut[key] = value + newImpExt[key] = value } } + // extract Ogury params from imp.ext.bidder to imp.ext for key, value := range impExtBidderHoist { - impExtOut[key] = value + newImpExt[key] = value } - ext, err := json.Marshal(impExtOut) + ext, err := json.Marshal(newImpExt) if err != nil { return nil, append(errors, &errortypes.BadInput{ Message: "Error while marshaling Imp.Ext bidder exension", @@ -72,11 +72,7 @@ func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapter request.Imp[i].Ext = ext // save adUnitCode - if adUnitCode := getAdUnitCode(impExt); adUnitCode != "" { - request.Imp[i].TagID = adUnitCode - } else { - request.Imp[i].TagID = imp.ID - } + request.Imp[i].TagID = imp.ID } // currency conversion @@ -144,21 +140,6 @@ func filterValidImps(request *openrtb2.BidRequest) (validImps []openrtb2.Imp) { return nil } -func getAdUnitCode(ext map[string]json.RawMessage) string { - var prebidExt openrtb_ext.ExtImpPrebid - v, ok := ext["prebid"] - if !ok { - return "" - } - - err := json.Unmarshal(v, &prebidExt) - if err != nil { - return "" - } - - return prebidExt.AdUnitCode -} - func setHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") diff --git a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json index 66e68b88ff4..7c550c9e7ce 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json +++ b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json @@ -3,15 +3,12 @@ "id": "test-request-id", "imp": [ { - "id": "test-imp-id", + "id": "ad-unit-code-as-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { "gpid": "global position id", - "prebid": { - "adunitcode": "ad-unit-code" - }, "bidder": { "assetKey": "OGY", "adUnitId": "123" @@ -29,23 +26,20 @@ "id": "test-request-id", "imp": [ { - "id":"test-imp-id", - "tagid": "ad-unit-code", + "id":"ad-unit-code-as-imp-id", + "tagid": "ad-unit-code-as-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123", - "prebid": { - "adunitcode": "ad-unit-code" - } + "adUnitId": "123" } } ] }, - "impIDs":["test-imp-id"] + "impIDs":["ad-unit-code-as-imp-id"] }, "mockResponse": { "status": 200, @@ -57,7 +51,7 @@ "seat": "seat", "bid": [{ "id": "some-UUID", - "impid": "test-imp-id", + "impid": "ad-unit-code-as-imp-id", "price": 0.500000, "adm": "adm string", "crid": "crid_10", @@ -78,7 +72,7 @@ { "bid": { "id": "some-UUID", - "impid": "test-imp-id", + "impid": "ad-unit-code-as-imp-id", "price": 0.5, "adm": "adm string", "crid": "crid_10", diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json index bbadc273979..f270f4ed955 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json @@ -1,6 +1,6 @@ { "mockBidRequest": { - "id": "test-request-id", + "id": "filter-imp-without-ogury-params", "site": { "publisher": { "id": "pub123" @@ -14,9 +14,6 @@ }, "ext": { "gpid": "global position id", - "prebid": { - "adunitcode": "ad-unit-code" - }, "bidder": { "assetKey": "OGY", "adUnitId": "123" @@ -37,9 +34,6 @@ }, "ext": { "gpid": "global position id", - "prebid": { - "adunitcode": "ad-unit-code-2" - }, "bidder": { "assetKey": "OGY3", "adUnitId": "1234" @@ -54,7 +48,7 @@ "expectedRequest": { "uri": "http://ogury.example.com", "body": { - "id": "test-request-id", + "id": "filter-imp-without-ogury-params", "site": { "publisher": { "id": "pub123" @@ -63,32 +57,26 @@ "imp": [ { "id":"test-imp-id", - "tagid": "ad-unit-code", + "tagid": "test-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123", - "prebid": { - "adunitcode": "ad-unit-code" - } + "adUnitId": "123" } }, { "id":"test-imp-id-3", - "tagid": "ad-unit-code-2", + "tagid": "test-imp-id-3", "banner": { "format": [{"w": 1, "h": 1}] }, "ext": { "gpid": "global position id", "assetKey": "OGY3", - "adUnitId": "1234", - "prebid": { - "adunitcode": "ad-unit-code-2" - } + "adUnitId": "1234" } } ] diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json index 62cc253ecbc..47d422fe6d0 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json @@ -1,6 +1,6 @@ { "mockBidRequest": { - "id": "test-request-id", + "id": "every-imp-without-param-dont-filter-imps", "site": { "publisher": { "id": "pub123" @@ -14,9 +14,6 @@ }, "ext": { "gpid": "global position id", - "prebid": { - "adunitcode": "ad-unit-code" - }, "bidder": {} } }, @@ -35,7 +32,7 @@ "expectedRequest": { "uri": "http://ogury.example.com", "body": { - "id": "test-request-id", + "id": "every-imp-without-param-dont-filter-imps", "site": { "publisher": { "id": "pub123" @@ -44,15 +41,12 @@ "imp": [ { "id":"test-imp-id", - "tagid": "ad-unit-code", + "tagid": "test-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, "ext": { - "gpid": "global position id", - "prebid": { - "adunitcode": "ad-unit-code" - } + "gpid": "global position id" } }, { diff --git a/adapters/ogury/ogurytest/exemplary/banner_publisher.json b/adapters/ogury/ogurytest/exemplary/banner_publisher.json index 1d8e2fd5a61..cbcab50d8d0 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_publisher.json +++ b/adapters/ogury/ogurytest/exemplary/banner_publisher.json @@ -12,11 +12,7 @@ "banner": { "format": [{"w": 128, "h": 100}] }, - "ext": { - "prebid": { - "adunitcode": "ad-unit-code" - } - } + "ext": {} } ] }, @@ -35,15 +31,11 @@ "imp": [ { "id":"test-imp-id", - "tagid": "ad-unit-code", + "tagid": "test-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, - "ext": { - "prebid": { - "adunitcode": "ad-unit-code" - } - } + "ext": {} } ] }, diff --git a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json index b1e4ec26748..f208c95dfd5 100644 --- a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json +++ b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json @@ -1,6 +1,6 @@ { "mockBidRequest": { - "id": "test-request-id", + "id": "every-param-in-imp.ext.bidder-is-hoisted-to-imp.ext", "imp": [ { "id": "test-imp-id", @@ -9,9 +9,6 @@ }, "ext": { "gpid": "global position id", - "prebid": { - "adunitcode": "ad-unit-code" - }, "bidder": { "assetKey": "OGY", "adUnitId": "123", @@ -27,11 +24,11 @@ "expectedRequest": { "uri": "http://ogury.example.com", "body": { - "id": "test-request-id", + "id": "every-param-in-imp.ext.bidder-is-hoisted-to-imp.ext", "imp": [ { "id":"test-imp-id", - "tagid": "ad-unit-code", + "tagid": "test-imp-id", "banner": { "format": [{"w": 128, "h": 100}] }, @@ -39,10 +36,7 @@ "gpid": "global position id", "assetKey": "OGY", "adUnitId": "123", - "testcampaign": "test123", - "prebid": { - "adunitcode": "ad-unit-code" - } + "testcampaign": "test123" } } ] From 119a5176691d6292928e3cbccd08c5e21df4a134 Mon Sep 17 00:00:00 2001 From: Ivan Krdzavac Date: Fri, 13 Dec 2024 15:06:33 +0100 Subject: [PATCH 9/9] ADV-20406 address pr comments (#12) * use jsonutil package instead standard json lib * don't allocate newImpExt, use impExt for hoisting bidder.params * rename to buildHeader * set IPv6 header * use mtype from response --- adapters/ogury/ogury.go | 63 ++++++++----------- .../exemplary/banner_asset_ad_unit.json | 12 +++- .../banner_multi_imp_with_params.json | 18 ++++-- ...banner_multi_imp_without_ogury_params.json | 11 ++-- .../ogurytest/exemplary/banner_publisher.json | 6 +- ...ode.json => banner_with_ad_unit_code.json} | 18 +++++- .../banner_with_arbitary_bidder_param.json | 13 +++- 7 files changed, 85 insertions(+), 56 deletions(-) rename adapters/ogury/ogurytest/supplemental/{banner_without_ad_unit_code.json => banner_with_ad_unit_code.json} (80%) diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go index 5e7436434e8..f35a098a8ed 100644 --- a/adapters/ogury/ogury.go +++ b/adapters/ogury/ogury.go @@ -12,6 +12,7 @@ import ( "github.com/prebid/prebid-server/v3/config" "github.com/prebid/prebid-server/v3/errortypes" "github.com/prebid/prebid-server/v3/openrtb_ext" + "github.com/prebid/prebid-server/v3/util/jsonutil" ) type adapter struct { @@ -23,7 +24,7 @@ func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) ( } func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - headers := setHeaders(request) + headers := buildHeaders(request) request.Imp = filterValidImps(request) if len(request.Imp) == 0 { @@ -36,34 +37,26 @@ func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapter for i, imp := range request.Imp { var impExt, impExtBidderHoist map[string]json.RawMessage // extract ext - if err := json.Unmarshal(imp.Ext, &impExt); err != nil { + if err := jsonutil.Unmarshal(imp.Ext, &impExt); err != nil { return nil, append(errors, &errortypes.BadInput{ Message: "Bidder extension not provided or can't be unmarshalled", }) } // find Ogury bidder params if bidder, ok := impExt[openrtb_ext.PrebidExtBidderKey]; ok { - if err := json.Unmarshal(bidder, &impExtBidderHoist); err != nil { + if err := jsonutil.Unmarshal(bidder, &impExtBidderHoist); err != nil { return nil, append(errors, &errortypes.BadInput{ Message: "Ogury bidder extension not provided or can't be unmarshalled", }) } } - newImpExt := make(map[string]any, len(impExt)-1+len(impExtBidderHoist)) - - // copy every imp.ext field to the new "ext" object except for imp.ext.bidder - for key, value := range impExt { - if key != openrtb_ext.PrebidExtBidderKey { - newImpExt[key] = value - } - } - // extract Ogury params from imp.ext.bidder to imp.ext + // extract every value from imp[].ext.bidder to imp[].ext for key, value := range impExtBidderHoist { - newImpExt[key] = value + impExt[key] = value } - ext, err := json.Marshal(newImpExt) + ext, err := jsonutil.Marshal(impExt) if err != nil { return nil, append(errors, &errortypes.BadInput{ Message: "Error while marshaling Imp.Ext bidder exension", @@ -93,7 +86,7 @@ func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapter } } - requestJSON, err := json.Marshal(request) + requestJSON, err := jsonutil.Marshal(request) if err != nil { return nil, []error{err} } @@ -115,10 +108,10 @@ func filterValidImps(request *openrtb2.BidRequest) (validImps []openrtb2.Imp) { var impExt adapters.ExtImpBidder var impExtOgury openrtb_ext.ImpExtOgury - if err := json.Unmarshal(imp.Ext, &impExt); err != nil { + if err := jsonutil.Unmarshal(imp.Ext, &impExt); err != nil { continue } - if err := json.Unmarshal(impExt.Bidder, &impExtOgury); err != nil { + if err := jsonutil.Unmarshal(impExt.Bidder, &impExtOgury); err != nil { continue } if impExtOgury.AssetKey != "" && impExtOgury.AdUnitID != "" { @@ -140,11 +133,12 @@ func filterValidImps(request *openrtb2.BidRequest) (validImps []openrtb2.Imp) { return nil } -func setHeaders(request *openrtb2.BidRequest) http.Header { +func buildHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") if request.Device != nil { headers.Add("X-Forwarded-For", request.Device.IP) + headers.Add("X-Forwarded-For", request.Device.IPv6) headers.Add("User-Agent", request.Device.UA) headers.Add("Accept-Language", request.Device.Language) } @@ -152,23 +146,20 @@ func setHeaders(request *openrtb2.BidRequest) http.Header { } -func getMediaTypeForBid(impressions []openrtb2.Imp, bid openrtb2.Bid) (openrtb_ext.BidType, error) { - for _, imp := range impressions { - if imp.ID == bid.ImpID { - switch { - case imp.Banner != nil: - return openrtb_ext.BidTypeBanner, nil - case imp.Video != nil: - return openrtb_ext.BidTypeVideo, nil - case imp.Native != nil: - return openrtb_ext.BidTypeNative, nil - } +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupAudio: + return openrtb_ext.BidTypeAudio, nil + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + default: + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unsupported MType \"%d\", for impression \"%s\"", bid.MType, bid.ImpID), } - - } - - return "", &errortypes.BadServerResponse{ - Message: fmt.Sprintf("Failed to determine media type of impression \"%s\"", bid.ImpID), } } @@ -181,7 +172,7 @@ func (a adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, } var response openrtb2.BidResponse - if err := json.Unmarshal(responseData.Body, &response); err != nil { + if err := jsonutil.Unmarshal(responseData.Body, &response); err != nil { return nil, []error{err} } @@ -190,7 +181,7 @@ func (a adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, var errors []error for _, seatBid := range response.SeatBid { for i, bid := range seatBid.Bid { - bidType, err := getMediaTypeForBid(request.Imp, bid) + bidType, err := getMediaTypeForBid(bid) if err != nil { errors = append(errors, err) continue diff --git a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json index 7c550c9e7ce..99b58b3d3cf 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json +++ b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json @@ -34,7 +34,11 @@ "ext": { "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123" + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } } } ] @@ -56,7 +60,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }] } ] @@ -77,7 +82,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json index f270f4ed955..ea39fb40c33 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json @@ -64,7 +64,11 @@ "ext": { "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123" + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } } }, { @@ -76,7 +80,11 @@ "ext": { "gpid": "global position id", "assetKey": "OGY3", - "adUnitId": "1234" + "adUnitId": "1234", + "bidder": { + "assetKey": "OGY3", + "adUnitId": "1234" + } } } ] @@ -98,7 +106,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }] } ] @@ -119,7 +128,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json index 47d422fe6d0..83a5be5a31d 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json @@ -13,8 +13,7 @@ "format": [{"w": 128, "h": 100}] }, "ext": { - "gpid": "global position id", - "bidder": {} + "gpid": "global position id" } }, { @@ -22,7 +21,7 @@ "banner": { "format": [{"w": 128, "h": 100}] }, - "ext": {"bidder": {}} + "ext": {} } ] }, @@ -76,7 +75,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }] } ] @@ -97,7 +97,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/ogury/ogurytest/exemplary/banner_publisher.json b/adapters/ogury/ogurytest/exemplary/banner_publisher.json index cbcab50d8d0..a6c5d3ac143 100644 --- a/adapters/ogury/ogurytest/exemplary/banner_publisher.json +++ b/adapters/ogury/ogurytest/exemplary/banner_publisher.json @@ -56,7 +56,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }] } ] @@ -77,7 +78,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json b/adapters/ogury/ogurytest/supplemental/banner_with_ad_unit_code.json similarity index 80% rename from adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json rename to adapters/ogury/ogurytest/supplemental/banner_with_ad_unit_code.json index 6ac73bc2212..f77774dfbf2 100644 --- a/adapters/ogury/ogurytest/supplemental/banner_without_ad_unit_code.json +++ b/adapters/ogury/ogurytest/supplemental/banner_with_ad_unit_code.json @@ -12,6 +12,9 @@ "bidder": { "assetKey": "OGY", "adUnitId": "123" + }, + "prebid": { + "adunitcode": "ad-unit-code" } } } @@ -34,7 +37,14 @@ "ext": { "gpid": "global position id", "assetKey": "OGY", - "adUnitId": "123" + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + }, + "prebid": { + "adunitcode": "ad-unit-code" + } } } ] @@ -56,7 +66,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }] } ] @@ -77,7 +88,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json index f208c95dfd5..6674d4dbac5 100644 --- a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json +++ b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json @@ -36,7 +36,12 @@ "gpid": "global position id", "assetKey": "OGY", "adUnitId": "123", - "testcampaign": "test123" + "testcampaign": "test123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123", + "testcampaign": "test123" + } } } ] @@ -58,7 +63,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }] } ] @@ -79,7 +85,8 @@ "adm": "adm string", "crid": "crid_10", "h": 100, - "w": 128 + "w": 128, + "mtype": 1 }, "type": "banner" }