From b3ed88e97d8a66d26dae932c786556faf55aa338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Mon, 3 Jun 2024 14:17:29 +0000 Subject: [PATCH 01/21] adding new Adapter intertech --- adapters/intertech/intertech.go | 340 ++++++++++++++++++++++++++++ openrtb_ext/imp_intertech.go | 10 + static/bidder-info/intertech.yaml | 14 ++ static/bidder-params/intertech.json | 22 ++ 4 files changed, 386 insertions(+) create mode 100644 adapters/intertech/intertech.go create mode 100644 openrtb_ext/imp_intertech.go create mode 100644 static/bidder-info/intertech.yaml create mode 100644 static/bidder-params/intertech.json diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go new file mode 100644 index 00000000000..e3a188a09fd --- /dev/null +++ b/adapters/intertech/intertech.go @@ -0,0 +1,340 @@ +package intertech + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + "text/template" + + "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" + "github.com/prebid/prebid-server/v2/macros" + "github.com/prebid/prebid-server/v2/openrtb_ext" +) + +const ( + refererQueryKey = "target-ref" + currencyQueryKey = "ssp-cur" + impIdQueryKey = "imp-id" +) + +// Composite id of an ad placement +type intertechPlacementID struct { + PageID string + ImpID string +} + +type adapter struct { + endpoint *template.Template +} + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { + template, err := template.New("endpointTemplate").Parse(config.Endpoint) + if err != nil { + return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) + } + + bidder := &adapter{ + endpoint: template, + } + + return bidder, nil +} + +func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var ( + requests []*adapters.RequestData + errors []error + ) + + referer := getReferer(requestData) + currency := getCurrency(requestData) + + for i := range requestData.Imp { + imp := requestData.Imp[i] + + placementId, err := getIntertechPlacementId(imp) + if err != nil { + errors = append(errors, err) + continue + } + + if err := modifyImp(&imp); err != nil { + errors = append(errors, err) + continue + } + + resolvedUrl, err := a.resolveUrl(*placementId, referer, currency) + if err != nil { + errors = append(errors, err) + continue + } + + splittedRequestData := splitRequestDataByImp(requestData, imp) + + requestBody, err := json.Marshal(splittedRequestData) + if err != nil { + errors = append(errors, err) + continue + } + + requests = append(requests, &adapters.RequestData{ + Method: "POST", + Uri: resolvedUrl, + Body: requestBody, + Headers: getHeaders(&splittedRequestData), + ImpIDs: openrtb_ext.GetImpIDs(splittedRequestData.Imp), + }) + } + + return requests, errors +} + +func getHeaders(request *openrtb2.BidRequest) http.Header { + headers := http.Header{} + + if request.Device != nil && request.Site != nil { + addNonEmptyHeaders(&headers, map[string]string{ + "Referer": request.Site.Page, + "Accept-Language": request.Device.Language, + "User-Agent": request.Device.UA, + "X-Forwarded-For": request.Device.IP, + "X-Real-Ip": request.Device.IP, + "Content-Type": "application/json;charset=utf-8", + "Accept": "application/json", + }) + } + + return headers +} + +func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) { + for key, value := range headerValues { + if len(value) > 0 { + headers.Add(key, value) + } + } +} + +// Request is in shared memory, so we have to make a shallow copy for further modification (imp is already a shallow copy) +func splitRequestDataByImp(request *openrtb2.BidRequest, imp openrtb2.Imp) openrtb2.BidRequest { + requestCopy := *request + requestCopy.Imp = []openrtb2.Imp{imp} + + return requestCopy +} + +func getIntertechPlacementId(imp openrtb2.Imp) (*intertechPlacementID, error) { + var ext adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &ext); err != nil { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("imp %s: unable to unmarshal ext", imp.ID), + } + } + + var intertechExt openrtb_ext.ExtImpIntertech + if err := json.Unmarshal(ext.Bidder, &intertechExt); err != nil { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("imp %s: unable to unmarshal ext.bidder: %v", imp.ID, err), + } + } + + placementID, err := mapExtToPlacementID(intertechExt) + if err != nil { + return nil, err + } + + return placementID, nil +} + +func mapExtToPlacementID(intertechExt openrtb_ext.ExtImpIntertech) (*intertechPlacementID, error) { + var placementID intertechPlacementID + + if len(intertechExt.PlacementID) == 0 { + placementID.ImpID = strconv.Itoa(int(intertechExt.ImpID)) + placementID.PageID = strconv.Itoa(int(intertechExt.PageID)) + return &placementID, nil + } + + idParts := strings.Split(intertechExt.PlacementID, "-") + + numericIdParts := []string{} + + for _, idPart := range idParts { + if _, err := strconv.Atoi(idPart); err == nil { + numericIdParts = append(numericIdParts, idPart) + } + } + + if len(numericIdParts) < 2 { + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("invalid placement id, it must contain two parts: %s", intertechExt.PlacementID), + } + } + + placementID.ImpID = numericIdParts[len(numericIdParts)-1] + placementID.PageID = numericIdParts[len(numericIdParts)-2] + + return &placementID, nil +} + +func modifyImp(imp *openrtb2.Imp) error { + if imp.Banner != nil { + banner, err := modifyBanner(*imp.Banner) + if banner != nil { + imp.Banner = banner + } + return err + } + + if imp.Native != nil { + return nil + } + + return &errortypes.BadInput{ + Message: fmt.Sprintf("Unsupported format. Intertech only supports banner and native types. Ignoring imp id #%s", imp.ID), + } +} + +func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { + format := banner.Format + + if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { + if len(format) == 0 { + return nil, &errortypes.BadInput{ + Message: "Invalid size provided for Banner", + } + } + + firstFormat := format[0] + banner.H = &firstFormat.H + banner.W = &firstFormat.W + } + + return &banner, nil +} + +// "Un-templates" the endpoint by replacing macroses and adding the required query parameters +func (a *adapter) resolveUrl(placementID intertechPlacementID, referer string, currency string) (string, error) { + params := macros.EndpointTemplateParams{PageID: placementID.PageID} + + endpointStr, err := macros.ResolveMacros(a.endpoint, params) + if err != nil { + return "", err + } + + parsedUrl, err := url.Parse(endpointStr) + if err != nil { + return "", err + } + + addNonEmptyQueryParams(parsedUrl, map[string]string{ + refererQueryKey: referer, + currencyQueryKey: currency, + impIdQueryKey: placementID.ImpID, + }) + + return parsedUrl.String(), nil +} + +func addNonEmptyQueryParams(url *url.URL, queryMap map[string]string) { + query := url.Query() + for key, value := range queryMap { + if len(value) > 0 { + query.Add(key, value) + } + } + + url.RawQuery = query.Encode() +} + +func getReferer(request *openrtb2.BidRequest) string { + if request.Site == nil { + return "" + } + + return request.Site.Domain +} + +func getCurrency(request *openrtb2.BidRequest) string { + if len(request.Cur) == 0 { + return "" + } + + return request.Cur[0] +} + +func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + + if adapters.IsResponseStatusCodeNoContent(responseData) { + return nil, nil + } + + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{err} + } + + var bidResponse openrtb2.BidResponse + if err := json.Unmarshal(responseData.Body, &bidResponse); err != nil { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Bad server response: %d", err), + }} + } + + bidResponseWithCapacity := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + + var errors []error + + impMap := map[string]*openrtb2.Imp{} + for i := range request.Imp { + imp := request.Imp[i] + + impMap[imp.ID] = &imp + } + + for _, seatBid := range bidResponse.SeatBid { + for i := range seatBid.Bid { + bid := seatBid.Bid[i] + + imp, exists := impMap[bid.ImpID] + if !exists { + errors = append(errors, &errortypes.BadInput{ + Message: fmt.Sprintf("Invalid bid imp ID #%s does not match any imp IDs from the original bid request", bid.ImpID), + }) + continue + } + + bidType, err := getBidType(*imp) + if err != nil { + errors = append(errors, err) + continue + } + + bidResponseWithCapacity.Bids = append(bidResponseWithCapacity.Bids, &adapters.TypedBid{ + Bid: &bid, + BidType: bidType, + }) + } + } + + return bidResponseWithCapacity, errors +} + +func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) { + if imp.Native != nil { + return openrtb_ext.BidTypeNative, nil + } + + if imp.Banner != nil { + return openrtb_ext.BidTypeBanner, nil + } + + return "", &errortypes.BadInput{ + Message: fmt.Sprintf("Processing an invalid impression; cannot resolve impression type for imp #%s", imp.ID), + } +} diff --git a/openrtb_ext/imp_intertech.go b/openrtb_ext/imp_intertech.go new file mode 100644 index 00000000000..798aadaf29c --- /dev/null +++ b/openrtb_ext/imp_intertech.go @@ -0,0 +1,10 @@ +package openrtb_ext + +type ExtImpIntertech struct { + PlacementID string `json:"placement_id"` + + // Deprecated: in favor of `PlacementID` + PageID int64 `json:"page_id"` + // Deprecated: in favor of `PlacementID` + ImpID int64 `json:"imp_id"` +} diff --git a/static/bidder-info/intertech.yaml b/static/bidder-info/intertech.yaml new file mode 100644 index 00000000000..8364e12fc31 --- /dev/null +++ b/static/bidder-info/intertech.yaml @@ -0,0 +1,14 @@ +endpoint: https://prebid.intertechsrvcs.com/prebid/{{page_id}}?imp-id={{imp_id}}&ssp-id=10500 +endpoint-compression: gzip +meta-info: + maintainer-email: prebid@intertechsrvcs.com + site-media-types: + - banner + - native + vendor-id: 0 +usersync: + url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&location= + redirect-url: /setuid?bidder=intertech&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&uid={UID} + cookie-family-name: intertech + type: redirect + support-cors: false \ No newline at end of file diff --git a/static/bidder-params/intertech.json b/static/bidder-params/intertech.json new file mode 100644 index 00000000000..7fcac20deaa --- /dev/null +++ b/static/bidder-params/intertech.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Intertech Adapter Params", + "description": "A schema which validates params accepted by the Intertech adapter", + "type": "object", + "properties": { + "page_id": { + "type": "integer", + "minLength": 1, + "description": "Special Page Id provided by Intertech Manager" + }, + "imp_id": { + "type": "integer", + "minLength": 1, + "description": "Special identifier provided by Intertech Manager" + } + }, + "required": [ + "page_id", + "imp_id" + ] + } \ No newline at end of file From 0274c44c15a685210657d43d05b5f617d92a0cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Thu, 6 Jun 2024 12:02:05 +0000 Subject: [PATCH 02/21] resolve comments and add tests --- adapters/intertech/intertech_test.go | 29 +++ .../intertechtest/exemplary/simple-baner.json | 135 ++++++++++ .../exemplary/simple-native.json | 135 ++++++++++ .../multiple-imps-some-malformed.json | 146 +++++++++++ .../supplemental/multiple-imps.json | 237 ++++++++++++++++++ .../simple-banner-empty-response.json | 101 ++++++++ .../simple-banner-empty-seatbid.json | 106 ++++++++ .../supplemental/simple-banner-sizes.json | 233 +++++++++++++++++ .../simple-banner-status-400.json | 102 ++++++++ .../simple-banner-unknown-imp.json | 125 +++++++++ .../simple-banner-unparsable-body.json | 102 ++++++++ .../supplemental/unknown-banner.json | 32 +++ adapters/intertech/params_test.go | 87 +++++++ exchange/adapter_builders.go | 2 + openrtb_ext/bidders.go | 2 + 15 files changed, 1574 insertions(+) create mode 100644 adapters/intertech/intertech_test.go create mode 100644 adapters/intertech/intertechtest/exemplary/simple-baner.json create mode 100644 adapters/intertech/intertechtest/exemplary/simple-native.json create mode 100644 adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json create mode 100644 adapters/intertech/intertechtest/supplemental/multiple-imps.json create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json create mode 100644 adapters/intertech/intertechtest/supplemental/unknown-banner.json create mode 100644 adapters/intertech/params_test.go diff --git a/adapters/intertech/intertech_test.go b/adapters/intertech/intertech_test.go new file mode 100644 index 00000000000..09d90f4902b --- /dev/null +++ b/adapters/intertech/intertech_test.go @@ -0,0 +1,29 @@ +package intertech + +import ( + "testing" + + "github.com/prebid/prebid-server/v2/adapters/adapterstest" + "github.com/prebid/prebid-server/v2/config" + "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/stretchr/testify/assert" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderIntertech, + config.Adapter{Endpoint: "https://prebid.intertechsrvcs.com/prebid/{{page_id}}?imp-id={{imp_id}}&ssp-id=10500"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "intertechtest", bidder) +} + +func TestEndpointTemplateMalformed(t *testing.T) { + _, buildErr := Builder(openrtb_ext.BidderIntertech, config.Adapter{ + Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + assert.Error(t, buildErr) +} diff --git a/adapters/intertech/intertechtest/exemplary/simple-baner.json b/adapters/intertech/intertechtest/exemplary/simple-baner.json new file mode 100644 index 00000000000..89d418a7c22 --- /dev/null +++ b/adapters/intertech/intertechtest/exemplary/simple-baner.json @@ -0,0 +1,135 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "placement_id": "134001-1" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1", + "language": "EN" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ], + "Accept-Language": [ + "EN" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "placement_id": "134001-1" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1", + "language": "EN" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "price": 1.25, + "crid": "crid", + "adm": "content", + "h": 600, + "w": 300 + } + ] + } + ], + "bidid": "bid_id", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "bid_id", + "impid": "imp_id", + "price": 1.25, + "adm": "content", + "crid": "crid", + "w": 300, + "h": 600 + }, + "type": "banner" + } + ] + } + ] + } \ No newline at end of file diff --git a/adapters/intertech/intertechtest/exemplary/simple-native.json b/adapters/intertech/intertechtest/exemplary/simple-native.json new file mode 100644 index 00000000000..e45f52d5c1c --- /dev/null +++ b/adapters/intertech/intertechtest/exemplary/simple-native.json @@ -0,0 +1,135 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "native": { + "request": "{}", + "ver": "1" + }, + "ext": { + "bidder": { + "placement_id": "R-134001-1" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1", + "language": "EN" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ], + "Accept-Language": [ + "EN" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "native": { + "request": "{}", + "ver": "1" + }, + "ext": { + "bidder": { + "placement_id": "R-134001-1" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1", + "language": "EN" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "price": 1.25, + "crid": "crid", + "adm": "adm_content", + "h": 600, + "w": 300 + } + ] + } + ], + "bidid": "bid_id", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "bid_id", + "impid": "imp_id", + "price": 1.25, + "adm": "adm_content", + "crid": "crid", + "w": 300, + "h": 600 + }, + "type": "native" + } + ] + } + ] + } \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json b/adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json new file mode 100644 index 00000000000..c1e4a62ec8b --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json @@ -0,0 +1,146 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id1", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + }, + { + "id": "imp_id2", + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 2 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/111?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id1", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id1"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id1", + "impid": "imp_id1", + "price": 1.25, + "crid": "crid", + "adm": "adm001", + "h": 600, + "w": 300 + } + ] + } + ], + "bidid": "bid_id" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "bid_id1", + "impid": "imp_id1", + "price": 1.25, + "adm": "adm001", + "crid": "crid", + "w": 300, + "h": 600 + }, + "type": "banner" + } + ] + } + ], + "expectedMakeRequestsErrors": [ + { + "value": "Unsupported format", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/multiple-imps.json b/adapters/intertech/intertechtest/supplemental/multiple-imps.json new file mode 100644 index 00000000000..3986cfc2dc5 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/multiple-imps.json @@ -0,0 +1,237 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id1", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + }, + { + "id": "imp_id2", + "banner": { + "w": 400, + "h": 800 + }, + "ext": { + "bidder": { + "placement_id": "222-2" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/111?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id1", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id1"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id1", + "impid": "imp_id1", + "price": 1.25, + "crid": "crid", + "adm": "adm001", + "h": 600, + "w": 300 + } + ] + } + ], + "bidid": "bid_id" + } + } + }, + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/222?imp-id=2&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id2", + "banner": { + "w": 400, + "h": 800 + }, + "ext": { + "bidder": { + "placement_id": "222-2" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id2"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id2", + "impid": "imp_id2", + "price": 1.25, + "crid": "crid", + "adm": "adm001", + "h": 800, + "w": 400 + } + ] + } + ], + "bidid": "bid_id" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "bid_id1", + "impid": "imp_id1", + "price": 1.25, + "adm": "adm001", + "crid": "crid", + "w": 300, + "h": 600 + }, + "type": "banner" + } + ] + }, + { + "bids": [ + { + "bid": { + "id": "bid_id2", + "impid": "imp_id2", + "price": 1.25, + "adm": "adm001", + "crid": "crid", + "w": 400, + "h": 800 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json b/adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json new file mode 100644 index 00000000000..b7ed72e5e2f --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json @@ -0,0 +1,101 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 200, + "headers": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Bad server response", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json b/adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json new file mode 100644 index 00000000000..e31a85f33d5 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json @@ -0,0 +1,106 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": null, + "bidid": "bid_id", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [] + } + ], + "expectedMakeBidsErrors": [] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json b/adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json new file mode 100644 index 00000000000..10653302bc9 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json @@ -0,0 +1,233 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "invalid_width", + "banner": { + "w": 0, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + }, + { + "id": "invalid_height", + "banner": { + "w": 400, + "h": 0 + }, + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 2 + } + } + }, + { + "id": "invalid_size", + "banner": { + "w": 0, + "h": 0 + }, + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 3 + } + } + }, + { + "id": "invalid_no_size_no_formats", + "banner": {}, + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 5 + } + } + }, + { + "id": "invalid_size", + "banner": { + "w": 0, + "h": 0 + }, + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 3 + } + } + }, + { + "id": "no_size_but_valid_formats", + "banner": { + "format": [ + { + "w": 600, + "h": 500 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 4 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/222?imp-id=4&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "no_size_but_valid_formats", + "banner": { + "w": 600, + "h": 500, + "format": [ + { + "w": 600, + "h": 500 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "page_id": 222, + "imp_id": 4 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["no_size_but_valid_formats"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id4", + "impid": "no_size_but_valid_formats", + "price": 1.25, + "crid": "crid", + "adm": "adm001", + "h": 800, + "w": 400 + } + ] + } + ], + "bidid": "bid_id" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "bid_id4", + "impid": "no_size_but_valid_formats", + "price": 1.25, + "adm": "adm001", + "crid": "crid", + "w": 400, + "h": 800 + }, + "type": "banner" + } + ] + } + ], + "expectedMakeRequestsErrors": [ + { + "value": "Invalid size", + "comparison": "regex" + }, + { + "value": "Invalid size", + "comparison": "regex" + }, + { + "value": "Invalid size", + "comparison": "regex" + }, + { + "value": "Invalid size", + "comparison": "regex" + }, + { + "value": "Invalid size", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json b/adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json new file mode 100644 index 00000000000..b428ab1d148 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json @@ -0,0 +1,102 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 400, + "headers": {}, + "body": {} + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json b/adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json new file mode 100644 index 00000000000..587e52e0b57 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": { + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id_unknown", + "price": 1.25, + "crid": "crid", + "adm": "content", + "h": 600, + "w": 300 + } + ] + } + ], + "bidid": "bid_id", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [] + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Invalid bid imp", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json b/adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json new file mode 100644 index 00000000000..46793eb6cdb --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json @@ -0,0 +1,102 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id"] + }, + "mockResponse": { + "status": 200, + "headers": {}, + "body": "invalid" + } + } + ], + "expectedBidResponses": [], + "expectedMakeBidsErrors": [ + { + "value": "Bad server response", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/unknown-banner.json b/adapters/intertech/intertechtest/supplemental/unknown-banner.json new file mode 100644 index 00000000000..a01b9037180 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/unknown-banner.json @@ -0,0 +1,32 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "video": { + "w": 100, + "h": 200 + }, + "ext": { + "bidder": { + "page_id": 134001, + "imp_id": 1 + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [], + "expectedMakeRequestsErrors": [ + { + "value": "Unsupported format", + "comparison": "regex" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/params_test.go b/adapters/intertech/params_test.go new file mode 100644 index 00000000000..2df19ef00ae --- /dev/null +++ b/adapters/intertech/params_test.go @@ -0,0 +1,87 @@ +package intertech + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/stretchr/testify/assert" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range validParams { + if err := validator.Validate(openrtb_ext.BidderIntertech, json.RawMessage(p)); err != nil { + t.Errorf("Schema rejected valid params: %s", p) + } + } +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderIntertech, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var validParams = []string{ + `{"page_id": 123123, "imp_id": 123}`, + `{"placement_id": "A-123123-123"}`, + `{"placement_id": "B-A-123123-123"}`, + `{"placement_id": "123123-123"}`, +} + +var invalidParams = []string{ + `{"pageId": 123123, "impId": 123}`, + `{"page_id": 0, "imp_id": 0}`, + `{"page_id": "123123", "imp_id": "123"}`, + `{"page_id": "123123", "imp_id": "123", "placement_id": "123123"}`, + `{"page_id": "123123"}`, + `{"imp_id": "123"}`, + `{"placement_id": 123123}`, + `{"placement_id": "123123"}`, + `{"placement_id": "A-123123"}`, + `{"placement_id": "B-A-123123"}`, + `{}`, +} + +func TestValidPlacementIdMapper(t *testing.T) { + for ext, expectedPlacementId := range validPlacementIds { + val, err := mapExtToPlacementID(ext) + + assert.Equal(t, &expectedPlacementId, val) + assert.NoError(t, err) + } +} + +func TestInvalidPlacementIdMapper(t *testing.T) { + for _, ext := range invalidPlacementIds { + _, err := mapExtToPlacementID(ext) + + assert.Error(t, err) + } +} + +var validPlacementIds = map[openrtb_ext.ExtImpIntertech]intertechPlacementID{ + {PlacementID: "A-12345-1"}: {PageID: "12345", ImpID: "1"}, + {PlacementID: "B-A-123123-123"}: {PageID: "123123", ImpID: "123"}, + {PlacementID: "111-222"}: {PageID: "111", ImpID: "222"}, + {PageID: 111, ImpID: 222}: {PageID: "111", ImpID: "222"}, +} + +var invalidPlacementIds = []openrtb_ext.ExtImpIntertech{ + {PlacementID: "123123"}, + {PlacementID: "A-123123"}, + {PlacementID: "B-A-123123"}, + {PlacementID: "C-B-A-123123"}, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 09c7bf83777..8645838e02c 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -100,6 +100,7 @@ import ( "github.com/prebid/prebid-server/v2/adapters/infytv" "github.com/prebid/prebid-server/v2/adapters/inmobi" "github.com/prebid/prebid-server/v2/adapters/interactiveoffers" + "github.com/prebid/prebid-server/v2/adapters/intertech" "github.com/prebid/prebid-server/v2/adapters/invibes" "github.com/prebid/prebid-server/v2/adapters/iqx" "github.com/prebid/prebid-server/v2/adapters/iqzone" @@ -311,6 +312,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderInfyTV: infytv.Builder, openrtb_ext.BidderInMobi: inmobi.Builder, openrtb_ext.BidderInteractiveoffers: interactiveoffers.Builder, + openrtb_ext.BidderIntertech: intertech.Builder, openrtb_ext.BidderInvibes: invibes.Builder, openrtb_ext.BidderIQX: iqx.Builder, openrtb_ext.BidderIQZone: iqzone.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 5f6e35452d5..fe575b00eb6 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -117,6 +117,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderInfyTV, BidderInMobi, BidderInteractiveoffers, + BidderIntertech, BidderInvibes, BidderIQX, BidderIQZone, @@ -405,6 +406,7 @@ const ( BidderInfyTV BidderName = "infytv" BidderInMobi BidderName = "inmobi" BidderInteractiveoffers BidderName = "interactiveoffers" + BidderIntertech BidderName = "intertech" BidderInvibes BidderName = "invibes" BidderIQX BidderName = "iqx" BidderIQZone BidderName = "iqzone" From a123a0ddd1904f5bbb3f4b90a3cc72660221f9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Thu, 6 Jun 2024 13:45:29 +0000 Subject: [PATCH 03/21] resolve comments --- adapters/intertech/intertech.go | 70 ++++++------------- adapters/intertech/intertech_test.go | 2 +- .../exemplary/simple-native.json | 2 +- static/bidder-info/intertech.yaml | 30 ++++---- static/bidder-params/intertech.json | 43 +++++++----- 5 files changed, 68 insertions(+), 79 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index e3a188a09fd..b8840ce0622 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -23,7 +23,7 @@ const ( impIdQueryKey = "imp-id" ) -// Composite id of an ad placement +// intertechPlacementID is the composite id of an ad placement type intertechPlacementID struct { PageID string ImpID string @@ -99,29 +99,26 @@ func getHeaders(request *openrtb2.BidRequest) http.Header { headers := http.Header{} if request.Device != nil && request.Site != nil { - addNonEmptyHeaders(&headers, map[string]string{ - "Referer": request.Site.Page, - "Accept-Language": request.Device.Language, - "User-Agent": request.Device.UA, - "X-Forwarded-For": request.Device.IP, - "X-Real-Ip": request.Device.IP, - "Content-Type": "application/json;charset=utf-8", - "Accept": "application/json", - }) + addNonEmptyHeader(&headers, "Referer", request.Site.Page) + addNonEmptyHeader(&headers, "Accept-Language", request.Device.Language) + addNonEmptyHeader(&headers, "User-Agent", request.Device.UA) + addNonEmptyHeader(&headers, "X-Forwarded-For", request.Device.IP) + addNonEmptyHeader(&headers, "X-Real-Ip", request.Device.IP) + addNonEmptyHeader(&headers, "X-Forwarded-For-IPv6", request.Device.IPv6) + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") } return headers } -func addNonEmptyHeaders(headers *http.Header, headerValues map[string]string) { - for key, value := range headerValues { - if len(value) > 0 { - headers.Add(key, value) - } +func addNonEmptyHeader(headers *http.Header, key, value string) { + if len(value) > 0 { + headers.Add(key, value) } } -// Request is in shared memory, so we have to make a shallow copy for further modification (imp is already a shallow copy) +// splitRequestDataByImp makes a shallow copy of the request for further modification (imp is already a shallow copy) func splitRequestDataByImp(request *openrtb2.BidRequest, imp openrtb2.Imp) openrtb2.BidRequest { requestCopy := *request requestCopy.Imp = []openrtb2.Imp{imp} @@ -162,23 +159,8 @@ func mapExtToPlacementID(intertechExt openrtb_ext.ExtImpIntertech) (*intertechPl } idParts := strings.Split(intertechExt.PlacementID, "-") - - numericIdParts := []string{} - - for _, idPart := range idParts { - if _, err := strconv.Atoi(idPart); err == nil { - numericIdParts = append(numericIdParts, idPart) - } - } - - if len(numericIdParts) < 2 { - return nil, &errortypes.BadInput{ - Message: fmt.Sprintf("invalid placement id, it must contain two parts: %s", intertechExt.PlacementID), - } - } - - placementID.ImpID = numericIdParts[len(numericIdParts)-1] - placementID.PageID = numericIdParts[len(numericIdParts)-2] + placementID.PageID = idParts[0] + placementID.ImpID = idParts[1] return &placementID, nil } @@ -192,19 +174,14 @@ func modifyImp(imp *openrtb2.Imp) error { return err } - if imp.Native != nil { - return nil - } - - return &errortypes.BadInput{ - Message: fmt.Sprintf("Unsupported format. Intertech only supports banner and native types. Ignoring imp id #%s", imp.ID), - } + return nil } func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { - format := banner.Format + bannerCopy := banner + format := bannerCopy.Format - if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { + if bannerCopy.W == nil || bannerCopy.H == nil || *bannerCopy.W == 0 || *bannerCopy.H == 0 { if len(format) == 0 { return nil, &errortypes.BadInput{ Message: "Invalid size provided for Banner", @@ -212,14 +189,14 @@ func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { } firstFormat := format[0] - banner.H = &firstFormat.H - banner.W = &firstFormat.W + bannerCopy.H = &firstFormat.H + bannerCopy.W = &firstFormat.W } - return &banner, nil + return &bannerCopy, nil } -// "Un-templates" the endpoint by replacing macroses and adding the required query parameters +// resolveUrl "un-templates" the endpoint by replacing macroses and adding the required query parameters func (a *adapter) resolveUrl(placementID intertechPlacementID, referer string, currency string) (string, error) { params := macros.EndpointTemplateParams{PageID: placementID.PageID} @@ -270,7 +247,6 @@ func getCurrency(request *openrtb2.BidRequest) string { } func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { - if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil } diff --git a/adapters/intertech/intertech_test.go b/adapters/intertech/intertech_test.go index 09d90f4902b..5aee72b610f 100644 --- a/adapters/intertech/intertech_test.go +++ b/adapters/intertech/intertech_test.go @@ -11,7 +11,7 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderIntertech, - config.Adapter{Endpoint: "https://prebid.intertechsrvcs.com/prebid/{{page_id}}?imp-id={{imp_id}}&ssp-id=10500"}, + config.Adapter{Endpoint: "https://prebid.intertechsrvcs.com/prebid/{{.PageID}}?ssp-id=10500"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { diff --git a/adapters/intertech/intertechtest/exemplary/simple-native.json b/adapters/intertech/intertechtest/exemplary/simple-native.json index e45f52d5c1c..ddaa386483d 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-native.json +++ b/adapters/intertech/intertechtest/exemplary/simple-native.json @@ -32,7 +32,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "uri": "https://prebid.intertechsrvcs.com/prebid/R?imp-id=134001&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", "headers": { "User-Agent": [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" diff --git a/static/bidder-info/intertech.yaml b/static/bidder-info/intertech.yaml index 8364e12fc31..6b6ee467a48 100644 --- a/static/bidder-info/intertech.yaml +++ b/static/bidder-info/intertech.yaml @@ -1,14 +1,18 @@ -endpoint: https://prebid.intertechsrvcs.com/prebid/{{page_id}}?imp-id={{imp_id}}&ssp-id=10500 -endpoint-compression: gzip -meta-info: - maintainer-email: prebid@intertechsrvcs.com - site-media-types: - - banner - - native - vendor-id: 0 -usersync: - url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&location= - redirect-url: /setuid?bidder=intertech&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&uid={UID} - cookie-family-name: intertech +# This adapter is ported from PBS-Java to PBS-Go for Prebid. Please open a GitHub issue instead of directly contacting the maintainer for technical issues. +endpoint: https://prebid.intertechsrvcs.com/prebid/{{.PageID}}?imp-id={{.ImpID}}&ssp-id=10500 +endpointCompression: GZIP +maintainer: + email: prebid@intertechsrvcs.com +capabilities: + site: + mediaTypes: + - banner + - native +userSync: + redirect: + url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}} + userMacro: "UID" + redirect-url: /setuid?bidder=intertech&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&uid={{.UID}} + cookieFamilyName: intertech type: redirect - support-cors: false \ No newline at end of file + supportCORS: false \ No newline at end of file diff --git a/static/bidder-params/intertech.json b/static/bidder-params/intertech.json index 7fcac20deaa..35cf83f7753 100644 --- a/static/bidder-params/intertech.json +++ b/static/bidder-params/intertech.json @@ -1,22 +1,31 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Intertech Adapter Params", - "description": "A schema which validates params accepted by the Intertech adapter", - "type": "object", - "properties": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Intertech Adapter Params", + "description": "A schema which validates params accepted by the Intertech adapter", + "type": "object", + "properties": { "page_id": { - "type": "integer", - "minLength": 1, - "description": "Special Page Id provided by Intertech Manager" + "type": "integer", + "minLength": 1, + "description": "Special Page Id provided by Intertech Manager" }, "imp_id": { - "type": "integer", - "minLength": 1, - "description": "Special identifier provided by Intertech Manager" + "type": "integer", + "minLength": 1, + "description": "Special identifier provided by Intertech Manager" + }, + "placementid": { + "type": "string", + "pattern": "^[0-9]+-[0-9]+$", + "description": "Combined Page Id and Imp Id in the format 'pageid-impid'" + } + }, + "oneOf": [ + { + "required": ["page_id", "imp_id"] + }, + { + "required": ["placementid"] } - }, - "required": [ - "page_id", - "imp_id" - ] - } \ No newline at end of file + ] +} \ No newline at end of file From b7d5642e6e23bff35f566c5a9228bdff6f6c84c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Fri, 7 Jun 2024 10:52:19 +0000 Subject: [PATCH 04/21] resolve comments --- adapters/intertech/intertech.go | 10 +- .../exemplary/simple-native.json | 6 +- .../supplemental/bad_placement_id.json | 39 +++++ .../multiple-imps-some-malformed.json | 146 ------------------ adapters/intertech/params_test.go | 26 +--- macros/macros.go | 1 + static/bidder-params/intertech.json | 4 +- 7 files changed, 57 insertions(+), 175 deletions(-) create mode 100644 adapters/intertech/intertechtest/supplemental/bad_placement_id.json delete mode 100644 adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index b8840ce0622..7eea46e024c 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -174,7 +174,13 @@ func modifyImp(imp *openrtb2.Imp) error { return err } - return nil + if imp.Native != nil { + return nil + } + + return &errortypes.BadInput{ + Message: fmt.Sprintf("Unsupported format. Yandex only supports banner and native types. Ignoring imp id #%s", imp.ID), + } } func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { @@ -198,7 +204,7 @@ func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { // resolveUrl "un-templates" the endpoint by replacing macroses and adding the required query parameters func (a *adapter) resolveUrl(placementID intertechPlacementID, referer string, currency string) (string, error) { - params := macros.EndpointTemplateParams{PageID: placementID.PageID} + params := macros.EndpointTemplateParams{PageID: placementID.PageID, ImpID: placementID.ImpID} endpointStr, err := macros.ResolveMacros(a.endpoint, params) if err != nil { diff --git a/adapters/intertech/intertechtest/exemplary/simple-native.json b/adapters/intertech/intertechtest/exemplary/simple-native.json index ddaa386483d..10d14c2dd78 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-native.json +++ b/adapters/intertech/intertechtest/exemplary/simple-native.json @@ -10,7 +10,7 @@ }, "ext": { "bidder": { - "placement_id": "R-134001-1" + "placement_id": "134001-1" } } } @@ -32,7 +32,7 @@ "httpCalls": [ { "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/R?imp-id=134001&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", "headers": { "User-Agent": [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" @@ -67,7 +67,7 @@ }, "ext": { "bidder": { - "placement_id": "R-134001-1" + "placement_id": "134001-1" } } } diff --git a/adapters/intertech/intertechtest/supplemental/bad_placement_id.json b/adapters/intertech/intertechtest/supplemental/bad_placement_id.json new file mode 100644 index 00000000000..8a56dfd46b9 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/bad_placement_id.json @@ -0,0 +1,39 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "placement_id": [] + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1", + "language": "EN" + }, + "tmax": 500 + }, + "httpCalls": [], + "expectedMakeRequestsErrors": [ + { + "value": "imp imp_id: unable to unmarshal ext.bidder: json: cannot unmarshal array into Go struct field ExtImpIntertech.placement_id of type string", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json b/adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json deleted file mode 100644 index c1e4a62ec8b..00000000000 --- a/adapters/intertech/intertechtest/supplemental/multiple-imps-some-malformed.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id1", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - }, - { - "id": "imp_id2", - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 2 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/111?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id1", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id1"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id1", - "impid": "imp_id1", - "price": 1.25, - "crid": "crid", - "adm": "adm001", - "h": 600, - "w": 300 - } - ] - } - ], - "bidid": "bid_id" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "bid_id1", - "impid": "imp_id1", - "price": 1.25, - "adm": "adm001", - "crid": "crid", - "w": 300, - "h": 600 - }, - "type": "banner" - } - ] - } - ], - "expectedMakeRequestsErrors": [ - { - "value": "Unsupported format", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/params_test.go b/adapters/intertech/params_test.go index 2df19ef00ae..0ecd6d028a5 100644 --- a/adapters/intertech/params_test.go +++ b/adapters/intertech/params_test.go @@ -36,14 +36,13 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{"page_id": 123123, "imp_id": 123}`, - `{"placement_id": "A-123123-123"}`, - `{"placement_id": "B-A-123123-123"}`, + // `{"placement_id": "A-123123-123"}`, + // `{"placement_id": "B-A-123123-123"}`, `{"placement_id": "123123-123"}`, } var invalidParams = []string{ `{"pageId": 123123, "impId": 123}`, - `{"page_id": 0, "imp_id": 0}`, `{"page_id": "123123", "imp_id": "123"}`, `{"page_id": "123123", "imp_id": "123", "placement_id": "123123"}`, `{"page_id": "123123"}`, @@ -64,24 +63,7 @@ func TestValidPlacementIdMapper(t *testing.T) { } } -func TestInvalidPlacementIdMapper(t *testing.T) { - for _, ext := range invalidPlacementIds { - _, err := mapExtToPlacementID(ext) - - assert.Error(t, err) - } -} - var validPlacementIds = map[openrtb_ext.ExtImpIntertech]intertechPlacementID{ - {PlacementID: "A-12345-1"}: {PageID: "12345", ImpID: "1"}, - {PlacementID: "B-A-123123-123"}: {PageID: "123123", ImpID: "123"}, - {PlacementID: "111-222"}: {PageID: "111", ImpID: "222"}, - {PageID: 111, ImpID: 222}: {PageID: "111", ImpID: "222"}, -} - -var invalidPlacementIds = []openrtb_ext.ExtImpIntertech{ - {PlacementID: "123123"}, - {PlacementID: "A-123123"}, - {PlacementID: "B-A-123123"}, - {PlacementID: "C-B-A-123123"}, + {PlacementID: "111-222"}: {PageID: "111", ImpID: "222"}, + {PageID: 111, ImpID: 222}: {PageID: "111", ImpID: "222"}, } diff --git a/macros/macros.go b/macros/macros.go index bde843c3cbb..861f85949cd 100644 --- a/macros/macros.go +++ b/macros/macros.go @@ -17,6 +17,7 @@ type EndpointTemplateParams struct { GvlID string PageID string SupplyId string + ImpID string } // UserSyncPrivacy specifies privacy policy macros, represented as strings, for user sync urls. diff --git a/static/bidder-params/intertech.json b/static/bidder-params/intertech.json index 35cf83f7753..1b852a40fc1 100644 --- a/static/bidder-params/intertech.json +++ b/static/bidder-params/intertech.json @@ -14,7 +14,7 @@ "minLength": 1, "description": "Special identifier provided by Intertech Manager" }, - "placementid": { + "placement_id": { "type": "string", "pattern": "^[0-9]+-[0-9]+$", "description": "Combined Page Id and Imp Id in the format 'pageid-impid'" @@ -25,7 +25,7 @@ "required": ["page_id", "imp_id"] }, { - "required": ["placementid"] + "required": ["placement_id"] } ] } \ No newline at end of file From 2b1b72714be5aab88c5550bed965a25528f4f666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Thu, 20 Jun 2024 12:21:10 +0000 Subject: [PATCH 05/21] resolve comments --- adapters/intertech/intertech.go | 19 +++- .../{simple-baner.json => simple-banner.json} | 0 .../supplemental/multiple-imps.json | 8 +- .../simple-banner-status-204.json | 96 +++++++++++++++++++ adapters/intertech/params_test.go | 1 + openrtb_ext/imp_intertech.go | 1 - static/bidder-info/intertech.yaml | 11 +-- 7 files changed, 119 insertions(+), 17 deletions(-) rename adapters/intertech/intertechtest/exemplary/{simple-baner.json => simple-banner.json} (100%) create mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 7eea46e024c..79eecc21171 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -187,13 +187,22 @@ func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { bannerCopy := banner format := bannerCopy.Format - if bannerCopy.W == nil || bannerCopy.H == nil || *bannerCopy.W == 0 || *bannerCopy.H == 0 { - if len(format) == 0 { - return nil, &errortypes.BadInput{ - Message: "Invalid size provided for Banner", - } + hasRootSize := bannerCopy.W != nil && bannerCopy.H != nil && *bannerCopy.W > 0 && *bannerCopy.H > 0 + if !hasRootSize && len(format) == 0 { + w := 0 + h := 0 + if bannerCopy.W != nil { + w = int(*bannerCopy.W) + } + if bannerCopy.H != nil { + h = int(*bannerCopy.H) } + return nil, &errortypes.BadInput{ + Message: fmt.Sprintf("Invalid sizes provided for Banner %dx%d", w, h), + } + } + if !hasRootSize { firstFormat := format[0] bannerCopy.H = &firstFormat.H bannerCopy.W = &firstFormat.W diff --git a/adapters/intertech/intertechtest/exemplary/simple-baner.json b/adapters/intertech/intertechtest/exemplary/simple-banner.json similarity index 100% rename from adapters/intertech/intertechtest/exemplary/simple-baner.json rename to adapters/intertech/intertechtest/exemplary/simple-banner.json diff --git a/adapters/intertech/intertechtest/supplemental/multiple-imps.json b/adapters/intertech/intertechtest/supplemental/multiple-imps.json index 3986cfc2dc5..e180708b4a2 100644 --- a/adapters/intertech/intertechtest/supplemental/multiple-imps.json +++ b/adapters/intertech/intertechtest/supplemental/multiple-imps.json @@ -186,9 +186,9 @@ { "id": "bid_id2", "impid": "imp_id2", - "price": 1.25, + "price": 2.50, "crid": "crid", - "adm": "adm001", + "adm": "adm002", "h": 800, "w": 400 } @@ -223,8 +223,8 @@ "bid": { "id": "bid_id2", "impid": "imp_id2", - "price": 1.25, - "adm": "adm001", + "price": 2.50, + "adm": "adm002", "crid": "crid", "w": 400, "h": 800 diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json b/adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json new file mode 100644 index 00000000000..688c628736a --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json @@ -0,0 +1,96 @@ +{ + "mockBidRequest": { + "id": "request_id", + "imp": [ + { + "id": "imp_id1", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://prebid.intertechsrvcs.com/prebid/111?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", + "headers": { + "User-Agent": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Real-Ip": [ + "127.0.0.1" + ], + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Referer": [ + "http://www.example.com" + ], + "Accept": [ + "application/json" + ] + }, + "body": { + "id": "request_id", + "imp": [ + { + "id": "imp_id1", + "banner": { + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "page_id": 111, + "imp_id": 1 + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com" + }, + "cur": [ + "USD" + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", + "ip": "127.0.0.1" + }, + "tmax": 500 + }, + "impIDs":["imp_id1"] + }, + "mockResponse": { + "status": 204, + "headers": {}, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/intertech/params_test.go b/adapters/intertech/params_test.go index 0ecd6d028a5..05bea38f71b 100644 --- a/adapters/intertech/params_test.go +++ b/adapters/intertech/params_test.go @@ -51,6 +51,7 @@ var invalidParams = []string{ `{"placement_id": "123123"}`, `{"placement_id": "A-123123"}`, `{"placement_id": "B-A-123123"}`, + `{"placement_id": "123123-A"}`, `{}`, } diff --git a/openrtb_ext/imp_intertech.go b/openrtb_ext/imp_intertech.go index 798aadaf29c..d8bfb830154 100644 --- a/openrtb_ext/imp_intertech.go +++ b/openrtb_ext/imp_intertech.go @@ -2,7 +2,6 @@ package openrtb_ext type ExtImpIntertech struct { PlacementID string `json:"placement_id"` - // Deprecated: in favor of `PlacementID` PageID int64 `json:"page_id"` // Deprecated: in favor of `PlacementID` diff --git a/static/bidder-info/intertech.yaml b/static/bidder-info/intertech.yaml index 6b6ee467a48..a89e55b1288 100644 --- a/static/bidder-info/intertech.yaml +++ b/static/bidder-info/intertech.yaml @@ -1,4 +1,5 @@ -# This adapter is ported from PBS-Java to PBS-Go for Prebid. Please open a GitHub issue instead of directly contacting the maintainer for technical issues. +# This adapter is ported from PBS-Java to PBS-Go by Prebid. Please open a GitHub issue instead of +# directly contacting the maintainer for technical issues. endpoint: https://prebid.intertechsrvcs.com/prebid/{{.PageID}}?imp-id={{.ImpID}}&ssp-id=10500 endpointCompression: GZIP maintainer: @@ -10,9 +11,5 @@ capabilities: - native userSync: redirect: - url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}} - userMacro: "UID" - redirect-url: /setuid?bidder=intertech&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&uid={{.UID}} - cookieFamilyName: intertech - type: redirect - supportCORS: false \ No newline at end of file + url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&location={{.RedirectURL}} + userMacro: "{UID}" \ No newline at end of file From 3e2bc4099e41c3199c8fc80b25e34cf397c99676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Wed, 10 Jul 2024 10:42:30 +0000 Subject: [PATCH 06/21] EndpointTemplateParams --- adapters/intertech/intertech.go | 37 +++++++++++++------------------ adapters/intertech/params_test.go | 5 +---- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 79eecc21171..c217e44c14e 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -58,7 +58,7 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad for i := range requestData.Imp { imp := requestData.Imp[i] - placementId, err := getIntertechPlacementId(imp) + placementId, err := getPlacementID(imp) if err != nil { errors = append(errors, err) continue @@ -126,7 +126,7 @@ func splitRequestDataByImp(request *openrtb2.BidRequest, imp openrtb2.Imp) openr return requestCopy } -func getIntertechPlacementId(imp openrtb2.Imp) (*intertechPlacementID, error) { +func getPlacementID(imp openrtb2.Imp) (*intertechPlacementID, error) { var ext adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &ext); err != nil { return nil, &errortypes.BadInput{ @@ -141,28 +141,24 @@ func getIntertechPlacementId(imp openrtb2.Imp) (*intertechPlacementID, error) { } } - placementID, err := mapExtToPlacementID(intertechExt) - if err != nil { - return nil, err - } - + placementID := mapExtToPlacementID(intertechExt) return placementID, nil } -func mapExtToPlacementID(intertechExt openrtb_ext.ExtImpIntertech) (*intertechPlacementID, error) { +func mapExtToPlacementID(intertechExt openrtb_ext.ExtImpIntertech) *intertechPlacementID { var placementID intertechPlacementID if len(intertechExt.PlacementID) == 0 { placementID.ImpID = strconv.Itoa(int(intertechExt.ImpID)) placementID.PageID = strconv.Itoa(int(intertechExt.PageID)) - return &placementID, nil + return &placementID } idParts := strings.Split(intertechExt.PlacementID, "-") placementID.PageID = idParts[0] placementID.ImpID = idParts[1] - return &placementID, nil + return &placementID } func modifyImp(imp *openrtb2.Imp) error { @@ -179,23 +175,22 @@ func modifyImp(imp *openrtb2.Imp) error { } return &errortypes.BadInput{ - Message: fmt.Sprintf("Unsupported format. Yandex only supports banner and native types. Ignoring imp id #%s", imp.ID), + Message: fmt.Sprintf("Unsupported format. Intertech only supports banner and native types. Ignoring imp id #%s", imp.ID), } } func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { - bannerCopy := banner - format := bannerCopy.Format + format := banner.Format - hasRootSize := bannerCopy.W != nil && bannerCopy.H != nil && *bannerCopy.W > 0 && *bannerCopy.H > 0 + hasRootSize := banner.W != nil && banner.H != nil && *banner.W > 0 && *banner.H > 0 if !hasRootSize && len(format) == 0 { w := 0 h := 0 - if bannerCopy.W != nil { - w = int(*bannerCopy.W) + if banner.W != nil { + w = int(*banner.W) } - if bannerCopy.H != nil { - h = int(*bannerCopy.H) + if banner.H != nil { + h = int(*banner.H) } return nil, &errortypes.BadInput{ Message: fmt.Sprintf("Invalid sizes provided for Banner %dx%d", w, h), @@ -204,11 +199,11 @@ func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { if !hasRootSize { firstFormat := format[0] - bannerCopy.H = &firstFormat.H - bannerCopy.W = &firstFormat.W + banner.H = &firstFormat.H + banner.W = &firstFormat.W } - return &bannerCopy, nil + return &banner, nil } // resolveUrl "un-templates" the endpoint by replacing macroses and adding the required query parameters diff --git a/adapters/intertech/params_test.go b/adapters/intertech/params_test.go index 05bea38f71b..5607cb238cf 100644 --- a/adapters/intertech/params_test.go +++ b/adapters/intertech/params_test.go @@ -36,8 +36,6 @@ func TestInvalidParams(t *testing.T) { var validParams = []string{ `{"page_id": 123123, "imp_id": 123}`, - // `{"placement_id": "A-123123-123"}`, - // `{"placement_id": "B-A-123123-123"}`, `{"placement_id": "123123-123"}`, } @@ -57,10 +55,9 @@ var invalidParams = []string{ func TestValidPlacementIdMapper(t *testing.T) { for ext, expectedPlacementId := range validPlacementIds { - val, err := mapExtToPlacementID(ext) + val := mapExtToPlacementID(ext) assert.Equal(t, &expectedPlacementId, val) - assert.NoError(t, err) } } From f0649d6863f8607ea959fe32d1dc69813a2fb681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Tue, 5 Nov 2024 11:39:23 +0000 Subject: [PATCH 07/21] resolve conflicts --- exchange/adapter_builders.go | 410 +++++++++++++++++------------------ macros/macros.go | 4 + 2 files changed, 209 insertions(+), 205 deletions(-) diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 8645838e02c..9db2957b86b 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -1,211 +1,211 @@ package exchange import ( - "github.com/prebid/prebid-server/v2/adapters" - ttx "github.com/prebid/prebid-server/v2/adapters/33across" - "github.com/prebid/prebid-server/v2/adapters/aax" - "github.com/prebid/prebid-server/v2/adapters/aceex" - "github.com/prebid/prebid-server/v2/adapters/acuityads" - "github.com/prebid/prebid-server/v2/adapters/adelement" - "github.com/prebid/prebid-server/v2/adapters/adf" - "github.com/prebid/prebid-server/v2/adapters/adgeneration" - "github.com/prebid/prebid-server/v2/adapters/adhese" - "github.com/prebid/prebid-server/v2/adapters/adkernel" - "github.com/prebid/prebid-server/v2/adapters/adkernelAdn" - "github.com/prebid/prebid-server/v2/adapters/adman" - "github.com/prebid/prebid-server/v2/adapters/admixer" - "github.com/prebid/prebid-server/v2/adapters/adnuntius" - "github.com/prebid/prebid-server/v2/adapters/adocean" - "github.com/prebid/prebid-server/v2/adapters/adoppler" - "github.com/prebid/prebid-server/v2/adapters/adot" - "github.com/prebid/prebid-server/v2/adapters/adpone" - "github.com/prebid/prebid-server/v2/adapters/adprime" - "github.com/prebid/prebid-server/v2/adapters/adquery" - "github.com/prebid/prebid-server/v2/adapters/adrino" - "github.com/prebid/prebid-server/v2/adapters/adsinteractive" - "github.com/prebid/prebid-server/v2/adapters/adtarget" - "github.com/prebid/prebid-server/v2/adapters/adtelligent" - "github.com/prebid/prebid-server/v2/adapters/adtrgtme" - "github.com/prebid/prebid-server/v2/adapters/advangelists" - "github.com/prebid/prebid-server/v2/adapters/adview" - "github.com/prebid/prebid-server/v2/adapters/adxcg" - "github.com/prebid/prebid-server/v2/adapters/adyoulike" - "github.com/prebid/prebid-server/v2/adapters/aidem" - "github.com/prebid/prebid-server/v2/adapters/aja" - "github.com/prebid/prebid-server/v2/adapters/algorix" - "github.com/prebid/prebid-server/v2/adapters/alkimi" - "github.com/prebid/prebid-server/v2/adapters/amx" - "github.com/prebid/prebid-server/v2/adapters/apacdex" - "github.com/prebid/prebid-server/v2/adapters/appnexus" - "github.com/prebid/prebid-server/v2/adapters/appush" - "github.com/prebid/prebid-server/v2/adapters/aso" - "github.com/prebid/prebid-server/v2/adapters/audienceNetwork" - "github.com/prebid/prebid-server/v2/adapters/automatad" - "github.com/prebid/prebid-server/v2/adapters/avocet" - "github.com/prebid/prebid-server/v2/adapters/axis" - "github.com/prebid/prebid-server/v2/adapters/axonix" - "github.com/prebid/prebid-server/v2/adapters/beachfront" - "github.com/prebid/prebid-server/v2/adapters/beintoo" - "github.com/prebid/prebid-server/v2/adapters/bematterfull" - "github.com/prebid/prebid-server/v2/adapters/between" - "github.com/prebid/prebid-server/v2/adapters/beyondmedia" - "github.com/prebid/prebid-server/v2/adapters/bidmachine" - "github.com/prebid/prebid-server/v2/adapters/bidmyadz" - "github.com/prebid/prebid-server/v2/adapters/bidscube" - "github.com/prebid/prebid-server/v2/adapters/bidstack" - "github.com/prebid/prebid-server/v2/adapters/bizzclick" - "github.com/prebid/prebid-server/v2/adapters/bliink" - "github.com/prebid/prebid-server/v2/adapters/blue" - "github.com/prebid/prebid-server/v2/adapters/bluesea" - "github.com/prebid/prebid-server/v2/adapters/bmtm" - "github.com/prebid/prebid-server/v2/adapters/boldwin" - "github.com/prebid/prebid-server/v2/adapters/brave" - "github.com/prebid/prebid-server/v2/adapters/bwx" - cadentaperturemx "github.com/prebid/prebid-server/v2/adapters/cadent_aperture_mx" - "github.com/prebid/prebid-server/v2/adapters/ccx" - "github.com/prebid/prebid-server/v2/adapters/coinzilla" - "github.com/prebid/prebid-server/v2/adapters/colossus" - "github.com/prebid/prebid-server/v2/adapters/compass" - "github.com/prebid/prebid-server/v2/adapters/connectad" - "github.com/prebid/prebid-server/v2/adapters/consumable" - "github.com/prebid/prebid-server/v2/adapters/conversant" - "github.com/prebid/prebid-server/v2/adapters/cpmstar" - "github.com/prebid/prebid-server/v2/adapters/criteo" - "github.com/prebid/prebid-server/v2/adapters/cwire" - "github.com/prebid/prebid-server/v2/adapters/datablocks" - "github.com/prebid/prebid-server/v2/adapters/decenterads" - "github.com/prebid/prebid-server/v2/adapters/deepintent" - "github.com/prebid/prebid-server/v2/adapters/definemedia" - "github.com/prebid/prebid-server/v2/adapters/dianomi" - "github.com/prebid/prebid-server/v2/adapters/dmx" - "github.com/prebid/prebid-server/v2/adapters/dxkulture" - evolution "github.com/prebid/prebid-server/v2/adapters/e_volution" - "github.com/prebid/prebid-server/v2/adapters/edge226" - "github.com/prebid/prebid-server/v2/adapters/emtv" - "github.com/prebid/prebid-server/v2/adapters/eplanning" - "github.com/prebid/prebid-server/v2/adapters/epom" - "github.com/prebid/prebid-server/v2/adapters/flipp" - "github.com/prebid/prebid-server/v2/adapters/freewheelssp" - "github.com/prebid/prebid-server/v2/adapters/frvradn" - "github.com/prebid/prebid-server/v2/adapters/gamma" - "github.com/prebid/prebid-server/v2/adapters/gamoshi" - "github.com/prebid/prebid-server/v2/adapters/globalsun" - "github.com/prebid/prebid-server/v2/adapters/gothamads" - "github.com/prebid/prebid-server/v2/adapters/grid" - "github.com/prebid/prebid-server/v2/adapters/gumgum" - "github.com/prebid/prebid-server/v2/adapters/huaweiads" - "github.com/prebid/prebid-server/v2/adapters/imds" - "github.com/prebid/prebid-server/v2/adapters/impactify" - "github.com/prebid/prebid-server/v2/adapters/improvedigital" - "github.com/prebid/prebid-server/v2/adapters/infytv" - "github.com/prebid/prebid-server/v2/adapters/inmobi" - "github.com/prebid/prebid-server/v2/adapters/interactiveoffers" - "github.com/prebid/prebid-server/v2/adapters/intertech" - "github.com/prebid/prebid-server/v2/adapters/invibes" - "github.com/prebid/prebid-server/v2/adapters/iqx" - "github.com/prebid/prebid-server/v2/adapters/iqzone" - "github.com/prebid/prebid-server/v2/adapters/ix" - "github.com/prebid/prebid-server/v2/adapters/jixie" - "github.com/prebid/prebid-server/v2/adapters/kargo" - "github.com/prebid/prebid-server/v2/adapters/kayzen" - "github.com/prebid/prebid-server/v2/adapters/kidoz" - "github.com/prebid/prebid-server/v2/adapters/kiviads" - "github.com/prebid/prebid-server/v2/adapters/krushmedia" - "github.com/prebid/prebid-server/v2/adapters/lemmadigital" - "github.com/prebid/prebid-server/v2/adapters/liftoff" - "github.com/prebid/prebid-server/v2/adapters/limelightDigital" - lmkiviads "github.com/prebid/prebid-server/v2/adapters/lm_kiviads" - "github.com/prebid/prebid-server/v2/adapters/lockerdome" - "github.com/prebid/prebid-server/v2/adapters/logan" - "github.com/prebid/prebid-server/v2/adapters/logicad" - "github.com/prebid/prebid-server/v2/adapters/loyal" - "github.com/prebid/prebid-server/v2/adapters/lunamedia" - "github.com/prebid/prebid-server/v2/adapters/mabidder" - "github.com/prebid/prebid-server/v2/adapters/madvertise" - "github.com/prebid/prebid-server/v2/adapters/marsmedia" - "github.com/prebid/prebid-server/v2/adapters/medianet" - "github.com/prebid/prebid-server/v2/adapters/mgid" - "github.com/prebid/prebid-server/v2/adapters/mgidX" - "github.com/prebid/prebid-server/v2/adapters/minutemedia" - "github.com/prebid/prebid-server/v2/adapters/mobfoxpb" - "github.com/prebid/prebid-server/v2/adapters/mobilefuse" - "github.com/prebid/prebid-server/v2/adapters/motorik" - "github.com/prebid/prebid-server/v2/adapters/nextmillennium" - "github.com/prebid/prebid-server/v2/adapters/nobid" - "github.com/prebid/prebid-server/v2/adapters/oms" - "github.com/prebid/prebid-server/v2/adapters/onetag" - "github.com/prebid/prebid-server/v2/adapters/openweb" - "github.com/prebid/prebid-server/v2/adapters/openx" - "github.com/prebid/prebid-server/v2/adapters/operaads" - "github.com/prebid/prebid-server/v2/adapters/orbidder" - "github.com/prebid/prebid-server/v2/adapters/outbrain" - "github.com/prebid/prebid-server/v2/adapters/ownadx" - "github.com/prebid/prebid-server/v2/adapters/pangle" - "github.com/prebid/prebid-server/v2/adapters/pgamssp" - "github.com/prebid/prebid-server/v2/adapters/playdigo" - "github.com/prebid/prebid-server/v2/adapters/pubmatic" - "github.com/prebid/prebid-server/v2/adapters/pubnative" - "github.com/prebid/prebid-server/v2/adapters/pulsepoint" - "github.com/prebid/prebid-server/v2/adapters/pwbid" - "github.com/prebid/prebid-server/v2/adapters/readpeak" - "github.com/prebid/prebid-server/v2/adapters/relevantdigital" - "github.com/prebid/prebid-server/v2/adapters/revcontent" - "github.com/prebid/prebid-server/v2/adapters/richaudience" - "github.com/prebid/prebid-server/v2/adapters/rise" - "github.com/prebid/prebid-server/v2/adapters/roulax" - "github.com/prebid/prebid-server/v2/adapters/rtbhouse" - "github.com/prebid/prebid-server/v2/adapters/rubicon" - salunamedia "github.com/prebid/prebid-server/v2/adapters/sa_lunamedia" - "github.com/prebid/prebid-server/v2/adapters/screencore" - "github.com/prebid/prebid-server/v2/adapters/seedingAlliance" - "github.com/prebid/prebid-server/v2/adapters/sharethrough" - "github.com/prebid/prebid-server/v2/adapters/silvermob" - "github.com/prebid/prebid-server/v2/adapters/silverpush" - "github.com/prebid/prebid-server/v2/adapters/smaato" - "github.com/prebid/prebid-server/v2/adapters/smartadserver" - "github.com/prebid/prebid-server/v2/adapters/smarthub" - "github.com/prebid/prebid-server/v2/adapters/smartrtb" - "github.com/prebid/prebid-server/v2/adapters/smartx" - "github.com/prebid/prebid-server/v2/adapters/smartyads" - "github.com/prebid/prebid-server/v2/adapters/smilewanted" - "github.com/prebid/prebid-server/v2/adapters/smrtconnect" - "github.com/prebid/prebid-server/v2/adapters/sonobi" - "github.com/prebid/prebid-server/v2/adapters/sovrn" - "github.com/prebid/prebid-server/v2/adapters/sovrnXsp" - "github.com/prebid/prebid-server/v2/adapters/sspBC" - "github.com/prebid/prebid-server/v2/adapters/stroeerCore" - "github.com/prebid/prebid-server/v2/adapters/taboola" - "github.com/prebid/prebid-server/v2/adapters/tappx" - "github.com/prebid/prebid-server/v2/adapters/teads" - "github.com/prebid/prebid-server/v2/adapters/telaria" - "github.com/prebid/prebid-server/v2/adapters/theadx" - "github.com/prebid/prebid-server/v2/adapters/tpmn" - "github.com/prebid/prebid-server/v2/adapters/trafficgate" - "github.com/prebid/prebid-server/v2/adapters/triplelift" - "github.com/prebid/prebid-server/v2/adapters/triplelift_native" - "github.com/prebid/prebid-server/v2/adapters/trustedstack" - "github.com/prebid/prebid-server/v2/adapters/ucfunnel" - "github.com/prebid/prebid-server/v2/adapters/undertone" - "github.com/prebid/prebid-server/v2/adapters/unicorn" - "github.com/prebid/prebid-server/v2/adapters/unruly" - "github.com/prebid/prebid-server/v2/adapters/videobyte" - "github.com/prebid/prebid-server/v2/adapters/videoheroes" - "github.com/prebid/prebid-server/v2/adapters/vidoomy" - "github.com/prebid/prebid-server/v2/adapters/visiblemeasures" - "github.com/prebid/prebid-server/v2/adapters/visx" - "github.com/prebid/prebid-server/v2/adapters/vox" - "github.com/prebid/prebid-server/v2/adapters/vrtcal" - "github.com/prebid/prebid-server/v2/adapters/xeworks" - "github.com/prebid/prebid-server/v2/adapters/yahooAds" - "github.com/prebid/prebid-server/v2/adapters/yandex" - "github.com/prebid/prebid-server/v2/adapters/yeahmobi" - "github.com/prebid/prebid-server/v2/adapters/yieldlab" - "github.com/prebid/prebid-server/v2/adapters/yieldmo" - "github.com/prebid/prebid-server/v2/adapters/yieldone" - "github.com/prebid/prebid-server/v2/adapters/zeroclickfraud" - "github.com/prebid/prebid-server/v2/adapters/zeta_global_ssp" - "github.com/prebid/prebid-server/v2/adapters/zmaticoo" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/adapters" + ttx "github.com/prebid/prebid-server/v3/adapters/33across" + "github.com/prebid/prebid-server/v3/adapters/aax" + "github.com/prebid/prebid-server/v3/adapters/aceex" + "github.com/prebid/prebid-server/v3/adapters/acuityads" + "github.com/prebid/prebid-server/v3/adapters/adelement" + "github.com/prebid/prebid-server/v3/adapters/adf" + "github.com/prebid/prebid-server/v3/adapters/adgeneration" + "github.com/prebid/prebid-server/v3/adapters/adhese" + "github.com/prebid/prebid-server/v3/adapters/adkernel" + "github.com/prebid/prebid-server/v3/adapters/adkernelAdn" + "github.com/prebid/prebid-server/v3/adapters/adman" + "github.com/prebid/prebid-server/v3/adapters/admixer" + "github.com/prebid/prebid-server/v3/adapters/adnuntius" + "github.com/prebid/prebid-server/v3/adapters/adocean" + "github.com/prebid/prebid-server/v3/adapters/adoppler" + "github.com/prebid/prebid-server/v3/adapters/adot" + "github.com/prebid/prebid-server/v3/adapters/adpone" + "github.com/prebid/prebid-server/v3/adapters/adprime" + "github.com/prebid/prebid-server/v3/adapters/adquery" + "github.com/prebid/prebid-server/v3/adapters/adrino" + "github.com/prebid/prebid-server/v3/adapters/adsinteractive" + "github.com/prebid/prebid-server/v3/adapters/adtarget" + "github.com/prebid/prebid-server/v3/adapters/adtelligent" + "github.com/prebid/prebid-server/v3/adapters/adtrgtme" + "github.com/prebid/prebid-server/v3/adapters/advangelists" + "github.com/prebid/prebid-server/v3/adapters/adview" + "github.com/prebid/prebid-server/v3/adapters/adxcg" + "github.com/prebid/prebid-server/v3/adapters/adyoulike" + "github.com/prebid/prebid-server/v3/adapters/aidem" + "github.com/prebid/prebid-server/v3/adapters/aja" + "github.com/prebid/prebid-server/v3/adapters/algorix" + "github.com/prebid/prebid-server/v3/adapters/alkimi" + "github.com/prebid/prebid-server/v3/adapters/amx" + "github.com/prebid/prebid-server/v3/adapters/apacdex" + "github.com/prebid/prebid-server/v3/adapters/appnexus" + "github.com/prebid/prebid-server/v3/adapters/appush" + "github.com/prebid/prebid-server/v3/adapters/aso" + "github.com/prebid/prebid-server/v3/adapters/audienceNetwork" + "github.com/prebid/prebid-server/v3/adapters/automatad" + "github.com/prebid/prebid-server/v3/adapters/avocet" + "github.com/prebid/prebid-server/v3/adapters/axis" + "github.com/prebid/prebid-server/v3/adapters/axonix" + "github.com/prebid/prebid-server/v3/adapters/beachfront" + "github.com/prebid/prebid-server/v3/adapters/beintoo" + "github.com/prebid/prebid-server/v3/adapters/bematterfull" + "github.com/prebid/prebid-server/v3/adapters/between" + "github.com/prebid/prebid-server/v3/adapters/beyondmedia" + "github.com/prebid/prebid-server/v3/adapters/bidmachine" + "github.com/prebid/prebid-server/v3/adapters/bidmyadz" + "github.com/prebid/prebid-server/v3/adapters/bidscube" + "github.com/prebid/prebid-server/v3/adapters/bidstack" + "github.com/prebid/prebid-server/v3/adapters/bizzclick" + "github.com/prebid/prebid-server/v3/adapters/bliink" + "github.com/prebid/prebid-server/v3/adapters/blue" + "github.com/prebid/prebid-server/v3/adapters/bluesea" + "github.com/prebid/prebid-server/v3/adapters/bmtm" + "github.com/prebid/prebid-server/v3/adapters/boldwin" + "github.com/prebid/prebid-server/v3/adapters/brave" + "github.com/prebid/prebid-server/v3/adapters/bwx" + cadentaperturemx "github.com/prebid/prebid-server/v3/adapters/cadent_aperture_mx" + "github.com/prebid/prebid-server/v3/adapters/ccx" + "github.com/prebid/prebid-server/v3/adapters/coinzilla" + "github.com/prebid/prebid-server/v3/adapters/colossus" + "github.com/prebid/prebid-server/v3/adapters/compass" + "github.com/prebid/prebid-server/v3/adapters/connectad" + "github.com/prebid/prebid-server/v3/adapters/consumable" + "github.com/prebid/prebid-server/v3/adapters/conversant" + "github.com/prebid/prebid-server/v3/adapters/cpmstar" + "github.com/prebid/prebid-server/v3/adapters/criteo" + "github.com/prebid/prebid-server/v3/adapters/cwire" + "github.com/prebid/prebid-server/v3/adapters/datablocks" + "github.com/prebid/prebid-server/v3/adapters/decenterads" + "github.com/prebid/prebid-server/v3/adapters/deepintent" + "github.com/prebid/prebid-server/v3/adapters/definemedia" + "github.com/prebid/prebid-server/v3/adapters/dianomi" + "github.com/prebid/prebid-server/v3/adapters/dmx" + "github.com/prebid/prebid-server/v3/adapters/dxkulture" + evolution "github.com/prebid/prebid-server/v3/adapters/e_volution" + "github.com/prebid/prebid-server/v3/adapters/edge226" + "github.com/prebid/prebid-server/v3/adapters/emtv" + "github.com/prebid/prebid-server/v3/adapters/eplanning" + "github.com/prebid/prebid-server/v3/adapters/epom" + "github.com/prebid/prebid-server/v3/adapters/flipp" + "github.com/prebid/prebid-server/v3/adapters/freewheelssp" + "github.com/prebid/prebid-server/v3/adapters/frvradn" + "github.com/prebid/prebid-server/v3/adapters/gamma" + "github.com/prebid/prebid-server/v3/adapters/gamoshi" + "github.com/prebid/prebid-server/v3/adapters/globalsun" + "github.com/prebid/prebid-server/v3/adapters/gothamads" + "github.com/prebid/prebid-server/v3/adapters/grid" + "github.com/prebid/prebid-server/v3/adapters/gumgum" + "github.com/prebid/prebid-server/v3/adapters/huaweiads" + "github.com/prebid/prebid-server/v3/adapters/imds" + "github.com/prebid/prebid-server/v3/adapters/impactify" + "github.com/prebid/prebid-server/v3/adapters/improvedigital" + "github.com/prebid/prebid-server/v3/adapters/infytv" + "github.com/prebid/prebid-server/v3/adapters/inmobi" + "github.com/prebid/prebid-server/v3/adapters/interactiveoffers" + "github.com/prebid/prebid-server/v3/adapters/intertech" + "github.com/prebid/prebid-server/v3/adapters/invibes" + "github.com/prebid/prebid-server/v3/adapters/iqx" + "github.com/prebid/prebid-server/v3/adapters/iqzone" + "github.com/prebid/prebid-server/v3/adapters/ix" + "github.com/prebid/prebid-server/v3/adapters/jixie" + "github.com/prebid/prebid-server/v3/adapters/kargo" + "github.com/prebid/prebid-server/v3/adapters/kayzen" + "github.com/prebid/prebid-server/v3/adapters/kidoz" + "github.com/prebid/prebid-server/v3/adapters/kiviads" + "github.com/prebid/prebid-server/v3/adapters/krushmedia" + "github.com/prebid/prebid-server/v3/adapters/lemmadigital" + "github.com/prebid/prebid-server/v3/adapters/liftoff" + "github.com/prebid/prebid-server/v3/adapters/limelightDigital" + lmkiviads "github.com/prebid/prebid-server/v3/adapters/lm_kiviads" + "github.com/prebid/prebid-server/v3/adapters/lockerdome" + "github.com/prebid/prebid-server/v3/adapters/logan" + "github.com/prebid/prebid-server/v3/adapters/logicad" + "github.com/prebid/prebid-server/v3/adapters/loyal" + "github.com/prebid/prebid-server/v3/adapters/lunamedia" + "github.com/prebid/prebid-server/v3/adapters/mabidder" + "github.com/prebid/prebid-server/v3/adapters/madvertise" + "github.com/prebid/prebid-server/v3/adapters/marsmedia" + "github.com/prebid/prebid-server/v3/adapters/medianet" + "github.com/prebid/prebid-server/v3/adapters/mgid" + "github.com/prebid/prebid-server/v3/adapters/mgidX" + "github.com/prebid/prebid-server/v3/adapters/minutemedia" + "github.com/prebid/prebid-server/v3/adapters/mobfoxpb" + "github.com/prebid/prebid-server/v3/adapters/mobilefuse" + "github.com/prebid/prebid-server/v3/adapters/motorik" + "github.com/prebid/prebid-server/v3/adapters/nextmillennium" + "github.com/prebid/prebid-server/v3/adapters/nobid" + "github.com/prebid/prebid-server/v3/adapters/oms" + "github.com/prebid/prebid-server/v3/adapters/onetag" + "github.com/prebid/prebid-server/v3/adapters/openweb" + "github.com/prebid/prebid-server/v3/adapters/openx" + "github.com/prebid/prebid-server/v3/adapters/operaads" + "github.com/prebid/prebid-server/v3/adapters/orbidder" + "github.com/prebid/prebid-server/v3/adapters/outbrain" + "github.com/prebid/prebid-server/v3/adapters/ownadx" + "github.com/prebid/prebid-server/v3/adapters/pangle" + "github.com/prebid/prebid-server/v3/adapters/pgamssp" + "github.com/prebid/prebid-server/v3/adapters/playdigo" + "github.com/prebid/prebid-server/v3/adapters/pubmatic" + "github.com/prebid/prebid-server/v3/adapters/pubnative" + "github.com/prebid/prebid-server/v3/adapters/pulsepoint" + "github.com/prebid/prebid-server/v3/adapters/pwbid" + "github.com/prebid/prebid-server/v3/adapters/readpeak" + "github.com/prebid/prebid-server/v3/adapters/relevantdigital" + "github.com/prebid/prebid-server/v3/adapters/revcontent" + "github.com/prebid/prebid-server/v3/adapters/richaudience" + "github.com/prebid/prebid-server/v3/adapters/rise" + "github.com/prebid/prebid-server/v3/adapters/roulax" + "github.com/prebid/prebid-server/v3/adapters/rtbhouse" + "github.com/prebid/prebid-server/v3/adapters/rubicon" + salunamedia "github.com/prebid/prebid-server/v3/adapters/sa_lunamedia" + "github.com/prebid/prebid-server/v3/adapters/screencore" + "github.com/prebid/prebid-server/v3/adapters/seedingAlliance" + "github.com/prebid/prebid-server/v3/adapters/sharethrough" + "github.com/prebid/prebid-server/v3/adapters/silvermob" + "github.com/prebid/prebid-server/v3/adapters/silverpush" + "github.com/prebid/prebid-server/v3/adapters/smaato" + "github.com/prebid/prebid-server/v3/adapters/smartadserver" + "github.com/prebid/prebid-server/v3/adapters/smarthub" + "github.com/prebid/prebid-server/v3/adapters/smartrtb" + "github.com/prebid/prebid-server/v3/adapters/smartx" + "github.com/prebid/prebid-server/v3/adapters/smartyads" + "github.com/prebid/prebid-server/v3/adapters/smilewanted" + "github.com/prebid/prebid-server/v3/adapters/smrtconnect" + "github.com/prebid/prebid-server/v3/adapters/sonobi" + "github.com/prebid/prebid-server/v3/adapters/sovrn" + "github.com/prebid/prebid-server/v3/adapters/sovrnXsp" + "github.com/prebid/prebid-server/v3/adapters/sspBC" + "github.com/prebid/prebid-server/v3/adapters/stroeerCore" + "github.com/prebid/prebid-server/v3/adapters/taboola" + "github.com/prebid/prebid-server/v3/adapters/tappx" + "github.com/prebid/prebid-server/v3/adapters/teads" + "github.com/prebid/prebid-server/v3/adapters/telaria" + "github.com/prebid/prebid-server/v3/adapters/theadx" + "github.com/prebid/prebid-server/v3/adapters/tpmn" + "github.com/prebid/prebid-server/v3/adapters/trafficgate" + "github.com/prebid/prebid-server/v3/adapters/triplelift" + "github.com/prebid/prebid-server/v3/adapters/triplelift_native" + "github.com/prebid/prebid-server/v3/adapters/trustedstack" + "github.com/prebid/prebid-server/v3/adapters/ucfunnel" + "github.com/prebid/prebid-server/v3/adapters/undertone" + "github.com/prebid/prebid-server/v3/adapters/unicorn" + "github.com/prebid/prebid-server/v3/adapters/unruly" + "github.com/prebid/prebid-server/v3/adapters/videobyte" + "github.com/prebid/prebid-server/v3/adapters/videoheroes" + "github.com/prebid/prebid-server/v3/adapters/vidoomy" + "github.com/prebid/prebid-server/v3/adapters/visiblemeasures" + "github.com/prebid/prebid-server/v3/adapters/visx" + "github.com/prebid/prebid-server/v3/adapters/vox" + "github.com/prebid/prebid-server/v3/adapters/vrtcal" + "github.com/prebid/prebid-server/v3/adapters/xeworks" + "github.com/prebid/prebid-server/v3/adapters/yahooAds" + "github.com/prebid/prebid-server/v3/adapters/yandex" + "github.com/prebid/prebid-server/v3/adapters/yeahmobi" + "github.com/prebid/prebid-server/v3/adapters/yieldlab" + "github.com/prebid/prebid-server/v3/adapters/yieldmo" + "github.com/prebid/prebid-server/v3/adapters/yieldone" + "github.com/prebid/prebid-server/v3/adapters/zeroclickfraud" + "github.com/prebid/prebid-server/v3/adapters/zeta_global_ssp" + "github.com/prebid/prebid-server/v3/adapters/zmaticoo" + "github.com/prebid/prebid-server/v3/openrtb_ext" ) // Adapter registration is kept in this separate file for ease of use and to aid diff --git a/macros/macros.go b/macros/macros.go index 861f85949cd..1fff558b39c 100644 --- a/macros/macros.go +++ b/macros/macros.go @@ -18,6 +18,10 @@ type EndpointTemplateParams struct { PageID string SupplyId string ImpID string + SspId string + SspID string + SeatID string + TokenID string } // UserSyncPrivacy specifies privacy policy macros, represented as strings, for user sync urls. From 3dad03f69a58db77b264a56a56baabd644e628bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Tue, 5 Nov 2024 12:29:54 +0000 Subject: [PATCH 08/21] v2 to v3 --- adapters/intertech/intertech.go | 10 +++++----- adapters/intertech/intertech_test.go | 6 +++--- adapters/intertech/params_test.go | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index c217e44c14e..e514e382a30 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -10,11 +10,11 @@ import ( "text/template" "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" - "github.com/prebid/prebid-server/v2/macros" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/adapters" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/errortypes" + "github.com/prebid/prebid-server/v3/macros" + "github.com/prebid/prebid-server/v3/openrtb_ext" ) const ( diff --git a/adapters/intertech/intertech_test.go b/adapters/intertech/intertech_test.go index 5aee72b610f..f05e42332a7 100644 --- a/adapters/intertech/intertech_test.go +++ b/adapters/intertech/intertech_test.go @@ -3,9 +3,9 @@ package intertech import ( "testing" - "github.com/prebid/prebid-server/v2/adapters/adapterstest" - "github.com/prebid/prebid-server/v2/config" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/adapters/adapterstest" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/openrtb_ext" "github.com/stretchr/testify/assert" ) diff --git a/adapters/intertech/params_test.go b/adapters/intertech/params_test.go index 5607cb238cf..e2d31b06b3b 100644 --- a/adapters/intertech/params_test.go +++ b/adapters/intertech/params_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/prebid/prebid-server/v2/openrtb_ext" + "github.com/prebid/prebid-server/v3/openrtb_ext" "github.com/stretchr/testify/assert" ) From 6da959dd47ffee2c23597f1c8ec701c6712ec88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Tue, 5 Nov 2024 12:43:28 +0000 Subject: [PATCH 09/21] fix v2 v3 --- exchange/adapter_builders.go | 1 + 1 file changed, 1 insertion(+) diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 03ff2610219..a0f0ada560d 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -110,6 +110,7 @@ import ( "github.com/prebid/prebid-server/v3/adapters/infytv" "github.com/prebid/prebid-server/v3/adapters/inmobi" "github.com/prebid/prebid-server/v3/adapters/interactiveoffers" + "github.com/prebid/prebid-server/v3/adapters/intertech" "github.com/prebid/prebid-server/v3/adapters/invibes" "github.com/prebid/prebid-server/v3/adapters/iqx" "github.com/prebid/prebid-server/v3/adapters/iqzone" From b1222c5a59a2f43ebf4371c42e8413dc514845ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Mon, 18 Nov 2024 16:25:05 +0000 Subject: [PATCH 10/21] fix comments --- adapters/intertech/intertech.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index e514e382a30..d0bcd997449 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -15,6 +15,7 @@ import ( "github.com/prebid/prebid-server/v3/errortypes" "github.com/prebid/prebid-server/v3/macros" "github.com/prebid/prebid-server/v3/openrtb_ext" + "github.com/prebid/prebid-server/v3/util/jsonutil" ) const ( @@ -77,7 +78,7 @@ func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *ad splittedRequestData := splitRequestDataByImp(requestData, imp) - requestBody, err := json.Marshal(splittedRequestData) + requestBody, err := jsonutil.Marshal(splittedRequestData) if err != nil { errors = append(errors, err) continue @@ -128,14 +129,14 @@ func splitRequestDataByImp(request *openrtb2.BidRequest, imp openrtb2.Imp) openr func getPlacementID(imp openrtb2.Imp) (*intertechPlacementID, error) { var ext adapters.ExtImpBidder - if err := json.Unmarshal(imp.Ext, &ext); err != nil { + if err := jsonutil.Unmarshal(imp.Ext, &ext); err != nil { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("imp %s: unable to unmarshal ext", imp.ID), } } var intertechExt openrtb_ext.ExtImpIntertech - if err := json.Unmarshal(ext.Bidder, &intertechExt); err != nil { + if err := jsonutil.Unmarshal(ext.Bidder, &intertechExt); err != nil { return nil, &errortypes.BadInput{ Message: fmt.Sprintf("imp %s: unable to unmarshal ext.bidder: %v", imp.ID, err), } From 72d373879818594dc79131299ef91387db8e0b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Mon, 18 Nov 2024 16:57:11 +0000 Subject: [PATCH 11/21] fix comments --- .../supplemental/bad_placement_id.json | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 adapters/intertech/intertechtest/supplemental/bad_placement_id.json diff --git a/adapters/intertech/intertechtest/supplemental/bad_placement_id.json b/adapters/intertech/intertechtest/supplemental/bad_placement_id.json deleted file mode 100644 index 8a56dfd46b9..00000000000 --- a/adapters/intertech/intertechtest/supplemental/bad_placement_id.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "placement_id": [] - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1", - "language": "EN" - }, - "tmax": 500 - }, - "httpCalls": [], - "expectedMakeRequestsErrors": [ - { - "value": "imp imp_id: unable to unmarshal ext.bidder: json: cannot unmarshal array into Go struct field ExtImpIntertech.placement_id of type string", - "comparison": "literal" - } - ] -} \ No newline at end of file From 6f3c68fd35b22759e1e064edbc7ffba33e0e5a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Mon, 25 Nov 2024 11:59:11 +0000 Subject: [PATCH 12/21] fix comments --- adapters/intertech/intertech.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index d0bcd997449..39387d1c9a7 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -1,7 +1,6 @@ package intertech import ( - "encoding/json" "fmt" "net/http" "net/url" @@ -267,7 +266,7 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData } var bidResponse openrtb2.BidResponse - if err := json.Unmarshal(responseData.Body, &bidResponse); err != nil { + if err := jsonutil.Unmarshal(responseData.Body, &bidResponse); err != nil { return nil, []error{&errortypes.BadServerResponse{ Message: fmt.Sprintf("Bad server response: %d", err), }} From cbd5d1c4724a904b6ddb4734030b5f7ed6fa5ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Tue, 10 Dec 2024 13:57:20 +0000 Subject: [PATCH 13/21] Deleted in json placemtnId, all adapter was change --- adapters/intertech/intertech.go | 356 ++++++++---------- adapters/intertech/intertech_test.go | 14 +- .../exemplary/simple-banner.json | 228 +++++------ adapters/intertech/params_test.go | 29 +- static/bidder-params/intertech.json | 16 +- 5 files changed, 265 insertions(+), 378 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 39387d1c9a7..3a8a9ccf564 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -6,321 +6,269 @@ import ( "net/url" "strconv" "strings" - "text/template" "github.com/prebid/openrtb/v20/openrtb2" "github.com/prebid/prebid-server/v3/adapters" "github.com/prebid/prebid-server/v3/config" "github.com/prebid/prebid-server/v3/errortypes" - "github.com/prebid/prebid-server/v3/macros" "github.com/prebid/prebid-server/v3/openrtb_ext" "github.com/prebid/prebid-server/v3/util/jsonutil" ) const ( - refererQueryKey = "target-ref" - currencyQueryKey = "ssp-cur" - impIdQueryKey = "imp-id" + pageIDMacro = "{{page_id}}" + impIDMacro = "{{imp_id}}" ) -// intertechPlacementID is the composite id of an ad placement -type intertechPlacementID struct { - PageID string - ImpID string +type adapter struct { + endpoint string } -type adapter struct { - endpoint *template.Template +type ExtImpIntertech struct { + PageID int `json:"page_id"` + ImpID int `json:"imp_id"` } func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { - template, err := template.New("endpointTemplate").Parse(config.Endpoint) - if err != nil { - return nil, fmt.Errorf("unable to parse endpoint url template: %v", err) - } - bidder := &adapter{ - endpoint: template, + endpoint: config.Endpoint, } - return bidder, nil } -func (a *adapter) MakeRequests(requestData *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - var ( - requests []*adapters.RequestData - errors []error - ) - - referer := getReferer(requestData) - currency := getCurrency(requestData) +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + var errs []error + var requests []*adapters.RequestData - for i := range requestData.Imp { - imp := requestData.Imp[i] + referer := getReferer(request) + cur := getCur(request) - placementId, err := getPlacementID(imp) + for _, imp := range request.Imp { + extImp, err := parseAndValidateImpExt(imp) if err != nil { - errors = append(errors, err) + errs = append(errs, err) continue } - if err := modifyImp(&imp); err != nil { - errors = append(errors, err) + modifiedImp, err := modifyImp(imp) + if err != nil { + errs = append(errs, err) continue } - resolvedUrl, err := a.resolveUrl(*placementId, referer, currency) + modifiedUrl, err := a.modifyUrl(extImp, referer, cur) if err != nil { - errors = append(errors, err) + errs = append(errs, err) continue } - splittedRequestData := splitRequestDataByImp(requestData, imp) + modRequest := *request + modRequest.Imp = []openrtb2.Imp{modifiedImp} - requestBody, err := jsonutil.Marshal(splittedRequestData) + reqData, err := buildRequestData(modRequest, modifiedUrl) if err != nil { - errors = append(errors, err) + errs = append(errs, err) continue } - requests = append(requests, &adapters.RequestData{ - Method: "POST", - Uri: resolvedUrl, - Body: requestBody, - Headers: getHeaders(&splittedRequestData), - ImpIDs: openrtb_ext.GetImpIDs(splittedRequestData.Imp), - }) + requests = append(requests, reqData) } - return requests, errors + return requests, errs } -func getHeaders(request *openrtb2.BidRequest) http.Header { - headers := http.Header{} - - if request.Device != nil && request.Site != nil { - addNonEmptyHeader(&headers, "Referer", request.Site.Page) - addNonEmptyHeader(&headers, "Accept-Language", request.Device.Language) - addNonEmptyHeader(&headers, "User-Agent", request.Device.UA) - addNonEmptyHeader(&headers, "X-Forwarded-For", request.Device.IP) - addNonEmptyHeader(&headers, "X-Real-Ip", request.Device.IP) - addNonEmptyHeader(&headers, "X-Forwarded-For-IPv6", request.Device.IPv6) - headers.Add("Content-Type", "application/json;charset=utf-8") - headers.Add("Accept", "application/json") - } - - return headers -} - -func addNonEmptyHeader(headers *http.Header, key, value string) { - if len(value) > 0 { - headers.Add(key, value) +func parseAndValidateImpExt(imp openrtb2.Imp) (ExtImpIntertech, error) { + var bidderExt adapters.ExtImpBidder + if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil { + return ExtImpIntertech{}, &errortypes.BadInput{ + Message: fmt.Sprintf("imp #%s: unable to parse bidder ext: %s", imp.ID, err), + } } -} - -// splitRequestDataByImp makes a shallow copy of the request for further modification (imp is already a shallow copy) -func splitRequestDataByImp(request *openrtb2.BidRequest, imp openrtb2.Imp) openrtb2.BidRequest { - requestCopy := *request - requestCopy.Imp = []openrtb2.Imp{imp} - return requestCopy -} - -func getPlacementID(imp openrtb2.Imp) (*intertechPlacementID, error) { - var ext adapters.ExtImpBidder - if err := jsonutil.Unmarshal(imp.Ext, &ext); err != nil { - return nil, &errortypes.BadInput{ - Message: fmt.Sprintf("imp %s: unable to unmarshal ext", imp.ID), + var extImp ExtImpIntertech + if err := jsonutil.Unmarshal(bidderExt.Bidder, &extImp); err != nil { + return ExtImpIntertech{}, &errortypes.BadInput{ + Message: fmt.Sprintf("imp #%s: unable to parse intertech ext: %s", imp.ID, err), } } - var intertechExt openrtb_ext.ExtImpIntertech - if err := jsonutil.Unmarshal(ext.Bidder, &intertechExt); err != nil { - return nil, &errortypes.BadInput{ - Message: fmt.Sprintf("imp %s: unable to unmarshal ext.bidder: %v", imp.ID, err), + if extImp.PageID == 0 { + return ExtImpIntertech{}, &errortypes.BadInput{ + Message: fmt.Sprintf("imp #%s: missing param page_id", imp.ID), } } - - placementID := mapExtToPlacementID(intertechExt) - return placementID, nil -} - -func mapExtToPlacementID(intertechExt openrtb_ext.ExtImpIntertech) *intertechPlacementID { - var placementID intertechPlacementID - - if len(intertechExt.PlacementID) == 0 { - placementID.ImpID = strconv.Itoa(int(intertechExt.ImpID)) - placementID.PageID = strconv.Itoa(int(intertechExt.PageID)) - return &placementID + if extImp.ImpID == 0 { + return ExtImpIntertech{}, &errortypes.BadInput{ + Message: fmt.Sprintf("imp #%s: missing param imp_id", imp.ID), + } } - idParts := strings.Split(intertechExt.PlacementID, "-") - placementID.PageID = idParts[0] - placementID.ImpID = idParts[1] - - return &placementID + return extImp, nil } -func modifyImp(imp *openrtb2.Imp) error { +func modifyImp(imp openrtb2.Imp) (openrtb2.Imp, error) { if imp.Banner != nil { - banner, err := modifyBanner(*imp.Banner) - if banner != nil { - imp.Banner = banner + banner, err := updateBanner(imp.Banner) + if err != nil { + return openrtb2.Imp{}, &errortypes.BadInput{ + Message: fmt.Sprintf("imp #%s: %s", imp.ID, err.Error()), + } } - return err + imp.Banner = banner + return imp, nil } - if imp.Native != nil { - return nil + return imp, nil } - - return &errortypes.BadInput{ - Message: fmt.Sprintf("Unsupported format. Intertech only supports banner and native types. Ignoring imp id #%s", imp.ID), + return openrtb2.Imp{}, &errortypes.BadInput{ + Message: fmt.Sprintf("Intertech only supports banner and native types. Ignoring imp id=%s", imp.ID), } } -func modifyBanner(banner openrtb2.Banner) (*openrtb2.Banner, error) { - format := banner.Format - - hasRootSize := banner.W != nil && banner.H != nil && *banner.W > 0 && *banner.H > 0 - if !hasRootSize && len(format) == 0 { - w := 0 - h := 0 - if banner.W != nil { - w = int(*banner.W) - } - if banner.H != nil { - h = int(*banner.H) - } - return nil, &errortypes.BadInput{ - Message: fmt.Sprintf("Invalid sizes provided for Banner %dx%d", w, h), +func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { + if banner == nil { + return nil, fmt.Errorf("banner is null") + } + if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { + if len(banner.Format) > 0 { + w := banner.Format[0].W + h := banner.Format[0].H + banner.W = &w + banner.H = &h + } else { + return nil, fmt.Errorf("Invalid sizes provided for Banner") } } + return banner, nil +} - if !hasRootSize { - firstFormat := format[0] - banner.H = &firstFormat.H - banner.W = &firstFormat.W - } +func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) (string, error) { + pageStr := strconv.Itoa(extImp.PageID) + impStr := strconv.Itoa(extImp.ImpID) - return &banner, nil -} + resolvedUrl := strings.ReplaceAll(a.endpoint, pageIDMacro, url.QueryEscape(pageStr)) + resolvedUrl = strings.ReplaceAll(resolvedUrl, impIDMacro, url.QueryEscape(impStr)) -// resolveUrl "un-templates" the endpoint by replacing macroses and adding the required query parameters -func (a *adapter) resolveUrl(placementID intertechPlacementID, referer string, currency string) (string, error) { - params := macros.EndpointTemplateParams{PageID: placementID.PageID, ImpID: placementID.ImpID} + if referer != "" { + resolvedUrl += "&target-ref=" + url.QueryEscape(referer) + } - endpointStr, err := macros.ResolveMacros(a.endpoint, params) - if err != nil { - return "", err + if cur != "" { + resolvedUrl += "&ssp-cur=" + cur } - parsedUrl, err := url.Parse(endpointStr) + return resolvedUrl, nil +} + +func buildRequestData(bidRequest openrtb2.BidRequest, uri string) (*adapters.RequestData, error) { + body, err := jsonutil.Marshal(bidRequest) if err != nil { - return "", err + return nil, err } - addNonEmptyQueryParams(parsedUrl, map[string]string{ - refererQueryKey: referer, - currencyQueryKey: currency, - impIdQueryKey: placementID.ImpID, - }) - - return parsedUrl.String(), nil -} + headers := http.Header{} + headers.Add("Content-Type", "application/json") -func addNonEmptyQueryParams(url *url.URL, queryMap map[string]string) { - query := url.Query() - for key, value := range queryMap { - if len(value) > 0 { - query.Add(key, value) + if bidRequest.Device != nil { + if bidRequest.Device.UA != "" { + headers.Add("User-Agent", bidRequest.Device.UA) + } + if bidRequest.Device.IP != "" { + headers.Add("X-Forwarded-For", bidRequest.Device.IP) + headers.Add("X-Real-Ip", bidRequest.Device.IP) + } + if bidRequest.Device.Language != "" { + headers.Add("Accept-Language", bidRequest.Device.Language) } } - url.RawQuery = query.Encode() + return &adapters.RequestData{ + Method: http.MethodPost, + Uri: uri, + Body: body, + Headers: headers, + }, nil } func getReferer(request *openrtb2.BidRequest) string { - if request.Site == nil { - return "" + if request.Site != nil { + return request.Site.Page } - - return request.Site.Domain + return "" } -func getCurrency(request *openrtb2.BidRequest) string { - if len(request.Cur) == 0 { - return "" +func getCur(request *openrtb2.BidRequest) string { + if len(request.Cur) > 0 { + return request.Cur[0] } - - return request.Cur[0] + return "" } -func (a *adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { - if adapters.IsResponseStatusCodeNoContent(responseData) { - return nil, nil - } - - if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { - return nil, []error{err} +func (a *adapter) MakeBids(req *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if responseData.StatusCode != http.StatusOK { + return nil, []error{&errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unexpected status code: %d", responseData.StatusCode), + }} } - var bidResponse openrtb2.BidResponse - if err := jsonutil.Unmarshal(responseData.Body, &bidResponse); err != nil { + var bidResp openrtb2.BidResponse + if err := jsonutil.Unmarshal(responseData.Body, &bidResp); err != nil { return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("Bad server response: %d", err), + Message: fmt.Sprintf("Failed to decode bid response: %s", err.Error()), }} } - bidResponseWithCapacity := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) - - var errors []error - - impMap := map[string]*openrtb2.Imp{} - for i := range request.Imp { - imp := request.Imp[i] - - impMap[imp.ID] = &imp + seatBids := bidResp.SeatBid + if seatBids == nil { + return &adapters.BidderResponse{ + Currency: bidResp.Cur, + Bids: make([]*adapters.TypedBid, 0), + }, nil } - for _, seatBid := range bidResponse.SeatBid { - for i := range seatBid.Bid { - bid := seatBid.Bid[i] + if len(seatBids) == 0 { + return nil, []error{&errortypes.BadServerResponse{ + Message: "SeatBids is empty", + }} + } - imp, exists := impMap[bid.ImpID] - if !exists { - errors = append(errors, &errortypes.BadInput{ - Message: fmt.Sprintf("Invalid bid imp ID #%s does not match any imp IDs from the original bid request", bid.ImpID), - }) - continue - } + bidderResponse := adapters.NewBidderResponseWithBidsCapacity(len(seatBids)) + bidderResponse.Currency = bidResp.Cur - bidType, err := getBidType(*imp) + var errs []error + for _, seatBid := range seatBids { + for _, bid := range seatBid.Bid { + bidType, err := getBidTypeFromImps(bid.ImpID, req.Imp) if err != nil { - errors = append(errors, err) + errs = append(errs, &errortypes.BadServerResponse{Message: err.Error()}) continue } - - bidResponseWithCapacity.Bids = append(bidResponseWithCapacity.Bids, &adapters.TypedBid{ + typedBid := &adapters.TypedBid{ Bid: &bid, BidType: bidType, - }) + } + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) } } - return bidResponseWithCapacity, errors + return bidderResponse, errs +} + +func getBidTypeFromImps(bidImpID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { + for _, imp := range imps { + if imp.ID == bidImpID { + return resolveImpType(imp) + } + } + return "", fmt.Errorf("Invalid bid imp ID %s does not match any imp IDs from the original bid request", bidImpID) } -func getBidType(imp openrtb2.Imp) (openrtb_ext.BidType, error) { +func resolveImpType(imp openrtb2.Imp) (openrtb_ext.BidType, error) { if imp.Native != nil { return openrtb_ext.BidTypeNative, nil } - if imp.Banner != nil { return openrtb_ext.BidTypeBanner, nil } - - return "", &errortypes.BadInput{ - Message: fmt.Sprintf("Processing an invalid impression; cannot resolve impression type for imp #%s", imp.ID), - } + return "", fmt.Errorf("Processing an invalid impression; cannot resolve impression type") } diff --git a/adapters/intertech/intertech_test.go b/adapters/intertech/intertech_test.go index f05e42332a7..952b2a4431c 100644 --- a/adapters/intertech/intertech_test.go +++ b/adapters/intertech/intertech_test.go @@ -6,13 +6,12 @@ import ( "github.com/prebid/prebid-server/v3/adapters/adapterstest" "github.com/prebid/prebid-server/v3/config" "github.com/prebid/prebid-server/v3/openrtb_ext" - "github.com/stretchr/testify/assert" ) func TestJsonSamples(t *testing.T) { - bidder, buildErr := Builder(openrtb_ext.BidderIntertech, - config.Adapter{Endpoint: "https://prebid.intertechsrvcs.com/prebid/{{.PageID}}?ssp-id=10500"}, - config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + bidder, buildErr := Builder(openrtb_ext.BidderIntertech, config.Adapter{ + Endpoint: "https://test.intertech.com/ssp?pid={{page_id}}&imp={{imp_id}}"}, config.Server{ + ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) @@ -20,10 +19,3 @@ func TestJsonSamples(t *testing.T) { adapterstest.RunJSONBidderTest(t, "intertechtest", bidder) } - -func TestEndpointTemplateMalformed(t *testing.T) { - _, buildErr := Builder(openrtb_ext.BidderIntertech, config.Adapter{ - Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) - - assert.Error(t, buildErr) -} diff --git a/adapters/intertech/intertechtest/exemplary/simple-banner.json b/adapters/intertech/intertechtest/exemplary/simple-banner.json index 89d418a7c22..ed208bf6be9 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-banner.json +++ b/adapters/intertech/intertechtest/exemplary/simple-banner.json @@ -1,135 +1,111 @@ { - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "placement_id": "134001-1" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1", - "language": "EN" - }, - "tmax": 500 + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)" + }, + "app": { + "id": "app_123", + "bundle": "com.example.testapp" }, - "httpCalls": [ + "imp": [ { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ], - "Accept-Language": [ - "EN" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "placement_id": "134001-1" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1", - "language": "EN" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id", - "impid": "imp_id", - "price": 1.25, - "crid": "crid", - "adm": "content", - "h": 600, - "w": 300 - } - ] - } - ], - "bidid": "bid_id", - "cur": "USD" + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 } } } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "bid_id", - "impid": "imp_id", - "price": 1.25, - "adm": "content", - "crid": "crid", - "w": 300, - "h": 600 - }, - "type": "banner" + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=&ssp-cur=USD", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "app": { + "id": "app_123", + "bundle": "com.example.testapp" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)" } - ] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "intertech", + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.5, + "adm": "

Test Ad

", + "cid": "test_cid", + "crid": "test_crid", + "w": 300, + "h": 250 + } + ] + } + ] + } } - ] - } \ No newline at end of file + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.5, + "adm": "

Test Ad

", + "cid": "test_cid", + "crid": "test_crid", + "w": 300, + "h": 250 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/params_test.go b/adapters/intertech/params_test.go index e2d31b06b3b..eb7bb0aba4e 100644 --- a/adapters/intertech/params_test.go +++ b/adapters/intertech/params_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/prebid/prebid-server/v3/openrtb_ext" - "github.com/stretchr/testify/assert" ) func TestValidParams(t *testing.T) { @@ -35,33 +34,15 @@ func TestInvalidParams(t *testing.T) { } var validParams = []string{ - `{"page_id": 123123, "imp_id": 123}`, - `{"placement_id": "123123-123"}`, + `{"page_id": 123, "imp_id": 456}`, + `{"page_id": 1, "imp_id": 1}`, + `{"page_id": 999, "imp_id": 999}`, } var invalidParams = []string{ - `{"pageId": 123123, "impId": 123}`, - `{"page_id": "123123", "imp_id": "123"}`, - `{"page_id": "123123", "imp_id": "123", "placement_id": "123123"}`, + `{"page_id": "abc", "imp_id": 1}`, + `{"page_id": "1", "imp_id": abc}`, `{"page_id": "123123"}`, `{"imp_id": "123"}`, - `{"placement_id": 123123}`, - `{"placement_id": "123123"}`, - `{"placement_id": "A-123123"}`, - `{"placement_id": "B-A-123123"}`, - `{"placement_id": "123123-A"}`, `{}`, } - -func TestValidPlacementIdMapper(t *testing.T) { - for ext, expectedPlacementId := range validPlacementIds { - val := mapExtToPlacementID(ext) - - assert.Equal(t, &expectedPlacementId, val) - } -} - -var validPlacementIds = map[openrtb_ext.ExtImpIntertech]intertechPlacementID{ - {PlacementID: "111-222"}: {PageID: "111", ImpID: "222"}, - {PageID: 111, ImpID: 222}: {PageID: "111", ImpID: "222"}, -} diff --git a/static/bidder-params/intertech.json b/static/bidder-params/intertech.json index 1b852a40fc1..8b1e3daa6cd 100644 --- a/static/bidder-params/intertech.json +++ b/static/bidder-params/intertech.json @@ -13,19 +13,9 @@ "type": "integer", "minLength": 1, "description": "Special identifier provided by Intertech Manager" - }, - "placement_id": { - "type": "string", - "pattern": "^[0-9]+-[0-9]+$", - "description": "Combined Page Id and Imp Id in the format 'pageid-impid'" } }, - "oneOf": [ - { - "required": ["page_id", "imp_id"] - }, - { - "required": ["placement_id"] - } - ] + "required": + ["page_id", + "imp_id"] } \ No newline at end of file From b16e49953bd5d2e17c36e797aa1ba7b007a05c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Tue, 10 Dec 2024 15:43:12 +0000 Subject: [PATCH 14/21] fix bugs --- adapters/intertech/intertech.go | 16 +++++++++------- .../intertechtest/exemplary/simple-banner.json | 18 +++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 3a8a9ccf564..efb458aa5c9 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -129,17 +129,18 @@ func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { if banner == nil { return nil, fmt.Errorf("banner is null") } - if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 { - if len(banner.Format) > 0 { - w := banner.Format[0].W - h := banner.Format[0].H - banner.W = &w - banner.H = &h + bannerCopy := *banner + if bannerCopy.W == nil || bannerCopy.H == nil || *bannerCopy.W == 0 || *bannerCopy.H == 0 { + if len(bannerCopy.Format) > 0 { + w := bannerCopy.Format[0].W + h := bannerCopy.Format[0].H + bannerCopy.W = &w + bannerCopy.H = &h } else { return nil, fmt.Errorf("Invalid sizes provided for Banner") } } - return banner, nil + return &bannerCopy, nil } func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) (string, error) { @@ -187,6 +188,7 @@ func buildRequestData(bidRequest openrtb2.BidRequest, uri string) (*adapters.Req Uri: uri, Body: body, Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(bidRequest.Imp), }, nil } diff --git a/adapters/intertech/intertechtest/exemplary/simple-banner.json b/adapters/intertech/intertechtest/exemplary/simple-banner.json index ed208bf6be9..b3dc5e87261 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-banner.json +++ b/adapters/intertech/intertechtest/exemplary/simple-banner.json @@ -5,9 +5,8 @@ "ip": "123.123.123.123", "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)" }, - "app": { - "id": "app_123", - "bundle": "com.example.testapp" + "site": { + "page": "mypage" }, "imp": [ { @@ -25,12 +24,13 @@ } } } - ] + ], + "cur": ["USD"] }, "httpCalls": [ { "expectedRequest": { - "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=&ssp-cur=USD", + "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=mypage&ssp-cur=USD", "body": { "id": "test-request-id", "imp": [ @@ -52,14 +52,14 @@ } } ], - "app": { - "id": "app_123", - "bundle": "com.example.testapp" + "site": { + "page": "mypage" }, "device": { "ip": "123.123.123.123", "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)" - } + }, + "cur": ["USD"] }, "impIDs": ["test-imp-id"] }, From 4745c2861a33b0fd103404c40fc0df913736193d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Tue, 10 Dec 2024 16:12:59 +0000 Subject: [PATCH 15/21] fix comments --- adapters/intertech/intertech.go | 77 +++++++------------ .../exemplary/simple-banner.json | 8 +- 2 files changed, 33 insertions(+), 52 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index efb458aa5c9..6ca5b8be9b8 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -206,71 +206,50 @@ func getCur(request *openrtb2.BidRequest) string { return "" } -func (a *adapter) MakeBids(req *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { - if responseData.StatusCode != http.StatusOK { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("Unexpected status code: %d", responseData.StatusCode), - }} +func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { + return nil, nil } - var bidResp openrtb2.BidResponse - if err := jsonutil.Unmarshal(responseData.Body, &bidResp); err != nil { - return nil, []error{&errortypes.BadServerResponse{ - Message: fmt.Sprintf("Failed to decode bid response: %s", err.Error()), - }} + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{err} } - seatBids := bidResp.SeatBid - if seatBids == nil { - return &adapters.BidderResponse{ - Currency: bidResp.Cur, - Bids: make([]*adapters.TypedBid, 0), - }, nil + var response openrtb2.BidResponse + if err := jsonutil.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} } - if len(seatBids) == 0 { - return nil, []error{&errortypes.BadServerResponse{ - Message: "SeatBids is empty", - }} + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + if len(response.Cur) != 0 { + bidResponse.Currency = response.Cur } - bidderResponse := adapters.NewBidderResponseWithBidsCapacity(len(seatBids)) - bidderResponse.Currency = bidResp.Cur - - var errs []error - for _, seatBid := range seatBids { - for _, bid := range seatBid.Bid { - bidType, err := getBidTypeFromImps(bid.ImpID, req.Imp) + for _, seatBid := range response.SeatBid { + for i := range seatBid.Bid { + bid := seatBid.Bid[i] + bidType, err := getBidType(bid) if err != nil { - errs = append(errs, &errortypes.BadServerResponse{Message: err.Error()}) - continue + return nil, []error{err} } - typedBid := &adapters.TypedBid{ - Bid: &bid, + + b := &adapters.TypedBid{ + Bid: &seatBid.Bid[i], BidType: bidType, } - bidderResponse.Bids = append(bidderResponse.Bids, typedBid) - } - } - - return bidderResponse, errs -} - -func getBidTypeFromImps(bidImpID string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) { - for _, imp := range imps { - if imp.ID == bidImpID { - return resolveImpType(imp) + bidResponse.Bids = append(bidResponse.Bids, b) } } - return "", fmt.Errorf("Invalid bid imp ID %s does not match any imp IDs from the original bid request", bidImpID) + return bidResponse, nil } -func resolveImpType(imp openrtb2.Imp) (openrtb_ext.BidType, error) { - if imp.Native != nil { - return openrtb_ext.BidTypeNative, nil - } - if imp.Banner != nil { +func getBidType(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative, nil } - return "", fmt.Errorf("Processing an invalid impression; cannot resolve impression type") + + return "", fmt.Errorf("could not define media type for impression: %s", bid.ImpID) } diff --git a/adapters/intertech/intertechtest/exemplary/simple-banner.json b/adapters/intertech/intertechtest/exemplary/simple-banner.json index b3dc5e87261..72c55764236 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-banner.json +++ b/adapters/intertech/intertechtest/exemplary/simple-banner.json @@ -80,7 +80,8 @@ "cid": "test_cid", "crid": "test_crid", "w": 300, - "h": 250 + "h": 250, + "mtype": 1 } ] } @@ -101,11 +102,12 @@ "cid": "test_cid", "crid": "test_crid", "w": 300, - "h": 250 + "h": 250, + "mtype": 1 }, "type": "banner" } ] } ] -} \ No newline at end of file +} From 80beb1c533264ecb6c5cb01a5acb76a0093e9c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Wed, 11 Dec 2024 08:30:04 +0000 Subject: [PATCH 16/21] adding tests --- adapters/intertech/intertech.go | 11 - .../intertechtest/exemplary/no-cur-req.json | 71 ++++++ .../intertechtest/exemplary/no-site-req.json | 67 +++++ .../exemplary/simple-banner-muli-format.json | 115 +++++++++ .../exemplary/simple-native.json | 220 +++++++--------- .../supplemental/bad_media_type.json | 100 ++++++++ .../supplemental/bad_response.json | 79 ++++++ .../supplemental/invalid-banner-size.json | 35 +++ .../supplemental/multiple-imps.json | 237 ------------------ .../simple-banner-empty-response.json | 101 -------- .../simple-banner-empty-seatbid.json | 106 -------- .../supplemental/simple-banner-sizes.json | 233 ----------------- .../simple-banner-status-204.json | 96 ------- .../simple-banner-status-400.json | 102 -------- .../simple-banner-unknown-imp.json | 125 --------- .../simple-banner-unparsable-body.json | 102 -------- .../supplemental/status-204.json | 73 ++++++ .../supplemental/status-not-200.json | 78 ++++++ .../supplemental/unknown-banner.json | 32 --- .../supplemental/unsuported-media-type.json | 43 ++++ 20 files changed, 755 insertions(+), 1271 deletions(-) create mode 100644 adapters/intertech/intertechtest/exemplary/no-cur-req.json create mode 100644 adapters/intertech/intertechtest/exemplary/no-site-req.json create mode 100644 adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json create mode 100644 adapters/intertech/intertechtest/supplemental/bad_media_type.json create mode 100644 adapters/intertech/intertechtest/supplemental/bad_response.json create mode 100644 adapters/intertech/intertechtest/supplemental/invalid-banner-size.json delete mode 100644 adapters/intertech/intertechtest/supplemental/multiple-imps.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json delete mode 100644 adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json create mode 100644 adapters/intertech/intertechtest/supplemental/status-204.json create mode 100644 adapters/intertech/intertechtest/supplemental/status-not-200.json delete mode 100644 adapters/intertech/intertechtest/supplemental/unknown-banner.json create mode 100644 adapters/intertech/intertechtest/supplemental/unsuported-media-type.json diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 6ca5b8be9b8..79c6ad69773 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -92,17 +92,6 @@ func parseAndValidateImpExt(imp openrtb2.Imp) (ExtImpIntertech, error) { } } - if extImp.PageID == 0 { - return ExtImpIntertech{}, &errortypes.BadInput{ - Message: fmt.Sprintf("imp #%s: missing param page_id", imp.ID), - } - } - if extImp.ImpID == 0 { - return ExtImpIntertech{}, &errortypes.BadInput{ - Message: fmt.Sprintf("imp #%s: missing param imp_id", imp.ID), - } - } - return extImp, nil } diff --git a/adapters/intertech/intertechtest/exemplary/no-cur-req.json b/adapters/intertech/intertechtest/exemplary/no-cur-req.json new file mode 100644 index 00000000000..a6101b6023c --- /dev/null +++ b/adapters/intertech/intertechtest/exemplary/no-cur-req.json @@ -0,0 +1,71 @@ +{ + "mockBidRequest": { + "id": "test-no-cur-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "site": { + "page": "http://example-nocur.com" + }, + "imp": [ + { + "id": "test-imp-no-cur", + "tagid": "no-cur-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1111, + "imp_id": 2222 + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1111&imp=2222&target-ref=http%3A%2F%2Fexample-nocur.com", + "body": { + "id": "test-no-cur-request-id", + "imp": [ + { + "id": "test-imp-no-cur", + "tagid": "no-cur-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1111, + "imp_id": 2222 + } + } + } + ], + "site": { + "page": "http://example-nocur.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + } + }, + "impIDs": ["test-imp-no-cur"] + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/intertech/intertechtest/exemplary/no-site-req.json b/adapters/intertech/intertechtest/exemplary/no-site-req.json new file mode 100644 index 00000000000..9d4901994bb --- /dev/null +++ b/adapters/intertech/intertechtest/exemplary/no-site-req.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "id": "test-no-site-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "imp": [ + { + "id": "test-imp-no-site", + "tagid": "no-site-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 3003, + "imp_id": 5005 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=3003&imp=5005&ssp-cur=USD", + "body": { + "id": "test-no-site-request-id", + "imp": [ + { + "id": "test-imp-no-site", + "tagid": "no-site-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 3003, + "imp_id": 5005 + } + } + } + ], + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-no-site"] + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json b/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json new file mode 100644 index 00000000000..0a998f0f3c2 --- /dev/null +++ b/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json @@ -0,0 +1,115 @@ +{ + "mockBidRequest": { + "id": "test-missing-dimensions-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "site": { + "page": "http://bannercheck.com" + }, + "imp": [ + { + "id": "test-imp-missing-dim", + "tagid": "tag-missing-dim", + "banner": { + "format": [ + { "w": 728, "h": 90 }, + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1111, + "imp_id": 2222 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1111&imp=2222&target-ref=http%3A%2F%2Fbannercheck.com&ssp-cur=USD", + "body": { + "id": "test-missing-dimensions-request-id", + "imp": [ + { + "id": "test-imp-missing-dim", + "tagid": "tag-missing-dim", + "banner": { + "w": 728, + "h": 90, + "format": [ + { "w": 728, "h": 90 }, + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1111, + "imp_id": 2222 + } + } + } + ], + "site": { + "page": "http://bannercheck.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-missing-dim"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-missing-dimensions-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "intertech", + "bid": [ + { + "id": "test_bid_missing_dim", + "impid": "test-imp-missing-dim", + "price": 0.7, + "adm": "

Test Banner 728x90

", + "cid": "cid_missing_dim", + "crid": "crid_missing_dim", + "w": 728, + "h": 90, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_missing_dim", + "impid": "test-imp-missing-dim", + "price": 0.7, + "adm": "

Test Banner 728x90

", + "cid": "cid_missing_dim", + "crid": "crid_missing_dim", + "w": 728, + "h": 90, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/intertech/intertechtest/exemplary/simple-native.json b/adapters/intertech/intertechtest/exemplary/simple-native.json index 10d14c2dd78..a9336b8ffb1 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-native.json +++ b/adapters/intertech/intertechtest/exemplary/simple-native.json @@ -1,135 +1,103 @@ { - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "native": { - "request": "{}", - "ver": "1" - }, - "ext": { - "bidder": { - "placement_id": "134001-1" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1", - "language": "EN" - }, - "tmax": 500 + "mockBidRequest": { + "id": "test-native-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X)" }, - "httpCalls": [ + "site": { + "page": "nativepage" + }, + "imp": [ { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ], - "Accept-Language": [ - "EN" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "native": { - "request": "{}", - "ver": "1" - }, - "ext": { - "bidder": { - "placement_id": "134001-1" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1", - "language": "EN" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] + "id": "test-native-imp-id", + "tagid": "test-native-tag", + "native": { + "request": "{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":25}}],\"eventtrackers\":[{\"event\":1,\"method\":1}],\"ver\":\"1.2\"}" }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id", - "impid": "imp_id", - "price": 1.25, - "crid": "crid", - "adm": "adm_content", - "h": 600, - "w": 300 - } - ] - } - ], - "bidid": "bid_id", - "cur": "USD" + "ext": { + "bidder": { + "page_id": 3003, + "imp_id": 4004 } } } ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "bid_id", - "impid": "imp_id", - "price": 1.25, - "adm": "adm_content", - "crid": "crid", - "w": 300, - "h": 600 - }, - "type": "native" - } - ] + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=3003&imp=4004&target-ref=nativepage&ssp-cur=USD", + "body": { + "id": "test-native-request-id", + "imp": [ + { + "id": "test-native-imp-id", + "tagid": "test-native-tag", + "native": { + "request": "{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":25}}],\"eventtrackers\":[{\"event\":1,\"method\":1}],\"ver\":\"1.2\"}" + }, + "ext": { + "bidder": { + "page_id": 3003, + "imp_id": 4004 + } + } + } + ], + "site": { + "page": "nativepage" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-native-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-native-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "intertech", + "bid": [ + { + "id": "test_native_bid_id", + "impid": "test-native-imp-id", + "price": 1.0, + "adm": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"title\":{\"text\":\"Test Native Title\"}}],\"link\":{\"url\":\"http://example.com\"},\"imptrackers\":[\"http://example.com/imp\"]}}", + "cid": "test_native_cid", + "crid": "test_native_crid", + "mtype": 4 + } + ] + } + ] + } } - ] - } \ No newline at end of file + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_native_bid_id", + "impid": "test-native-imp-id", + "price": 1.0, + "adm": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"title\":{\"text\":\"Test Native Title\"}}],\"link\":{\"url\":\"http://example.com\"},\"imptrackers\":[\"http://example.com/imp\"]}}", + "cid": "test_native_cid", + "crid": "test_native_crid", + "mtype": 4 + }, + "type": "native" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/bad_media_type.json b/adapters/intertech/intertechtest/supplemental/bad_media_type.json new file mode 100644 index 00000000000..4e1074f136c --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/bad_media_type.json @@ -0,0 +1,100 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 3003, + "imp_id": 5005 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=3003&imp=5005&target-ref=http%3A%2F%2Fexample.com&ssp-cur=USD", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 3003, + "imp_id": 5005 + } + } + } + ], + "site": { + "page": "http://example.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "intertech", + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.5, + "adm": "

Test Ad

", + "cid": "test_cid", + "crid": "test_crid", + "w": 300, + "h": 250, + "mtype": 2 + } + ] + } + ] + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "could not define media type for impression: test-imp-id", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/bad_response.json b/adapters/intertech/intertechtest/supplemental/bad_response.json new file mode 100644 index 00000000000..6ca58d71dd9 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/bad_response.json @@ -0,0 +1,79 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=http%3A%2F%2Fexample.com&ssp-cur=USD", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "site": { + "page": "http://example.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "expect { or n, but found \"", + "comparison": "literal" + } + ] + } + \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/invalid-banner-size.json b/adapters/intertech/intertechtest/supplemental/invalid-banner-size.json new file mode 100644 index 00000000000..49d6a4996cf --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/invalid-banner-size.json @@ -0,0 +1,35 @@ +{ + "mockBidRequest": { + "id": "test-invalid-sizes-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "site": { + "page": "http://no-size-banner.com" + }, + "imp": [ + { + "id": "test-imp-no-size", + "tagid": "no-size-tag", + "banner": { + "format": [] + }, + "ext": { + "bidder": { + "page_id": 1111, + "imp_id": 9999 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [], + "expectedMakeRequestsErrors": [ + { + "value": "imp #test-imp-no-size: Invalid sizes provided for Banner", + "comparison": "literal" + } + ] +} diff --git a/adapters/intertech/intertechtest/supplemental/multiple-imps.json b/adapters/intertech/intertechtest/supplemental/multiple-imps.json deleted file mode 100644 index e180708b4a2..00000000000 --- a/adapters/intertech/intertechtest/supplemental/multiple-imps.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id1", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - }, - { - "id": "imp_id2", - "banner": { - "w": 400, - "h": 800 - }, - "ext": { - "bidder": { - "placement_id": "222-2" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/111?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id1", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id1"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id1", - "impid": "imp_id1", - "price": 1.25, - "crid": "crid", - "adm": "adm001", - "h": 600, - "w": 300 - } - ] - } - ], - "bidid": "bid_id" - } - } - }, - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/222?imp-id=2&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id2", - "banner": { - "w": 400, - "h": 800 - }, - "ext": { - "bidder": { - "placement_id": "222-2" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id2"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id2", - "impid": "imp_id2", - "price": 2.50, - "crid": "crid", - "adm": "adm002", - "h": 800, - "w": 400 - } - ] - } - ], - "bidid": "bid_id" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "bid_id1", - "impid": "imp_id1", - "price": 1.25, - "adm": "adm001", - "crid": "crid", - "w": 300, - "h": 600 - }, - "type": "banner" - } - ] - }, - { - "bids": [ - { - "bid": { - "id": "bid_id2", - "impid": "imp_id2", - "price": 2.50, - "adm": "adm002", - "crid": "crid", - "w": 400, - "h": 800 - }, - "type": "banner" - } - ] - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json b/adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json deleted file mode 100644 index b7ed72e5e2f..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-empty-response.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] - }, - "mockResponse": { - "status": 200, - "headers": {} - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Bad server response", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json b/adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json deleted file mode 100644 index e31a85f33d5..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-empty-seatbid.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": null, - "bidid": "bid_id", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [] - } - ], - "expectedMakeBidsErrors": [] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json b/adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json deleted file mode 100644 index 10653302bc9..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-sizes.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "invalid_width", - "banner": { - "w": 0, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - }, - { - "id": "invalid_height", - "banner": { - "w": 400, - "h": 0 - }, - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 2 - } - } - }, - { - "id": "invalid_size", - "banner": { - "w": 0, - "h": 0 - }, - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 3 - } - } - }, - { - "id": "invalid_no_size_no_formats", - "banner": {}, - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 5 - } - } - }, - { - "id": "invalid_size", - "banner": { - "w": 0, - "h": 0 - }, - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 3 - } - } - }, - { - "id": "no_size_but_valid_formats", - "banner": { - "format": [ - { - "w": 600, - "h": 500 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 4 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/222?imp-id=4&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "no_size_but_valid_formats", - "banner": { - "w": 600, - "h": 500, - "format": [ - { - "w": 600, - "h": 500 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "page_id": 222, - "imp_id": 4 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["no_size_but_valid_formats"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id4", - "impid": "no_size_but_valid_formats", - "price": 1.25, - "crid": "crid", - "adm": "adm001", - "h": 800, - "w": 400 - } - ] - } - ], - "bidid": "bid_id" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [ - { - "bid": { - "id": "bid_id4", - "impid": "no_size_but_valid_formats", - "price": 1.25, - "adm": "adm001", - "crid": "crid", - "w": 400, - "h": 800 - }, - "type": "banner" - } - ] - } - ], - "expectedMakeRequestsErrors": [ - { - "value": "Invalid size", - "comparison": "regex" - }, - { - "value": "Invalid size", - "comparison": "regex" - }, - { - "value": "Invalid size", - "comparison": "regex" - }, - { - "value": "Invalid size", - "comparison": "regex" - }, - { - "value": "Invalid size", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json b/adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json deleted file mode 100644 index 688c628736a..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-status-204.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id1", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/111?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id1", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 111, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id1"] - }, - "mockResponse": { - "status": 204, - "headers": {}, - "body": {} - } - } - ], - "expectedBidResponses": [] -} diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json b/adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json deleted file mode 100644 index b428ab1d148..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-status-400.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] - }, - "mockResponse": { - "status": 400, - "headers": {}, - "body": {} - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json b/adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json deleted file mode 100644 index 587e52e0b57..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-unknown-imp.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": { - "id": "request_id", - "seatbid": [ - { - "bid": [ - { - "id": "bid_id", - "impid": "imp_id_unknown", - "price": 1.25, - "crid": "crid", - "adm": "content", - "h": 600, - "w": 300 - } - ] - } - ], - "bidid": "bid_id", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "bids": [] - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Invalid bid imp", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json b/adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json deleted file mode 100644 index 46793eb6cdb..00000000000 --- a/adapters/intertech/intertechtest/supplemental/simple-banner-unparsable-body.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "https://prebid.intertechsrvcs.com/prebid/134001?imp-id=1&ssp-cur=USD&ssp-id=10500&target-ref=www.example.com", - "headers": { - "User-Agent": [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" - ], - "X-Forwarded-For": [ - "127.0.0.1" - ], - "X-Real-Ip": [ - "127.0.0.1" - ], - "Content-Type": [ - "application/json;charset=utf-8" - ], - "Referer": [ - "http://www.example.com" - ], - "Accept": [ - "application/json" - ] - }, - "body": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "banner": { - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com" - }, - "cur": [ - "USD" - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "impIDs":["imp_id"] - }, - "mockResponse": { - "status": 200, - "headers": {}, - "body": "invalid" - } - } - ], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [ - { - "value": "Bad server response", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/status-204.json b/adapters/intertech/intertechtest/supplemental/status-204.json new file mode 100644 index 00000000000..8225c9ea57d --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/status-204.json @@ -0,0 +1,73 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "site": { + "page": "http://example.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=http%3A%2F%2Fexample.com&ssp-cur=USD", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "site": { + "page": "http://example.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/intertech/intertechtest/supplemental/status-not-200.json b/adapters/intertech/intertechtest/supplemental/status-not-200.json new file mode 100644 index 00000000000..58317e359fd --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/status-not-200.json @@ -0,0 +1,78 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "site": { + "page": "http://mypage.com" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=http%3A%2F%2Fmypage.com&ssp-cur=USD", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250, + "format": [ + { "w": 300, "h": 250 } + ] + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "site": { + "page": "http://mypage.com" + }, + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 404, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 404. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/intertech/intertechtest/supplemental/unknown-banner.json b/adapters/intertech/intertechtest/supplemental/unknown-banner.json deleted file mode 100644 index a01b9037180..00000000000 --- a/adapters/intertech/intertechtest/supplemental/unknown-banner.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "mockBidRequest": { - "id": "request_id", - "imp": [ - { - "id": "imp_id", - "video": { - "w": 100, - "h": 200 - }, - "ext": { - "bidder": { - "page_id": 134001, - "imp_id": 1 - } - } - } - ], - "device": { - "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "ip": "127.0.0.1" - }, - "tmax": 500 - }, - "httpCalls": [], - "expectedMakeRequestsErrors": [ - { - "value": "Unsupported format", - "comparison": "regex" - } - ] -} \ No newline at end of file diff --git a/adapters/intertech/intertechtest/supplemental/unsuported-media-type.json b/adapters/intertech/intertechtest/supplemental/unsuported-media-type.json new file mode 100644 index 00000000000..350fba40ca4 --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/unsuported-media-type.json @@ -0,0 +1,43 @@ +{ + "mockBidRequest": { + "id": "test-unsupported-media-type-request-id", + "device": { + "ip": "123.123.123.123", + "ua": "Mozilla/5.0 (X11; Linux x86_64)" + }, + "site": { + "page": "http://unsupportedmedia.com" + }, + "imp": [ + { + "id": "test-imp-unsupported", + "tagid": "unsupported-tag", + "video": { + "mimes": ["video/mp4"], + "minduration": 15, + "maxduration": 30, + "protocols": [2, 3, 5, 6], + "w": 640, + "h": 360, + "startdelay": 0, + "linearity": 1, + "skip": 0 + }, + "ext": { + "bidder": { + "page_id": 9999, + "imp_id": 8888 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [], + "expectedMakeRequestsErrors": [ + { + "value": "Intertech only supports banner and native types. Ignoring imp id=test-imp-unsupported", + "comparison": "literal" + } + ] +} From 7695a5ec690b5fe685caab9e31ffca62853f3a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Thu, 12 Dec 2024 11:38:18 +0000 Subject: [PATCH 17/21] fix comments --- adapters/intertech/intertech.go | 25 +---- .../exemplary/simple-banner-muli-format.json | 32 +++--- .../exemplary/simple-banner.json | 24 ++-- .../supplemental/invalid-ext.json | 30 +++++ .../no-cur-req.json | 0 .../intertechtest/supplemental/no-device.json | 105 ++++++++++++++++++ .../no-site-req.json | 0 .../supplemental/unsuported-media-type.json | 43 ------- 8 files changed, 172 insertions(+), 87 deletions(-) create mode 100644 adapters/intertech/intertechtest/supplemental/invalid-ext.json rename adapters/intertech/intertechtest/{exemplary => supplemental}/no-cur-req.json (100%) create mode 100644 adapters/intertech/intertechtest/supplemental/no-device.json rename adapters/intertech/intertechtest/{exemplary => supplemental}/no-site-req.json (100%) delete mode 100644 adapters/intertech/intertechtest/supplemental/unsuported-media-type.json diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 79c6ad69773..7dfcf118f9e 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -56,11 +56,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E continue } - modifiedUrl, err := a.modifyUrl(extImp, referer, cur) - if err != nil { - errs = append(errs, err) - continue - } + modifiedUrl := a.modifyUrl(extImp, referer, cur) modRequest := *request modRequest.Imp = []openrtb2.Imp{modifiedImp} @@ -104,20 +100,11 @@ func modifyImp(imp openrtb2.Imp) (openrtb2.Imp, error) { } } imp.Banner = banner - return imp, nil - } - if imp.Native != nil { - return imp, nil - } - return openrtb2.Imp{}, &errortypes.BadInput{ - Message: fmt.Sprintf("Intertech only supports banner and native types. Ignoring imp id=%s", imp.ID), } + return imp, nil } func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { - if banner == nil { - return nil, fmt.Errorf("banner is null") - } bannerCopy := *banner if bannerCopy.W == nil || bannerCopy.H == nil || *bannerCopy.W == 0 || *bannerCopy.H == 0 { if len(bannerCopy.Format) > 0 { @@ -132,7 +119,7 @@ func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { return &bannerCopy, nil } -func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) (string, error) { +func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) string { pageStr := strconv.Itoa(extImp.PageID) impStr := strconv.Itoa(extImp.ImpID) @@ -147,7 +134,7 @@ func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) (string resolvedUrl += "&ssp-cur=" + cur } - return resolvedUrl, nil + return resolvedUrl } func buildRequestData(bidRequest openrtb2.BidRequest, uri string) (*adapters.RequestData, error) { @@ -157,7 +144,8 @@ func buildRequestData(bidRequest openrtb2.BidRequest, uri string) (*adapters.Req } headers := http.Header{} - headers.Add("Content-Type", "application/json") + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") if bidRequest.Device != nil { if bidRequest.Device.UA != "" { @@ -171,7 +159,6 @@ func buildRequestData(bidRequest openrtb2.BidRequest, uri string) (*adapters.Req headers.Add("Accept-Language", bidRequest.Device.Language) } } - return &adapters.RequestData{ Method: http.MethodPost, Uri: uri, diff --git a/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json b/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json index 0a998f0f3c2..39f12626289 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json +++ b/adapters/intertech/intertechtest/exemplary/simple-banner-muli-format.json @@ -1,6 +1,6 @@ { "mockBidRequest": { - "id": "test-missing-dimensions-request-id", + "id": "request-id-1", "device": { "ip": "123.123.123.123", "ua": "Mozilla/5.0 (X11; Linux x86_64)" @@ -10,8 +10,8 @@ }, "imp": [ { - "id": "test-imp-missing-dim", - "tagid": "tag-missing-dim", + "id": "imp-id-1", + "tagid": "tag-id-1", "banner": { "format": [ { "w": 728, "h": 90 }, @@ -33,11 +33,11 @@ "expectedRequest": { "uri": "https://test.intertech.com/ssp?pid=1111&imp=2222&target-ref=http%3A%2F%2Fbannercheck.com&ssp-cur=USD", "body": { - "id": "test-missing-dimensions-request-id", + "id": "request-id-1", "imp": [ { - "id": "test-imp-missing-dim", - "tagid": "tag-missing-dim", + "id": "imp-id-1", + "tagid": "tag-id-1", "banner": { "w": 728, "h": 90, @@ -63,24 +63,24 @@ }, "cur": ["USD"] }, - "impIDs": ["test-imp-missing-dim"] + "impIDs": ["imp-id-1"] }, "mockResponse": { "status": 200, "body": { - "id": "test-missing-dimensions-request-id", + "id": "request-id-1", "cur": "USD", "seatbid": [ { "seat": "intertech", "bid": [ { - "id": "test_bid_missing_dim", - "impid": "test-imp-missing-dim", + "id": "bid-id-1", + "impid": "imp-id-1", "price": 0.7, "adm": "

Test Banner 728x90

", - "cid": "cid_missing_dim", - "crid": "crid_missing_dim", + "cid": "campaign-id-1", + "crid": "creative-id-1", "w": 728, "h": 90, "mtype": 1 @@ -97,12 +97,12 @@ "bids": [ { "bid": { - "id": "test_bid_missing_dim", - "impid": "test-imp-missing-dim", + "id": "bid-id-1", + "impid": "imp-id-1", "price": 0.7, "adm": "

Test Banner 728x90

", - "cid": "cid_missing_dim", - "crid": "crid_missing_dim", + "cid": "campaign-id-1", + "crid": "creative-id-1", "w": 728, "h": 90, "mtype": 1 diff --git a/adapters/intertech/intertechtest/exemplary/simple-banner.json b/adapters/intertech/intertechtest/exemplary/simple-banner.json index 72c55764236..dc0473465af 100644 --- a/adapters/intertech/intertechtest/exemplary/simple-banner.json +++ b/adapters/intertech/intertechtest/exemplary/simple-banner.json @@ -3,7 +3,8 @@ "id": "test-request-id", "device": { "ip": "123.123.123.123", - "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)" + "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)", + "language": "en-US" }, "site": { "page": "mypage" @@ -13,9 +14,8 @@ "id": "test-imp-id", "tagid": "test-tag", "banner": { - "format": [ - { "w": 300, "h": 250 } - ] + "w": 300, + "h": 250 }, "ext": { "bidder": { @@ -31,6 +31,14 @@ { "expectedRequest": { "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=mypage&ssp-cur=USD", + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"], + "Accept-Language": ["en-US"], + "User-Agent": ["Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)"], + "X-Forwarded-For": ["123.123.123.123"], + "X-Real-Ip": ["123.123.123.123"] + }, "body": { "id": "test-request-id", "imp": [ @@ -39,10 +47,7 @@ "tagid": "test-tag", "banner": { "w": 300, - "h": 250, - "format": [ - { "w": 300, "h": 250 } - ] + "h": 250 }, "ext": { "bidder": { @@ -57,7 +62,8 @@ }, "device": { "ip": "123.123.123.123", - "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)" + "ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)", + "language": "en-US" }, "cur": ["USD"] }, diff --git a/adapters/intertech/intertechtest/supplemental/invalid-ext.json b/adapters/intertech/intertechtest/supplemental/invalid-ext.json new file mode 100644 index 00000000000..4c8eb9c9c7c --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/invalid-ext.json @@ -0,0 +1,30 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": 123 + } + ] + }, + + "httpCalls": [], + + "expectedBidResponses": [], + + "expectedMakeRequestsErrors": [ + { + "value": "imp #test-imp-id: unable to parse bidder ext: expect { or n, but found 1", + "comparison": "literal" + } + ] +} diff --git a/adapters/intertech/intertechtest/exemplary/no-cur-req.json b/adapters/intertech/intertechtest/supplemental/no-cur-req.json similarity index 100% rename from adapters/intertech/intertechtest/exemplary/no-cur-req.json rename to adapters/intertech/intertechtest/supplemental/no-cur-req.json diff --git a/adapters/intertech/intertechtest/supplemental/no-device.json b/adapters/intertech/intertechtest/supplemental/no-device.json new file mode 100644 index 00000000000..8f811e0709c --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/no-device.json @@ -0,0 +1,105 @@ +{ + "mockBidRequest": { + "id": "test-request-no-device", + "site": { + "page": "mypage" + }, + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "cur": ["USD"] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=mypage&ssp-cur=USD", + "headers": { + "Content-Type": ["application/json;charset=utf-8"], + "Accept": ["application/json"] + }, + "body": { + "id": "test-request-no-device", + "imp": [ + { + "id": "test-imp-id", + "tagid": "test-tag", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "page_id": 1001, + "imp_id": 2002 + } + } + } + ], + "site": { + "page": "mypage" + }, + "cur": ["USD"] + }, + "impIDs": ["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-no-device", + "cur": "USD", + "seatbid": [ + { + "seat": "intertech", + "bid": [ + { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.5, + "adm": "

Test Ad

", + "cid": "test_cid", + "crid": "test_crid", + "w": 300, + "h": 250, + "mtype": 1 + } + ] + } + ] + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "test_bid_id", + "impid": "test-imp-id", + "price": 0.5, + "adm": "

Test Ad

", + "cid": "test_cid", + "crid": "test_crid", + "w": 300, + "h": 250, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/intertech/intertechtest/exemplary/no-site-req.json b/adapters/intertech/intertechtest/supplemental/no-site-req.json similarity index 100% rename from adapters/intertech/intertechtest/exemplary/no-site-req.json rename to adapters/intertech/intertechtest/supplemental/no-site-req.json diff --git a/adapters/intertech/intertechtest/supplemental/unsuported-media-type.json b/adapters/intertech/intertechtest/supplemental/unsuported-media-type.json deleted file mode 100644 index 350fba40ca4..00000000000 --- a/adapters/intertech/intertechtest/supplemental/unsuported-media-type.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-unsupported-media-type-request-id", - "device": { - "ip": "123.123.123.123", - "ua": "Mozilla/5.0 (X11; Linux x86_64)" - }, - "site": { - "page": "http://unsupportedmedia.com" - }, - "imp": [ - { - "id": "test-imp-unsupported", - "tagid": "unsupported-tag", - "video": { - "mimes": ["video/mp4"], - "minduration": 15, - "maxduration": 30, - "protocols": [2, 3, 5, 6], - "w": 640, - "h": 360, - "startdelay": 0, - "linearity": 1, - "skip": 0 - }, - "ext": { - "bidder": { - "page_id": 9999, - "imp_id": 8888 - } - } - } - ], - "cur": ["USD"] - }, - "httpCalls": [], - "expectedMakeRequestsErrors": [ - { - "value": "Intertech only supports banner and native types. Ignoring imp id=test-imp-unsupported", - "comparison": "literal" - } - ] -} From f21611f9c6094dcd0ed28b86536cd44f672bdf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Thu, 12 Dec 2024 14:10:46 +0000 Subject: [PATCH 18/21] fix comments --- .../supplemental/invalid-bidder.json | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 adapters/intertech/intertechtest/supplemental/invalid-bidder.json diff --git a/adapters/intertech/intertechtest/supplemental/invalid-bidder.json b/adapters/intertech/intertechtest/supplemental/invalid-bidder.json new file mode 100644 index 00000000000..0f530a0e68c --- /dev/null +++ b/adapters/intertech/intertechtest/supplemental/invalid-bidder.json @@ -0,0 +1,28 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": "badBidder" + } + } + ] + }, + + "expectedMakeRequestsErrors": [ + { + "value": "imp #test-imp-id: unable to parse intertech ext: expect { or n, but found \"", + "comparison": "literal" + } + ] +} From 09f70731a2a750fd71cc218f7048fb659a0d0ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Fri, 13 Dec 2024 14:08:24 +0000 Subject: [PATCH 19/21] fix comments --- openrtb_ext/imp_intertech.go | 5 +---- static/bidder-info/intertech.yaml | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/openrtb_ext/imp_intertech.go b/openrtb_ext/imp_intertech.go index d8bfb830154..bfce61fe1c3 100644 --- a/openrtb_ext/imp_intertech.go +++ b/openrtb_ext/imp_intertech.go @@ -1,9 +1,6 @@ package openrtb_ext type ExtImpIntertech struct { - PlacementID string `json:"placement_id"` - // Deprecated: in favor of `PlacementID` PageID int64 `json:"page_id"` - // Deprecated: in favor of `PlacementID` - ImpID int64 `json:"imp_id"` + ImpID int64 `json:"imp_id"` } diff --git a/static/bidder-info/intertech.yaml b/static/bidder-info/intertech.yaml index a89e55b1288..bf4b52bc382 100644 --- a/static/bidder-info/intertech.yaml +++ b/static/bidder-info/intertech.yaml @@ -11,5 +11,5 @@ capabilities: - native userSync: redirect: - url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&location={{.RedirectURL}} + url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&location= userMacro: "{UID}" \ No newline at end of file From 7eb75691d830c447c8615ab3edb9d83f458f40b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Fri, 13 Dec 2024 14:10:28 +0000 Subject: [PATCH 20/21] fix comments --- adapters/intertech/intertech.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 7dfcf118f9e..15cdb0b57cd 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -24,11 +24,6 @@ type adapter struct { endpoint string } -type ExtImpIntertech struct { - PageID int `json:"page_id"` - ImpID int `json:"imp_id"` -} - func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { bidder := &adapter{ endpoint: config.Endpoint, @@ -73,17 +68,17 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E return requests, errs } -func parseAndValidateImpExt(imp openrtb2.Imp) (ExtImpIntertech, error) { +func parseAndValidateImpExt(imp openrtb2.Imp) (openrtb_ext.ExtImpIntertech, error) { var bidderExt adapters.ExtImpBidder if err := jsonutil.Unmarshal(imp.Ext, &bidderExt); err != nil { - return ExtImpIntertech{}, &errortypes.BadInput{ + return openrtb_ext.ExtImpIntertech{}, &errortypes.BadInput{ Message: fmt.Sprintf("imp #%s: unable to parse bidder ext: %s", imp.ID, err), } } - var extImp ExtImpIntertech + var extImp openrtb_ext.ExtImpIntertech if err := jsonutil.Unmarshal(bidderExt.Bidder, &extImp); err != nil { - return ExtImpIntertech{}, &errortypes.BadInput{ + return openrtb_ext.ExtImpIntertech{}, &errortypes.BadInput{ Message: fmt.Sprintf("imp #%s: unable to parse intertech ext: %s", imp.ID, err), } } @@ -119,9 +114,9 @@ func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { return &bannerCopy, nil } -func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) string { - pageStr := strconv.Itoa(extImp.PageID) - impStr := strconv.Itoa(extImp.ImpID) +func (a *adapter) modifyUrl(extImp openrtb_ext.ExtImpIntertech, referer, cur string) string { + pageStr := strconv.Itoa(int(extImp.PageID)) + impStr := strconv.Itoa(int(extImp.ImpID)) resolvedUrl := strings.ReplaceAll(a.endpoint, pageIDMacro, url.QueryEscape(pageStr)) resolvedUrl = strings.ReplaceAll(resolvedUrl, impIDMacro, url.QueryEscape(impStr)) From d78e1cb9a4b301fcfbddabced213cd074f1a945b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kaczmarek?= Date: Wed, 15 Jan 2025 11:12:46 +0000 Subject: [PATCH 21/21] fix comments --- adapters/intertech/intertech.go | 4 ++-- openrtb_ext/imp_intertech.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adapters/intertech/intertech.go b/adapters/intertech/intertech.go index 15cdb0b57cd..ae491995a76 100644 --- a/adapters/intertech/intertech.go +++ b/adapters/intertech/intertech.go @@ -115,8 +115,8 @@ func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) { } func (a *adapter) modifyUrl(extImp openrtb_ext.ExtImpIntertech, referer, cur string) string { - pageStr := strconv.Itoa(int(extImp.PageID)) - impStr := strconv.Itoa(int(extImp.ImpID)) + pageStr := strconv.Itoa(extImp.PageID) + impStr := strconv.Itoa(extImp.ImpID) resolvedUrl := strings.ReplaceAll(a.endpoint, pageIDMacro, url.QueryEscape(pageStr)) resolvedUrl = strings.ReplaceAll(resolvedUrl, impIDMacro, url.QueryEscape(impStr)) diff --git a/openrtb_ext/imp_intertech.go b/openrtb_ext/imp_intertech.go index bfce61fe1c3..7c0bc955c5a 100644 --- a/openrtb_ext/imp_intertech.go +++ b/openrtb_ext/imp_intertech.go @@ -1,6 +1,6 @@ package openrtb_ext type ExtImpIntertech struct { - PageID int64 `json:"page_id"` - ImpID int64 `json:"imp_id"` + PageID int `json:"page_id"` + ImpID int `json:"imp_id"` }