From 18c794b8ec2a03260b77b7ce17df6da1b7d22208 Mon Sep 17 00:00:00 2001 From: Piotr Jaworski Date: Fri, 13 Oct 2023 12:58:42 +0200 Subject: [PATCH 1/3] RTBHouse: native support --- adapters/rtbhouse/rtbhouse.go | 63 ++++++++- .../bidfloor-as-bidder-param-without-cur.json | 130 +++++++++++++++++ .../exemplary/bidfloor-as-bidder-param.json | 133 ++++++++++++++++++ .../bidfloor-as-impbidfloor-with-cur.json | 130 +++++++++++++++++ .../bidfloor-as-impbidfloor-without-cur.json | 128 +++++++++++++++++ .../exemplary/currency-conversion.json | 123 ---------------- .../native-with-deprecated-native-prop.json | 100 +++++++++++++ .../native-with-proper-native-response.json | 100 +++++++++++++ .../exemplary/simple-banner-no-mtype.json | 87 ++++++++++++ .../rtbhousetest/exemplary/simple-banner.json | 6 +- ...bidfloors-given-param-and-impbidfloor.json | 132 +++++++++++++++++ .../faulty-request-bidder-params.json | 30 ++++ .../faulty-request-no-impext.json | 25 ++++ .../native-with-faulty-adm-native-prop.json | 84 +++++++++++ .../native-with-faulty-adm-response.json | 84 +++++++++++ static/bidder-info/rtbhouse.yaml | 1 + 16 files changed, 1227 insertions(+), 129 deletions(-) create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param-without-cur.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-with-cur.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-without-cur.json delete mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/currency-conversion.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/native-with-deprecated-native-prop.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/native-with-proper-native-response.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json create mode 100644 adapters/rtbhouse/rtbhousetest/exemplary/two-bidfloors-given-param-and-impbidfloor.json create mode 100644 adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-bidder-params.json create mode 100644 adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-no-impext.json create mode 100644 adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json create mode 100644 adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index dc67df9aa2b..1d00c898fd3 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -2,10 +2,12 @@ package rtbhouse import ( "encoding/json" + "errors" "fmt" "net/http" "strings" + "github.com/buger/jsonparser" "github.com/prebid/openrtb/v19/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" @@ -49,9 +51,12 @@ func (adapter *RTBHouseAdapter) MakeRequests( if err != nil { return nil, []error{err} } - if rtbhouseExt.BidFloor > 0 && len(reqCopy.Cur) > 0 { - bidFloorCur = reqCopy.Cur[0] + if rtbhouseExt.BidFloor > 0 { bidFloor = rtbhouseExt.BidFloor + bidFloorCur = BidderCurrency + if len(reqCopy.Cur) > 0 { + bidFloorCur = reqCopy.Cur[0] + } } } @@ -155,9 +160,27 @@ func (adapter *RTBHouseAdapter) MakeBids( var typedBid *adapters.TypedBid for _, seatBid := range openRTBBidderResponse.SeatBid { for _, bid := range seatBid.Bid { + var err error bid := bid // pin! -> https://github.com/kyoh86/scopelint#whats-this - typedBid = &adapters.TypedBid{Bid: &bid, BidType: "banner"} - bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + bidType := getMediaTypeForBid(bid) + + if bidType != "" { + typedBid = &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } + + // for native bid responses fix Adm field + if typedBid.BidType == openrtb_ext.BidTypeNative { + bid.AdM, err = getNativeAdm(bid.AdM) + if err != nil { + errs = append(errs, err) + return nil, errs + } + } + + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + } } } @@ -166,3 +189,35 @@ func (adapter *RTBHouseAdapter) MakeBids( return bidderResponse, nil } + +func getMediaTypeForBid(bid openrtb2.Bid) openrtb_ext.BidType { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative + default: + return "" + } +} + +func getNativeAdm(adm string) (string, error) { + var err error + nativeAdm := make(map[string]interface{}) + err = json.Unmarshal([]byte(adm), &nativeAdm) + if err != nil { + return adm, errors.New("unable to unmarshal native adm") + } + + // move bid.adm.native to bid.adm + if _, ok := nativeAdm["native"]; ok { + //using jsonparser to avoid marshaling, encode escape, etc. + value, dataType, _, err := jsonparser.Get([]byte(adm), string(openrtb_ext.BidTypeNative)) + if err != nil || dataType != jsonparser.Object { + return adm, errors.New("unable to get native adm") + } + adm = string(value) + } + + return adm, nil +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param-without-cur.json b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param-without-cur.json new file mode 100644 index 00000000000..79aa038c3ca --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param-without-cur.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "12345", + "bidfloor": 3.00 + } + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "bidfloor": 3.00, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "publisherId": "12345", + "bidfloor": 3.00 + } + }, + "id": "test-imp-id" + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param.json b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param.json new file mode 100644 index 00000000000..99b3a87ebfa --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-bidder-param.json @@ -0,0 +1,133 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "cur": [ + "EUR" + ], + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": "12345", + "bidfloor": 2 + } + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "bidfloor": 0.1, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "publisherId": "12345", + "bidfloor": 2 + } + }, + "id": "test-imp-id" + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-with-cur.json b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-with-cur.json new file mode 100644 index 00000000000..85e8a1c28cf --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-with-cur.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 1.00, + "bidfloorcur": "EUR", + "ext": { + "bidder": { + "publisherId": "12345" + } + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "bidfloor": 0.05, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "publisherId": "12345" + } + }, + "id": "test-imp-id" + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-without-cur.json b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-without-cur.json new file mode 100644 index 00000000000..1417965741e --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/bidfloor-as-impbidfloor-without-cur.json @@ -0,0 +1,128 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 1.00, + "ext": { + "bidder": { + "publisherId": "12345" + } + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "bidfloor": 1, + "ext": { + "bidder": { + "publisherId": "12345" + } + }, + "id": "test-imp-id" + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/currency-conversion.json b/adapters/rtbhouse/rtbhousetest/exemplary/currency-conversion.json deleted file mode 100644 index 95bfb1e4420..00000000000 --- a/adapters/rtbhouse/rtbhousetest/exemplary/currency-conversion.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "bidfloor": 1.00, - "bidfloorcur": "EUR", - "ext": { - "bidder": { - "placementId": "12345" - } - } - } - ], - "ext": { - "prebid": { - "currency": { - "rates": { - "EUR": { - "USD": 0.05 - } - }, - "usepbsrates": false - } - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://localhost/prebid_server", - "body": { - "id": "test-request-id", - "cur": ["USD"], - "imp": [ - { - "banner": { - "format": [ - { - "h": 250, - "w": 300 - } - ] - }, - "bidfloor": 0.05, - "bidfloorcur": "USD", - "ext": { - "bidder": { - "placementId": "12345" - } - }, - "id": "test-imp-id" - } - ], - "ext": { - "prebid": { - "currency": { - "rates": { - "EUR": { - "USD": 0.05 - } - }, - "usepbsrates": false - } - } - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-response-id", - "cur": "USD", - "seatbid": [{ - "seat": "rtbhouse", - "bid": [{ - "id": "randomid", - "impid": "test-imp-id", - "price": 300, - "adid": "12345678", - "adm": "some-test-ad", - "cid": "987", - "crid": "12345678", - "h": 250, - "w": 300 - } - ] - }] - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "randomid", - "impid": "test-imp-id", - "price": 300, - "adid": "12345678", - "adm": "some-test-ad", - "cid": "987", - "crid": "12345678", - "h": 250, - "w": 300 - }, - "type": "banner" - } - ] - } - ] - } diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/native-with-deprecated-native-prop.json b/adapters/rtbhouse/rtbhousetest/exemplary/native-with-deprecated-native-prop.json new file mode 100644 index 00000000000..e79b21a1207 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/native-with-deprecated-native-prop.json @@ -0,0 +1,100 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "bidder": {} + }, + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "id": "test-native-request", + "ext": {}, + "debug": 1 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-native-request", + "cur": [ + "USD" + ], + "imp": [ + { + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + }, + "ext": { + "bidder": {} + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "ext": {} + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-native-request", + "bidid": "test-bidid", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "test-native-request", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"title\":{\"text\":\"title text\"}},{\"id\":1,\"data\":{\"value\":\"data value\"}},{\"id\":2,\"img\":{\"url\":\"image.url\",\"w\":1200,\"h\":628}}],\"link\":{\"url\":\"link.url\"},\"imptrackers\":[\"imp.tracker.url\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"event.tracker.url\"}]}}", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 4 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-native-request", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"title\":{\"text\":\"title text\"}},{\"id\":1,\"data\":{\"value\":\"data value\"}},{\"id\":2,\"img\":{\"url\":\"image.url\",\"w\":1200,\"h\":628}}],\"link\":{\"url\":\"link.url\"},\"imptrackers\":[\"imp.tracker.url\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"event.tracker.url\"}]}", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 4 + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/native-with-proper-native-response.json b/adapters/rtbhouse/rtbhousetest/exemplary/native-with-proper-native-response.json new file mode 100644 index 00000000000..9f5962fd3a1 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/native-with-proper-native-response.json @@ -0,0 +1,100 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "bidder": {} + }, + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "id": "test-native-request", + "ext": {}, + "debug": 1 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-native-request", + "cur": [ + "USD" + ], + "imp": [ + { + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + }, + "ext": { + "bidder": {} + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "ext": {} + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-native-request", + "bidid": "test-bidid", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "test-native-request", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"title\":{\"text\":\"title text\"}},{\"id\":1,\"data\":{\"value\":\"data value\"}},{\"id\":2,\"img\":{\"url\":\"image.url\",\"w\":1200,\"h\":628}}],\"link\":{\"url\":\"link.url\"},\"imptrackers\":[\"imp.tracker.url\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"event.tracker.url\"}]}", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 4 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "test-native-request", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"title\":{\"text\":\"title text\"}},{\"id\":1,\"data\":{\"value\":\"data value\"}},{\"id\":2,\"img\":{\"url\":\"image.url\",\"w\":1200,\"h\":628}}],\"link\":{\"url\":\"link.url\"},\"imptrackers\":[\"imp.tracker.url\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"event.tracker.url\"}]}", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 4 + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json b/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json new file mode 100644 index 00000000000..e503acdcbd0 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json @@ -0,0 +1,87 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": {} + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "site": { + "page": "https://good.site/url" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": {} + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 0.500000, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner.json b/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner.json index 2a8c4681ffa..468e73f2aca 100644 --- a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner.json +++ b/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner.json @@ -56,7 +56,8 @@ "cid": "987", "crid": "12345678", "h": 250, - "w": 300 + "w": 300, + "mtype": 1 }] }], "cur": "USD" @@ -76,7 +77,8 @@ "cid": "987", "crid": "12345678", "w": 300, - "h": 250 + "h": 250, + "mtype": 1 }, "type": "banner" }] diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/two-bidfloors-given-param-and-impbidfloor.json b/adapters/rtbhouse/rtbhousetest/exemplary/two-bidfloors-given-param-and-impbidfloor.json new file mode 100644 index 00000000000..fc706d97004 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/exemplary/two-bidfloors-given-param-and-impbidfloor.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "bidfloor": 1.00, + "bidfloorcur": "EUR", + "ext": { + "bidder": { + "publisherId": "12345", + "bidfloor": 2.00 + } + } + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "bidfloor": 0.05, + "bidfloorcur": "USD", + "ext": { + "bidder": { + "publisherId": "12345", + "bidfloor": 2 + } + }, + "id": "test-imp-id" + } + ], + "ext": { + "prebid": { + "currency": { + "rates": { + "EUR": { + "USD": 0.05 + } + }, + "usepbsrates": false + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 300, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-bidder-params.json b/adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-bidder-params.json new file mode 100644 index 00000000000..70fddf620e6 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-bidder-params.json @@ -0,0 +1,30 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "publisherId": 12345 + } + } + } + ], + "ext": {} + }, + "expectedMakeRequestsErrors": [ + { + "value": "Error while unmarshaling bidder extension", + "comparison": "literal" + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-no-impext.json b/adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-no-impext.json new file mode 100644 index 00000000000..f416f8106fa --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/supplemental/faulty-request-no-impext.json @@ -0,0 +1,25 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + } + } + ], + "ext": {} + }, + "expectedMakeRequestsErrors": [ + { + "value": "Bidder extension not provided or can't be unmarshalled", + "comparison": "literal" + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json new file mode 100644 index 00000000000..e4fb5d86a2a --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json @@ -0,0 +1,84 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "bidder": {} + }, + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "id": "test-native-request", + "ext": {}, + "debug": 1 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-native-request", + "cur": [ + "USD" + ], + "imp": [ + { + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + }, + "ext": { + "bidder": {} + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "ext": {} + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-native-request", + "bidid": "test-bidid", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "test-native-request", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"native\":\"faulty object\"}", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 4 + } + ] + } + ] + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unable to get native adm", + "comparison": "literal" + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json new file mode 100644 index 00000000000..e562dcdf7d4 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json @@ -0,0 +1,84 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "bidder": {} + }, + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "id": "test-native-request", + "ext": {}, + "debug": 1 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-native-request", + "cur": [ + "USD" + ], + "imp": [ + { + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + }, + "ext": { + "bidder": {} + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "ext": {} + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-native-request", + "bidid": "test-bidid", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "test-native-request", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"ver\":\"1.2\"", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 4 + } + ] + } + ] + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unable to unmarshal native adm", + "comparison": "literal" + } + ] +} diff --git a/static/bidder-info/rtbhouse.yaml b/static/bidder-info/rtbhouse.yaml index ad2fbfcbc95..b80cc0ff4f8 100644 --- a/static/bidder-info/rtbhouse.yaml +++ b/static/bidder-info/rtbhouse.yaml @@ -7,6 +7,7 @@ capabilities: site: mediaTypes: - banner + - native userSync: # rtbhouse supports user syncing, but requires configuration by the host. contact this # bidder directly at the email address in this file to ask about enabling user sync. From 4478925042fcfe69b9f4d2a7d88a9e186f35619a Mon Sep 17 00:00:00 2001 From: Piotr Jaworski Date: Fri, 13 Oct 2023 14:02:11 +0200 Subject: [PATCH 2/3] RTBHouse: unknown mtype defaults to banner (align with Java) --- adapters/rtbhouse/rtbhouse.go | 31 +++++++++---------- .../exemplary/simple-banner-no-mtype.json | 15 ++++++++- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index 1d00c898fd3..d642486edec 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -164,23 +164,21 @@ func (adapter *RTBHouseAdapter) MakeBids( bid := bid // pin! -> https://github.com/kyoh86/scopelint#whats-this bidType := getMediaTypeForBid(bid) - if bidType != "" { - typedBid = &adapters.TypedBid{ - Bid: &bid, - BidType: bidType, - } + typedBid = &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } - // for native bid responses fix Adm field - if typedBid.BidType == openrtb_ext.BidTypeNative { - bid.AdM, err = getNativeAdm(bid.AdM) - if err != nil { - errs = append(errs, err) - return nil, errs - } + // for native bid responses fix Adm field + if typedBid.BidType == openrtb_ext.BidTypeNative { + bid.AdM, err = getNativeAdm(bid.AdM) + if err != nil { + errs = append(errs, err) + return nil, errs } - - bidderResponse.Bids = append(bidderResponse.Bids, typedBid) } + + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) } } @@ -197,14 +195,13 @@ func getMediaTypeForBid(bid openrtb2.Bid) openrtb_ext.BidType { case openrtb2.MarkupNative: return openrtb_ext.BidTypeNative default: - return "" + return openrtb_ext.BidTypeBanner } } func getNativeAdm(adm string) (string, error) { - var err error nativeAdm := make(map[string]interface{}) - err = json.Unmarshal([]byte(adm), &nativeAdm) + err := json.Unmarshal([]byte(adm), &nativeAdm) if err != nil { return adm, errors.New("unable to unmarshal native adm") } diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json b/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json index e503acdcbd0..6f7e9d34521 100644 --- a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json +++ b/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json @@ -81,7 +81,20 @@ "expectedBidResponses": [ { "currency": "USD", - "bids": [] + "bids": [{ + "bid": { + "id": "randomid", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "12345678", + "cid": "987", + "crid": "12345678", + "w": 300, + "h": 250 + }, + "type": "banner" + }] } ] } From 3012d465c90289d8749920c8b0bb6c7c9d4281e4 Mon Sep 17 00:00:00 2001 From: Piotr Jaworski Date: Fri, 20 Oct 2023 11:45:33 +0200 Subject: [PATCH 3/3] RTBHouse: detecting media type may return an error --- adapters/rtbhouse/rtbhouse.go | 43 +++--- ...ner-native-req-faulty-mtype-in-native.json | 141 ++++++++++++++++++ .../native-with-faulty-adm-native-prop.json | 6 + .../native-with-faulty-adm-response.json | 6 + .../supplemental/simple-banner-bad-mtype.json | 94 ++++++++++++ .../simple-banner-no-mtype.json | 21 +-- 6 files changed, 277 insertions(+), 34 deletions(-) create mode 100644 adapters/rtbhouse/rtbhousetest/supplemental/banner-native-req-faulty-mtype-in-native.json create mode 100644 adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-bad-mtype.json rename adapters/rtbhouse/rtbhousetest/{exemplary => supplemental}/simple-banner-no-mtype.json (83%) diff --git a/adapters/rtbhouse/rtbhouse.go b/adapters/rtbhouse/rtbhouse.go index d642486edec..68436f1d17e 100644 --- a/adapters/rtbhouse/rtbhouse.go +++ b/adapters/rtbhouse/rtbhouse.go @@ -160,42 +160,45 @@ func (adapter *RTBHouseAdapter) MakeBids( var typedBid *adapters.TypedBid for _, seatBid := range openRTBBidderResponse.SeatBid { for _, bid := range seatBid.Bid { - var err error bid := bid // pin! -> https://github.com/kyoh86/scopelint#whats-this - bidType := getMediaTypeForBid(bid) - - typedBid = &adapters.TypedBid{ - Bid: &bid, - BidType: bidType, - } + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errs = append(errs, err) + continue + } else { + typedBid = &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + } - // for native bid responses fix Adm field - if typedBid.BidType == openrtb_ext.BidTypeNative { - bid.AdM, err = getNativeAdm(bid.AdM) - if err != nil { - errs = append(errs, err) - return nil, errs + // for native bid responses fix Adm field + if typedBid.BidType == openrtb_ext.BidTypeNative { + bid.AdM, err = getNativeAdm(bid.AdM) + if err != nil { + errs = append(errs, err) + continue + } } - } - bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + } } } bidderResponse.Currency = BidderCurrency - return bidderResponse, nil + return bidderResponse, errs } -func getMediaTypeForBid(bid openrtb2.Bid) openrtb_ext.BidType { +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { switch bid.MType { case openrtb2.MarkupBanner: - return openrtb_ext.BidTypeBanner + return openrtb_ext.BidTypeBanner, nil case openrtb2.MarkupNative: - return openrtb_ext.BidTypeNative + return openrtb_ext.BidTypeNative, nil default: - return openrtb_ext.BidTypeBanner + return "", fmt.Errorf("unrecognized bid type in response from rtbhouse for bid %s", bid.ImpID) } } diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/banner-native-req-faulty-mtype-in-native.json b/adapters/rtbhouse/rtbhousetest/supplemental/banner-native-req-faulty-mtype-in-native.json new file mode 100644 index 00000000000..6e6f415acbc --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/supplemental/banner-native-req-faulty-mtype-in-native.json @@ -0,0 +1,141 @@ +{ + "mockBidRequest": { + "imp": [ + { + "ext": { + "bidder": {} + }, + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + } + }, + { + "id": "test-banner-imp", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": {} + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "id": "test-multi-slot-request", + "ext": {}, + "debug": 1 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-multi-slot-request", + "cur": [ + "USD" + ], + "imp": [ + { + "id": "test-native-imp", + "native": { + "request": "{\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]}],\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"required\":1,\"title\":{\"len\":140}},{\"id\":1,\"required\":1,\"data\":{\"type\":2}},{\"id\":2,\"required\":1,\"img\":{\"type\":3}}]}", + "ver": "1.2" + }, + "ext": { + "bidder": {} + } + }, + { + "id": "test-banner-imp", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }] + }, + "ext": { + "bidder": {} + } + } + ], + "site": { + "page": "https://good.site/url" + }, + "ext": {} + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-multi-slot-request", + "bidid": "test-bidid", + "cur": "USD", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid-native", + "impid": "test-native-imp", + "price": 0.5, + "adid": "test-adid", + "adm": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":0,\"title\":{\"text\":\"title text\"}},{\"id\":1,\"data\":{\"value\":\"data value\"}},{\"id\":2,\"img\":{\"url\":\"image.url\",\"w\":1200,\"h\":628}}],\"link\":{\"url\":\"link.url\"},\"imptrackers\":[\"imp.tracker.url\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"event.tracker.url\"}]}}", + "adomain": [ "adomain.com" ], + "cid": "test-cid", + "crid": "test-crid", + "dealid": "test-dealid", + "mtype": 99 + }, + { + "id": "randomid-banner", + "impid": "test-banner-imp", + "price": 0.500000, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [{ + "bid": { + "id": "randomid-banner", + "impid": "test-banner-imp", + "price": 0.500000, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unrecognized bid type in response from rtbhouse for bid test-native-imp", + "comparison": "literal" + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json index e4fb5d86a2a..5e1aa0ef4b7 100644 --- a/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json +++ b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-native-prop.json @@ -75,6 +75,12 @@ } } ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ], "expectedMakeBidsErrors": [ { "value": "unable to get native adm", diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json index e562dcdf7d4..41cc909f304 100644 --- a/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json +++ b/adapters/rtbhouse/rtbhousetest/supplemental/native-with-faulty-adm-response.json @@ -75,6 +75,12 @@ } } ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ], "expectedMakeBidsErrors": [ { "value": "unable to unmarshal native adm", diff --git a/adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-bad-mtype.json b/adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-bad-mtype.json new file mode 100644 index 00000000000..fc52cc30601 --- /dev/null +++ b/adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-bad-mtype.json @@ -0,0 +1,94 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": { + "page": "https://good.site/url" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": {} + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://localhost/prebid_server", + "body": { + "id": "test-request-id", + "cur": [ + "USD" + ], + "site": { + "page": "https://good.site/url" + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": {} + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "rtbhouse", + "bid": [ + { + "id": "randomid", + "impid": "test-imp-id", + "price": 0.500000, + "adid": "12345678", + "adm": "some-test-ad", + "cid": "987", + "crid": "12345678", + "h": 250, + "w": 300, + "mtype": 99 + } + ] + } + ], + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unrecognized bid type in response from rtbhouse for bid test-imp-id", + "comparison": "literal" + } + ] +} diff --git a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json b/adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-no-mtype.json similarity index 83% rename from adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json rename to adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-no-mtype.json index 6f7e9d34521..8bb9e8a1f89 100644 --- a/adapters/rtbhouse/rtbhousetest/exemplary/simple-banner-no-mtype.json +++ b/adapters/rtbhouse/rtbhousetest/supplemental/simple-banner-no-mtype.json @@ -81,20 +81,13 @@ "expectedBidResponses": [ { "currency": "USD", - "bids": [{ - "bid": { - "id": "randomid", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "12345678", - "cid": "987", - "crid": "12345678", - "w": 300, - "h": 250 - }, - "type": "banner" - }] + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unrecognized bid type in response from rtbhouse for bid test-imp-id", + "comparison": "literal" } ] }