diff --git a/adapters/stroeerCore/stroeercore.go b/adapters/stroeerCore/stroeercore.go index 733d549e907..f2ef4923d7b 100644 --- a/adapters/stroeerCore/stroeercore.go +++ b/adapters/stroeerCore/stroeercore.go @@ -23,17 +23,22 @@ type response struct { } type bidResponse struct { - ID string `json:"id"` - BidID string `json:"bidId"` - CPM float64 `json:"cpm"` - Width int64 `json:"width"` - Height int64 `json:"height"` - Ad string `json:"ad"` - CrID string `json:"crid"` - Mtype string `json:"mtype"` + ID string `json:"id"` + BidID string `json:"bidId"` + CPM float64 `json:"cpm"` + Width int64 `json:"width"` + Height int64 `json:"height"` + Ad string `json:"ad"` + CrID string `json:"crid"` + Mtype string `json:"mtype"` + DSA json.RawMessage `json:"dsa"` } -func (b bidResponse) resolveMediaType() (mt openrtb2.MarkupType, bt openrtb_ext.BidType, err error) { +type bidExt struct { + DSA json.RawMessage `json:"dsa,omitempty"` +} + +func (b *bidResponse) resolveMediaType() (mt openrtb2.MarkupType, bt openrtb_ext.BidType, err error) { switch b.Mtype { case "banner": return openrtb2.MarkupBanner, openrtb_ext.BidTypeBanner, nil @@ -82,6 +87,15 @@ func (a *adapter) MakeBids(bidRequest *openrtb2.BidRequest, requestData *adapter MType: markupType, } + if bid.DSA != nil { + dsaJson, err := json.Marshal(bidExt{bid.DSA}) + if err != nil { + errors = append(errors, err) + } else { + openRtbBid.Ext = dsaJson + } + } + bidderResponse.Bids = append(bidderResponse.Bids, &adapters.TypedBid{ Bid: &openRtbBid, BidType: bidType, diff --git a/adapters/stroeerCore/stroeercoretest/exemplary/dsa.json b/adapters/stroeerCore/stroeercoretest/exemplary/dsa.json new file mode 100644 index 00000000000..70baef5fc4b --- /dev/null +++ b/adapters/stroeerCore/stroeercoretest/exemplary/dsa.json @@ -0,0 +1,202 @@ +{ + "mockBidRequest": { + "id": "auction-id", + "cur": [ + "EUR" + ], + "imp": [ + { + "id": "1", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "sid": "123456" + } + } + } + ], + "device": { + "ip": "123.123.123.123" + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/some/path" + }, + "user": { + "buyeruid": "test-buyer-user-id" + }, + "regs": { + "ext": { + "dsa": { + "dsarequired": 3, + "pubrender": 0, + "datatopub": 2, + "transparency": [ + { + "domain": "example-platform.com", + "dsaparams": [ + 1 + ] + }, + { + "domain": "example-ssp.com", + "dsaparams": [ + 1, + 2 + ] + } + ] + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ] + }, + "uri": "http://localhost/s2sdsh", + "body": { + "id": "auction-id", + "cur": [ + "EUR" + ], + "imp": [ + { + "id": "1", + "tagid": "123456", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "sid": "123456" + } + } + } + ], + "device": { + "ip": "123.123.123.123" + }, + "site": { + "domain": "www.publisher.com", + "page": "http://www.publisher.com/some/path" + }, + "user": { + "buyeruid": "test-buyer-user-id" + }, + "regs": { + "ext": { + "dsa": { + "dsarequired": 3, + "pubrender": 0, + "datatopub": 2, + "transparency": [ + { + "domain": "example-platform.com", + "dsaparams": [ + 1 + ] + }, + { + "domain": "example-ssp.com", + "dsaparams": [ + 1, + 2 + ] + } + ] + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "bids": [ + { + "id": "1829273982920-01", + "bidId": "1", + "cpm": 2, + "width": 300, + "height": 600, + "ad": "advert", + "crid": "wasd", + "mtype": "banner", + "dsa": { + "behalf": "Advertiser A", + "paid": "Advertiser B", + "transparency": [ + { + "domain": "example-domain.com", + "dsaparams": [ + 1, + 2 + ] + } + ], + "adrender": 1 + } + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "EUR", + "bids": [ + { + "bid": { + "id": "1829273982920-01", + "impid": "1", + "price": 2, + "adm": "advert", + "w": 300, + "h": 600, + "crid": "wasd", + "mtype": 1, + "ext": { + "dsa": { + "behalf": "Advertiser A", + "paid": "Advertiser B", + "transparency": [ + { + "domain": "example-domain.com", + "dsaparams": [ + 1, + 2 + ] + } + ], + "adrender": 1 + } + } + }, + "type": "banner" + } + ] + } + ] +}