diff --git a/adapters/openweb/openweb.go b/adapters/openweb/openweb.go index b74e97dfc3f..a1996d056b2 100644 --- a/adapters/openweb/openweb.go +++ b/adapters/openweb/openweb.go @@ -2,10 +2,14 @@ package openweb import ( "encoding/json" + "errors" "fmt" "net/http" + "strconv" + "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" @@ -16,175 +20,115 @@ type adapter struct { endpoint string } -type openwebImpExt struct { - OpenWeb openrtb_ext.ExtImpOpenWeb `json:"openweb"` -} - -func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - totalImps := len(request.Imp) - errors := make([]error, 0, totalImps) - sourceIdToImpIds := make(map[int][]int) - var sourceIds []int - - for i := 0; i < totalImps; i++ { - - sourceId, err := validateImpression(&request.Imp[i]) - - if err != nil { - errors = append(errors, err) - continue - } - - if _, ok := sourceIdToImpIds[sourceId]; !ok { - sourceIdToImpIds[sourceId] = make([]int, 0, totalImps-i) - sourceIds = append(sourceIds, sourceId) - } - - sourceIdToImpIds[sourceId] = append(sourceIdToImpIds[sourceId], i) - +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) { + org, err := checkExtAndExtractOrg(request) + if err != nil { + errs = append(errs, fmt.Errorf("checkExtAndExtractOrg: %w", err)) + return nil, errs } - totalReqs := len(sourceIdToImpIds) - if totalReqs == 0 { - return nil, errors + requestJSON, err := json.Marshal(request) + if err != nil { + errs = append(errs, fmt.Errorf("marshal bidRequest: %w", err)) + return nil, errs } headers := http.Header{} headers.Add("Content-Type", "application/json;charset=utf-8") - headers.Add("Accept", "application/json") - reqs := make([]*adapters.RequestData, 0, totalReqs) + return append(requestsToBidder, &adapters.RequestData{ + Method: http.MethodPost, + Uri: a.endpoint + "?publisher_id=" + org, + Body: requestJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + }), nil +} - imps := request.Imp - reqCopy := *request - reqCopy.Imp = make([]openrtb2.Imp, totalImps) - for _, sourceId := range sourceIds { - impIds := sourceIdToImpIds[sourceId] - reqCopy.Imp = reqCopy.Imp[:0] +// checkExtAndExtractOrg checks the presence of required parameters and extracts the Org ID string. +func checkExtAndExtractOrg(request *openrtb2.BidRequest) (string, error) { + var err error + for _, imp := range request.Imp { + var bidderExt adapters.ExtImpBidder + if err = json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return "", fmt.Errorf("unmarshal bidderExt: %w", err) + } - for i := 0; i < len(impIds); i++ { - reqCopy.Imp = append(reqCopy.Imp, imps[impIds[i]]) + var impExt openrtb_ext.ExtImpOpenWeb + if err = json.Unmarshal(bidderExt.Bidder, &impExt); err != nil { + return "", fmt.Errorf("unmarshal ExtImpOpenWeb: %w", err) } - body, err := json.Marshal(reqCopy) - if err != nil { - errors = append(errors, fmt.Errorf("error while encoding bidRequest, err: %s", err)) - return nil, errors + if impExt.PlacementID == "" { + return "", errors.New("no placement id supplied") } - reqs = append(reqs, &adapters.RequestData{ - Method: "POST", - Uri: a.endpoint + fmt.Sprintf("?aid=%d", sourceId), - Body: body, - Headers: headers, - ImpIDs: openrtb_ext.GetImpIDs(reqCopy.Imp), - }) - } + if impExt.Org != "" { + return strings.TrimSpace(impExt.Org), nil + } - return reqs, errors + if impExt.Aid != 0 { + return strconv.Itoa(impExt.Aid), nil + } + } + return "", errors.New("no org or aid supplied") } -func (a *adapter) MakeBids(bidReq *openrtb2.BidRequest, unused *adapters.RequestData, httpRes *adapters.ResponseData) (*adapters.BidderResponse, []error) { - - if httpRes.StatusCode == http.StatusNoContent { +func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil } - if httpRes.StatusCode != http.StatusOK { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("Remote server error: %s", httpRes.Body), - }} - } - var bidResp openrtb2.BidResponse - if err := json.Unmarshal(httpRes.Body, &bidResp); err != nil { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("error while decoding response, err: %s", err), - }} + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{err} } - bidResponse := adapters.NewBidderResponse() - var errors []error + var response openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } - for _, sb := range bidResp.SeatBid { - for i := 0; i < len(sb.Bid); i++ { + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + if response.Cur != "" { + bidResponse.Currency = response.Cur + } - bid := sb.Bid[i] + var errs []error - mediaType, impOK := getBidType(bidReq.Imp, bid.ImpID) - if !impOK { - errors = append(errors, &errortypes.BadServerResponse{ - Message: fmt.Sprintf("ignoring bid id=%s, request doesn't contain any impression with id=%s", bid.ID, bid.ImpID), - }) + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errs = append(errs, err) continue } bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ - Bid: &bid, - BidType: mediaType, + Bid: &seatBid.Bid[i], + BidType: bidType, }) } } - return bidResponse, errors + return bidResponse, errs } -func getBidType(imps []openrtb2.Imp, impId string) (mediaType openrtb_ext.BidType, ok bool) { - mediaType = openrtb_ext.BidTypeBanner - for _, imp := range imps { - if imp.ID == impId { - ok = true - - if imp.Video != nil { - mediaType = openrtb_ext.BidTypeVideo - } - - break - } - } - - return -} - -func validateImpression(imp *openrtb2.Imp) (int, error) { - var bidderExt adapters.ExtImpBidder - - if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return 0, &errortypes.BadInput{ - Message: fmt.Sprintf("ignoring imp id=%s, error while decoding extImpBidder, err: %s", imp.ID, err), - } - } - - impExt := openrtb_ext.ExtImpOpenWeb{} - err := json.Unmarshal(bidderExt.Bidder, &impExt) - if err != nil { - return 0, &errortypes.BadInput{ - Message: fmt.Sprintf("ignoring imp id=%s, error while decoding impExt, err: %s", imp.ID, err), +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + default: + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("unsupported MType %d", bid.MType), } } - - var impExtBuffer []byte - - impExtBuffer, err = json.Marshal(&openwebImpExt{ - OpenWeb: impExt, - }) - if err != nil { - return 0, &errortypes.BadInput{ - Message: fmt.Sprintf("ignoring imp id=%s, error while encoding impExt, err: %s", imp.ID, err), - } - } - - if impExt.BidFloor > 0 { - imp.BidFloor = impExt.BidFloor - } - - imp.Ext = impExtBuffer - - return impExt.SourceID, nil } // Builder builds a new instance of the OpenWeb adapter for the given bidder with the given config. -func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { +func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { bidder := &adapter{ endpoint: config.Endpoint, } diff --git a/adapters/openweb/openweb_test.go b/adapters/openweb/openweb_test.go index a63dafd06c2..2a135acb1f0 100644 --- a/adapters/openweb/openweb_test.go +++ b/adapters/openweb/openweb_test.go @@ -10,7 +10,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderOpenWeb, config.Adapter{ - Endpoint: "http://ghb.spotim.market/pbs/ortb"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + Endpoint: "https://pbs.openwebmp.com/pbs"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) diff --git a/adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json b/adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json deleted file mode 100644 index 2fd7c195b3e..00000000000 --- a/adapters/openweb/openwebtest/exemplary/multiple-imps-same-aid.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 30, - "ext": { - "bidder": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 - } - } - }, - { - "id": "test-imp-id-2", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 30, - "ext": { - "bidder": { - "aid": 1000, - "siteId": 4321, - "bidFloor": 20 - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 20, - "ext": { - "openweb": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 - } - } - }, - { - "id": "test-imp-id-2", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "bidfloor": 20, - "ext": { - "openweb": { - "aid": 1000, - "siteId": 4321, - "bidFloor": 20 - } - } - } - ] - }, - "impIDs":["test-imp-id","test-imp-id-2"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "test-seat", - "bid": [ - { - "id": "test-bid-id", - "impid": "test-imp-id", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - }, - { - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - } - ] - } - ], - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "test-bid-id", - "impid": "test-imp-id", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 300, - "h": 250 - }, - "type": "banner" - }, - { - "bid": { - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 300, - "h": 250 - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/openweb/openwebtest/exemplary/simple-banner.json b/adapters/openweb/openwebtest/exemplary/simple-banner.json index b742fa50eb9..e6c1abd7cc6 100644 --- a/adapters/openweb/openwebtest/exemplary/simple-banner.json +++ b/adapters/openweb/openwebtest/exemplary/simple-banner.json @@ -16,12 +16,10 @@ } ] }, - "bidfloor": 30, "ext": { "bidder": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 + "org": "777", + "placementId": "1" } } }, @@ -39,94 +37,70 @@ } ] }, - "bidfloor": 30, "ext": { "bidder": { - "aid": 2000, - "siteId": 4321, - "bidFloor": 20 + "org": "777", + "placementId": "1" } } } ] }, - "httpCalls": [ { "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", + "uri": "https://pbs.openwebmp.com/pbs?publisher_id=777", "body": { "id": "test-request-id", "imp": [ { - "id":"test-imp-id", + "id": "test-imp-id", "banner": { "format": [ - {"w":300,"h":250}, - {"w":300,"h":600} + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } ] }, - "bidfloor": 20, "ext": { - "openweb": { - "aid": 1000, - "siteId": 1234, - "bidFloor": 20 + "bidder": { + "org": "777", + "placementId": "1" } } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "test-seat", - "bid": [{ - "id": "test-bid-id", - "impid": "test-imp-id", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - }] - } - ], - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=2000", - "body": { - "id": "test-request-id", - "imp": [ + }, { - "id":"test-imp-id-2", + "id": "test-imp-id-2", "banner": { "format": [ - {"w":300,"h":250}, - {"w":300,"h":600} + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } ] }, - "bidfloor": 20, "ext": { - "openweb": { - "aid": 2000, - "siteId": 4321, - "bidFloor": 20 + "bidder": { + "org": "777", + "placementId": "1" } } } ] }, - "impIDs":["test-imp-id-2"] + "impIDs": [ + "test-imp-id", + "test-imp-id-2" + ] }, "mockResponse": { "status": 200, @@ -134,16 +108,19 @@ "id": "test-request-id", "seatbid": [ { - "seat": "test-seat-2", - "bid": [{ - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "h": 250, - "w": 300 - }] + "seat": "test-seat", + "bid": [ + { + "id": "test-bid-id", + "impid": "test-imp-id", + "price": 30, + "adm": "some-test-ad", + "crid": "crid_10", + "h": 250, + "w": 300, + "mtype": 1 + } + ] } ], "cur": "USD" @@ -163,24 +140,8 @@ "adm": "some-test-ad", "crid": "crid_10", "w": 300, - "h": 250 - }, - "type": "banner" - } - ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "test-bid-id-2", - "impid": "test-imp-id-2", - "price": 30, - "adm": "some-test-ad", - "crid": "crid_10", - "w": 300, - "h": 250 + "h": 250, + "mtype": 1 }, "type": "banner" } diff --git a/adapters/openweb/openwebtest/exemplary/simple-video.json b/adapters/openweb/openwebtest/exemplary/simple-video.json index e8052e7ebf2..199607cbe32 100644 --- a/adapters/openweb/openwebtest/exemplary/simple-video.json +++ b/adapters/openweb/openwebtest/exemplary/simple-video.json @@ -14,22 +14,22 @@ }, "ext": { "bidder": { - "aid": 1000 + "aid": 777, + "placementId": "1" } } } ] }, - "httpCalls": [ { "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", + "uri": "https://pbs.openwebmp.com/pbs?publisher_id=777", "body": { "id": "test-request-id", "imp": [ { - "id":"test-imp-id", + "id": "test-imp-id", "video": { "w": 900, "h": 250, @@ -39,14 +39,17 @@ ] }, "ext": { - "openweb": { - "aid": 1000 + "bidder": { + "aid": 777, + "placementId": "1" } } } ] }, - "impIDs":["test-imp-id"] + "impIDs": [ + "test-imp-id" + ] }, "mockResponse": { "status": 200, @@ -60,7 +63,8 @@ "impid": "test-imp-id", "price": 3.5, "w": 900, - "h": 250 + "h": 250, + "mtype": 2 } ] } @@ -79,7 +83,8 @@ "impid": "test-imp-id", "price": 3.5, "w": 900, - "h": 250 + "h": 250, + "mtype": 2 }, "type": "video" } diff --git a/adapters/openweb/openwebtest/supplemental/wrong-impression-mapping.json b/adapters/openweb/openwebtest/supplemental/missing-mtype.json similarity index 59% rename from adapters/openweb/openwebtest/supplemental/wrong-impression-mapping.json rename to adapters/openweb/openwebtest/supplemental/missing-mtype.json index f83ec46da6f..68b487216c0 100644 --- a/adapters/openweb/openwebtest/supplemental/wrong-impression-mapping.json +++ b/adapters/openweb/openwebtest/supplemental/missing-mtype.json @@ -14,22 +14,22 @@ }, "ext": { "bidder": { - "aid": 1000 + "org": "777", + "placementId": "1" } } } ] }, - "httpCalls": [ { "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", + "uri": "https://pbs.openwebmp.com/pbs?publisher_id=777", "body": { "id": "test-request-id", "imp": [ { - "id":"test-imp-id", + "id": "test-imp-id", "video": { "w": 900, "h": 250, @@ -39,28 +39,37 @@ ] }, "ext": { - "openweb": { - "aid": 1000 + "bidder": { + "org": "777", + "placementId": "1" } } } ] }, - "impIDs":["test-imp-id"] + "impIDs": [ + "test-imp-id" + ] }, "mockResponse": { "status": 200, "body": { "id": "test-request-id", + "cur": "USD", "seatbid": [ { + "seat": "958", "bid": [ { - "id": "test-bid-id", - "impid": "SOME-WRONG-IMP-ID", - "price": 3.5, + "id": "8ee514f1-b2b8-4abb-89fd-084437d1e800", + "impid": "test-imp-id", + "price": 0.500000, "w": 900, - "h": 250 + "h": 250, + "mimes": [ + "video/x-flv", + "video/mp4" + ] } ] } @@ -69,11 +78,16 @@ } } ], - "expectedBidResponses": [{"currency":"USD","bids":[]}], "expectedMakeBidsErrors": [ { - "value": "ignoring bid id=test-bid-id, request doesn't contain any impression with id=SOME-WRONG-IMP-ID", + "value": "unsupported MType 0", "comparison": "literal" } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [] + } ] } diff --git a/adapters/openweb/openwebtest/supplemental/no-valid-imps.json b/adapters/openweb/openwebtest/supplemental/missing-org-and-aid.json similarity index 78% rename from adapters/openweb/openwebtest/supplemental/no-valid-imps.json rename to adapters/openweb/openwebtest/supplemental/missing-org-and-aid.json index 3335639d59f..6d156985029 100644 --- a/adapters/openweb/openwebtest/supplemental/no-valid-imps.json +++ b/adapters/openweb/openwebtest/supplemental/missing-org-and-aid.json @@ -14,16 +14,16 @@ }, "ext": { "bidder": { - "aid": "not valid value" + "org": "", + "placementId": "1" } } } ] }, - "expectedMakeRequestsErrors": [ { - "value": "^ignoring imp id=test-imp-id, error while decoding impExt", + "value": "no org or aid supplied", "comparison": "regex" } ] diff --git a/adapters/openweb/openwebtest/supplemental/missing-placement-id.json b/adapters/openweb/openwebtest/supplemental/missing-placement-id.json new file mode 100644 index 00000000000..d7159e2f638 --- /dev/null +++ b/adapters/openweb/openwebtest/supplemental/missing-placement-id.json @@ -0,0 +1,29 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "w": 900, + "h": 250, + "mimes": [ + "video/x-flv", + "video/mp4" + ] + }, + "ext": { + "bidder": { + "org": "777" + } + } + } + ] + }, + "expectedMakeRequestsErrors": [ + { + "value": "no placement id supplied", + "comparison": "regex" + } + ] +} diff --git a/adapters/openweb/openwebtest/supplemental/status-204.json b/adapters/openweb/openwebtest/supplemental/status-204.json deleted file mode 100644 index 637c2113fc5..00000000000 --- a/adapters/openweb/openwebtest/supplemental/status-204.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "bidder": { - "aid": 1000 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "openweb": { - "aid": 1000 - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 204 - } - } - ] -} diff --git a/adapters/openweb/openwebtest/supplemental/status-400.json b/adapters/openweb/openwebtest/supplemental/status-400.json deleted file mode 100644 index 20500de2b4a..00000000000 --- a/adapters/openweb/openwebtest/supplemental/status-400.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "bidder": { - "aid": 1000 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "openweb": { - "aid": 1000 - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 400, - "body": "Bad request" - } - } - ], - - "expectedMakeBidsErrors": [ - { - "value": "Remote server error: \"Bad request\"", - "comparison": "literal" - } - ], - - "expectedBidResponses": [] -} diff --git a/adapters/openweb/openwebtest/supplemental/status-500.json b/adapters/openweb/openwebtest/supplemental/status-500.json deleted file mode 100644 index 48cfab3b7fa..00000000000 --- a/adapters/openweb/openwebtest/supplemental/status-500.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "bidder": { - "aid": 1000 - } - } - } - ] - }, - - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://ghb.spotim.market/pbs/ortb?aid=1000", - "body": { - "id": "test-request-id", - "imp": [ - { - "id":"test-imp-id", - "video": { - "w": 900, - "h": 250, - "mimes": [ - "video/x-flv", - "video/mp4" - ] - }, - "ext": { - "openweb": { - "aid": 1000 - } - } - } - ] - }, - "impIDs":["test-imp-id"] - }, - "mockResponse": { - "status": 500, - "body": "Internal error" - } - } - ], - - "expectedMakeBidsErrors": [ - { - "value": "Remote server error: \"Internal error\"", - "comparison": "literal" - } - ], - - "expectedBidResponses": [] -} diff --git a/adapters/openweb/params_test.go b/adapters/openweb/params_test.go index 7a53124fa30..82e2f9e5ed5 100644 --- a/adapters/openweb/params_test.go +++ b/adapters/openweb/params_test.go @@ -39,10 +39,8 @@ func TestInvalidParams(t *testing.T) { } var validParams = []string{ - `{"aid":123}`, - `{"aid":123,"placementId":1234}`, - `{"aid":123,"siteId":4321}`, - `{"aid":123,"siteId":0,"bidFloor":0}`, + `{"aid":123,"placementId":"1234"}`, + `{"org":"123","placementId":"1234"}`, } var invalidParams = []string{ @@ -53,8 +51,10 @@ var invalidParams = []string{ `4.2`, `[]`, `{}`, - `{"aid":"some string instead of int"}`, - `{"aid":"0"}`, + `{"org":123}`, + `{"org":0}`, + `{"org":"123","placementId":123}`, + `{"org":123, "placementId":"123"}`, + `{"aid":123}`, `{"aid":"123","placementId":"123"}`, - `{"aid":123, "placementId":"123", "siteId":"321"}`, } diff --git a/openrtb_ext/imp_openweb.go b/openrtb_ext/imp_openweb.go index fc3cbdacdd0..5df8e7d18e5 100644 --- a/openrtb_ext/imp_openweb.go +++ b/openrtb_ext/imp_openweb.go @@ -2,8 +2,7 @@ package openrtb_ext // ExtImpOpenWeb defines the contract for bidrequest.imp[i].ext.prebid.bidder.openweb type ExtImpOpenWeb struct { - SourceID int `json:"aid"` - PlacementID int `json:"placementId,omitempty"` - SiteID int `json:"siteId,omitempty"` - BidFloor float64 `json:"bidFloor,omitempty"` + Aid int `json:"aid,omitempty"` + Org string `json:"org,omitempty"` + PlacementID string `json:"placementId"` } diff --git a/static/bidder-info/openweb.yaml b/static/bidder-info/openweb.yaml index 9272719cf19..cde54acfb25 100644 --- a/static/bidder-info/openweb.yaml +++ b/static/bidder-info/openweb.yaml @@ -1,7 +1,8 @@ -endpoint: "http://ghb.spotim.market/pbs/ortb" +endpoint: "https://pbs.openwebmp.com/pbs" maintainer: email: "monetization@openweb.com" gvlVendorID: 280 +modifyingVastXmlAllowed: true capabilities: app: mediaTypes: @@ -12,7 +13,6 @@ capabilities: - banner - video userSync: - # openweb 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. - supports: - - redirect + iframe: + url: https://pbs-cs.openwebmp.com/pbs-iframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redirect={{.RedirectURL}} + userMacro: "[PBS_UID]" diff --git a/static/bidder-params/openweb.json b/static/bidder-params/openweb.json index ec5766ad663..62a4853ed65 100644 --- a/static/bidder-params/openweb.json +++ b/static/bidder-params/openweb.json @@ -2,25 +2,34 @@ "$schema": "http://json-schema.org/draft-04/schema#", "title": "OpenWeb Adapter Params", "description": "A schema which validates params accepted by the OpenWeb adapter", - "type": "object", "properties": { "placementId": { - "type": "integer", - "description": "An ID which identifies this placement of the impression" - }, - "siteId": { - "type": "integer", - "description": "An ID which identifies the site selling the impression" + "type": "string", + "description": "An ID which identifies this placement of the impression", + "minLength": 1 }, "aid": { "type": "integer", - "description": "An ID which identifies the channel" + "description": "Deprecated: An ID which identifies the channel" }, - "bidFloor": { - "type": "number", - "description": "BidFloor, US Dollars" + "org": { + "type": "string", + "description": "The organization ID.", + "minLength": 1 } }, - "required": ["aid"] + "required": [ "placementId" ], + "oneOf": [ + { + "required": [ + "aid" + ] + }, + { + "required": [ + "org" + ] + } + ] }