From 9c182ad295467d2661358b7587b44b157544c559 Mon Sep 17 00:00:00 2001 From: Karim Mourra Date: Wed, 24 Sep 2025 13:18:02 -0300 Subject: [PATCH] Connatix: Copy entire imp[i].ext (#4521) --- adapters/connatix/connatix.go | 17 +- .../bid-request-imp-ext-persistence.json | 194 ++++++++++++++++++ adapters/connatix/models.go | 4 - 3 files changed, 205 insertions(+), 10 deletions(-) create mode 100644 adapters/connatix/connatixtest/supplemental/bid-request-imp-ext-persistence.json diff --git a/adapters/connatix/connatix.go b/adapters/connatix/connatix.go index 11cf7a146..c479a2892 100644 --- a/adapters/connatix/connatix.go +++ b/adapters/connatix/connatix.go @@ -222,15 +222,20 @@ func buildRequestImp(imp *openrtb2.Imp, ext impExtIncoming, displayManagerVer st imp.BidFloor = convertedValue } - impExt := impExt{ - Connatix: impExtConnatix{ - PlacementId: ext.Bidder.PlacementId, - ViewabilityPercentage: ext.Bidder.ViewabilityPercentage, - }, + var incomingExt map[string]interface{} + if err := jsonutil.Unmarshal(imp.Ext, &incomingExt); err != nil { + incomingExt = make(map[string]interface{}) + } + + delete(incomingExt, "bidder") + + incomingExt["connatix"] = impExtConnatix{ + PlacementId: ext.Bidder.PlacementId, + ViewabilityPercentage: ext.Bidder.ViewabilityPercentage, } var err error - imp.Ext, err = json.Marshal(impExt) + imp.Ext, err = json.Marshal(incomingExt) return err } diff --git a/adapters/connatix/connatixtest/supplemental/bid-request-imp-ext-persistence.json b/adapters/connatix/connatixtest/supplemental/bid-request-imp-ext-persistence.json new file mode 100644 index 000000000..00b99b818 --- /dev/null +++ b/adapters/connatix/connatixtest/supplemental/bid-request-imp-ext-persistence.json @@ -0,0 +1,194 @@ +{ + "mockBidRequest": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 500, + "user": { + "buyeruid": "1-some-user" + }, + "app": { + "publisher": { + "id": "123456789" + }, + "cat": [ + "IAB22-1" + ], + "bundle": "com.app.awesome", + "name": "Awesome App", + "domain": "awesomeapp.com", + "id": "123456789", + "ext": { + "prebid": { + "source": "test", + "version": "1.0.0" + } + } + }, + "imp": [ + { + "id": "some-imp-id", + "tagid": "some-tag-id", + "banner": { + "format":[ + { + "w": 320, + "h": 50 + } + ] + }, + "ext": { + "bidder": { + "placementId": "some-placement-id", + "viewabilityPercentage": 0.6 + }, + "random": { + "data_a": { + "data_1": "data_1" + }, + "data_b": { + "data_2": "data_2" + } + }, + "gpid": "test-gpid" + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://example.com?dc=us-east-2", + "body": { + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-imp-id", + "tagid": "some-tag-id", + "banner": { + "w": 320, + "h": 50, + "format": [ + { + "w": 320, + "h": 50 + } + ] + }, + "displaymanagerver": "test-1.0.0", + "ext": { + "connatix": { + "placementId": "some-placement-id", + "viewabilityPercentage": 0.6 + }, + "random": { + "data_a": { + "data_1": "data_1" + }, + "data_b": { + "data_2": "data_2" + } + }, + "gpid": "test-gpid" + } + } + ], + "app": { + "id": "123456789", + "name": "Awesome App", + "bundle": "com.app.awesome", + "domain": "awesomeapp.com", + "cat": [ + "IAB22-1" + ], + "publisher": { + "id": "123456789" + }, + "ext": { + "prebid": { + "source": "test", + "version": "1.0.0" + } + } + }, + "user": { + "buyeruid": "1-some-user" + }, + "tmax": 500 + }, + "impIDs": [ + "some-imp-id" + ] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [ + { + "bid": [ + { + "id": "some-bid-id", + "impid": "some-imp-id", + "price": 0.52, + "adm": "some-test-ad", + "adomain": [ + "test.com" + ], + "crid": "112233", + "w": 320, + "h": 50, + "ext": { + "connatix": { + "mediaType": "banner" + } + } + } + ], + "seat": "connatix", + "group": 0 + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-bid-id", + "impid": "some-imp-id", + "price": 0.52, + "adm": "some-test-ad", + "crid": "112233", + "adomain": [ + "test.com" + ], + "w": 320, + "h": 50, + "ext": { + "connatix": { + "mediaType": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] + } diff --git a/adapters/connatix/models.go b/adapters/connatix/models.go index 95317d7e2..aebd51d09 100644 --- a/adapters/connatix/models.go +++ b/adapters/connatix/models.go @@ -12,10 +12,6 @@ type impExtIncoming struct { Bidder openrtb_ext.ExtImpConnatix `json:"bidder"` } -type impExt struct { - Connatix impExtConnatix `json:"connatix"` -} - type impExtConnatix struct { PlacementId string `json:"placementId,omitempty"` ViewabilityPercentage float64 `json:"viewabilityPercentage,omitempty"`