diff --git a/adapters/rise/rise.go b/adapters/rise/rise.go index d9d9c2a4bc9..f243019014d 100644 --- a/adapters/rise/rise.go +++ b/adapters/rise/rise.go @@ -20,6 +20,14 @@ type adapter struct { endpointURL string } +type riseExtBidPrebid struct { + Meta *openrtb_ext.ExtBidPrebidMeta `json:"meta,omitempty"` +} + +type riseExtBid struct { + Prebid *riseExtBidPrebid `json:"prebid,omitempty"` +} + func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { return &adapter{ endpointURL: config.Endpoint, @@ -83,6 +91,7 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ Bid: &seatBid.Bid[i], BidType: bidType, + BidMeta: getBidMeta(bid), }) } } @@ -90,6 +99,19 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData return bidResponse, errs } +func getBidMeta(bid openrtb2.Bid) *openrtb_ext.ExtBidPrebidMeta { + if len(bid.Ext) == 0 { + return nil + } + + var bidExt riseExtBid + if err := jsonutil.Unmarshal(bid.Ext, &bidExt); err != nil || bidExt.Prebid == nil { + return nil + } + + return bidExt.Prebid.Meta +} + func extractOrg(openRTBRequest *openrtb2.BidRequest) (string, error) { var err error for _, imp := range openRTBRequest.Imp { diff --git a/adapters/rise/risetest/exemplary/simple-banner-meta.json b/adapters/rise/risetest/exemplary/simple-banner-meta.json new file mode 100644 index 00000000000..cbf00a284b4 --- /dev/null +++ b/adapters/rise/risetest/exemplary/simple-banner-meta.json @@ -0,0 +1,121 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher_id": "72721" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server?publisher_id=72721", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisher_id": "72721" + } + } + } + ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 1.5, + "adm": "some-test-ad", + "adomain": ["example.com"], + "crid": "29681110", + "h": 250, + "w": 300, + "mtype": 1, + "ext": { + "prebid": { + "meta": { + "advertiserDomains": ["example.com"], + "primaryCatId": "IAB1-1", + "secondaryCatIds": ["IAB1-2", "IAB1-3"] + } + } + } + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 1.5, + "adm": "some-test-ad", + "adomain": ["example.com"], + "crid": "29681110", + "w": 300, + "h": 250, + "mtype": 1, + "ext": { + "prebid": { + "meta": { + "advertiserDomains": ["example.com"], + "primaryCatId": "IAB1-1", + "secondaryCatIds": ["IAB1-2", "IAB1-3"] + } + } + } + }, + "type": "banner", + "bidMeta": { + "advertiserDomains": ["example.com"], + "primaryCatId": "IAB1-1", + "secondaryCatIds": ["IAB1-2", "IAB1-3"] + } + } + ] + } + ] +} \ No newline at end of file